Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorptessier2009-02-10 13:57:53 +0000
committerptessier2009-02-10 13:57:53 +0000
commit8a10546f417d2999fd597b0ead57ff3a9d2466d1 (patch)
tree04c021dd5d1c4ab8ff06e7b7ab2d150fa38fa7e4 /uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus
parent7906283b1be38fead335aefebf5d6ce4291eb381 (diff)
downloadorg.eclipse.papyrus-8a10546f417d2999fd597b0ead57ff3a9d2466d1.tar.gz
org.eclipse.papyrus-8a10546f417d2999fd597b0ead57ff3a9d2466d1.tar.xz
org.eclipse.papyrus-8a10546f417d2999fd597b0ead57ff3a9d2466d1.zip
set the content of each uml plugin of the CQ
Diffstat (limited to 'uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus')
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/ClassDiagramEditorFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/CreateClassDiagramAction.java61
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/CreateClassDiagramCommandHandler.java61
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/CreateGmfClassDiagramCommandHandler.java50
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/CreationCommand.java50
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/UmlClassDiagramForMultiEditor.java274
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/command/AssociationClassViewCreateCommand.java172
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/command/CreateAssociationClassSupplement.java127
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/command/CreateAssociationSupplement.java118
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/command/DependencyBranchDeletion.java130
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/command/DependencyDiamonViewCreateCommand.java146
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/command/DestroyAssociationCommand.java61
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/command/PropertyCommandForAssociation.java54
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/command/SemanticAdapter.java40
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/command/SupplementCommand.java110
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/edit/actions/InitializeDiagramAction.java81
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/edit/actions/RestoreRelatedLinksAction.java78
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/edit/commands/InitializeDiagramCommand.java270
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/edit/commands/RestoreRelatedLinksCommand.java369
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/edit/policies/DiagramDragDropEditPolicy.java152
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/helper/NamedElementHelper.java83
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/listeners/DropTargetListener.java80
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/parsers/AppliedStereotypeParser.java179
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/parsers/CustomMessageFormatParser.java112
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/parsers/OperationParser.java85
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/parsers/PropertyParser.java173
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/policies/RemoveOphanConnectionViewClazzPolicy.java41
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/policies/RemoveOrphanConnectionViewPolicy.java152
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/policies/RemoveOrphanNodeViewPolicy.java68
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/providers/ClassDiagramContributionItemProvider.java40
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/providers/CustomDeferredCreateConnectionViewCommand.java139
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/providers/CustomEditPolicyProvider.java69
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/providers/CustomGraphicalNodeEditPolicy.java309
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/providers/CustomUMLParserProvider.java424
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/AbstractionCreateCommand.java165
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/AbstractionReorientCommand.java178
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Association2CreateCommand.java40
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Association2ReorientCommand.java165
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Association3CreateCommand.java150
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/AssociationClass2CreateCommand.java167
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/AssociationClassCreateCommand.java70
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/AssociationClassReorientCommand.java178
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/AssociationCreateCommand.java164
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/AssociationReorientCommand.java179
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Class2CreateCommand.java69
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Class3CreateCommand.java70
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Class4CreateCommand.java70
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Class5CreateCommand.java69
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/ClassCreateCommand.java70
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Comment2CreateCommand.java70
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/CommentAnnotatedElementCreateCommand.java97
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/CommentAnnotatedElementReorientCommand.java161
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/CommentCreateCommand.java70
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Component2CreateCommand.java70
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/ComponentCreateCommand.java70
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Constraint2CreateCommand.java70
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/ConstraintConstrainedElementCreateCommand.java97
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/ConstraintConstrainedElementReorientCommand.java161
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/ConstraintCreateCommand.java70
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/DataType2CreateCommand.java70
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/DataTypeCreateCommand.java70
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Dependency2CreateCommand.java53
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Dependency2ReorientCommand.java165
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Dependency3CreateCommand.java152
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/DependencyCreateCommand.java165
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/DependencyReorientCommand.java178
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/ElementImportCreateCommand.java140
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/ElementImportReorientCommand.java166
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Enumeration2CreateCommand.java70
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/EnumerationCreateCommand.java70
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/EnumerationLiteralCreateCommand.java70
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/GeneralizationCreateCommand.java164
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/GeneralizationReorientCommand.java165
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/InstanceSpecification2CreateCommand.java70
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/InstanceSpecificationCreateCommand.java70
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Interface2CreateCommand.java70
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/InterfaceCreateCommand.java70
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/InterfaceRealizationCreateCommand.java140
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/InterfaceRealizationReorientCommand.java166
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Model2CreateCommand.java70
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/ModelCreateCommand.java70
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Operation2CreateCommand.java70
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Operation3CreateCommand.java70
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Operation4CreateCommand.java71
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Operation5CreateCommand.java70
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/OperationCreateCommand.java70
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Package2CreateCommand.java69
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/PackageCreateCommand.java69
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/PackageImportCreateCommand.java138
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/PackageImportReorientCommand.java166
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/PackageMergeCreateCommand.java162
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/PackageMergeReorientCommand.java169
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/PrimitiveType2CreateCommand.java70
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/PrimitiveTypeCreateCommand.java70
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/ProfileApplicationCreateCommand.java138
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/ProfileApplicationReorientCommand.java166
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Property2CreateCommand.java105
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Property3CreateCommand.java70
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Property4CreateCommand.java70
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Property5CreateCommand.java72
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/PropertyCreateCommand.java70
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/RealizationCreateCommand.java165
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/RealizationReorientCommand.java178
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/ReceptionCreateCommand.java70
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/RedefinableTemplateSignatureCreateCommand.java65
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Signal2CreateCommand.java70
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/SignalCreateCommand.java70
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/SlotCreateCommand.java53
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/SubstitutionCreateCommand.java164
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/SubstitutionReorientCommand.java169
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/TemplateBindingCreateCommand.java166
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/TemplateBindingReorientCommand.java175
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/TemplateParameterCreateCommand.java71
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/UMLReorientConnectionViewCommand.java80
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/UsageCreateCommand.java165
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/UsageReorientCommand.java178
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/AbstractionEditHelper.java20
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/AssociationClassEditHelper.java20
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/AssociationEditHelper.java20
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/ClassEditHelper.java20
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/CommentEditHelper.java20
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/ComponentEditHelper.java20
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/ConstraintEditHelper.java20
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/DataTypeEditHelper.java20
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/DependencyEditHelper.java20
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/ElementImportEditHelper.java20
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/EnumerationEditHelper.java20
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/EnumerationLiteralEditHelper.java20
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/GeneralizationEditHelper.java20
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/InstanceSpecificationEditHelper.java20
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/InterfaceEditHelper.java20
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/InterfaceRealizationEditHelper.java20
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/ModelEditHelper.java20
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/OperationEditHelper.java20
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/PackageEditHelper.java20
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/PackageImportEditHelper.java20
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/PackageMergeEditHelper.java20
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/PrimitiveTypeEditHelper.java20
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/ProfileApplicationEditHelper.java20
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/PropertyEditHelper.java20
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/RealizationEditHelper.java20
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/ReceptionEditHelper.java20
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/RedefinableTemplateSignatureEditHelper.java20
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/SignalEditHelper.java20
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/SlotEditHelper.java20
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/SubstitutionEditHelper.java20
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/TemplateBindingEditHelper.java20
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/TemplateParameterEditHelper.java20
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/UMLBaseEditHelper.java81
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/UsageEditHelper.java20
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AbstractionEditPart.java173
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AbstractionName2EditPart.java529
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AbstractionNameEditPart.java529
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Association2EditPart.java261
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Association3EditPart.java148
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationClass2EditPart.java215
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationClassAttributeCompartmentEditPart.java92
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationClassEditPart.java450
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationClassName2EditPart.java554
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationClassNameEditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationClassQualifiedNameEditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationEditPart.java257
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationName2EditPart.java529
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationName3EditPart.java531
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationName4EditPart.java531
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationName5EditPart.java531
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationName6EditPart.java531
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationNameEditPart.java529
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Class2EditPart.java561
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Class3EditPart.java561
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Class4EditPart.java534
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Class5EditPart.java561
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassAttributeCompartment2EditPart.java92
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassAttributeCompartmentEditPart.java92
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassEditPart.java539
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassName2EditPart.java554
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassName3EditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassName4EditPart.java554
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassNameEditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassNestedClassifierCompartment2EditPart.java92
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassNestedClassifierCompartmentEditPart.java92
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassOperationCompartment2EditPart.java92
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassOperationCompartmentEditPart.java92
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassQualifiedName2EditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassQualifiedNameEditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Comment2EditPart.java298
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/CommentAnnotatedElementEditPart.java84
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/CommentBody2EditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/CommentBodyEditPart.java663
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/CommentEditPart.java299
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/CommentLinkDescriptorEditPart.java86
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Component2EditPart.java517
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentAttributeCompartment2EditPart.java92
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentAttributeCompartmentEditPart.java92
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentEditPart.java524
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentName2EditPart.java554
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentName3EditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentName4EditPart.java554
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentNameEditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentNestedClassifierCompartment2EditPart.java92
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentNestedClassifierCompartmentEditPart.java92
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentOperationCompartment2EditPart.java92
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentOperationCompartmentEditPart.java92
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentQualifiedName2EditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentQualifiedNameEditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Constraint2EditPart.java298
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ConstraintConstrainedElementEditPart.java84
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ConstraintEditPart.java298
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ConstraintName2EditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ConstraintNameEditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataType2EditPart.java498
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataTypeAttributeCompartment2EditPart.java92
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataTypeAttributeCompartmentEditPart.java92
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataTypeEditPart.java505
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataTypeName2EditPart.java554
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataTypeName3EditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataTypeName4EditPart.java554
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataTypeNameEditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataTypeOperationCompartment2EditPart.java92
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataTypeOperationCompartmentEditPart.java92
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataTypeQualifiedName2EditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataTypeQualifiedNameEditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Dependency2EditPart.java201
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Dependency3EditPart.java190
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DependencyEditPart.java173
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DependencyName2EditPart.java529
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DependencyName3EditPart.java516
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DependencyName4EditPart.java529
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DependencyNameEditPart.java529
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ElementImportAlias2EditPart.java529
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ElementImportAliasEditPart.java529
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ElementImportEditPart.java173
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Enumeration2EditPart.java414
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/EnumerationEditPart.java421
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/EnumerationEnumerationLiteralCompartment2EditPart.java92
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/EnumerationEnumerationLiteralCompartmentEditPart.java92
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/EnumerationLiteralEditPart.java585
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/EnumerationName2EditPart.java554
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/EnumerationName3EditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/EnumerationName4EditPart.java554
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/EnumerationNameEditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/EnumerationQualifiedName2EditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/EnumerationQualifiedNameEditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/GeneralizationEditPart.java152
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/GeneralizationIsSubstitutableEditPart.java529
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InstanceSpecification2EditPart.java414
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InstanceSpecificationEditPart.java421
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InstanceSpecificationName2EditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InstanceSpecificationName3EditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InstanceSpecificationName4EditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InstanceSpecificationNameEditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InstanceSpecificationQualifiedName2EditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InstanceSpecificationQualifiedNameEditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InstanceSpecificationSlotCompartment2EditPart.java92
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InstanceSpecificationSlotCompartmentEditPart.java92
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Interface2EditPart.java515
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceAttributeCompartment2EditPart.java92
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceAttributeCompartmentEditPart.java92
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceEditPart.java522
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceName2EditPart.java554
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceName3EditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceName4EditPart.java554
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceNameEditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceNestedClassifierCompartment2EditPart.java92
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceNestedClassifierCompartmentEditPart.java92
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceOperationCompartment2EditPart.java92
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceOperationCompartmentEditPart.java92
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceQualifiedName2EditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceQualifiedNameEditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceRealizationEditPart.java173
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceRealizationName2EditPart.java529
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceRealizationNameEditPart.java529
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Model2EditPart.java426
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Model3EditPart.java426
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ModelEditPart.java63
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ModelName2EditPart.java554
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ModelName3EditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ModelName4EditPart.java554
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ModelNameEditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ModelPackageableElementCompartment2EditPart.java81
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ModelPackageableElementCompartmentEditPart.java81
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ModelQualifiedName2EditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ModelQualifiedNameEditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Operation2EditPart.java581
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Operation3EditPart.java581
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Operation4EditPart.java581
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Operation5EditPart.java581
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/OperationEditPart.java581
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Package2EditPart.java421
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackageEditPart.java422
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackageImportEditPart.java169
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackageImportVisibilityEditPart.java529
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackageMergeEditPart.java147
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackageName2EditPart.java554
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackageName3EditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackageName4EditPart.java554
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackageNameEditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackagePackageableElementCompartment2EditPart.java81
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackagePackageableElementCompartmentEditPart.java81
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackageQualifiedName2EditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackageQualifiedNameEditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PrimitiveType2EditPart.java358
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PrimitiveTypeEditPart.java365
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PrimitiveTypeName2EditPart.java554
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PrimitiveTypeName3EditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PrimitiveTypeName4EditPart.java554
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PrimitiveTypeNameEditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PrimitiveTypeQualifiedName2EditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PrimitiveTypeQualifiedNameEditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ProfileApplicationEditPart.java147
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Property2EditPart.java581
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Property3EditPart.java581
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Property4EditPart.java581
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Property5EditPart.java581
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PropertyEditPart.java581
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/RealizationEditPart.java173
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/RealizationName2EditPart.java529
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/RealizationNameEditPart.java529
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ReceptionEditPart.java575
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/RedefinableTemplateSignatureEditPart.java319
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/RedefinableTemplateSignatureTemplateParameterCompartmentEditPart.java89
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Signal2EditPart.java479
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SignalAttributeCompartment2EditPart.java92
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SignalAttributeCompartmentEditPart.java92
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SignalEditPart.java484
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SignalName2EditPart.java554
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SignalName3EditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SignalName4EditPart.java554
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SignalNameEditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SignalQualifiedName2EditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SignalQualifiedNameEditPart.java550
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SlotEditPart.java183
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SubstitutionEditPart.java173
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SubstitutionName2EditPart.java529
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SubstitutionNameEditPart.java529
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/TemplateBindingEditPart.java169
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/TemplateParameterEditPart.java573
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/UMLEditPartFactory.java718
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/UsageEditPart.java173
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/UsageName2EditPart.java529
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/UsageNameEditPart.java529
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/WrappingLabelEditPart.java531
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/AbstractionItemSemanticEditPolicy.java179
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Association2ItemSemanticEditPolicy.java243
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Association3ItemSemanticEditPolicy.java234
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/AssociationClass2ItemSemanticEditPolicy.java256
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/AssociationClassAttributeCompartmentCanonicalEditPolicy.java85
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/AssociationClassAttributeCompartmentItemSemanticEditPolicy.java40
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/AssociationClassItemSemanticEditPolicy.java299
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/AssociationItemSemanticEditPolicy.java247
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Class2ItemSemanticEditPolicy.java260
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Class3ItemSemanticEditPolicy.java260
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Class4CanonicalEditPolicy.java85
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Class4ItemSemanticEditPolicy.java343
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Class5ItemSemanticEditPolicy.java260
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassAttributeCompartment2CanonicalEditPolicy.java85
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassAttributeCompartment2ItemSemanticEditPolicy.java40
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassAttributeCompartmentCanonicalEditPolicy.java85
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassAttributeCompartmentItemSemanticEditPolicy.java40
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassCanonicalEditPolicy.java85
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassItemSemanticEditPolicy.java347
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassNestedClassifierCompartment2CanonicalEditPolicy.java85
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassNestedClassifierCompartment2ItemSemanticEditPolicy.java40
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassNestedClassifierCompartmentCanonicalEditPolicy.java85
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassNestedClassifierCompartmentItemSemanticEditPolicy.java40
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassOperationCompartment2CanonicalEditPolicy.java88
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassOperationCompartment2ItemSemanticEditPolicy.java47
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassOperationCompartmentCanonicalEditPolicy.java88
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassOperationCompartmentItemSemanticEditPolicy.java47
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Comment2ItemSemanticEditPolicy.java117
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/CommentAnnotatedElementItemSemanticEditPolicy.java32
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/CommentItemSemanticEditPolicy.java122
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Component2CanonicalEditPolicy.java85
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Component2ItemSemanticEditPolicy.java339
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentAttributeCompartment2CanonicalEditPolicy.java85
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentAttributeCompartment2ItemSemanticEditPolicy.java40
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentAttributeCompartmentCanonicalEditPolicy.java85
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentAttributeCompartmentItemSemanticEditPolicy.java40
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentCanonicalEditPolicy.java85
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentItemSemanticEditPolicy.java343
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentNestedClassifierCompartment2CanonicalEditPolicy.java85
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentNestedClassifierCompartment2ItemSemanticEditPolicy.java40
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentNestedClassifierCompartmentCanonicalEditPolicy.java85
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentNestedClassifierCompartmentItemSemanticEditPolicy.java40
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentOperationCompartment2CanonicalEditPolicy.java85
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentOperationCompartment2ItemSemanticEditPolicy.java40
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentOperationCompartmentCanonicalEditPolicy.java85
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentOperationCompartmentItemSemanticEditPolicy.java40
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Constraint2ItemSemanticEditPolicy.java183
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ConstraintConstrainedElementItemSemanticEditPolicy.java32
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ConstraintItemSemanticEditPolicy.java188
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataType2CanonicalEditPolicy.java85
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataType2ItemSemanticEditPolicy.java316
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataTypeAttributeCompartment2CanonicalEditPolicy.java85
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataTypeAttributeCompartment2ItemSemanticEditPolicy.java40
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataTypeAttributeCompartmentCanonicalEditPolicy.java85
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataTypeAttributeCompartmentItemSemanticEditPolicy.java40
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataTypeCanonicalEditPolicy.java85
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataTypeItemSemanticEditPolicy.java320
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataTypeOperationCompartment2CanonicalEditPolicy.java85
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataTypeOperationCompartment2ItemSemanticEditPolicy.java40
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataTypeOperationCompartmentCanonicalEditPolicy.java85
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataTypeOperationCompartmentItemSemanticEditPolicy.java40
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Dependency2ItemSemanticEditPolicy.java190
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Dependency3ItemSemanticEditPolicy.java168
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DependencyItemSemanticEditPolicy.java179
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ElementImportItemSemanticEditPolicy.java113
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Enumeration2ItemSemanticEditPolicy.java284
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/EnumerationEnumerationLiteralCompartment2CanonicalEditPolicy.java85
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/EnumerationEnumerationLiteralCompartment2ItemSemanticEditPolicy.java40
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/EnumerationEnumerationLiteralCompartmentCanonicalEditPolicy.java85
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/EnumerationEnumerationLiteralCompartmentItemSemanticEditPolicy.java40
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/EnumerationItemSemanticEditPolicy.java288
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/EnumerationLiteralItemSemanticEditPolicy.java183
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/GeneralizationItemSemanticEditPolicy.java113
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InstanceSpecification2ItemSemanticEditPolicy.java218
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InstanceSpecificationItemSemanticEditPolicy.java222
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InstanceSpecificationSlotCompartment2CanonicalEditPolicy.java85
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InstanceSpecificationSlotCompartment2ItemSemanticEditPolicy.java40
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InstanceSpecificationSlotCompartmentCanonicalEditPolicy.java85
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InstanceSpecificationSlotCompartmentItemSemanticEditPolicy.java40
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Interface2CanonicalEditPolicy.java85
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Interface2ItemSemanticEditPolicy.java339
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceAttributeCompartment2CanonicalEditPolicy.java85
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceAttributeCompartment2ItemSemanticEditPolicy.java40
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceAttributeCompartmentCanonicalEditPolicy.java85
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceAttributeCompartmentItemSemanticEditPolicy.java40
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceCanonicalEditPolicy.java85
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceItemSemanticEditPolicy.java343
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceNestedClassifierCompartment2CanonicalEditPolicy.java85
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceNestedClassifierCompartment2ItemSemanticEditPolicy.java40
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceNestedClassifierCompartmentCanonicalEditPolicy.java85
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceNestedClassifierCompartmentItemSemanticEditPolicy.java40
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceOperationCompartment2CanonicalEditPolicy.java85
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceOperationCompartment2ItemSemanticEditPolicy.java40
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceOperationCompartmentCanonicalEditPolicy.java85
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceOperationCompartmentItemSemanticEditPolicy.java40
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceRealizationItemSemanticEditPolicy.java179
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Model2CanonicalEditPolicy.java85
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Model2ItemSemanticEditPolicy.java319
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Model3CanonicalEditPolicy.java85
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Model3ItemSemanticEditPolicy.java315
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ModelCanonicalEditPolicy.java742
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ModelItemSemanticEditPolicy.java164
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ModelPackageableElementCompartment2CanonicalEditPolicy.java108
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ModelPackageableElementCompartment2ItemSemanticEditPolicy.java117
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ModelPackageableElementCompartmentCanonicalEditPolicy.java108
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicy.java117
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/OpenDiagramEditPolicy.java195
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Operation2ItemSemanticEditPolicy.java194
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Operation3ItemSemanticEditPolicy.java194
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Operation4ItemSemanticEditPolicy.java194
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Operation5ItemSemanticEditPolicy.java172
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/OperationItemSemanticEditPolicy.java194
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Package2CanonicalEditPolicy.java85
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Package2ItemSemanticEditPolicy.java315
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/PackageCanonicalEditPolicy.java85
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/PackageImportItemSemanticEditPolicy.java113
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/PackageItemSemanticEditPolicy.java319
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/PackageMergeItemSemanticEditPolicy.java113
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/PackagePackageableElementCompartment2CanonicalEditPolicy.java108
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/PackagePackageableElementCompartment2ItemSemanticEditPolicy.java117
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/PackagePackageableElementCompartmentCanonicalEditPolicy.java108
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicy.java117
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/PrimitiveType2ItemSemanticEditPolicy.java249
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/PrimitiveTypeItemSemanticEditPolicy.java254
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ProfileApplicationItemSemanticEditPolicy.java113
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Property2ItemSemanticEditPolicy.java172
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Property3ItemSemanticEditPolicy.java172
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Property4ItemSemanticEditPolicy.java172
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Property5ItemSemanticEditPolicy.java172
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/PropertyItemSemanticEditPolicy.java172
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/RealizationItemSemanticEditPolicy.java179
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ReceptionItemSemanticEditPolicy.java194
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/RedefinableTemplateSignatureItemSemanticEditPolicy.java207
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/RedefinableTemplateSignatureTemplateParameterCompartmentCanonicalEditPolicy.java85
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/RedefinableTemplateSignatureTemplateParameterCompartmentItemSemanticEditPolicy.java40
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Signal2CanonicalEditPolicy.java85
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Signal2ItemSemanticEditPolicy.java304
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/SignalAttributeCompartment2CanonicalEditPolicy.java85
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/SignalAttributeCompartment2ItemSemanticEditPolicy.java40
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/SignalAttributeCompartmentCanonicalEditPolicy.java85
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/SignalAttributeCompartmentItemSemanticEditPolicy.java40
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/SignalCanonicalEditPolicy.java85
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/SignalItemSemanticEditPolicy.java308
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/SlotItemSemanticEditPolicy.java117
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/SubstitutionItemSemanticEditPolicy.java179
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/TemplateBindingItemSemanticEditPolicy.java113
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/TemplateParameterItemSemanticEditPolicy.java117
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/UMLBaseItemSemanticEditPolicy.java646
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/UMLTextNonResizableEditPolicy.java213
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/UMLTextSelectionEditPolicy.java197
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/UsageItemSemanticEditPolicy.java179
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/expressions/UMLAbstractExpression.java162
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/expressions/UMLOCLFactory.java181
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/navigator/UMLAbstractNavigatorItem.java71
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/navigator/UMLDomainNavigatorContentProvider.java230
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/navigator/UMLDomainNavigatorItem.java119
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/navigator/UMLDomainNavigatorLabelProvider.java107
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/navigator/UMLNavigatorActionProvider.java182
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/navigator/UMLNavigatorContentProvider.java5450
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/navigator/UMLNavigatorGroup.java110
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/navigator/UMLNavigatorItem.java97
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/navigator/UMLNavigatorLabelProvider.java1540
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/navigator/UMLNavigatorLinkHelper.java128
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/navigator/UMLNavigatorSorter.java40
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/parsers/AbstractParser.java401
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/parsers/CompositeParser.java86
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/parsers/MessageFormatParser.java215
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/DeleteElementAction.java96
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/DiagramEditorContextMenuProvider.java79
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/Messages.java1501
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/ModelElementSelectionPage.java156
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLCreationWizard.java167
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLCreationWizardPage.java96
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLDiagramActionBarContributor.java36
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLDiagramEditor.java280
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLDiagramEditorPlugin.java253
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLDiagramEditorUtil.java386
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLDiagramUpdateCommand.java91
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLDiagramUpdater.java6244
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLDocumentProvider.java993
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLDomainModelElementTester.java776
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLInitDiagramFileAction.java99
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLLinkDescriptor.java105
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLLoadResourceAction.java76
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLMatchingStrategy.java47
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLNewDiagramFileWizard.java176
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLNodeDescriptor.java70
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLPaletteFactory.java642
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLUriEditorInputTester.java35
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLVisualIDRegistry.java1492
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/ValidateAction.java274
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/AbstractionPreferencePage.java119
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/AssociationClass_2013PreferencePage.java71
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/AssociationPreferencePage.java119
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/ClassDiagramPreferencePage.java45
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/Class_2008PreferencePage.java71
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/Comment_2012PreferencePage.java71
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/Component_2002PreferencePage.java71
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/Constraint_2011PreferencePage.java71
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/DataType_2010PreferencePage.java71
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/DependencyPreferencePage.java119
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/DiagramAppearancePreferencePage.java29
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/DiagramConnectionsPreferencePage.java29
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/DiagramGeneralPreferencePage.java29
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/DiagramPreferenceInitializer.java73
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/DiagramPrintingPreferencePage.java29
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/DiagramRulersAndGridPreferencePage.java29
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/ElementImportPreferencePage.java119
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/Enumeration_2006PreferencePage.java71
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/GeneralizationPreferencePage.java119
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/IPapyrusPreferencesConstant.java930
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/InstanceSpecification_2001PreferencePage.java71
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/InterfaceRealizationPreferencePage.java119
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/Interface_2004PreferencePage.java71
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/Model_2005PreferencePage.java71
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/PackageImportPreferencePage.java119
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/PackageMergePreferencePage.java119
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/Package_2007PreferencePage.java71
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/PrimitiveType_2009PreferencePage.java71
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/ProfileApplicationPreferencePage.java119
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/RealizationPreferencePage.java119
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/Signal_2003PreferencePage.java71
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/SubstitutionPreferencePage.java119
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/TemplateBindingPreferencePage.java119
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/UsagePreferencePage.java119
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/providers/ElementInitializers.java1009
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/providers/UMLEditPartProvider.java154
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/providers/UMLElementTypes.java696
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/providers/UMLIconProvider.java44
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/providers/UMLMarkerNavigationProvider.java94
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/providers/UMLModelingAssistantProvider.java549
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/providers/UMLParserProvider.java3053
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/providers/UMLValidationProvider.java93
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/providers/UMLViewProvider.java851
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/sheet/UMLPropertySection.java123
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/sheet/UMLSheetLabelProvider.java92
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AbstractionName2ViewFactory.java52
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AbstractionNameViewFactory.java52
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AbstractionViewFactory.java63
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Association2ViewFactory.java51
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Association3ViewFactory.java38
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationClass2ViewFactory.java51
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationClassAttributeCompartmentViewFactory.java77
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationClassName2ViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationClassNameViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationClassQualifiedNameViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationClassViewFactory.java80
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationName2ViewFactory.java52
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationName3ViewFactory.java52
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationName4ViewFactory.java52
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationName5ViewFactory.java52
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationName6ViewFactory.java52
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationNameViewFactory.java52
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationViewFactory.java71
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Class2ViewFactory.java48
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Class3ViewFactory.java48
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Class4ViewFactory.java75
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Class5ViewFactory.java48
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassAttributeCompartment2ViewFactory.java77
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassAttributeCompartmentViewFactory.java77
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassName2ViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassName3ViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassName4ViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassNameViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassNestedClassifierCompartment2ViewFactory.java77
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassNestedClassifierCompartmentViewFactory.java77
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassOperationCompartment2ViewFactory.java77
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassOperationCompartmentViewFactory.java77
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassQualifiedName2ViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassQualifiedNameViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassViewFactory.java84
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Comment2ViewFactory.java65
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/CommentAnnotatedElementViewFactory.java51
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/CommentBody2ViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/CommentBodyViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/CommentLinkDescriptorViewFactory.java51
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/CommentViewFactory.java74
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Component2ViewFactory.java75
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentAttributeCompartment2ViewFactory.java77
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentAttributeCompartmentViewFactory.java77
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentName2ViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentName3ViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentName4ViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentNameViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentNestedClassifierCompartment2ViewFactory.java77
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentNestedClassifierCompartmentViewFactory.java77
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentOperationCompartment2ViewFactory.java77
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentOperationCompartmentViewFactory.java77
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentQualifiedName2ViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentQualifiedNameViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentViewFactory.java84
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Constraint2ViewFactory.java65
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ConstraintConstrainedElementViewFactory.java51
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ConstraintName2ViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ConstraintNameViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ConstraintViewFactory.java74
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataType2ViewFactory.java73
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataTypeAttributeCompartment2ViewFactory.java77
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataTypeAttributeCompartmentViewFactory.java77
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataTypeName2ViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataTypeName3ViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataTypeName4ViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataTypeNameViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataTypeOperationCompartment2ViewFactory.java77
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataTypeOperationCompartmentViewFactory.java77
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataTypeQualifiedName2ViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataTypeQualifiedNameViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataTypeViewFactory.java82
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Dependency2ViewFactory.java64
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Dependency3ViewFactory.java50
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DependencyName2ViewFactory.java52
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DependencyName3ViewFactory.java39
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DependencyName4ViewFactory.java39
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DependencyNameViewFactory.java52
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DependencyViewFactory.java63
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ElementImportAlias2ViewFactory.java52
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ElementImportAliasViewFactory.java52
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ElementImportViewFactory.java63
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Enumeration2ViewFactory.java71
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/EnumerationEnumerationLiteralCompartment2ViewFactory.java77
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/EnumerationEnumerationLiteralCompartmentViewFactory.java77
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/EnumerationLiteralViewFactory.java48
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/EnumerationName2ViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/EnumerationName3ViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/EnumerationName4ViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/EnumerationNameViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/EnumerationQualifiedName2ViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/EnumerationQualifiedNameViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/EnumerationViewFactory.java80
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/GeneralizationIsSubstitutableViewFactory.java52
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/GeneralizationViewFactory.java61
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InstanceSpecification2ViewFactory.java71
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InstanceSpecificationName2ViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InstanceSpecificationName3ViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InstanceSpecificationName4ViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InstanceSpecificationNameViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InstanceSpecificationQualifiedName2ViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InstanceSpecificationQualifiedNameViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InstanceSpecificationSlotCompartment2ViewFactory.java77
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InstanceSpecificationSlotCompartmentViewFactory.java77
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InstanceSpecificationViewFactory.java80
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Interface2ViewFactory.java70
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceAttributeCompartment2ViewFactory.java77
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceAttributeCompartmentViewFactory.java77
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceName2ViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceName3ViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceName4ViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceNameViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceNestedClassifierCompartment2ViewFactory.java77
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceNestedClassifierCompartmentViewFactory.java77
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceOperationCompartment2ViewFactory.java77
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceOperationCompartmentViewFactory.java77
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceQualifiedName2ViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceQualifiedNameViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceRealizationName2ViewFactory.java52
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceRealizationNameViewFactory.java52
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceRealizationViewFactory.java63
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceViewFactory.java79
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Model2ViewFactory.java80
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Model3ViewFactory.java71
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ModelName2ViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ModelName3ViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ModelName4ViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ModelNameViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ModelPackageableElementCompartment2ViewFactory.java76
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ModelPackageableElementCompartmentViewFactory.java76
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ModelQualifiedName2ViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ModelQualifiedNameViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ModelViewFactory.java44
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Operation2ViewFactory.java48
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Operation3ViewFactory.java48
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Operation4ViewFactory.java48
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Operation5ViewFactory.java48
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/OperationViewFactory.java48
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Package2ViewFactory.java71
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackageImportViewFactory.java61
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackageImportVisibilityViewFactory.java52
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackageMergeViewFactory.java51
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackageName2ViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackageName3ViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackageName4ViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackageNameViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackagePackageableElementCompartment2ViewFactory.java76
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackagePackageableElementCompartmentViewFactory.java76
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackageQualifiedName2ViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackageQualifiedNameViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackageViewFactory.java80
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PrimitiveType2ViewFactory.java69
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PrimitiveTypeName2ViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PrimitiveTypeName3ViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PrimitiveTypeName4ViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PrimitiveTypeNameViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PrimitiveTypeQualifiedName2ViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PrimitiveTypeQualifiedNameViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PrimitiveTypeViewFactory.java78
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ProfileApplicationViewFactory.java51
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Property2ViewFactory.java48
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Property3ViewFactory.java48
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Property4ViewFactory.java48
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Property5ViewFactory.java48
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PropertyViewFactory.java48
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/RealizationName2ViewFactory.java52
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/RealizationNameViewFactory.java52
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/RealizationViewFactory.java63
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ReceptionViewFactory.java48
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/RedefinableTemplateSignatureTemplateParameterCompartmentViewFactory.java76
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/RedefinableTemplateSignatureViewFactory.java66
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Signal2ViewFactory.java71
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SignalAttributeCompartment2ViewFactory.java77
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SignalAttributeCompartmentViewFactory.java77
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SignalName2ViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SignalName3ViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SignalName4ViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SignalNameViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SignalQualifiedName2ViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SignalQualifiedNameViewFactory.java34
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SignalViewFactory.java80
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SlotViewFactory.java57
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SubstitutionName2ViewFactory.java52
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SubstitutionNameViewFactory.java52
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SubstitutionViewFactory.java63
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/TemplateBindingViewFactory.java61
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/TemplateParameterViewFactory.java48
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/UsageName2ViewFactory.java52
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/UsageNameViewFactory.java52
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/UsageViewFactory.java63
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/WrappingLabelViewFactory.java52
769 files changed, 157778 insertions, 0 deletions
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/ClassDiagramEditorFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/ClassDiagramEditorFactory.java
new file mode 100644
index 00000000000..a1f80faaef6
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/ClassDiagramEditorFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cedric Dumoulin Cedric.Dumoulin@lifl.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.diagram.clazz;
+
+import org.eclipse.papyrus.core.adaptor.gmf.GmfEditorFactory;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelEditPart;
+
+/**
+ * @author dumoulin
+ *
+ */
+public class ClassDiagramEditorFactory extends GmfEditorFactory {
+
+ /**
+ * @param diagramClass
+ * @param expectedType
+ */
+ public ClassDiagramEditorFactory() {
+ super(UmlClassDiagramForMultiEditor.class, ModelEditPart.MODEL_ID);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/CreateClassDiagramAction.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/CreateClassDiagramAction.java
new file mode 100644
index 00000000000..3dd08bba236
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/CreateClassDiagramAction.java
@@ -0,0 +1,61 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cedric Dumoulin Cedric.Dumoulin@lifl.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.diagram.clazz;
+
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.papyrus.core.adaptor.gmf.AbstractGmfCreateDiagramAction;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelEditPart;
+import org.eclipse.papyrus.sasheditor.extension.ICreateDiagramAction;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.UMLFactory;
+
+/**
+ * Action creating a new diagram.
+ *
+ * @deprecated Not used anymore TODO Remove it.
+ * @author dumoulin
+ *
+ */
+public class CreateClassDiagramAction extends AbstractGmfCreateDiagramAction implements ICreateDiagramAction {
+
+ /**
+ * Create the first element of the uml part.
+ */
+ @Override
+ protected Package createInitialModel() {
+ return UMLFactory.eINSTANCE.createPackage();
+ }
+
+ @Override
+ protected String getDiagramName() {
+ // TODO Auto-generated method stub
+ return "PapyrusClassDiagram";
+ }
+
+ /**
+ * @return
+ */
+ protected String getDiagramNotationID() {
+ return ModelEditPart.MODEL_ID;
+ }
+
+ /**
+ * @return
+ */
+ protected PreferencesHint getPreferenceHint() {
+ return org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/CreateClassDiagramCommandHandler.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/CreateClassDiagramCommandHandler.java
new file mode 100644
index 00000000000..4beff41e41e
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/CreateClassDiagramCommandHandler.java
@@ -0,0 +1,61 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cedric Dumoulin Cedric.Dumoulin@lifl.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.diagram.clazz;
+
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.papyrus.core.adaptor.gmf.AbstractGmfCreateDiagramCommandHandler;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelEditPart;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.UMLFactory;
+
+/**
+ * Action creating a new diagram. This handler is used with editors using SharedObject.
+ *
+ * @deprecated Now use Context
+ * @author dumoulin
+ *
+ */
+public class CreateClassDiagramCommandHandler extends AbstractGmfCreateDiagramCommandHandler implements IHandler {
+
+ /**
+ * Create the first element of the uml part.
+ */
+ @Override
+ protected Package createInitialModel() {
+ return UMLFactory.eINSTANCE.createPackage();
+ }
+
+ @Override
+ protected String getDiagramName() {
+ // TODO Auto-generated method stub
+ return "PapyrusClassDiagram";
+ }
+
+ /**
+ * @return
+ */
+ protected String getDiagramNotationID() {
+ return ModelEditPart.MODEL_ID;
+ }
+
+ /**
+ * @return
+ */
+ protected PreferencesHint getPreferenceHint() {
+ return org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/CreateGmfClassDiagramCommandHandler.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/CreateGmfClassDiagramCommandHandler.java
new file mode 100644
index 00000000000..4cfc26b1a94
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/CreateGmfClassDiagramCommandHandler.java
@@ -0,0 +1,50 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cedric Dumoulin Cedric.Dumoulin@lifl.fr - Initial API and implementation
+ *
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.diagram.clazz;
+
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.papyrus.core.adaptor.gmf.AbstractPapyrusGmfCreateDiagramCommandHandler;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelEditPart;
+
+/**
+ * Action creating a new GMF diagram in Papyrus This handler is used with editors using BackboneContext.
+ *
+ * @author dumoulin
+ * @author <a href="mailto:jerome.benois@obeo.fr">Jerome Benois</a>
+ */
+public class CreateGmfClassDiagramCommandHandler extends AbstractPapyrusGmfCreateDiagramCommandHandler implements IHandler {
+
+ @Override
+ protected String getDiagramName() {
+ return openDiagramNameDialog("ClassDiagram");
+ }
+
+ /**
+ * @return
+ */
+ protected String getDiagramNotationID() {
+ return ModelEditPart.MODEL_ID;
+ }
+
+ /**
+ * @return
+ */
+ protected PreferencesHint getPreferenceHint() {
+ return org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/CreationCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/CreationCommand.java
new file mode 100644
index 00000000000..5f5d1589d77
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/CreationCommand.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.papyrus.diagram.clazz;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.core.extension.commands.ICreationCommand;
+import org.eclipse.papyrus.core.utils.DiResourceSet;
+import org.eclipse.uml2.uml.Element;
+
+/**
+ * Define a command to create a new Class Diagram.
+ *
+ * @author <a href="mailto:jerome.benois@obeo.fr">Jerome Benois</a>
+ */
+public class CreationCommand extends CreateGmfClassDiagramCommandHandler implements ICreationCommand {
+
+ String diagramName = null;
+
+ /**
+ * {@inheritDoc}
+ */
+ public void createDiagram(final DiResourceSet diResourceSet, final EObject container, final String name) {
+ this.diagramName = name;
+ TransactionalEditingDomain transactionalEditingDomain = diResourceSet.getTransactionalEditingDomain();
+ RecordingCommand command = new RecordingCommand(transactionalEditingDomain) {
+
+ @Override
+ protected void doExecute() {
+ runAsTransaction(diResourceSet, (Element) container);
+ }
+ };
+ transactionalEditingDomain.getCommandStack().execute(command);
+ }
+
+ @Override
+ protected String getDiagramName() {
+ return diagramName;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/UmlClassDiagramForMultiEditor.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/UmlClassDiagramForMultiEditor.java
new file mode 100644
index 00000000000..a3088577900
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/UmlClassDiagramForMultiEditor.java
@@ -0,0 +1,274 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cedric Dumoulin Cedric.Dumoulin@lifl.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.emf.common.ui.URIEditorInput;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.GraphicalViewer;
+import org.eclipse.gef.ui.actions.ActionRegistry;
+import org.eclipse.gef.ui.actions.RedoAction;
+import org.eclipse.gef.ui.actions.SelectAllAction;
+import org.eclipse.gef.ui.actions.UndoAction;
+import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditDomain;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocumentProvider;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.internal.l10n.EditorMessages;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.util.LocalSelectionTransfer;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.papyrus.core.adaptor.gmf.GmfEditorContext;
+import org.eclipse.papyrus.core.editor.IMultiDiagramEditor;
+import org.eclipse.papyrus.core.extension.editorcontext.IEditorContext;
+import org.eclipse.papyrus.diagram.clazz.custom.listeners.DropTargetListener;
+import org.eclipse.swt.dnd.TransferData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PartInitException;
+
+/**
+ * An editor to be used in multitabs editor. This editor extends the original UML Activity Diagram.
+ *
+ * @author dumoulin
+ *
+ */
+public class UmlClassDiagramForMultiEditor extends org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditor {
+
+ /**
+ * Parent
+ */
+ private GmfEditorContext context;
+
+ /**
+ * The diagram shown by this editor.
+ */
+ private Diagram diagram;
+
+ Composite splitter;
+
+ /**
+ * @generated NOT
+ */
+ public UmlClassDiagramForMultiEditor(Diagram diagram, GmfEditorContext context) {
+ super();
+ this.diagram = diagram;
+ this.context = context;
+
+ // overrides editing domain created by super constructor
+
+ setDocumentProvider(context.getDocumentProvider());
+ System.err.println(this.getClass().getName());
+ }
+
+ /**
+ * @generated NOT
+ */
+ public UmlClassDiagramForMultiEditor(Object diagram, IEditorContext context) {
+ this((Diagram) diagram, (GmfEditorContext) context);
+ }
+
+ /**
+ * Configures the diagram with the parent Multi editor shared command stack
+ */
+ @Override
+ protected void configureDiagramEditDomain() {
+ super.configureDiagramEditDomain();
+ DiagramEditDomain editDomain = (DiagramEditDomain) getDiagramEditDomain();
+
+ if (editDomain != null) {
+ editDomain.setCommandStack(context.getDiagramEditDomain().getDiagramCommandStack());
+ editDomain.setActionManager(context.getDiagramEditDomain().getActionManager());
+ }
+ }
+
+ /**
+ * Creates and register actions with the {@link ActionRegistry} for this editor.
+ */
+ @Override
+ protected void createActions() {
+ ActionRegistry registry = getActionRegistry();
+ IAction action;
+
+ action = new UndoAction(this);
+ registry.registerAction(action);
+ getStackActions().add(action.getId());
+
+ action = new RedoAction(this);
+ registry.registerAction(action);
+ getStackActions().add(action.getId());
+
+ action = new SelectAllAction(this);
+ registry.registerAction(action);
+
+ // action = new DirectEditAction(this);
+ // registry.registerAction(action);
+ // getSelectionActions().add(action.getId());
+ }
+
+ @Override
+ protected void createGraphicalViewer(Composite parent) {
+ System.out.println("store Composite " + parent);
+ splitter = parent;
+ super.createGraphicalViewer(parent);
+ }
+
+ /**
+ * @return the diagram
+ */
+ public Diagram getDiagram() {
+ return diagram;
+ }
+
+ /**
+ *
+ */
+ final protected IDocumentProvider getDocumentProvider(IEditorInput input) {
+ // System.out.println("getDocumentProvider(IEditorInput input)");
+ if (input instanceof IFileEditorInput || input instanceof URIEditorInput) {
+ return context.getDocumentProvider();
+ }
+ return super.getDocumentProvider(input);
+ }
+
+ public String getEditingDomainID() {
+ return "org.eclipse.uml2.diagram.clazz.EditingDomain";
+ }
+
+ /**
+ * Change visibility to public.
+ */
+ @Override
+ public GraphicalViewer getGraphicalViewer() {
+ return super.getGraphicalViewer();
+ }
+
+ /**
+ * @return the parentEditor
+ */
+ public GmfEditorContext getSharedObjects() {
+ return context;
+ }
+
+ /**
+ *
+ */
+ @Override
+ public void init(IEditorSite site, IEditorInput input) throws PartInitException {
+ super.init(site, input);
+ // Set name after calling super.init()
+ setPartName(getDiagram().getName());
+ }
+
+ @Override
+ protected void initializeGraphicalViewer() {
+ super.initializeGraphicalViewer();
+
+ // Enable Drop
+ getDiagramGraphicalViewer().addDropTargetListener(new DropTargetListener(getDiagramGraphicalViewer(), LocalSelectionTransfer.getTransfer()) {
+
+ @Override
+ protected Object getJavaObject(TransferData data) {
+ return LocalSelectionTransfer.getTransfer().nativeToJava(data);
+ }
+
+ @Override
+ protected TransactionalEditingDomain getTransactionalEditingDomain() {
+ return getEditingDomain();
+ }
+ });
+
+ }
+
+ @Override
+ public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+ if (getSite().getPage().getActiveEditor() instanceof IMultiDiagramEditor) {
+ IMultiDiagramEditor editor = (IMultiDiagramEditor) getSite().getPage().getActiveEditor();
+ // If not the active editor, ignore selection changed.
+ if (this.equals(editor.getActiveEditor())) {
+ updateActions(getSelectionActions());
+ } else {
+ super.selectionChanged(part, selection);
+ }
+ } else {
+ super.selectionChanged(part, selection);
+ }
+ }
+
+ /**
+ * @param diagram
+ * the diagram to set
+ */
+ public void setDiagram(Diagram diagram) {
+ this.diagram = diagram;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setDocumentProvider(IEditorInput input) {
+ if (input instanceof IFileEditorInput || input instanceof URIEditorInput) {
+ setDocumentProvider(context.getDocumentProvider());
+ } else {
+ super.setDocumentProvider(input);
+ }
+ }
+
+ @Override
+ public void setFocus() {
+
+ // System.out.println("setFocus( " + ((Object)splitter).hashCode() +
+ // "):" + splitter.getChildren());
+ splitter.setFocus();
+
+ super.setFocus();
+ }
+
+ /**
+ *
+ */
+ @Override
+ public void setInput(IEditorInput input) {
+ try {
+ // We are in a nested editor.
+ // Provide an URI with fragment in order to reuse the same Resource
+ // and to
+ // set the diagram to the fragment.
+ // First, compute the URI
+ URIEditorInput uriInput = new URIEditorInput(EcoreUtil.getURI(diagram));
+ System.err.println(this.getClass().getSimpleName() + ".setInput(" + uriInput.toString() + ")");
+ doSetInput(uriInput, true);
+ } catch (CoreException x) {
+ String title = EditorMessages.Editor_error_setinput_title;
+ String msg = EditorMessages.Editor_error_setinput_message;
+ Shell shell = getSite().getShell();
+ ErrorDialog.openError(shell, title, msg, x.getStatus());
+ }
+
+ }
+
+ /**
+ * @param parentEditor
+ * the parentEditor to set
+ */
+ public void setSharedObject(GmfEditorContext parentEditor) {
+ this.context = parentEditor;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/command/AssociationClassViewCreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/command/AssociationClassViewCreateCommand.java
new file mode 100644
index 00000000000..5909e56adfc
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/command/AssociationClassViewCreateCommand.java
@@ -0,0 +1,172 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.custom.command;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartViewer;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewAndElementRequest;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.notation.Location;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.view.factories.AssociationClassViewFactory;
+
+/**
+ * Custom class to create the associationClass node
+ *
+ * @author Patrick Tessier
+ */
+public class AssociationClassViewCreateCommand extends AbstractTransactionalCommand {
+
+ /**
+ * iadapter to send eobjet
+ *
+ * @author Patrick Tessier
+ */
+ private class SemanticAdapter implements IAdaptable {
+
+ private EObject element;
+
+ public SemanticAdapter(EObject element) {
+ this.element = element;
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ public Object getAdapter(Class adapter) {
+ if (adapter.equals(EObject.class)) {
+ return element;
+ }
+ return null;
+ }
+
+ }
+
+ private static View node;
+
+ private View containerView;
+
+ private CreateConnectionViewAndElementRequest createConnectionViewAndElementRequest;
+
+ private EObject element;
+
+ private EObject eobject;
+
+ private Point location;
+
+ private PreferencesHint preferenceHint;
+
+ public EObjectAdapter result;
+
+ private EditPartViewer viewer;
+
+ /**
+ * constructor
+ *
+ * @param createConnectionViewAndElementRequest
+ * the request that is used to obtained the associationclass
+ * @param domain
+ * the current edit domain
+ * @param container
+ * the container view
+ * @param viewer
+ * the viewer
+ * @param preferencesHint
+ * the preference hint of the diagram
+ * @param point
+ * the location of the future association node
+ */
+ public AssociationClassViewCreateCommand(CreateConnectionViewAndElementRequest createConnectionViewAndElementRequest, TransactionalEditingDomain domain, View container, EditPartViewer viewer,
+ PreferencesHint preferencesHint, Point point) {
+ super(domain, "AssociationClassViewCreateCommand", null); //$NON-NLS-1$
+ this.containerView = container;
+ this.viewer = viewer;
+ this.preferenceHint = preferencesHint;
+ this.createConnectionViewAndElementRequest = createConnectionViewAndElementRequest;
+ this.location = point;
+
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ // / get the factory of the viewer
+ AssociationClassViewFactory factory = new AssociationClassViewFactory();
+ // creation of the element
+ CreateElementRequestAdapter requestAdapter = ((CreateConnectionViewAndElementRequest) createConnectionViewAndElementRequest).getConnectionViewAndElementDescriptor()
+ .getCreateElementRequestAdapter();
+ CreateRelationshipRequest createElementRequest = (CreateRelationshipRequest) requestAdapter.getAdapter(CreateRelationshipRequest.class);
+
+ this.node = factory.createView(new SemanticAdapter(createElementRequest.getNewElement()), this.containerView, ((IHintedType) UMLElementTypes.AssociationClass_2013).getSemanticHint(), -1,
+ true, preferenceHint);
+ // put to the good position
+ Location notationLocation = NotationFactory.eINSTANCE.createLocation();
+ notationLocation.setX(location.x);
+ notationLocation.setY(location.y);
+ ((Node) this.node).setLayoutConstraint(notationLocation);
+ return CommandResult.newOKCommandResult(node);
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ public List getAffectedFiles() {
+ if (viewer != null) {
+ EditPart editpart = viewer.getRootEditPart().getContents();
+ if (editpart instanceof IGraphicalEditPart) {
+ View view = (View) ((IGraphicalEditPart) editpart).getModel();
+ if (view != null) {
+ IFile f = WorkspaceSynchronizer.getFile(view.eResource());
+ return f != null ? Collections.singletonList(f) : Collections.EMPTY_LIST;
+ }
+ }
+ }
+ return super.getAffectedFiles();
+ }
+
+ /**
+ * used to obtain the created node
+ *
+ * @return the created node
+ */
+ public View getNode() {
+ return node;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/command/CreateAssociationClassSupplement.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/command/CreateAssociationClassSupplement.java
new file mode 100644
index 00000000000..7c7f2d31f0f
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/command/CreateAssociationClassSupplement.java
@@ -0,0 +1,127 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.custom.command;
+
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PropertyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.ui.toolbox.LookForElement;
+import org.eclipse.uml2.uml.AssociationClass;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.Type;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * This is the supplement command adapted for association
+ *
+ * @author Patrick Tessier
+ */
+public class CreateAssociationClassSupplement extends SupplementCommand {
+
+ private CreateRelationshipRequest request;
+
+ /**
+ * this is the constructor of the supplement command for the association
+ *
+ * @param container
+ * the container of the association (package)
+ * @param source
+ * the source of the association (Type)
+ * @param target
+ * the target of the association (Type)
+ */
+ public CreateAssociationClassSupplement(EObject container, EObject source, EObject target) {
+ super(container, source, target);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean canExecute() {
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+
+ @Override
+ protected ConfigureRequest createConfigureRequest(ConfigureRequest request) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public EObject doDefaultElementCreation(TransactionalEditingDomain domain, EObject newElement) {
+
+ AssociationClass association = UMLFactory.eINSTANCE.createAssociationClass();
+
+ // create target property
+
+ CreateElementRequest request = new CreateElementRequest(domain, getSource(), UMLElementTypes.Property_3002, UMLPackage.eINSTANCE.getStructuredClassifier_OwnedAttribute());
+ CreateElementCommand c = new PropertyCreateCommand(request);
+ LookForElement.getCommandStack().execute(new ICommandProxy(c));
+ assert (c.getCommandResult() == null);
+ assert (c.getCommandResult().getReturnValue() == null);
+ Property targetProperty = (Property) c.getCommandResult().getReturnValue();
+ targetProperty.setType((Type) getTarget());
+ targetProperty.setName(((Type) getTarget()).getName().toLowerCase());
+ // create source property
+
+ request = new CreateElementRequest(domain, association, UMLElementTypes.Property_3002, UMLPackage.eINSTANCE.getAssociation_OwnedEnd());
+ c = new PropertyCommandForAssociation(request);
+ LookForElement.getCommandStack().execute(new ICommandProxy(c));
+ assert (c.getCommandResult() == null);
+ assert (c.getCommandResult().getReturnValue() == null);
+ Property sourceProperty = (Property) c.getCommandResult().getReturnValue();
+ sourceProperty.setType((Type) getSource());
+ sourceProperty.setName(((Type) getSource()).getName().toLowerCase());
+ List<Property> memberEnds = association.getMemberEnds();
+
+ if ((memberEnds.indexOf(((Property) targetProperty)) >= 0)) {
+ association.getMemberEnds().move(1, ((Property) targetProperty));
+ } else {
+ association.getMemberEnds().add(1, ((Property) targetProperty));
+ }
+
+ if ((memberEnds.indexOf(((Property) sourceProperty)) >= 0)) {
+ association.getMemberEnds().move(0, ((Property) sourceProperty));
+ } else {
+ association.getMemberEnds().add(0, ((Property) sourceProperty));
+ }
+ ((Package) getContainer()).getPackagedElements().add(association);
+
+ // ////////////////////////////////////////////////////////////////////
+ return association;
+ }
+
+ public void setRequest(CreateRelationshipRequest request) {
+ this.request = request;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/command/CreateAssociationSupplement.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/command/CreateAssociationSupplement.java
new file mode 100644
index 00000000000..8e999433ba7
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/command/CreateAssociationSupplement.java
@@ -0,0 +1,118 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.custom.command;
+
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PropertyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.ui.toolbox.LookForElement;
+import org.eclipse.uml2.uml.Association;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.Type;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * This is the supplement command adapted for association
+ *
+ * @author Patrick Tessier
+ */
+public class CreateAssociationSupplement extends SupplementCommand {
+
+ /**
+ * this is the constructor of the supplement command for the association
+ *
+ * @param container
+ * the container of the association (package)
+ * @param source
+ * the source of the association (Type)
+ * @param target
+ * the target of the association (Type)
+ */
+ public CreateAssociationSupplement(EObject container, EObject source, EObject target) {
+ super(container, source, target);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean canExecute() {
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+
+ @Override
+ protected ConfigureRequest createConfigureRequest(ConfigureRequest request) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public EObject doDefaultElementCreation(TransactionalEditingDomain domain, EObject newElement) {
+
+ Association association = UMLFactory.eINSTANCE.createAssociation();
+
+ // create target property
+
+ CreateElementRequest request = new CreateElementRequest(domain, getSource(), UMLElementTypes.Property_3002, UMLPackage.eINSTANCE.getStructuredClassifier_OwnedAttribute());
+ CreateElementCommand c = new PropertyCreateCommand(request);
+ LookForElement.getCommandStack().execute(new ICommandProxy(c));
+ assert (c.getCommandResult() == null);
+ assert (c.getCommandResult().getReturnValue() == null);
+ Property targetProperty = (Property) c.getCommandResult().getReturnValue();
+ targetProperty.setType((Type) getTarget());
+ targetProperty.setName(((Type) getTarget()).getName().toLowerCase());
+ // create source property
+
+ request = new CreateElementRequest(domain, association, UMLElementTypes.Property_3002, UMLPackage.eINSTANCE.getAssociation_OwnedEnd());
+ c = new PropertyCommandForAssociation(request);
+ LookForElement.getCommandStack().execute(new ICommandProxy(c));
+ assert (c.getCommandResult() == null);
+ assert (c.getCommandResult().getReturnValue() == null);
+ Property sourceProperty = (Property) c.getCommandResult().getReturnValue();
+ sourceProperty.setType((Type) getSource());
+ sourceProperty.setName(((Type) getSource()).getName().toLowerCase());
+ List<Property> memberEnds = association.getMemberEnds();
+
+ if ((memberEnds.indexOf(((Property) targetProperty)) >= 0)) {
+ association.getMemberEnds().move(1, ((Property) targetProperty));
+ } else {
+ association.getMemberEnds().add(1, ((Property) targetProperty));
+ }
+
+ if ((memberEnds.indexOf(((Property) sourceProperty)) >= 0)) {
+ association.getMemberEnds().move(0, ((Property) sourceProperty));
+ } else {
+ association.getMemberEnds().add(0, ((Property) sourceProperty));
+ }
+ ((Package) getContainer()).getPackagedElements().add(association);
+ return association;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/command/DependencyBranchDeletion.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/command/DependencyBranchDeletion.java
new file mode 100644
index 00000000000..a796e5a3c92
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/command/DependencyBranchDeletion.java
@@ -0,0 +1,130 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.custom.command;
+
+import java.util.ArrayList;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest.ConnectionViewDescriptor;
+import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
+import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.diagram.clazz.custom.providers.CustomDeferredCreateConnectionViewCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.uml2.uml.Dependency;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.UMLPackage;
+
+public class DependencyBranchDeletion implements IObjectActionDelegate {
+
+ private Dependency3EditPart selectedElement;
+
+ public DependencyBranchDeletion() {
+ // TODO Auto-generated constructor stub
+ }
+
+ public void run(IAction action) {
+
+ CompoundCommand command = new CompoundCommand();
+ Dependency dependency = null;
+ TransactionalEditingDomain domain = selectedElement.getEditingDomain();
+ GraphicalEditPart dependencyNodeEditPart = null;
+
+ // 1. Semanctic deletion of the client or supplier
+ GraphicalEditPart branchSource = (GraphicalEditPart) selectedElement.getSource();
+ GraphicalEditPart branchtarget = (GraphicalEditPart) selectedElement.getTarget();
+ EStructuralFeature feature = null;
+ ArrayList<NamedElement> newValue = new ArrayList<NamedElement>();
+
+ if (branchSource.resolveSemanticElement() instanceof Dependency) {
+ // target is the supplier of the dependency
+ dependency = (Dependency) branchSource.resolveSemanticElement();
+ dependencyNodeEditPart = branchSource;
+ newValue.addAll(dependency.getSuppliers());
+ newValue.remove(branchtarget.resolveSemanticElement());
+ feature = UMLPackage.eINSTANCE.getDependency_Supplier();
+
+ } else {
+ // source is the client of the dependency to remove
+ feature = UMLPackage.eINSTANCE.getDependency_Client();
+ dependency = (Dependency) branchtarget.resolveSemanticElement();
+ dependencyNodeEditPart = branchtarget;
+ newValue.addAll(dependency.getClients());
+ newValue.remove(branchSource.resolveSemanticElement());
+ }
+ SetRequest setRequest = new SetRequest(dependency, feature, newValue);
+ SetValueCommand setValueCommand = new SetValueCommand(setRequest);
+ command.add(new ICommandProxy(setValueCommand));
+
+ // 2. graphical deletion of the branch
+ View branchDependencyView = selectedElement.getNotationView();
+ command.add(new ICommandProxy(new DeleteCommand(domain, branchDependencyView)));
+
+ // 3. test if it exists more than 2 branches
+ int branchNumber = dependencyNodeEditPart.getSourceConnections().size() + dependencyNodeEditPart.getTargetConnections().size();
+ if (branchNumber == 3) {
+ // 4. Graphical deletion of the node
+ command.add(new ICommandProxy(new DeleteCommand(domain, dependencyNodeEditPart.getNotationView())));
+ // 5. Graphical creation of the binary dependency
+ // 5.1 calculus of the furture source and taget of the binary dependency
+ ArrayList<EditPart> sourceList = new ArrayList<EditPart>();
+ ArrayList<EditPart> targetList = new ArrayList<EditPart>();
+
+ sourceList.addAll(dependencyNodeEditPart.getSourceConnections());
+ targetList.addAll(dependencyNodeEditPart.getTargetConnections());
+ sourceList.remove(selectedElement);
+ targetList.remove(selectedElement);
+ PreferencesHint preferencesHint = ((GraphicalEditPart) ((ConnectionEditPart) (sourceList.get(0))).getTarget()).getDiagramPreferencesHint();
+ ConnectionViewDescriptor viewDescriptor = new ConnectionViewDescriptor(UMLElementTypes.Dependency_4008, ((IHintedType) UMLElementTypes.Dependency_4008).getSemanticHint(), preferencesHint);
+
+ CustomDeferredCreateConnectionViewCommand binaryCommand = new CustomDeferredCreateConnectionViewCommand(domain, ((IHintedType) UMLElementTypes.Dependency_4008).getSemanticHint(),
+ new SemanticAdapter(null, (((ConnectionEditPart) (targetList.get(0))).getSource()).getModel()), new SemanticAdapter(null, (((ConnectionEditPart) (sourceList.get(0))).getTarget())
+ .getModel()), sourceList.get(0).getViewer(), preferencesHint, viewDescriptor, null);
+ binaryCommand.setElement(dependency);
+ command.add(new ICommandProxy(binaryCommand));
+ }
+ // 6.command Execution
+ selectedElement.getDiagramEditDomain().getDiagramCommandStack().execute(command);
+
+ }
+
+ public void selectionChanged(IAction action, ISelection selection) {
+ if (selection instanceof IStructuredSelection) {
+ Object selectedobject = ((IStructuredSelection) selection).getFirstElement();
+ if (selectedobject instanceof Dependency3EditPart) {
+ selectedElement = (Dependency3EditPart) selectedobject;
+ }
+ }
+ }
+
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+ // TODO Auto-generated method stub
+
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/command/DependencyDiamonViewCreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/command/DependencyDiamonViewCreateCommand.java
new file mode 100644
index 00000000000..b922e8012ea
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/command/DependencyDiamonViewCreateCommand.java
@@ -0,0 +1,146 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.custom.command;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartViewer;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
+import org.eclipse.gmf.runtime.notation.Location;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.view.factories.Dependency2ViewFactory;
+
+/**
+ * Custom class to create the associationClass node
+ *
+ * @author Patrick Tessier
+ */
+public class DependencyDiamonViewCreateCommand extends AbstractTransactionalCommand {
+
+ /**
+ * iadapter to send eobjet
+ *
+ * @author Patrick Tessier
+ */
+
+ private static View node;
+
+ private View containerView;
+
+ private EObject element;
+
+ private EObject eobject;
+
+ private Point location;
+
+ private PreferencesHint preferenceHint;
+
+ public EObjectAdapter result;
+
+ private SemanticAdapter semanticApdater;
+
+ private EditPartViewer viewer;
+
+ /**
+ * constructor
+ *
+ * @param createConnectionViewAndElementRequest
+ * the request that is used to obtained the associationclass
+ * @param domain
+ * the current edit domain
+ * @param container
+ * the container view
+ * @param viewer
+ * the viewer
+ * @param preferencesHint
+ * the preference hint of the diagram
+ * @param point
+ * the location of the future association node
+ */
+ public DependencyDiamonViewCreateCommand(TransactionalEditingDomain domain, View container, EditPartViewer viewer, PreferencesHint preferencesHint, Point point, SemanticAdapter semanticAdapter) {
+ super(domain, "AssociationClassViewCreateCommand", null); //$NON-NLS-1$
+ this.containerView = container;
+ this.viewer = viewer;
+ this.preferenceHint = preferencesHint;
+ this.location = point;
+ this.semanticApdater = semanticAdapter;
+ setResult(CommandResult.newOKCommandResult(semanticAdapter));
+
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ // / get the factory of the viewer
+ Dependency2ViewFactory factory = new Dependency2ViewFactory();
+ // creation of the element
+
+ this.node = factory.createView(semanticApdater, this.containerView, ((IHintedType) UMLElementTypes.Dependency_2014).getSemanticHint(), -1, true, preferenceHint);
+ // put to the good position
+ Location notationLocation = NotationFactory.eINSTANCE.createLocation();
+ notationLocation.setX(location.x);
+ notationLocation.setY(location.y);
+ ((Node) this.node).setLayoutConstraint(notationLocation);
+ semanticApdater.setView(this.node);
+ return CommandResult.newOKCommandResult(semanticApdater);
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ public List getAffectedFiles() {
+ if (viewer != null) {
+ EditPart editpart = viewer.getRootEditPart().getContents();
+ if (editpart instanceof IGraphicalEditPart) {
+ View view = (View) ((IGraphicalEditPart) editpart).getModel();
+ if (view != null) {
+ IFile f = WorkspaceSynchronizer.getFile(view.eResource());
+ return f != null ? Collections.singletonList(f) : Collections.EMPTY_LIST;
+ }
+ }
+ }
+ return super.getAffectedFiles();
+ }
+
+ /**
+ * used to obtain the created node
+ *
+ * @return the created node
+ */
+ public View getNode() {
+ return node;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/command/DestroyAssociationCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/command/DestroyAssociationCommand.java
new file mode 100644
index 00000000000..3c07fcbb9f3
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/command/DestroyAssociationCommand.java
@@ -0,0 +1,61 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.custom.command;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.papyrus.ui.toolbox.LookForElement;
+import org.eclipse.uml2.uml.Association;
+
+/**
+ * This is the command in charge to supress the association and associated properties
+ *
+ * @author Patrick Tessier
+ */
+public class DestroyAssociationCommand extends DestroyElementCommand {
+
+ /**
+ * constructor of theis command
+ *
+ * @param request
+ * see {@link DestroyElementRequest}
+ */
+ public DestroyAssociationCommand(DestroyElementRequest request) {
+ super(request);
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+
+ Association association = (Association) getElementToDestroy();
+ DestroyElementRequest request = new DestroyElementRequest(getEditingDomain(), association.getMemberEnds().get(1), true);
+ DestroyElementCommand c = new DestroyElementCommand(request);
+ LookForElement.getCommandStack().execute(new ICommandProxy(c));
+ request = new DestroyElementRequest(getEditingDomain(), association.getMemberEnds().get(0), true);
+ c = new DestroyElementCommand(request);
+ LookForElement.getCommandStack().execute(new ICommandProxy(c));
+ request = new DestroyElementRequest(getEditingDomain(), association, true);
+ c = new DestroyElementCommand(request);
+ LookForElement.getCommandStack().execute(new ICommandProxy(c));
+ return CommandResult.newOKCommandResult();
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/command/PropertyCommandForAssociation.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/command/PropertyCommandForAssociation.java
new file mode 100644
index 00000000000..78276c71a3c
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/command/PropertyCommandForAssociation.java
@@ -0,0 +1,54 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.custom.command;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PropertyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.Association;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+public class PropertyCommandForAssociation extends PropertyCreateCommand {
+
+ public PropertyCommandForAssociation(CreateElementRequest req) {
+ super(req);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected EObject doDefaultElementCreation() {
+ Property newElement = UMLFactory.eINSTANCE.createProperty();
+
+ Association owner = (Association) getElementToEdit();
+ owner.getOwnedEnds().add(newElement);
+
+ UMLElementTypes.init_Property_3002(newElement);
+ return newElement;
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getAssociation();
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/command/SemanticAdapter.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/command/SemanticAdapter.java
new file mode 100644
index 00000000000..4ef9ad30eda
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/command/SemanticAdapter.java
@@ -0,0 +1,40 @@
+package org.eclipse.papyrus.diagram.clazz.custom.command;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.notation.View;
+
+public class SemanticAdapter implements IAdaptable {
+
+ private Object element;
+
+ private Object view;
+
+ public SemanticAdapter(EObject element, Object view) {
+ this.element = element;
+ this.view = view;
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ public Object getAdapter(Class adapter) {
+ if (adapter.equals(EObject.class)) {
+ return element;
+ }
+ if (adapter.equals(View.class)) {
+ return view;
+ }
+ return null;
+ }
+
+ public void setElement(Object element) {
+ this.element = element;
+ }
+
+ public void setView(Object view) {
+ this.view = view;
+ }
+
+} \ No newline at end of file
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/command/SupplementCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/command/SupplementCommand.java
new file mode 100644
index 00000000000..f88454d6fe5
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/command/SupplementCommand.java
@@ -0,0 +1,110 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.custom.command;
+
+import org.eclipse.core.commands.operations.IUndoableOperation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+
+/**
+ * This class is used to supplement a gmf connection command.
+ *
+ * @author Patrick Tessier
+ */
+public abstract class SupplementCommand {
+
+ private EObject container;
+
+ private EObject source;
+
+ private EObject target;
+
+ /**
+ * the supplement command has the same parameter as connection create command of gmf command
+ *
+ * @param container
+ * the container of the link
+ * @param source
+ * the source of the link
+ *
+ * @param target
+ * the target of the link
+ */
+ public SupplementCommand(EObject container, EObject source, EObject target) {
+ super();
+ this.container = container;
+ this.source = source;
+ this.target = target;
+ }
+
+ /**
+ * this is the same fucntionnality as {@link IUndoableOperation}
+ *
+ * @return true if the command ca be executed
+ */
+ public abstract boolean canExecute();
+
+ /**
+ * Creates the request to configure the new element.
+ *
+ * @see EditElementCommand
+ * @return the request
+ */
+ protected abstract ConfigureRequest createConfigureRequest(ConfigureRequest request);
+
+ /**
+ * this is the method tat realize the execution of the command
+ *
+ * @param newElement
+ * the new element ro configure
+ * @return the new element
+ */
+ public abstract EObject doDefaultElementCreation(TransactionalEditingDomain domain, EObject newElement);
+
+ /**
+ * use to obtain the container of the link
+ *
+ * @return the container of the link
+ */
+ public EObject getContainer() {
+ return container;
+ }
+
+ /**
+ * use to obtain the source of the link
+ *
+ * @return the source of the link
+ */
+ public EObject getSource() {
+ return source;
+ }
+
+ /**
+ * use to obtain the target of the link
+ *
+ * @return the target of the link
+ */
+ public EObject getTarget() {
+ return target;
+ }
+
+ /**
+ * use to set the container of the link
+ */
+ public void setContainer(EObject container) {
+ this.container = container;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/edit/actions/InitializeDiagramAction.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/edit/actions/InitializeDiagramAction.java
new file mode 100644
index 00000000000..855aae9bba1
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/edit/actions/InitializeDiagramAction.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.custom.edit.actions;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.diagram.ui.actions.ActionIds;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramCommandStack;
+import org.eclipse.gmf.runtime.diagram.ui.requests.ArrangeRequest;
+import org.eclipse.gmf.runtime.diagram.ui.services.layout.LayoutType;
+import org.eclipse.papyrus.diagram.clazz.custom.edit.commands.InitializeDiagramCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelEditPart;
+import org.eclipse.papyrus.diagram.common.actions.AbstractAction;
+
+/**
+ * Initialize diagram elements from a semantic model.
+ *
+ * @author <a href="mailto:jerome.benois@obeo.fr">Jerome Benois</a>
+ */
+public class InitializeDiagramAction extends AbstractAction {
+
+ public static String ID = "papyrus.initializeDiagramAction";
+
+ public InitializeDiagramAction() {
+ setId(ID);
+ setText("Initialize Diagram");
+ setToolTipText("Initialize Diagram");
+ // setImageDescriptor(Plugin.getBundledImageDescriptor("icons/*.gif"));
+ }
+
+ /**
+ * @return the diagram ID
+ */
+ protected String getDiagramNotationID() {
+ return ModelEditPart.MODEL_ID;
+ }
+
+ /**
+ * @see org.eclipse.jface.action.Action#isEnabled()
+ */
+ @Override
+ public boolean isEnabled() {
+ return getDiagramNotationID().equals(getCurrentDiagram().getType());
+ }
+
+ /**
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ @Override
+ public void run() {
+ if (false == getHost() instanceof DiagramEditPart) {
+ return;
+ }
+ DiagramEditPart diagramEditPart = (DiagramEditPart) getHost();
+ final DiagramCommandStack commandStack = getHost().getDiagramEditDomain().getDiagramCommandStack();
+
+ // Run initialize at first (do not use compoundCommand)
+ commandStack.execute(new ICommandProxy(new InitializeDiagramCommand(diagramEditPart)), new NullProgressMonitor());
+
+ // Run ArrangeAll on the newly created graphical elements
+ // get the element list to arrange
+ List<?> editparts = diagramEditPart.getRoot().getChildren();
+ // arrange the elements
+ ArrangeRequest arrangeRequest = new ArrangeRequest(ActionIds.ACTION_ARRANGE_ALL, LayoutType.DEFAULT);
+ arrangeRequest.setPartsToArrange(editparts);
+ Command arrangeCmd = diagramEditPart.getCommand(arrangeRequest);
+ commandStack.execute(arrangeCmd, new NullProgressMonitor());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/edit/actions/RestoreRelatedLinksAction.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/edit/actions/RestoreRelatedLinksAction.java
new file mode 100644
index 00000000000..5564d52dc9c
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/edit/actions/RestoreRelatedLinksAction.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.custom.edit.actions;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramCommandStack;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.custom.edit.commands.RestoreRelatedLinksCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelEditPart;
+import org.eclipse.papyrus.diagram.common.actions.AbstractAction;
+
+/**
+ * Restore related links to selected element
+ *
+ * @author <a href="mailto:jerome.benois@obeo.fr">Jerome Benois</a>
+ */
+public class RestoreRelatedLinksAction extends AbstractAction {
+
+ public static String ID = "papyrus.restoreRelatedLinksAction";
+
+ public RestoreRelatedLinksAction() {
+ setId(ID);
+ setText("Restore Related Elements");
+ setToolTipText("Restore Related Elements");
+ // setImageDescriptor(Plugin.getBundledImageDescriptor("icons/*.gif"));
+ }
+
+ /**
+ * @return
+ */
+ protected String getDiagramNotationID() {
+ return ModelEditPart.MODEL_ID;
+ }
+
+ /**
+ * @see org.eclipse.jface.action.Action#isEnabled()
+ */
+ @Override
+ public boolean isEnabled() {
+ return (!getSelection().isEmpty() && getDiagramNotationID().equals(getCurrentDiagram().getType()));
+ }
+
+ /**
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ @Override
+ public void run() {
+ List<View> selection = getSelection();
+
+ if (selection.isEmpty()) {
+ return;
+ }
+
+ if (false == getHost() instanceof DiagramEditPart) {
+ return;
+ }
+ DiagramEditPart diagramEditPart = (DiagramEditPart) getHost();
+
+ final DiagramCommandStack commandStack = getHost().getDiagramEditDomain().getDiagramCommandStack();
+ CompoundCommand cmd = new CompoundCommand("Restore Related Links");
+ cmd.add(new ICommandProxy(new RestoreRelatedLinksCommand(diagramEditPart, selection)));
+ commandStack.execute(cmd, new NullProgressMonitor());
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/edit/commands/InitializeDiagramCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/edit/commands/InitializeDiagramCommand.java
new file mode 100644
index 00000000000..44eaa6b927f
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/edit/commands/InitializeDiagramCommand.java
@@ -0,0 +1,270 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.custom.edit.commands;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.ListIterator;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.commands.CreateCommand;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.commands.SetViewMutabilityCommand;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ICanonicalShapeCompartmentLayout;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.common.util.CommandUtil;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.AssociationClass;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.PackageableElement;
+
+/**
+ * Initialize diagram elements from a semantic model.
+ *
+ * @author <a href="mailto:jerome.benois@obeo.fr">Jerome Benois</a>
+ */
+public class InitializeDiagramCommand extends AbstractTransactionalCommand {
+
+ // protected List<?> adapters;
+
+ protected Diagram diagram;
+
+ protected DiagramEditPart host;
+
+ public InitializeDiagramCommand(DiagramEditPart diagramEditPart) {
+ super(diagramEditPart.getEditingDomain(), "Initialize Diagram From Semantic Model", null);
+ this.host = diagramEditPart;
+ this.diagram = host.getDiagramView();
+ }
+
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ // To load visualIDRegistry
+ host().refresh();
+
+ List createdViews = new LinkedList();
+ createdViews.addAll(populateSemanticNodes());
+
+ if (createdViews.size() > 0) {
+ RestoreRelatedLinksCommand restoreRelatedLinksCommand = new RestoreRelatedLinksCommand(((DiagramEditPart) getHost()), createdViews);
+ CommandUtil.executeCommand(new ICommandProxy(restoreRelatedLinksCommand), host());
+ // DeferredLayoutCommand layoutCmd = new DeferredLayoutCommand(host().getEditingDomain(), createdViews, host());
+ // CommandUtils.executeCommand(new ICommandProxy(layoutCmd), host());
+ }
+
+ // Make views immutable
+ List viewAdapters = prepareAdapterList(createdViews);
+ final Command immutable = SetViewMutabilityCommand.makeImmutable(viewAdapters);
+ PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+
+ public void run() {
+ immutable.execute();
+ }
+ });
+ return null;
+ }
+
+ /**
+ * Forwards the supplied request to its source if the target is <tt>null</tt>; otherwise it is forwarded to the target. Forwards the supplied request to the editpart's <code>host</code>.
+ *
+ * @param request
+ * a <code>CreareConnecgtorViewRequest</code>
+ * @return Command to create the views in the request
+ */
+ protected Command getCreateViewCommand(CreateRequest request) {
+ if (request instanceof CreateConnectionViewRequest) {
+ CreateConnectionViewRequest ccr = (CreateConnectionViewRequest) request;
+ EditPart ep = ccr.getTargetEditPart() == null ? ccr.getSourceEditPart() : ccr.getTargetEditPart();
+ return ep.getCommand(request);
+ }
+
+ CompositeCommand cc = new CompositeCommand(DiagramUIMessages.AddCommand_Label);
+ Command cmd = host().getCommand(request);
+ if (cmd == null) {
+ assert request instanceof CreateViewRequest;
+ Iterator descriptors = ((CreateViewRequest) request).getViewDescriptors().iterator();
+ while (descriptors.hasNext()) {
+ ViewDescriptor descriptor = (ViewDescriptor) descriptors.next();
+ ICommand createCommand = getCreateViewCommand(descriptor);
+ cc.compose(createCommand);
+ }
+ } else {
+ cc.compose(new CommandProxy(cmd));
+ Iterator descriptors = ((CreateViewRequest) request).getViewDescriptors().iterator();
+ while (descriptors.hasNext()) {
+ ViewDescriptor descriptor = (ViewDescriptor) descriptors.next();
+ cc.compose(new CommandProxy(SetViewMutabilityCommand.makeMutable(descriptor)));
+ }
+ }
+ return new ICommandProxy(cc.reduce());
+ }
+
+ /**
+ * @param descriptor
+ * @return ICommand to create a view given a descriptor
+ */
+ protected ICommand getCreateViewCommand(ViewDescriptor descriptor) {
+ TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
+ CreateCommand createCommand = new CreateCommand(editingDomain, descriptor, (View) getHost().getModel());
+ CompositeCommand cmd = new CompositeCommand(DiagramUIMessages.AddCommand_Label);
+ cmd.compose(createCommand);
+ cmd.compose(new CommandProxy(SetViewMutabilityCommand.makeMutable(descriptor)));
+ return cmd;
+ }
+
+ /**
+ * Return a create view request. The request's location is set to {@link ICanonicalShapeCompartmentLayout#UNDEFINED}.
+ *
+ * @param descriptors
+ * a {@link CreateViewRequest.ViewDescriptor} list.
+ * @return a create request
+ */
+ protected CreateViewRequest getCreateViewRequest(List descriptors) {
+ CreateViewRequest cvr = new CreateViewRequest(descriptors);
+ Point loc = ICanonicalShapeCompartmentLayout.UNDEFINED.getLocation();
+ cvr.setLocation(loc);
+ return cvr;
+ }
+
+ /**
+ * @return the current diagram
+ */
+ private Diagram getDiagram() {
+ return ((View) getHost().getModel()).getDiagram();
+ }
+
+ /**
+ * @return <code>(IGraphicalEditPart)host()</code>.
+ */
+ protected final IGraphicalEditPart getHost() {
+ return host;
+ }
+
+ /**
+ * Convenience method to create a view descriptor. Will call {@link #getViewDescriptor(IAdaptable, Class, String, int)}
+ *
+ * @param element
+ * semantic element.
+ * @return view descriptor
+ */
+ protected ViewDescriptor getViewDescriptor(EObject element) {
+ //
+ // create the view descritor
+ // String factoryHint = getDefaultFactoryHint();
+ IAdaptable elementAdapter = new EObjectAdapter(element);// CanonicalElementAdapter(element, factoryHint);
+
+ ViewDescriptor descriptor = getViewDescriptor(elementAdapter, Node.class, null, ViewUtil.APPEND);
+ return descriptor;
+ }
+
+ /**
+ * Return a view descriptor.
+ *
+ * @param elementAdapter
+ * semantic element
+ * @param viewKind
+ * type of view to create
+ * @param hint
+ * factory hint
+ * @param index
+ * index
+ * @return a create <i>non-persisted</i> view descriptor
+ */
+ protected ViewDescriptor getViewDescriptor(IAdaptable elementAdapter, Class viewKind, String hint, int index) {
+
+ return new ViewDescriptor(elementAdapter, viewKind, hint, index, false, host().getDiagramPreferencesHint());
+ }
+
+ /**
+ * @return <code>(IGraphicalEditPart)host()</code>.
+ */
+ protected final IGraphicalEditPart host() {
+ return host;
+ }
+
+ protected List<ViewDescriptor> populateSemanticNodes() {
+ List<ViewDescriptor> descriptors = new ArrayList<ViewDescriptor>();
+ View viewObject = (View) getHost().getModel();
+ EObject container = getDiagram().getElement();
+ if (container instanceof Package) {
+ Package rootPackage = (Package) container;
+ Iterator<PackageableElement> it = rootPackage.getPackagedElements().iterator();
+ while (it.hasNext()) {
+ PackageableElement element = it.next();
+ if (!(element instanceof AssociationClass)) {
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(viewObject, element);
+ if (visualID != -1) {
+ ViewDescriptor descriptor = getViewDescriptor(element);
+ descriptors.add(descriptor);
+ }
+ }
+ }
+ }
+ if (!descriptors.isEmpty()) {
+ // create the request
+ CreateViewRequest request = getCreateViewRequest(descriptors);
+
+ // get the command and execute it.
+ Command cmd = getCreateViewCommand(request);
+ if (cmd != null && cmd.canExecute()) {
+ SetViewMutabilityCommand.makeMutable(new EObjectAdapter(host().getNotationView())).execute();
+ CommandUtil.executeCommand(cmd, host());
+ return (List) request.getNewObject();
+ }
+ }
+ return Collections.EMPTY_LIST;
+ }
+
+ private List prepareAdapterList(List createdViews) {
+ List viewAdapters = new ArrayList();
+ viewAdapters.add(host());
+ ListIterator li = createdViews.listIterator();
+ while (li.hasNext()) {
+ Object obj = li.next();
+ if (obj != null) {
+ if (!(obj instanceof IAdaptable) && obj instanceof EObject) {
+ viewAdapters.add(new EObjectAdapter((EObject) obj));
+ } else {
+ viewAdapters.add(obj);
+ }
+ }
+ }
+ return viewAdapters;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/edit/commands/RestoreRelatedLinksCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/edit/commands/RestoreRelatedLinksCommand.java
new file mode 100644
index 00000000000..d660ae85712
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/edit/commands/RestoreRelatedLinksCommand.java
@@ -0,0 +1,369 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.custom.edit.commands;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.diagram.core.commands.SetPropertyCommand;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.internal.properties.Properties;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataTypeEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.EnumerationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InstanceSpecificationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PrimitiveTypeEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SignalEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLLinkDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.common.util.CommandUtil;
+import org.eclipse.uml2.uml.Association;
+import org.eclipse.uml2.uml.Type;
+
+/**
+ * Restore related links to selected element
+ *
+ * @author <a href="mailto:jerome.benois@obeo.fr">Jerome Benois</a>
+ */
+// Inspired from EcoreTools source code
+public class RestoreRelatedLinksCommand extends AbstractTransactionalCommand {
+
+ private final static List<Integer> visualIds = Arrays.asList(ClassEditPart.VISUAL_ID, InstanceSpecificationEditPart.VISUAL_ID, InterfaceEditPart.VISUAL_ID, ComponentEditPart.VISUAL_ID,
+ DataTypeEditPart.VISUAL_ID, EnumerationEditPart.VISUAL_ID, PrimitiveTypeEditPart.VISUAL_ID, SignalEditPart.VISUAL_ID, PackageEditPart.VISUAL_ID);
+
+ protected List<?> adapters;
+
+ protected Diagram diagram;
+
+ protected DiagramEditPart host;
+
+ public RestoreRelatedLinksCommand(DiagramEditPart diagramEditPart, List<?> selection) {
+ super(diagramEditPart.getEditingDomain(), "Restore related links", null);
+ this.host = diagramEditPart;
+ this.diagram = host.getDiagramView();
+ this.adapters = selection;
+ }
+
+ private void cleanAdd(Collection<UMLLinkDescriptor> result, View view, List<?> descriptors) {
+ for (Object object : descriptors) {
+ if (false == object instanceof UMLLinkDescriptor) {
+ continue;
+ }
+ UMLLinkDescriptor descriptor = (UMLLinkDescriptor) object;
+ if (cleanContains(result, descriptor)) {
+ continue;
+ }
+ // check owner
+ if (!isOwner(view, descriptor)) {
+ continue;
+ }
+ result.add(descriptor);
+ }
+ }
+
+ /**
+ * Detect if similar descriptor already exist in given collection.
+ *
+ * @param result
+ * the collection of unique ingoing and outgoing links descriptors
+ * @param umlLinkDescriptor
+ * the descriptor to search
+ * @return true if already exist
+ */
+ private boolean cleanContains(Collection<? extends UMLLinkDescriptor> result, UMLLinkDescriptor umlLinkDescriptor) {
+ for (Object object : result) {
+ if (false == object instanceof UMLLinkDescriptor) {
+ continue;
+ }
+ UMLLinkDescriptor descriptor = (UMLLinkDescriptor) object;
+ if (descriptor.getModelElement() == umlLinkDescriptor.getModelElement() && descriptor.getSource() == umlLinkDescriptor.getSource()
+ && descriptor.getDestination() == umlLinkDescriptor.getDestination() && descriptor.getVisualID() == umlLinkDescriptor.getVisualID()) {
+ return true;
+ }
+
+ // prevent duplicate association descriptors
+ // detect fake association due to GMF limitations to compute derived attribute "Association.endType"
+ // it seems GMF Node cannot use two structuralFeature for one graphical Node ... (dixit Patrick)
+ if (descriptor.getModelElement() instanceof Association && umlLinkDescriptor.getModelElement() instanceof Association) {
+ Association assoc1 = (Association) descriptor.getModelElement();
+ Association assoc2 = (Association) umlLinkDescriptor.getModelElement();
+ if (assoc1.getEndTypes().size() > 1 && assoc2.getEndTypes().size() > 1) {
+ Type source1 = assoc1.getEndTypes().get(0);
+ Type target1 = assoc1.getEndTypes().get(1);
+ Type source2 = assoc2.getEndTypes().get(0);
+ Type target2 = assoc2.getEndTypes().get(1);
+ if (source1.equals(source2) && target1.equals(target2)) {
+ return true;
+ }
+ }
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Collects all related links for view
+ *
+ * @param view
+ * @param domain2NotationMap
+ *
+ * @return linkdescriptors
+ */
+ protected Collection<? extends UMLLinkDescriptor> collectPartRelatedLinks(View view, Map<EObject, View> domain2NotationMap) {
+ Collection<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ // We must prevent duplicate descriptors
+ List<?> outgoingDescriptors = UMLDiagramUpdater.getOutgoingLinks(view);
+ cleanAdd(result, view, outgoingDescriptors);
+
+ List<?> incomingDescriptors = UMLDiagramUpdater.getIncomingLinks(view);
+ cleanAdd(result, view, incomingDescriptors);
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ return result;
+ }
+
+ /**
+ * Create related links corresponding to linkDescriptions
+ *
+ * @param linkDescriptors
+ * @param domain2NotationMap
+ */
+ protected void createRelatedLinks(Collection<? extends UMLLinkDescriptor> linkDescriptors, Map<EObject, View> domain2NotationMap) {
+ // map diagram
+ mapModel(diagram, domain2NotationMap);
+
+ for (UMLLinkDescriptor nextLinkDescriptor : linkDescriptors) {
+ EditPart sourceEditPart = getEditPart(nextLinkDescriptor.getSource(), domain2NotationMap);
+ EditPart targetEditPart = getEditPart(nextLinkDescriptor.getDestination(), domain2NotationMap);
+
+ // If the parts are still null...
+ if (sourceEditPart == null || targetEditPart == null) {
+ continue;
+ }
+ CreateConnectionViewRequest.ConnectionViewDescriptor descriptor = new CreateConnectionViewRequest.ConnectionViewDescriptor(nextLinkDescriptor.getSemanticAdapter(), null, ViewUtil.APPEND,
+ false, host.getDiagramPreferencesHint());
+ CreateConnectionViewRequest ccr = new CreateConnectionViewRequest(descriptor);
+ ccr.setType(RequestConstants.REQ_CONNECTION_START);
+ ccr.setSourceEditPart(sourceEditPart);
+ sourceEditPart.getCommand(ccr);
+ ccr.setTargetEditPart(targetEditPart);
+ ccr.setType(RequestConstants.REQ_CONNECTION_END);
+ Command cmd = targetEditPart.getCommand(ccr);
+ if (cmd != null && cmd.canExecute()) {
+ CommandUtil.executeCommand(cmd, host);
+ }
+ }
+
+ }
+
+ /**
+ *
+ * @see org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand#doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+ */
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ // To register all EditPart in the global visualIDRegistry
+ host().refresh();
+
+ for (Object object : adapters) {
+ if (object instanceof IAdaptable) {
+ IAdaptable ad = (IAdaptable) object;
+ View view = (View) ad.getAdapter(View.class);
+ if (view != null) {
+ refreshRelatedLinks(view);
+ }
+ } else if (object instanceof View) {
+ refreshRelatedLinks((View) object);
+ }
+
+ }
+
+ return CommandResult.newOKCommandResult();
+ }
+
+ /**
+ * Retrieves editpart corresponding to domainModelElement
+ *
+ * @param domainModelElement
+ * @param domain2NotationMap
+ */
+ protected EditPart getEditPart(EObject domainModelElement, Map<? extends EObject, ? extends View> domain2NotationMap) {
+ View view = domain2NotationMap.get(domainModelElement);
+ if (view != null) {
+ return (EditPart) host.getViewer().getEditPartRegistry().get(view);
+ }
+ return null;
+ }
+
+ /**
+ * Get linkdescriptors of the related links for graphicalEditPart
+ *
+ * @param graphicalEditPart
+ * @param domain2NotationMap
+ *
+ * @return linkDescritors
+ */
+ protected Collection<? extends UMLLinkDescriptor> getLinkDescriptorToProcess(View notationView, Map<EObject, View> domain2NotationMap) {
+ // Collect all related link from semantic model
+ Collection<? extends UMLLinkDescriptor> linkDescriptors = collectPartRelatedLinks(notationView, domain2NotationMap);
+
+ // Collect all related link from graphical model
+ Collection<Edge> existingLinks = new LinkedList<Edge>();
+ for (Object edge : notationView.getTargetEdges()) {
+ if (edge instanceof Edge && false == existingLinks.contains(edge)) {
+ existingLinks.add((Edge) edge);
+ }
+ }
+ for (Object edge : notationView.getSourceEdges()) {
+ if (edge instanceof Edge && false == existingLinks.contains(edge)) {
+ existingLinks.add((Edge) edge);
+ }
+ }
+
+ // Set all existing related link visible
+ setViewVisible(existingLinks);
+
+ // Remove already existing links
+ for (Iterator<Edge> linksIterator = existingLinks.iterator(); linksIterator.hasNext();) {
+ Edge nextDiagramLink = linksIterator.next();
+ int diagramLinkVisualID = UMLVisualIDRegistry.getVisualID(nextDiagramLink);
+ if (diagramLinkVisualID == -1) {
+ if (nextDiagramLink.getSource() != null && nextDiagramLink.getTarget() != null) {
+ linksIterator.remove();
+ }
+ continue;
+ }
+ EObject diagramLinkObject = nextDiagramLink.getElement();
+ EObject diagramLinkSrc = nextDiagramLink.getSource().getElement();
+ EObject diagramLinkDst = nextDiagramLink.getTarget().getElement();
+ for (Iterator<? extends UMLLinkDescriptor> LinkDescriptorsIterator = linkDescriptors.iterator(); LinkDescriptorsIterator.hasNext();) {
+ UMLLinkDescriptor nextLinkDescriptor = LinkDescriptorsIterator.next();
+ if (diagramLinkObject == nextLinkDescriptor.getModelElement() && diagramLinkSrc == nextLinkDescriptor.getSource() && diagramLinkDst == nextLinkDescriptor.getDestination()
+ && diagramLinkVisualID == nextLinkDescriptor.getVisualID()) {
+ linksIterator.remove();
+ LinkDescriptorsIterator.remove();
+ }
+ }
+ }
+ return linkDescriptors;
+ }
+
+ /**
+ * @return <code>(IGraphicalEditPart)host()</code>.
+ */
+ protected final IGraphicalEditPart host() {
+ return host;
+ }
+
+ private boolean isOwner(View view, UMLLinkDescriptor descriptor) {
+ EObject source = descriptor.getSource();
+ EObject dest = descriptor.getDestination();
+ if (source != null && source.equals(view.getElement())) {
+ return true;
+ }
+ if (dest != null && dest.equals(view.getElement())) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Maps view
+ *
+ * @param view
+ * @param domain2NotationMap
+ */
+ protected void mapModel(View view, Map<EObject, View> domain2NotationMap) {
+ if (!ModelEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(view))) {
+ return;
+ }
+
+ if (visualIds.contains(UMLVisualIDRegistry.getVisualID(view))) {
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) {
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ EList<View> children = view.getChildren();
+ for (View child : children) {
+ mapModel(child, domain2NotationMap);
+ }
+ @SuppressWarnings("unchecked")
+ EList<View> sourceEdges = view.getSourceEdges();
+ for (View edge : sourceEdges) {
+ mapModel(edge, domain2NotationMap);
+ }
+ }
+
+ /**
+ * Refresh related links for graphicalEditPart
+ *
+ * @param graphicalEditPart
+ */
+ protected void refreshRelatedLinks(View notationView) {
+ Map<EObject, View> domain2NotationMap = new HashMap<EObject, View>();
+
+ // Create related links
+ Collection<? extends UMLLinkDescriptor> linkDescriptors = getLinkDescriptorToProcess(notationView, domain2NotationMap);
+ createRelatedLinks(linkDescriptors, domain2NotationMap);
+ }
+
+ /**
+ * Set view visible
+ *
+ * @param part
+ * @param views
+ */
+ protected void setViewVisible(Collection<? extends View> views) {
+ for (View view : views) {
+ if (view.isVisible()) {
+ continue;
+ }
+ SetPropertyCommand cmd = new SetPropertyCommand(host.getEditingDomain(), "Restore related linksCommand show view", new EObjectAdapter(view), Properties.ID_ISVISIBLE, Boolean.TRUE);
+ if (cmd != null && cmd.canExecute()) {
+ CommandUtil.executeCommand(new ICommandProxy(cmd), host);
+ }
+ }
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/edit/policies/DiagramDragDropEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/edit/policies/DiagramDragDropEditPolicy.java
new file mode 100644
index 00000000000..81b6583ef06
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/edit/policies/DiagramDragDropEditPolicy.java
@@ -0,0 +1,152 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.custom.edit.policies;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.commands.CreateCommand;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.commands.SetViewMutabilityCommand;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ICanonicalShapeCompartmentLayout;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * Add Drag and drop support on diagram
+ *
+ * @author <a href="mailto:jerome.benois@obeo.fr">Jerome Benois</a>
+ */
+public class DiagramDragDropEditPolicy extends org.eclipse.gmf.runtime.diagram.ui.editpolicies.DiagramDragDropEditPolicy {
+
+ protected Command createViewsAndRestoreRelatedLinks(DropObjectsRequest dropRequest, List<? extends ViewDescriptor> viewDescriptors) {
+ CreateViewRequest createViewRequest = new CreateViewRequest(viewDescriptors);
+ createViewRequest.setLocation(dropRequest.getLocation());
+ Command createCommand = getHost().getCommand(createViewRequest);
+ // Chain restore related links
+ // restoreRelatedLinks(createViewRequest, createCommand);
+
+ return createCommand;
+ }
+
+ /**
+ * Forwards the supplied request to its source if the target is <tt>null</tt>; otherwise it is forwarded to the target. Forwards the supplied request to the editpart's <code>host</code>.
+ *
+ * @param request
+ * a <code>CreareConnecgtorViewRequest</code>
+ * @return Command to create the views in the request
+ */
+ protected Command getCreateViewCommand(CreateRequest request) {
+ if (request instanceof CreateConnectionViewRequest) {
+ CreateConnectionViewRequest ccr = (CreateConnectionViewRequest) request;
+ EditPart ep = ccr.getTargetEditPart() == null ? ccr.getSourceEditPart() : ccr.getTargetEditPart();
+ return ep.getCommand(request);
+ }
+
+ CompositeCommand cc = new CompositeCommand(DiagramUIMessages.AddCommand_Label);
+ Command cmd = ((DiagramEditPart) getHost()).getCommand(request);
+ if (cmd == null) {
+ assert request instanceof CreateViewRequest;
+ Iterator descriptors = ((CreateViewRequest) request).getViewDescriptors().iterator();
+ while (descriptors.hasNext()) {
+ ViewDescriptor descriptor = (ViewDescriptor) descriptors.next();
+ ICommand createCommand = getCreateViewCommand(descriptor);
+ cc.compose(createCommand);
+ }
+ } else {
+ cc.compose(new CommandProxy(cmd));
+ Iterator descriptors = ((CreateViewRequest) request).getViewDescriptors().iterator();
+ while (descriptors.hasNext()) {
+ ViewDescriptor descriptor = (ViewDescriptor) descriptors.next();
+ cc.compose(new CommandProxy(SetViewMutabilityCommand.makeMutable(descriptor)));
+ }
+ }
+ return new ICommandProxy(cc.reduce());
+ }
+
+ /**
+ * @param descriptor
+ * @return ICommand to create a view given a descriptor
+ */
+ protected ICommand getCreateViewCommand(ViewDescriptor descriptor) {
+ TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
+ CreateCommand createCommand = new CreateCommand(editingDomain, descriptor, (View) getHost().getModel());
+ CompositeCommand cmd = new CompositeCommand(DiagramUIMessages.AddCommand_Label);
+ cmd.compose(createCommand);
+ cmd.compose(new CommandProxy(SetViewMutabilityCommand.makeMutable(descriptor)));
+ return cmd;
+ }
+
+ @Override
+ public Command getDropObjectsCommand(DropObjectsRequest dropRequest) {
+ List descriptors = new ArrayList();
+ Iterator iter = dropRequest.getObjects().iterator();
+ while (iter.hasNext()) {
+ EObject element = (EObject) iter.next();
+ IAdaptable elementAdapter = new EObjectAdapter(element);
+ ViewDescriptor descriptor = new ViewDescriptor(elementAdapter, Node.class, null, ViewUtil.APPEND, false, ((DiagramEditPart) getHost()).getDiagramPreferencesHint());
+ descriptors.add(descriptor);
+ }
+ if (!descriptors.isEmpty()) {
+ // create the request
+ CreateViewRequest request = new CreateViewRequest(descriptors);
+ Point loc = ICanonicalShapeCompartmentLayout.UNDEFINED.getLocation();
+ request.setLocation(loc);
+
+ // get the command and execute it.
+ Command cmd = getCreateViewCommand(request);
+ if (cmd != null && cmd.canExecute()) {
+ // SetViewMutabilityCommand.makeMutable(new EObjectAdapter(((DiagramEditPart) getHost()).getNotationView())).execute();
+ // CommandUtils.executeCommand(cmd, ((DiagramEditPart) getHost()));
+ // return (List) request.getNewObject();
+ }
+ return cmd;
+ }
+ return null;
+ // List viewDescriptors = new ArrayList();
+ // Iterator iter = dropRequest.getObjects().iterator();
+ //
+ // if (dropRequest.getObjects().size() > 0 && dropRequest.getObjects().get(0) instanceof String) {
+ // return getDropFileCommand(dropRequest);
+ // }
+ //
+ // while (iter.hasNext()) {
+ // EObject eObject = (EObject) iter.next();
+ // System.out.println("-----> " + eObject);
+ // viewDescriptors.add(new CreateViewRequest.ViewDescriptor(new EObjectAdapter(eObject), ((IGraphicalEditPart) getHost()).getDiagramPreferencesHint()));
+ // }
+
+ // return createViewsAndArrangeCommand(dropRequest, viewDescriptors);
+ // return createViewsAndRestoreRelatedLinks(dropRequest, viewDescriptors);
+ // return createViewsAndArrangeCommand(dropRequest, viewDescriptors);
+ }
+
+} \ No newline at end of file
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/helper/NamedElementHelper.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/helper/NamedElementHelper.java
new file mode 100644
index 00000000000..7858502e60a
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/helper/NamedElementHelper.java
@@ -0,0 +1,83 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.custom.helper;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.NamedElement;
+
+/**
+ * This singleton is used to find a new name of element
+ *
+ *
+ */
+public class NamedElementHelper {
+
+ public static NamedElementHelper EINSTANCE = new NamedElementHelper();
+
+ private String baseString = "default";
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getBaseString() {
+ return baseString;
+ }
+
+ /**
+ * Generic method that returns a new unique name within a namespace.
+ *
+ * @param umlParent
+ * the parent of the element to create
+ *
+ * @return a distinguisable name within the namespace of the umlParent
+ */
+ public String getNewUMLElementName(Element umlParent, EClass eclass) {
+
+ this.setBaseString(eclass.getName());
+ String name = ""; //$NON-NLS-1$
+
+ boolean found = false;
+ // i <10000: avoid infinite loops
+ for (int i = 0; i < 10001; i++) {
+ found = false;
+ name = getBaseString() + i;
+ Iterator it = umlParent.getOwnedElements().iterator();
+ while (it.hasNext() && !found) {
+ Object o = it.next();
+ if (o instanceof NamedElement) {
+ if (name.equals(((NamedElement) o).getName())) {
+ found = true;
+ }
+ }
+ }
+ if (!found) {
+ return name;
+ }
+ }
+ return getBaseString() + "X"; //$NON-NLS-1$
+ }
+
+ /**
+ * set the base string for the name
+ *
+ * @param baseString
+ * a string that is the prefix
+ */
+ public void setBaseString(String baseString) {
+ this.baseString = baseString;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/listeners/DropTargetListener.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/listeners/DropTargetListener.java
new file mode 100644
index 00000000000..74691f1603f
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/listeners/DropTargetListener.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.custom.listeners;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.EditPartViewer;
+import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramDropTargetListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.dnd.TransferData;
+
+/**
+ * This class is used to handle drop event on diagram
+ *
+ * @author <a href="mailto:jerome.benois@obeo.fr">Jerome Benois</a>
+ */
+public abstract class DropTargetListener extends DiagramDropTargetListener {
+
+ public DropTargetListener(EditPartViewer viewer, Transfer xfer) {
+ super(viewer, xfer);
+ }
+
+ protected abstract Object getJavaObject(TransferData data);
+
+ @Override
+ protected List<EObject> getObjectsBeingDropped() {
+ // get objects from transfer
+ TransferData data = getCurrentEvent().currentDataType;
+ HashSet<URI> uris = new HashSet<URI>();
+
+ Object transferedObject = getJavaObject(data);
+ if (transferedObject instanceof IStructuredSelection) {
+ IStructuredSelection selection = (IStructuredSelection) transferedObject;
+ for (Iterator<?> it = selection.iterator(); it.hasNext();) {
+ Object nextSelectedObject = it.next();
+ // if (nextSelectedObject instanceof UMLNavigatorItem) {
+ // View view = ((UMLNavigatorItem) nextSelectedObject).getView();
+ // nextSelectedObject = view.getElement();
+ // } else
+ if (nextSelectedObject instanceof IAdaptable) {
+ IAdaptable adaptable = (IAdaptable) nextSelectedObject;
+ nextSelectedObject = adaptable.getAdapter(EObject.class);
+ }
+ if (nextSelectedObject instanceof EObject) {
+ EObject modelElement = (EObject) nextSelectedObject;
+ Resource modelElementResource = modelElement.eResource();
+ uris.add(modelElementResource.getURI().appendFragment(modelElementResource.getURIFragment(modelElement)));
+ // TODO check visualID supported by class diagram
+ }
+ }
+ }
+
+ ArrayList<EObject> result = new ArrayList<EObject>();
+ for (URI uri : uris) {
+ EObject modelObject = getTransactionalEditingDomain().getResourceSet().getEObject(uri, true);
+ result.add(modelObject);
+ }
+ return result;
+ }
+
+ protected abstract TransactionalEditingDomain getTransactionalEditingDomain();
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/parsers/AppliedStereotypeParser.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/parsers/AppliedStereotypeParser.java
new file mode 100644
index 00000000000..611ab7d4547
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/parsers/AppliedStereotypeParser.java
@@ -0,0 +1,179 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.custom.parsers;
+
+import java.util.Iterator;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.uml2.uml.Abstraction;
+import org.eclipse.uml2.uml.Component;
+import org.eclipse.uml2.uml.DataType;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Enumeration;
+import org.eclipse.uml2.uml.Interface;
+import org.eclipse.uml2.uml.Model;
+import org.eclipse.uml2.uml.PackageImport;
+import org.eclipse.uml2.uml.PackageMerge;
+import org.eclipse.uml2.uml.PrimitiveType;
+import org.eclipse.uml2.uml.Profile;
+import org.eclipse.uml2.uml.Realization;
+import org.eclipse.uml2.uml.Reception;
+import org.eclipse.uml2.uml.Signal;
+import org.eclipse.uml2.uml.Stereotype;
+import org.eclipse.uml2.uml.Substitution;
+import org.eclipse.uml2.uml.Usage;
+
+/**
+ * this the parser used to manage applied stereotype
+ *
+ * @author Patrick Tessier
+ */
+public class AppliedStereotypeParser implements IParser {
+
+ protected final String stereoBegin = "\u00AB";
+
+ protected final String stereoEnd = "\u00BB";
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ public IContentAssistProcessor getCompletionProcessor(IAdaptable element) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ public String getEditString(IAdaptable element, int flags) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ public ICommand getParseCommand(IAdaptable element, String newString, int flags) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ public String getPrintString(IAdaptable element, int flags) {
+
+ if (element instanceof EObjectAdapter) {
+ return stereotypesToDisplay(" ", (Element) ((EObjectAdapter) element).getRealObject());
+ }
+ return null;
+
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ public boolean isAffectingEvent(Object event, int flags) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ public IParserEditStatus isValidEditString(IAdaptable element, String editString) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /**
+ * get the list of sterotype to display.To modify by taking account preferences of stereotype display
+ *
+ * @param separator
+ * " " or "/n" for example
+ * @param umlElement
+ * the uml element on which stereotype are displayed
+ * @return the lis of sterotype to display
+ */
+ public String stereotypesToDisplay(String separator, Element umlElement) {
+ String stereotypesToDisplay = "";
+
+ // AL Changes Feb. 07 - Beg
+ // Style Handling for STEREOTYPE_NAME_APPEARANCE from ProfileApplicationPreferencePage
+ // Stereotype displayed according to UML standard (first letter forced to lower case) - default -
+ // or kept as entered by user (user controlled)
+
+ // Get the preference from PreferenceStore
+ // IPreferenceStore store = PapyrusPlugin.getDefault().getPreferenceStore();
+ // String sNameAppearance = store.getString(ProfileApplicationPreferenceConstants.P_STEREOTYPE_NAME_APPEARANCE);
+
+ // AL Changes Feb. 07 - End
+ // TODO: remove this and replace by figurelabel
+ // Particular cases
+ if (umlElement instanceof Signal) {
+ stereotypesToDisplay = "signal," + separator;
+ } else if (umlElement instanceof Enumeration) {
+ stereotypesToDisplay = "enumeration," + separator;
+ } else if (umlElement instanceof DataType && !(umlElement instanceof PrimitiveType)) {
+ stereotypesToDisplay = "dataType," + separator;
+ } else if (umlElement instanceof PrimitiveType && !(umlElement instanceof DataType)) {
+ stereotypesToDisplay = "primitiveType," + separator;
+ } else if (umlElement instanceof Interface) {
+ stereotypesToDisplay = "interface," + separator;
+ } else if (umlElement instanceof Reception) {
+ stereotypesToDisplay = "signal," + separator;
+ } else if (umlElement instanceof Model) {
+ stereotypesToDisplay = "model," + separator;
+ } else if (umlElement instanceof Profile) {
+ stereotypesToDisplay = "profile," + separator;
+ } else if (umlElement instanceof Stereotype) {
+ stereotypesToDisplay = "stereotype," + separator;
+ } else if (umlElement instanceof Component) {
+ stereotypesToDisplay = "component," + separator;
+ } else if (umlElement instanceof Substitution) {
+ stereotypesToDisplay = "substitute," + separator;
+ } else if (umlElement instanceof Abstraction && !(umlElement instanceof Realization)) {
+ stereotypesToDisplay = "abstraction," + separator;
+ } else if (umlElement instanceof PackageImport) {
+ stereotypesToDisplay = "import," + separator;
+ } else if (umlElement instanceof PackageMerge) {
+ stereotypesToDisplay = "merge," + separator;
+ } else if (umlElement instanceof Usage) {
+ stereotypesToDisplay = "use," + separator;
+ }
+
+ Iterator<Stereotype> iterStereotype = (umlElement).getAppliedStereotypes().iterator();
+ while (iterStereotype.hasNext()) {
+ stereotypesToDisplay = iterStereotype.next().getLabel();
+ stereotypesToDisplay += "," + separator;
+ }
+
+ if (!(stereotypesToDisplay.equals(""))) {
+ return stereoBegin + stereotypesToDisplay.substring(0, stereotypesToDisplay.length() - 2) + stereoEnd;
+ }
+
+ return " ";
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/parsers/CustomMessageFormatParser.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/parsers/CustomMessageFormatParser.java
new file mode 100644
index 00000000000..4bb6184d1b3
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/parsers/CustomMessageFormatParser.java
@@ -0,0 +1,112 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.custom.parsers;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.papyrus.diagram.clazz.parsers.MessageFormatParser;
+
+public class CustomMessageFormatParser extends MessageFormatParser {
+
+ /** this is the ref ereference in order to obtain the obtain which feature will be displayed **/
+ private EStructuralFeature eRefFeature;
+
+ /** this is the index of object that we look for **/
+ private int objectIndex;
+
+ public CustomMessageFormatParser(EAttribute[] features, EStructuralFeature eRefFeature, int objectIndex) {
+ super(features);
+ this.eRefFeature = eRefFeature;
+ this.objectIndex = objectIndex;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getEditString(IAdaptable adapter, int flags) {
+ IAdaptable reachedObject = obtainObject(adapter);
+ if (reachedObject != null) {
+ return super.getEditString(reachedObject, flags);
+ }
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ICommand getParseCommand(IAdaptable adapter, String newString, int flags) {
+ IAdaptable reachedObject = obtainObject(adapter);
+ if (reachedObject != null) {
+ return super.getParseCommand(reachedObject, newString, flags);
+ }
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getPrintString(IAdaptable adapter, int flags) {
+ IAdaptable reachedObject = obtainObject(adapter);
+ if (reachedObject != null) {
+ return super.getPrintString(reachedObject, flags);
+ }
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public IParserEditStatus isValidEditString(IAdaptable adapter, String editString) {
+ IAdaptable reachedObject = obtainObject(adapter);
+ if (reachedObject != null) {
+ return super.isValidEditString(reachedObject, editString);
+ }
+ return null;
+ }
+
+ /**
+ * this method returns the object that is link to the elemtn by an Ereference
+ *
+ * @param adapter
+ * the element where we look for the good element
+ * @return the associated element
+ */
+ protected IAdaptable obtainObject(IAdaptable adapter) {
+ EObject element = (EObject) adapter.getAdapter(EObject.class);
+ Object result = element.eGet(eRefFeature);
+ // this is a collection
+ if (result instanceof List<?>) {
+ // the index is coherent
+ if (((List<?>) result).size() > objectIndex) {
+ EObject object = (EObject) ((List<?>) result).get(objectIndex);
+ return new EObjectAdapter(object);
+ }
+ // the index is not coherent
+ return null;
+ } else {
+ // this not a collection
+ if (objectIndex == 0) {
+ return new EObjectAdapter((EObject) result);
+ }
+ }
+ return null;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/parsers/OperationParser.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/parsers/OperationParser.java
new file mode 100644
index 00000000000..eed14f581db
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/parsers/OperationParser.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.custom.parsers;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.papyrus.umlutils.ICustomAppearence;
+import org.eclipse.uml2.uml.Operation;
+
+/**
+ * This the custom parser to manage operation
+ *
+ * @author Patrick Tessier
+ */
+public class OperationParser implements IParser {
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ public IContentAssistProcessor getCompletionProcessor(IAdaptable element) {
+ return null;
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ public String getEditString(final IAdaptable element, int flags) {
+ if (element instanceof EObjectAdapter) {
+
+ final Operation operation = ((Operation) ((EObjectAdapter) element).getRealObject());
+ return operation.getLabel();
+ }
+ return null;
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ public ICommand getParseCommand(IAdaptable element, String newString, int flags) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ public String getPrintString(IAdaptable element, int flags) {
+ if (element instanceof EObjectAdapter) {
+ Operation operation = ((Operation) ((EObjectAdapter) element).getRealObject());
+ org.eclipse.papyrus.umlutils.Operation utilOperation = new org.eclipse.papyrus.umlutils.Operation(operation);
+ return utilOperation.getCustomLabel(ICustomAppearence.DEFAULT_UML_OPERATION);
+ }
+ return null;
+ }
+
+ public boolean isAffectingEvent(Object event, int flags) {
+ // TODO Auto-generated method stub
+ return true;
+ }
+
+ public IParserEditStatus isValidEditString(IAdaptable element, String editString) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/parsers/PropertyParser.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/parsers/PropertyParser.java
new file mode 100644
index 00000000000..aa43650e6f9
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/parsers/PropertyParser.java
@@ -0,0 +1,173 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.custom.parsers;
+
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.util.SafeRunnable;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.parsers.modelgenerator.PropertyGenerator;
+import org.eclipse.papyrus.ui.toolbox.LookForElement;
+import org.eclipse.papyrus.umlutils.ICustomAppearence;
+import org.eclipse.uml2.uml.Property;
+
+/**
+ * This the parser in charge of editing and displaying properties in Papyrus. For the edition of properties, a dialog box is opened
+ *
+ * @author Patrick Tessier
+ */
+public class PropertyParser implements IParser {
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ public IContentAssistProcessor getCompletionProcessor(IAdaptable element) {
+ return null;
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ public String getEditString(final IAdaptable element, int flags) {
+ if (element instanceof EObjectAdapter) {
+
+ // // to understand see http://dev.eclipse.org/newslists/news.eclipse.modeling.gmf/msg08129.html
+ // try {
+ // LookForElement.getTransactionalEditingDomain().runExclusive(new Runnable() {
+ //
+ // public void run() {
+ // Display.getCurrent().asyncExec(new Runnable() {
+ //
+ // public void run() {
+ // final Property property = ((Property) ((EObjectAdapter) element).getRealObject());
+ // org.eclipse.papyrus.umlutils.Property utilProperty = new org.eclipse.papyrus.umlutils.Property(property);
+ // final PropertyLabelEditorDialog dialog = new PropertyLabelEditorDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), property, utilProperty
+ // .getLabel());
+ // final int code = dialog.open();
+ //
+ // if (code == Window.OK) {
+ // SafeRunnable.run(new SafeRunnable() {
+ //
+ // public void run() {
+ // final PropertyGenerator generator = new PropertyGenerator(property);
+ // RecordingCommand rc = new RecordingCommand(LookForElement.getTransactionalEditingDomain()) {
+ //
+ // protected void doExecute() {
+ // generator.parseAndModifyProperty(dialog.getValue());
+ // }
+ // };
+ // LookForElement.getTransactionalEditingDomain().getCommandStack().execute(rc);
+ // }
+ // });
+ // }
+ // }
+ // });
+ // }
+ // });
+ // } catch (Exception e) {
+ // System.err.println(e);
+ // }
+ final Property property = ((Property) ((EObjectAdapter) element).getRealObject());
+ org.eclipse.papyrus.umlutils.Property utilProperty = new org.eclipse.papyrus.umlutils.Property(property);
+ return utilProperty.getCustomLabel(ICustomAppearence.DEFAULT_UML_PROPERTY);
+ }
+ return "";
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ public ICommand getParseCommand(IAdaptable element, String newString, int flags) {
+ final Property property = ((Property) ((EObjectAdapter) element).getRealObject());
+ final String result = newString;
+
+ AbstractTransactionalCommand tc = new AbstractTransactionalCommand(LookForElement.getTransactionalEditingDomain(), "Edit Property", (List) null) {
+
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ SafeRunnable.run(new SafeRunnable() {
+
+ public void run() {
+ final PropertyGenerator generator = new PropertyGenerator(property);
+ RecordingCommand rc = new RecordingCommand(LookForElement.getTransactionalEditingDomain()) {
+
+ protected void doExecute() {
+ generator.parseAndModifyProperty(result);
+ }
+ };
+ LookForElement.getTransactionalEditingDomain().getCommandStack().execute(rc);
+ }
+ });
+ return CommandResult.newOKCommandResult();
+
+ };
+ };
+ return tc;
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ public String getPrintString(IAdaptable element, int flags) {
+ if (element instanceof EObjectAdapter) {
+ Property property = ((Property) ((EObjectAdapter) element).getRealObject());
+ org.eclipse.papyrus.umlutils.Property utilProperty = new org.eclipse.papyrus.umlutils.Property(property);
+ return utilProperty.getCustomLabel(ICustomAppearence.DEFAULT_UML_PROPERTY);
+ }
+ return null;
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ public boolean isAffectingEvent(Object event, int flags) {
+ // TODO Auto-generated method stub
+ return true;
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ public IParserEditStatus isValidEditString(IAdaptable element, String editString) {
+ if (element instanceof EObjectAdapter) {
+ Property property = ((Property) ((EObjectAdapter) element).getRealObject());
+ PropertyGenerator generator = new PropertyGenerator(property);
+ String message = generator.parseAndValidateProperty(editString);
+ if (message == null) {
+ return new ParserEditStatus(UMLDiagramEditorPlugin.ID, IParserEditStatus.OK, "");
+ } else {
+ return new ParserEditStatus(UMLDiagramEditorPlugin.ID, IParserEditStatus.ERROR, message);
+ }
+ }
+ return new ParserEditStatus(UMLDiagramEditorPlugin.ID, IParserEditStatus.OK, "");
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/policies/RemoveOphanConnectionViewClazzPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/policies/RemoveOphanConnectionViewClazzPolicy.java
new file mode 100644
index 00000000000..195fd7f99b5
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/policies/RemoveOphanConnectionViewClazzPolicy.java
@@ -0,0 +1,41 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.Tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.custom.policies;
+
+import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * this class is used to supress orphan connection into ClassDiagram
+ *
+ */
+public class RemoveOphanConnectionViewClazzPolicy extends RemoveOrphanConnectionViewPolicy {
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ protected String getPrefixofElementTypes() {
+ return "org.eclipse.papyrus.diagram.clazz";
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ protected void initMapEdgewithoutElement() {
+ edgeWithoutElement.put(((IHintedType) UMLElementTypes.Link_4016).getSemanticHint(), ((IHintedType) UMLElementTypes.Link_4016).getSemanticHint());
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/policies/RemoveOrphanConnectionViewPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/policies/RemoveOrphanConnectionViewPolicy.java
new file mode 100644
index 00000000000..8f55782c1a9
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/policies/RemoveOrphanConnectionViewPolicy.java
@@ -0,0 +1,152 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.Tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.custom.policies;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.ModelCanonicalEditPolicy;
+
+/**
+ * this policy is used to supress orphan connection in GMF diagram
+ *
+ * @author Patrick Tessier
+ */
+public abstract class RemoveOrphanConnectionViewPolicy extends ModelCanonicalEditPolicy {
+
+ protected HashMap<String, String> edgeWithoutElement;
+
+ /**
+ * the constructor
+ */
+ public RemoveOrphanConnectionViewPolicy() {
+ super();
+ edgeWithoutElement = new HashMap<String, String>();
+ initMapEdgewithoutElement();
+
+ }
+
+ /**
+ * It exist two manner to find orphan edge: the edge is no associated to an element of the model exception contained into "edgeWithoutElement"- the edge is associated to bad element (not defined
+ * in the mapping)
+ *
+ * @param viewChildren
+ * the view
+ * @return the list of edge to supress
+ */
+ protected List findOrphanEdge(Collection<Edge> viewChildren) {
+ ArrayList<Edge> orphanEdge = new ArrayList<Edge>();
+ Iterator<Edge> it = viewChildren.iterator();
+ while (it.hasNext()) {
+ Edge currentEdge = it.next();
+ // find if it extist a bad mapping
+
+ if (currentEdge.getElement() != null) {
+ // try to find a Ielement type
+
+ String prefix = getPrefixofElementTypes();
+ String umlElementClassName = currentEdge.getElement().getClass().getInterfaces()[0].getSimpleName();
+
+ String result2 = prefix + "." + umlElementClassName + "_" + currentEdge.getType();
+ IElementType theElementType = ElementTypeRegistry.getInstance().getType(result2);
+ if (theElementType == null) {
+ orphanEdge.add(currentEdge);
+ }
+ }
+ if (currentEdge.getElement() == null && !edgeWithoutElement.containsKey(currentEdge.getType())) {
+ orphanEdge.add(currentEdge);
+ }
+ }
+
+ return orphanEdge;
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ protected Collection getConnectionViews() {
+ ArrayList edgelist = new ArrayList();
+ Iterator<EObject> it = ((View) getHost().getModel()).eContents().iterator();
+ while (it.hasNext()) {
+ EObject currentObject = it.next();
+ if (currentObject instanceof Edge) {
+ edgelist.add((Edge) currentObject);
+ }
+ }
+ return edgelist;
+ }
+
+ /**
+ * get the string that is the prefix of ElementTypes for example. In class diagram this is: "org.eclipse.papyrus.diagram.clazz";
+ *
+ * @return the prefix
+ */
+ protected abstract String getPrefixofElementTypes();
+
+ /**
+ * add element ID that are not linked to the model example for the class diagram <BR>
+ * </BR><quote> edgeWithoutElement.put(((IHintedType) UMLElementTypes.Link_4016).getSemanticHint(), ((IHintedType) UMLElementTypes.Link_4016).getSemanticHint()); </quote>
+ */
+ protected abstract void initMapEdgewithoutElement();
+
+ /**
+ * this code comes from generated classes of canonical policies
+ *
+ * @return
+ */
+ private Collection refreshConnections() {
+
+ return new ArrayList();
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ protected void refreshSemantic() {
+ List createdConnectionViews = refreshSemanticConnections();
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ protected List refreshSemanticConnections() {
+ Edge viewChild;
+ EObject semanticChild;
+ //
+ // current connection views
+ Collection<Edge> viewChildren = getConnectionViews();
+
+ List orphaned = findOrphanEdge(viewChildren);
+ //
+ // delete all the remaining views
+ deleteViews(orphaned.iterator());
+
+ //
+ // create a view for each remaining semantic element.
+ List viewDescriptors = new ArrayList();
+
+ return viewDescriptors;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/policies/RemoveOrphanNodeViewPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/policies/RemoveOrphanNodeViewPolicy.java
new file mode 100644
index 00000000000..2ef8e52648e
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/policies/RemoveOrphanNodeViewPolicy.java
@@ -0,0 +1,68 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.Tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.custom.policies;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.uml2.uml.AssociationClass;
+
+/**
+ * this policy is used to supress orphan node view in GMF view the prolicy to remove orphan connection is more complex. It is dependent of the diagram. see remove OrphanConnectionView policy in
+ * clazzdiagram
+ *
+ * @author Patrick Tessier
+ */
+public class RemoveOrphanNodeViewPolicy extends CanonicalEditPolicy {
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ protected Command getCreateViewCommand(CreateRequest request) {
+ return null;
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ protected List getSemanticChildrenList() {
+
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator<?> it = UMLDiagramUpdater.getPackage_1000SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ ArrayList<AssociationClass> associationClassResult = new ArrayList<AssociationClass>();
+
+ for (Iterator ite = result.iterator(); ite.hasNext();) {
+ EObject eobject = (EObject) ite.next();
+ if (eobject instanceof AssociationClass) {
+ associationClassResult.add((AssociationClass) eobject);
+ }
+ }
+
+ return result;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/providers/ClassDiagramContributionItemProvider.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/providers/ClassDiagramContributionItemProvider.java
new file mode 100644
index 00000000000..e6d19cd54c8
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/providers/ClassDiagramContributionItemProvider.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.custom.providers;
+
+import org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.AbstractContributionItemProvider;
+import org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.papyrus.diagram.clazz.custom.edit.actions.InitializeDiagramAction;
+import org.eclipse.papyrus.diagram.clazz.custom.edit.actions.RestoreRelatedLinksAction;
+
+/**
+ * This class used to contrib item for specific actions.
+ *
+ * @author <a href="mailto:jerome.benois@obeo.fr">Jerome Benois</a>
+ */
+public class ClassDiagramContributionItemProvider extends AbstractContributionItemProvider {
+
+ /**
+ * @see org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.AbstractContributionItemProvider#createAction(java.lang.String,
+ * org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor)
+ */
+ @Override
+ protected IAction createAction(String actionId, IWorkbenchPartDescriptor partDescriptor) {
+ if (actionId.equals(RestoreRelatedLinksAction.ID)) {
+ return new RestoreRelatedLinksAction();
+ }
+ if (actionId.equals(InitializeDiagramAction.ID)) {
+ return new InitializeDiagramAction();
+ }
+ return super.createAction(actionId, partDescriptor);
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/providers/CustomDeferredCreateConnectionViewCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/providers/CustomDeferredCreateConnectionViewCommand.java
new file mode 100644
index 00000000000..a47d575a7a2
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/providers/CustomDeferredCreateConnectionViewCommand.java
@@ -0,0 +1,139 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.custom.providers;
+
+import java.util.Map;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.EditPartViewer;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.ui.commands.DeferredCreateConnectionViewCommand;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest.ConnectionViewDescriptor;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.custom.command.AssociationClassViewCreateCommand;
+
+/**
+ * This class is used to create a connection view
+ *
+ * @author Patrick Tessier
+ */
+public class CustomDeferredCreateConnectionViewCommand extends DeferredCreateConnectionViewCommand implements ICommand {
+
+ private ICommand command;
+
+ /** the command saved for undo and redo */
+ private Command createConnectionCmd;
+
+ protected ConnectionViewDescriptor viewDescriptor;
+
+ /**
+ * Constructor
+ *
+ * @param editingDomain
+ * the editing domain
+ * @param element
+ * the semantic element (may be null)
+ * @param sourceViewAdapter
+ * the source of the link
+ * @param targetViewAdapter
+ * the target of the link (may be null if the command is filled)
+ * @param viewer
+ * the viewer
+ * @param preferencesHint
+ * the preferencehint of the diagram
+ * @param command
+ * the command in which we look for the result for the target (may be null)
+ */
+ public CustomDeferredCreateConnectionViewCommand(TransactionalEditingDomain editingDomain, EObject element, IAdaptable sourceViewAdapter, IAdaptable targetViewAdapter, EditPartViewer viewer,
+ PreferencesHint preferencesHint, ICommand command) {
+ super(editingDomain, element, sourceViewAdapter, targetViewAdapter, viewer, preferencesHint);
+ this.command = command;
+ }
+
+ /**
+ * Constructor
+ *
+ * @param editingDomain
+ * the editing domain
+ *@param semanticHint
+ * the semantic of the graphical element
+ * @param sourceViewAdapter
+ * the source of the link
+ * @param targetViewAdapter
+ * the target of the link (may be null if the command is filled)
+ * @param viewer
+ * the viewer
+ * @param preferencesHint
+ * the preferencehint of the diagram
+ * @param viewDescriptor
+ * the view descriptor
+ * @param command
+ * the command in which we look for the result for the target (may be null)
+ */
+ public CustomDeferredCreateConnectionViewCommand(TransactionalEditingDomain editingDomain, String semanticHint, IAdaptable sourceViewAdapter, IAdaptable targetViewAdapter, EditPartViewer viewer,
+ PreferencesHint preferencesHint, ConnectionViewDescriptor viewDescriptor, ICommand command) {
+ super(editingDomain, semanticHint, sourceViewAdapter, targetViewAdapter, viewer, preferencesHint);
+ this.viewDescriptor = viewDescriptor;
+ this.command = command;
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException {
+ Map epRegistry = viewer.getEditPartRegistry();
+ IGraphicalEditPart sourceEP = (IGraphicalEditPart) epRegistry.get(sourceViewAdapter.getAdapter(View.class));
+ IGraphicalEditPart targetEP = null;
+ CreateConnectionViewRequest createRequest = null;
+ if (command != null && command instanceof AssociationClassViewCreateCommand) {
+ targetEP = (IGraphicalEditPart) epRegistry.get(((AssociationClassViewCreateCommand) command).getNode());
+ } else {
+ targetEP = (IGraphicalEditPart) epRegistry.get(targetViewAdapter.getAdapter(View.class));
+ }
+
+ // If these are null, then the diagram's editparts may not
+ // have been refreshed yet.
+ Assert.isNotNull(sourceEP);
+ Assert.isNotNull(targetEP);
+
+ // use the String semanticHint to create a view
+ // modification in order to fixe the bug
+ createRequest = new CreateConnectionViewRequest(viewDescriptor);
+ createConnectionCmd = CreateConnectionViewRequest.getCreateCommand(createRequest, sourceEP, targetEP);
+
+ if (createConnectionCmd.canExecute()) {
+ createConnectionCmd.execute();
+ }
+ if (element != null) {
+ ((View) (createRequest.getConnectionViewDescriptor().getAdapter(View.class))).setElement(element);
+ }
+ viewer = null;// for garbage collection
+ return CommandResult.newOKCommandResult();
+ }
+
+ public void setElement(EObject element) {
+ this.element = element;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/providers/CustomEditPolicyProvider.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/providers/CustomEditPolicyProvider.java
new file mode 100644
index 00000000000..ce95b315881
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/providers/CustomEditPolicyProvider.java
@@ -0,0 +1,69 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.custom.providers;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.common.core.service.IOperation;
+import org.eclipse.gmf.runtime.common.core.service.IProviderChangeListener;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.INodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.CreateEditPoliciesOperation;
+import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.IEditPolicyProvider;
+
+/**
+ * this is an editpolicy provider in charge to install a policy to create a AssociationClass
+ *
+ * @author Patrick Tessier
+ */
+public class CustomEditPolicyProvider implements IEditPolicyProvider {
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ public void addProviderChangeListener(IProviderChangeListener listener) {
+
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ public void createEditPolicies(EditPart editPart) {
+ editPart.installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ public boolean provides(IOperation operation) {
+ // install editpolicy in the case of classifer
+ if (operation instanceof CreateEditPoliciesOperation) {
+ EditPart editPart = ((CreateEditPoliciesOperation) operation).getEditPart();
+ if (editPart instanceof INodeEditPart)
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ public void removeProviderChangeListener(IProviderChangeListener listener) {
+
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/providers/CustomGraphicalNodeEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/providers/CustomGraphicalNodeEditPolicy.java
new file mode 100644
index 00000000000..3c9c79ad7ad
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/providers/CustomGraphicalNodeEditPolicy.java
@@ -0,0 +1,309 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.custom.providers;
+
+import java.util.Iterator;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartViewer;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
+import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.GraphicalNodeEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.internal.commands.SetConnectionBendpointsCommand;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewAndElementRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest.ConnectionViewDescriptor;
+import org.eclipse.gmf.runtime.diagram.ui.util.INotationType;
+import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
+import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.custom.command.AssociationClassViewCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.custom.command.DependencyDiamonViewCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.custom.command.SemanticAdapter;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.Dependency;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * This class is used to launch command to create associationClass
+ *
+ * @author Patrick Tessier
+ */
+public class CustomGraphicalNodeEditPolicy extends GraphicalNodeEditPolicy {
+
+ /**
+ * This method is used to produce a set of commands in charge of the creation of AssociationClass
+ *
+ * @param createConnectionViewAndElementRequest
+ * @param command
+ * the command that is used to create the link associationClass
+ * @return the set of command to create an association Class
+ */
+ private Command getAssociationClassElementCommand(CreateConnectionViewAndElementRequest createConnectionViewAndElementRequest, Command command) {
+ if (command instanceof ICommandProxy) {
+ GraphicalEditPart sourceEditPart = (GraphicalEditPart) createConnectionViewAndElementRequest.getSourceEditPart();
+
+ // 1. calculus of the position of the associationClass node
+ Point p = sourceEditPart.getFigure().getBounds().getTopRight().getCopy();
+ sourceEditPart.getFigure().translateToAbsolute(p);
+ int edgeCount = sourceEditPart.getNotationView().getSourceEdges().size();
+ int offset = (edgeCount * 50) - 100;
+ p = p.translate(100, offset);
+
+ // 2. creation of the associationClass Node without semantic element
+ GraphicalEditPart parent = (GraphicalEditPart) sourceEditPart.getParent();
+ AssociationClassViewCreateCommand assCommand = new AssociationClassViewCreateCommand(createConnectionViewAndElementRequest, getEditingDomain(), (View) parent.getModel(),
+ (EditPartViewer) sourceEditPart.getViewer(), sourceEditPart.getDiagramPreferencesHint(), p);
+ command = command.chain(new ICommandProxy(assCommand));
+
+ // 3. creation of the dashed line between the associationClass link and associationClass Node
+ // target
+ IAdaptable associationClassLinkViewAdapter = (IAdaptable) (createConnectionViewAndElementRequest.getNewObject());
+
+ ConnectionViewDescriptor viewDescriptor = new ConnectionViewDescriptor(UMLElementTypes.Link_4016, ((INotationType) UMLElementTypes.Link_4016).getSemanticHint(), sourceEditPart
+ .getDiagramPreferencesHint());
+ ICommand dashedLineCmd = new CustomDeferredCreateConnectionViewCommand(getEditingDomain(), ((IHintedType) UMLElementTypes.Link_4016).getSemanticHint(), associationClassLinkViewAdapter,
+ null, sourceEditPart.getViewer(), sourceEditPart.getDiagramPreferencesHint(), viewDescriptor, assCommand);
+
+ command = command.chain(new ICommandProxy(dashedLineCmd));
+ return command;
+ }
+ return null;
+ }
+
+ private Command getBranchDepencencyCommand(CreateConnectionViewAndElementRequest createConnectionViewAndElementRequest, Command command) {
+ EditPart sourceEditPart = createConnectionViewAndElementRequest.getSourceEditPart();
+ EditPart targetEditPart = createConnectionViewAndElementRequest.getTargetEditPart();
+ // 0. add the branh graphically
+ ConnectionViewDescriptor viewDescriptor = new ConnectionViewDescriptor(UMLElementTypes.Dependency_4018, ((IHintedType) UMLElementTypes.Dependency_4018).getSemanticHint(),
+ ((IGraphicalEditPart) sourceEditPart).getDiagramPreferencesHint());
+
+ CustomDeferredCreateConnectionViewCommand aBranchCommand = new CustomDeferredCreateConnectionViewCommand(getEditingDomain(), ((IHintedType) UMLElementTypes.Dependency_4018).getSemanticHint(),
+ new SemanticAdapter(null, sourceEditPart.getModel()), new SemanticAdapter(null, targetEditPart.getModel()), sourceEditPart.getViewer(), ((IGraphicalEditPart) sourceEditPart)
+ .getDiagramPreferencesHint(), viewDescriptor, null);
+ command = new CompoundCommand();
+ ((CompoundCommand) command).add(new ICommandProxy(aBranchCommand));
+
+ // 1. add the supplier or client
+ EObject newSemanticElement = null;
+ EStructuralFeature feature = null;
+ Dependency dependency = null;
+ if (((View) sourceEditPart.getModel()).getElement() != null && ((View) sourceEditPart.getModel()).getElement() instanceof Dependency) {
+ newSemanticElement = (NamedElement) ((View) targetEditPart.getModel()).getElement();
+ dependency = (Dependency) ((View) sourceEditPart.getModel()).getElement();
+ feature = UMLPackage.eINSTANCE.getDependency_Supplier();
+ }
+
+ if (((View) targetEditPart.getModel()).getElement() != null && ((View) targetEditPart.getModel()).getElement() instanceof Dependency) {
+ newSemanticElement = (NamedElement) ((View) sourceEditPart.getModel()).getElement();
+ dependency = (Dependency) ((View) targetEditPart.getModel()).getElement();
+ feature = UMLPackage.eINSTANCE.getDependency_Client();
+ }
+ // set the new client or the new supplier
+ SetRequest setRequest = new SetRequest(dependency, feature, newSemanticElement);
+ SetValueCommand setValueCommand = new SetValueCommand(setRequest);
+ ((CompoundCommand) command).add(new ICommandProxy(setValueCommand));
+ return command;
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ public Command getCommand(Request request) {
+
+ // we have to distinguish the case where this is an association class
+ if (REQ_CONNECTION_END.equals(request.getType())) {
+ if (request instanceof CreateConnectionViewAndElementRequest) {
+ // default behavior
+ Command c = getConnectionAndRelationshipCompleteCommand((CreateConnectionViewAndElementRequest) request);
+
+ // case of associationClass
+ CreateElementRequestAdapter requestAdapter = ((CreateConnectionViewAndElementRequest) request).getConnectionViewAndElementDescriptor().getCreateElementRequestAdapter();
+ CreateRelationshipRequest createElementRequest = (CreateRelationshipRequest) requestAdapter.getAdapter(CreateRelationshipRequest.class);
+ if (UMLElementTypes.AssociationClass_4017.equals(createElementRequest.getElementType())) {
+ return getAssociationClassElementCommand(((CreateConnectionViewAndElementRequest) request), c);
+
+ } else if (UMLElementTypes.Dependency_4018.equals(createElementRequest.getElementType())) {
+ return getDependencyCommand(((CreateConnectionViewAndElementRequest) request), c);
+
+ } else {
+ return c;
+ }
+ }
+ }
+ return super.getCommand(request);
+ }
+
+ private Command getDependencyCommand(CreateConnectionViewAndElementRequest createConnectionViewAndElementRequest, Command command) {
+ // 0. get source and target type
+ command = new CompoundCommand();
+ EditPart sourceEditPart = createConnectionViewAndElementRequest.getSourceEditPart();
+ EditPart targetEditPart = createConnectionViewAndElementRequest.getTargetEditPart();
+
+ // if the the source or the target is a node dependency the purpose is to create only one branch
+ if ((((View) sourceEditPart.getModel()).getType() == "" + Dependency2EditPart.VISUAL_ID) || (((View) targetEditPart.getModel()).getType() == "" + Dependency2EditPart.VISUAL_ID)) {
+ return getBranchDepencencyCommand(createConnectionViewAndElementRequest, command);
+ }
+
+ // the source or the target has to be different of a dependency branch
+ if ((((View) sourceEditPart.getModel()).getType() == "" + Dependency3EditPart.VISUAL_ID) || (((View) targetEditPart.getModel()).getType() == "" + Dependency3EditPart.VISUAL_ID)) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ // if not this a transformation of simple dependency to multiDependency
+ return getDependencyToMultiDependencyCommand(createConnectionViewAndElementRequest, command);
+ }
+
+ /**
+ * this method is used to create a branch of a dependency
+ *
+ * @param createConnectionViewAndElementRequest
+ * @param command
+ * the command that is used to create the link branch of a dependency
+ * @return the set of command to create a branch of a dependency
+ */
+ private Command getDependencyToMultiDependencyCommand(CreateConnectionViewAndElementRequest createConnectionViewAndElementRequest, Command command) {
+
+ // 0. creation of variables
+ command = new CompoundCommand();
+ Point sourceLocation = null;
+ Point targetLocation = null;
+ Point nodeLocation = null;
+ NamedElement newSemanticElement = null;// element that will be added as client ou supplier of the dependecy
+ EStructuralFeature feature = null; // role client or supplier
+ EditPart sourceEditPart = createConnectionViewAndElementRequest.getSourceEditPart();
+ EditPart targetEditPart = createConnectionViewAndElementRequest.getTargetEditPart();
+ View dependencyView = null;
+ Dependency dependency = null;
+ View parentView = null;
+
+ // 1. initialization
+ ICommandProxy startcommand = ((ICommandProxy) createConnectionViewAndElementRequest.getStartCommand());
+ Iterator<?> ite = ((CompositeCommand) startcommand.getICommand()).iterator();
+
+ while (ite.hasNext()) {
+ ICommand currentCommand = (ICommand) ite.next();
+ if (currentCommand instanceof SetConnectionBendpointsCommand) {
+ sourceLocation = ((SetConnectionBendpointsCommand) currentCommand).getSourceRefPoint();
+ targetLocation = ((SetConnectionBendpointsCommand) currentCommand).getTargetRefPoint();
+ }
+ }
+
+ if (targetEditPart != null) {
+ // the source or the target must be a dependency
+ // look for the redit part that represnet the editpart
+ if (((View) sourceEditPart.getModel()).getElement() != null && ((View) sourceEditPart.getModel()).getElement() instanceof Dependency) {
+ dependencyView = ((View) sourceEditPart.getModel());
+ dependency = (Dependency) ((View) sourceEditPart.getModel()).getElement();
+ nodeLocation = sourceLocation;
+ newSemanticElement = (NamedElement) ((View) targetEditPart.getModel()).getElement();
+ feature = UMLPackage.eINSTANCE.getDependency_Supplier();
+ }
+
+ if (((View) targetEditPart.getModel()).getElement() != null && ((View) targetEditPart.getModel()).getElement() instanceof Dependency) {
+ dependencyView = ((View) targetEditPart.getModel());
+ dependency = (Dependency) ((View) targetEditPart.getModel()).getElement();
+ nodeLocation = targetLocation;
+ newSemanticElement = (NamedElement) ((View) sourceEditPart.getModel()).getElement();
+ feature = UMLPackage.eINSTANCE.getDependency_Client();
+ }
+
+ if (dependencyView == null) {
+ return null;
+ }
+ parentView = (View) dependencyView.eContainer();
+ // 2. Remove the view of the dependency
+ View dependencyViewSource = ((Edge) dependencyView).getSource();
+ View dependencyViewTarget = ((Edge) dependencyView).getTarget();
+
+ ((CompoundCommand) command).add(new ICommandProxy(new DeleteCommand(getEditingDomain(), dependencyView)));
+
+ // 3. Node creation at this position
+ DependencyDiamonViewCreateCommand nodeCreation = new DependencyDiamonViewCreateCommand(getEditingDomain(), parentView, (EditPartViewer) sourceEditPart.getViewer(),
+ ((IGraphicalEditPart) sourceEditPart).getDiagramPreferencesHint(), nodeLocation, new SemanticAdapter(dependency, null));
+ ((CompoundCommand) command).add(new ICommandProxy(nodeCreation));
+
+ // 4. reconstruction of the old link by taking in account the old connection
+ ConnectionViewDescriptor viewDescriptor = new ConnectionViewDescriptor(UMLElementTypes.Dependency_4018, ((IHintedType) UMLElementTypes.Dependency_4018).getSemanticHint(),
+ ((IGraphicalEditPart) sourceEditPart).getDiagramPreferencesHint());
+
+ // 5. reconstruction of the first branch between old source to node
+ ICommand firstBranchCommand = new CustomDeferredCreateConnectionViewCommand(getEditingDomain(), ((IHintedType) UMLElementTypes.Dependency_4018).getSemanticHint(), new SemanticAdapter(
+ null, dependencyViewSource), (IAdaptable) nodeCreation.getCommandResult().getReturnValue(), sourceEditPart.getViewer(), ((IGraphicalEditPart) sourceEditPart)
+ .getDiagramPreferencesHint(), viewDescriptor, null);
+ ((CustomDeferredCreateConnectionViewCommand) firstBranchCommand).setElement(dependency);
+ ((CompoundCommand) command).add(new ICommandProxy(firstBranchCommand));
+
+ // 6. reconstruction of the second branch between node to old target
+ ICommand secondBranchCommand = new CustomDeferredCreateConnectionViewCommand(getEditingDomain(), ((IHintedType) UMLElementTypes.Dependency_4018).getSemanticHint(),
+ (IAdaptable) nodeCreation.getCommandResult().getReturnValue(), new SemanticAdapter(null, dependencyViewTarget), sourceEditPart.getViewer(), ((IGraphicalEditPart) sourceEditPart)
+ .getDiagramPreferencesHint(), viewDescriptor, null);
+ ((CustomDeferredCreateConnectionViewCommand) secondBranchCommand).setElement(dependency);
+ ((CompoundCommand) command).add(new ICommandProxy(secondBranchCommand));
+
+ // 7. Create of the third branch between node and target our source.
+ ICommand thirdBranchCommand = null;
+
+ if (dependencyView.equals(((View) sourceEditPart.getModel()))) {
+ // third branch node and target
+ thirdBranchCommand = new CustomDeferredCreateConnectionViewCommand(getEditingDomain(), ((IHintedType) UMLElementTypes.Dependency_4018).getSemanticHint(), (IAdaptable) nodeCreation
+ .getCommandResult().getReturnValue(), new SemanticAdapter(null, targetEditPart.getModel()), sourceEditPart.getViewer(), ((IGraphicalEditPart) sourceEditPart)
+ .getDiagramPreferencesHint(), viewDescriptor, null);
+ } else {
+ // // third branch source and node
+ thirdBranchCommand = new CustomDeferredCreateConnectionViewCommand(getEditingDomain(), ((IHintedType) UMLElementTypes.Dependency_4018).getSemanticHint(), new SemanticAdapter(null,
+ sourceEditPart.getModel()), (IAdaptable) nodeCreation.getCommandResult().getReturnValue(), sourceEditPart.getViewer(), ((IGraphicalEditPart) sourceEditPart)
+ .getDiagramPreferencesHint(), viewDescriptor, null);
+ }
+ ((CustomDeferredCreateConnectionViewCommand) thirdBranchCommand).setElement(dependency);
+ ((CompoundCommand) command).add(new ICommandProxy(thirdBranchCommand));
+
+ // 8. set thenew client or the new supplier
+ SetRequest setRequest = new SetRequest(dependency, feature, newSemanticElement);
+ SetValueCommand setValueCommand = new SetValueCommand(setRequest);
+ ((CompoundCommand) command).add(new ICommandProxy(setValueCommand));
+ return command;
+ }
+ return null;
+ }
+
+ /**
+ * used to obtain the transactional edit domain
+ *
+ * @return the current transactional edit domain1
+ */
+ private TransactionalEditingDomain getEditingDomain() {
+ return ((IGraphicalEditPart) getHost()).getEditingDomain();
+ }
+
+} \ No newline at end of file
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/providers/CustomUMLParserProvider.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/providers/CustomUMLParserProvider.java
new file mode 100644
index 00000000000..589c557543c
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/custom/providers/CustomUMLParserProvider.java
@@ -0,0 +1,424 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.custom.providers;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.papyrus.diagram.clazz.custom.parsers.AppliedStereotypeParser;
+import org.eclipse.papyrus.diagram.clazz.custom.parsers.CustomMessageFormatParser;
+import org.eclipse.papyrus.diagram.clazz.custom.parsers.OperationParser;
+import org.eclipse.papyrus.diagram.clazz.custom.parsers.PropertyParser;
+import org.eclipse.papyrus.diagram.clazz.parsers.MessageFormatParser;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * this class is used to overload specific parsers
+ *
+ * @author patrick Tessier
+ */
+public class CustomUMLParserProvider extends UMLParserProvider {
+
+ public CustomUMLParserProvider() {
+ super();
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createAbstractionName_6015Parser() {
+ IParser parser = new AppliedStereotypeParser();
+ return parser;
+ }
+
+ protected IParser createAssociationClassName_5065Parser() {
+ IParser parser = new AppliedStereotypeParser();
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createAssociationName_6001Parser() {
+ IParser parser = new AppliedStereotypeParser();
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createAssociationName_6002Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createAssociationName_6003Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ IParser parser = new CustomMessageFormatParser(features, UMLPackage.eINSTANCE.getAssociation_MemberEnd(), 0);
+ return parser;
+
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createAssociationName_6004Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getMultiplicityElement_Lower(), UMLPackage.eINSTANCE.getMultiplicityElement_Upper(), };
+ CustomMessageFormatParser parser = new CustomMessageFormatParser(features, UMLPackage.eINSTANCE.getAssociation_MemberEnd(), 0);
+ parser.setViewPattern("{0}..{1}");
+ parser.setEditorPattern("{0}..{1}");
+ parser.setEditPattern("{0}..{1}");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createAssociationName_6005Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getMultiplicityElement_Lower(), UMLPackage.eINSTANCE.getMultiplicityElement_Upper(), };
+ CustomMessageFormatParser parser = new CustomMessageFormatParser(features, UMLPackage.eINSTANCE.getAssociation_MemberEnd(), 1);
+ parser.setViewPattern("{0}..{1}");
+ parser.setEditorPattern("{0}..{1}");
+ parser.setEditPattern("{0}..{1}");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createAssociationName_6006Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ IParser parser = new CustomMessageFormatParser(features, UMLPackage.eINSTANCE.getAssociation_MemberEnd(), 1);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createClassName_5013Parser() {
+ IParser parser = new AppliedStereotypeParser();
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createClassName_5028Parser() {
+ IParser parser = new AppliedStereotypeParser();
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createComponentName_5004Parser() {
+ IParser parser = new AppliedStereotypeParser();
+ return parser;
+ }
+
+ protected IParser createComponentName_5042Parser() {
+ IParser parser = new AppliedStereotypeParser();
+ return parser;
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ protected IParser createCustomPropertyParser() {
+ return new PropertyParser();
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createDataTypeName_5034Parser() {
+ IParser parser = new AppliedStereotypeParser();
+ return parser;
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ protected IParser createDataTypeName_5060Parser() {
+ IParser parser = new AppliedStereotypeParser();
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createDataTypeQualifiedName_5036Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_QualifiedName(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("({0})");
+ parser.setEditorPattern("({0})");
+ parser.setEditPattern("({0})");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createDependencyName_6027Parser() {
+ IParser parser = new AppliedStereotypeParser();
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createElementImportAlias_6021Parser() {
+ IParser parser = new AppliedStereotypeParser();
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createEnumerationName_5022Parser() {
+ IParser parser = new AppliedStereotypeParser();
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createEnumerationName_5054Parser() {
+ IParser parser = new AppliedStereotypeParser();
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createGeneralizationIsSubstitutable_6007Parser() {
+ IParser parser = new AppliedStereotypeParser();
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createInstanceSpecificationName_5001Parser() {
+ IParser parser = new AppliedStereotypeParser();
+ return parser;
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ protected IParser createInstanceSpecificationName_5039Parser() {
+ IParser parser = new AppliedStereotypeParser();
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createInterfaceName_5010Parser() {
+ IParser parser = new AppliedStereotypeParser();
+ return parser;
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ protected IParser createInterfaceName_5048Parser() {
+ IParser parser = new AppliedStereotypeParser();
+ return parser;
+
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createInterfaceRealizationName_6008Parser() {
+ IParser parser = new AppliedStereotypeParser();
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createModelName_5019Parser() {
+ IParser parser = new AppliedStereotypeParser();
+ return parser;
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ protected IParser createModelName_5051Parser() {
+ IParser parser = new AppliedStereotypeParser();
+ return parser;
+
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createOperation_3003Parser() {
+ return createOperationParser();
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createOperation_3007Parser() {
+ return createOperationParser();
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createOperation_3013Parser() {
+ return createOperationParser();
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createOperation_3019Parser() {
+ return createOperationParser();
+ }
+
+ private IParser createOperationParser() {
+ OperationParser operationParser = new OperationParser();
+ return operationParser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createPackageImportVisibility_6022Parser() {
+ IParser parser = new AppliedStereotypeParser();
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createPackageName_5016Parser() {
+ IParser parser = new AppliedStereotypeParser();
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createPackageName_5025Parser() {
+ IParser parser = new AppliedStereotypeParser();
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createPrimitiveTypeName_5031Parser() {
+ IParser parser = new AppliedStereotypeParser();
+ return parser;
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ protected IParser createPrimitiveTypeName_5057Parser() {
+ IParser parser = new AppliedStereotypeParser();
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createProperty_3002Parser() {
+ return createCustomPropertyParser();
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createProperty_3005Parser() {
+ return createCustomPropertyParser();
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createProperty_3006Parser() {
+ return createCustomPropertyParser();
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createProperty_3012Parser() {
+ return createCustomPropertyParser();
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createProperty_3018Parser() {
+ return createCustomPropertyParser();
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createRealizationName_6012Parser() {
+ IParser parser = new AppliedStereotypeParser();
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createSignalName_5007Parser() {
+ IParser parser = new AppliedStereotypeParser();
+ return parser;
+ }
+
+ protected IParser createSignalName_5045Parser() {
+ IParser parser = new AppliedStereotypeParser();
+ return parser;
+
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createSubstitutionName_6010Parser() {
+ IParser parser = new AppliedStereotypeParser();
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createUsageName_6017Parser() {
+ IParser parser = new AppliedStereotypeParser();
+ return parser;
+ }
+
+} \ No newline at end of file
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/AbstractionCreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/AbstractionCreateCommand.java
new file mode 100644
index 00000000000..d9c4f0bf1e2
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/AbstractionCreateCommand.java
@@ -0,0 +1,165 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.Abstraction;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class AbstractionCreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ private final EObject source;
+
+ /**
+ * @generated
+ */
+ private final EObject target;
+
+ /**
+ * @generated
+ */
+ private Package container;
+
+ /**
+ * @generated
+ */
+ public AbstractionCreateCommand(CreateRelationshipRequest request, EObject source, EObject target) {
+ super(request);
+ this.source = source;
+ this.target = target;
+ if (request.getContainmentFeature() == null) {
+ setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+
+ // Find container element for the new link.
+ // Climb up by containment hierarchy starting from the source
+ // and return the first element that is instance of the container class.
+ for (EObject element = source; element != null; element = element.eContainer()) {
+ if (element instanceof Package) {
+ container = (Package) element;
+ super.setElementToEdit(container);
+ break;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (source == null && target == null) {
+ return false;
+ }
+ if (source != null && false == source instanceof NamedElement) {
+ return false;
+ }
+ if (target != null && false == target instanceof NamedElement) {
+ return false;
+ }
+ if (getSource() == null) {
+ return true; // link creation is in progress; source is not defined yet
+ }
+ // target may be null here but it's possible to check constraint
+ if (getContainer() == null) {
+ return false;
+ }
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canCreateAbstraction_4006(getContainer(), getSource(), getTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ Abstraction newElement = UMLFactory.eINSTANCE.createAbstraction();
+ getContainer().getPackagedElements().add(newElement);
+ newElement.getClients().add(getSource());
+ newElement.getSuppliers().add(getTarget());
+ UMLElementTypes.init_Abstraction_4006(newElement);
+ return newElement;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getPackage();
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
+ }
+ return super.doExecuteWithResult(monitor, info);
+ }
+
+ /**
+ * @generated
+ */
+ protected ConfigureRequest createConfigureRequest() {
+ ConfigureRequest request = super.createConfigureRequest();
+ request.setParameter(CreateRelationshipRequest.SOURCE, getSource());
+ request.setParameter(CreateRelationshipRequest.TARGET, getTarget());
+ return request;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setElementToEdit(EObject element) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @generated
+ */
+ protected NamedElement getSource() {
+ return (NamedElement) source;
+ }
+
+ /**
+ * @generated
+ */
+ protected NamedElement getTarget() {
+ return (NamedElement) target;
+ }
+
+ /**
+ * @generated
+ */
+ public Package getContainer() {
+ return container;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/AbstractionReorientCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/AbstractionReorientCommand.java
new file mode 100644
index 00000000000..99c301e96cd
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/AbstractionReorientCommand.java
@@ -0,0 +1,178 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.uml2.uml.Abstraction;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.Package;
+
+/**
+ * @generated
+ */
+public class AbstractionReorientCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private final int reorientDirection;
+
+ /**
+ * @generated
+ */
+ private final EObject oldEnd;
+
+ /**
+ * @generated
+ */
+ private final EObject newEnd;
+
+ /**
+ * @generated
+ */
+ public AbstractionReorientCommand(ReorientRelationshipRequest request) {
+ super(request.getLabel(), request.getRelationship(), request);
+ reorientDirection = request.getDirection();
+ oldEnd = request.getOldRelationshipEnd();
+ newEnd = request.getNewRelationshipEnd();
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (false == getElementToEdit() instanceof Abstraction) {
+ return false;
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return canReorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
+ return canReorientTarget();
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientSource() {
+ if (!(oldEnd instanceof NamedElement && newEnd instanceof NamedElement)) {
+ return false;
+ }
+ if (getLink().getSuppliers().size() != 1) {
+ return false;
+ }
+ NamedElement target = (NamedElement) getLink().getSuppliers().get(0);
+ if (!(getLink().eContainer() instanceof Package)) {
+ return false;
+ }
+ Package container = (Package) getLink().eContainer();
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canExistAbstraction_4006(container, getNewSource(), target);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientTarget() {
+ if (!(oldEnd instanceof NamedElement && newEnd instanceof NamedElement)) {
+ return false;
+ }
+ if (getLink().getClients().size() != 1) {
+ return false;
+ }
+ NamedElement source = (NamedElement) getLink().getClients().get(0);
+ if (!(getLink().eContainer() instanceof Package)) {
+ return false;
+ }
+ Package container = (Package) getLink().eContainer();
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canExistAbstraction_4006(container, source, getNewTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in reorient link command"); //$NON-NLS-1$
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return reorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
+ return reorientTarget();
+ }
+ throw new IllegalStateException();
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientSource() throws ExecutionException {
+ getLink().getClients().remove(getOldSource());
+ getLink().getClients().add(getNewSource());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientTarget() throws ExecutionException {
+ getLink().getSuppliers().remove(getOldTarget());
+ getLink().getSuppliers().add(getNewTarget());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ /**
+ * @generated
+ */
+ protected Abstraction getLink() {
+ return (Abstraction) getElementToEdit();
+ }
+
+ /**
+ * @generated
+ */
+ protected NamedElement getOldSource() {
+ return (NamedElement) oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected NamedElement getNewSource() {
+ return (NamedElement) newEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected NamedElement getOldTarget() {
+ return (NamedElement) oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected NamedElement getNewTarget() {
+ return (NamedElement) newEnd;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Association2CreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Association2CreateCommand.java
new file mode 100644
index 00000000000..dd76519e94b
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Association2CreateCommand.java
@@ -0,0 +1,40 @@
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class Association2CreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public Association2CreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getPackage();
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Association2ReorientCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Association2ReorientCommand.java
new file mode 100644
index 00000000000..ad1e90edfab
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Association2ReorientCommand.java
@@ -0,0 +1,165 @@
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.uml2.uml.Association;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.Type;
+
+/**
+ * @generated
+ */
+public class Association2ReorientCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private final int reorientDirection;
+
+ /**
+ * @generated
+ */
+ private final EObject oldEnd;
+
+ /**
+ * @generated
+ */
+ private final EObject newEnd;
+
+ /**
+ * @generated
+ */
+ public Association2ReorientCommand(ReorientRelationshipRequest request) {
+ super(request.getLabel(), request.getRelationship(), request);
+ reorientDirection = request.getDirection();
+ oldEnd = request.getOldRelationshipEnd();
+ newEnd = request.getNewRelationshipEnd();
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (false == getElementToEdit() instanceof Association) {
+ return false;
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return canReorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
+ return canReorientTarget();
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientSource() {
+ if (!(oldEnd instanceof Type && newEnd instanceof Type)) {
+ return false;
+ }
+ if (getLink().getEndTypes().size() != 1) {
+ return false;
+ }
+ Type target = (Type) getLink().getEndTypes().get(0);
+ if (!(getLink().eContainer() instanceof Package)) {
+ return false;
+ }
+ Package container = (Package) getLink().eContainer();
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canExistAssociation_4019(container, getNewSource(), target);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientTarget() {
+ if (!(oldEnd instanceof Type && newEnd instanceof Type)) {
+ return false;
+ }
+ if (getLink().getEndTypes().size() != 1) {
+ return false;
+ }
+ Type source = (Type) getLink().getEndTypes().get(0);
+ if (!(getLink().eContainer() instanceof Package)) {
+ return false;
+ }
+ Package container = (Package) getLink().eContainer();
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canExistAssociation_4019(container, source, getNewTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in reorient link command"); //$NON-NLS-1$
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return reorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
+ return reorientTarget();
+ }
+ throw new IllegalStateException();
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientSource() throws ExecutionException {
+ getLink().getEndTypes().remove(getOldSource());
+ getLink().getEndTypes().add(getNewSource());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientTarget() throws ExecutionException {
+ getLink().getEndTypes().remove(getOldTarget());
+ getLink().getEndTypes().add(getNewTarget());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ /**
+ * @generated
+ */
+ protected Association getLink() {
+ return (Association) getElementToEdit();
+ }
+
+ /**
+ * @generated
+ */
+ protected Type getOldSource() {
+ return (Type) oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected Type getNewSource() {
+ return (Type) newEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected Type getOldTarget() {
+ return (Type) oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected Type getNewTarget() {
+ return (Type) newEnd;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Association3CreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Association3CreateCommand.java
new file mode 100644
index 00000000000..f988ef9bf7a
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Association3CreateCommand.java
@@ -0,0 +1,150 @@
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.uml2.uml.Association;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.Type;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class Association3CreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ private final EObject source;
+
+ /**
+ * @generated
+ */
+ private final EObject target;
+
+ /**
+ * @generated
+ */
+ private Package container;
+
+ /**
+ * @generated
+ */
+ public Association3CreateCommand(CreateRelationshipRequest request, EObject source, EObject target) {
+ super(request);
+ this.source = source;
+ this.target = target;
+ if (request.getContainmentFeature() == null) {
+ setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+
+ // Find container element for the new link.
+ // Climb up by containment hierarchy starting from the source
+ // and return the first element that is instance of the container class.
+ for (EObject element = source; element != null; element = element.eContainer()) {
+ if (element instanceof Package) {
+ container = (Package) element;
+ super.setElementToEdit(container);
+ break;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (source == null && target == null) {
+ return false;
+ }
+ if (source != null && false == source instanceof Type) {
+ return false;
+ }
+ if (target != null && false == target instanceof Type) {
+ return false;
+ }
+ if (getSource() == null) {
+ return true; // link creation is in progress; source is not defined yet
+ }
+ // target may be null here but it's possible to check constraint
+ if (getContainer() == null) {
+ return false;
+ }
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canCreateAssociation_4019(getContainer(), getSource(), getTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ Association newElement = UMLFactory.eINSTANCE.createAssociation();
+ getContainer().getPackagedElements().add(newElement);
+ newElement.getEndTypes().add(getSource());
+ newElement.getEndTypes().add(getTarget());
+ return newElement;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getPackage();
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
+ }
+ return super.doExecuteWithResult(monitor, info);
+ }
+
+ /**
+ * @generated
+ */
+ protected ConfigureRequest createConfigureRequest() {
+ ConfigureRequest request = super.createConfigureRequest();
+ request.setParameter(CreateRelationshipRequest.SOURCE, getSource());
+ request.setParameter(CreateRelationshipRequest.TARGET, getTarget());
+ return request;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setElementToEdit(EObject element) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @generated
+ */
+ protected Type getSource() {
+ return (Type) source;
+ }
+
+ /**
+ * @generated
+ */
+ protected Type getTarget() {
+ return (Type) target;
+ }
+
+ /**
+ * @generated
+ */
+ public Package getContainer() {
+ return container;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/AssociationClass2CreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/AssociationClass2CreateCommand.java
new file mode 100644
index 00000000000..054a41094a5
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/AssociationClass2CreateCommand.java
@@ -0,0 +1,167 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.custom.command.CreateAssociationClassSupplement;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.AssociationClass;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.Type;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+// EDGE
+public class AssociationClass2CreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ private Package container;
+
+ /**
+ * @generated
+ */
+ private final EObject source;
+
+ /**
+ * @generated
+ */
+ private final EObject target;
+
+ /**
+ * @generated
+ */
+ public AssociationClass2CreateCommand(CreateRelationshipRequest request, EObject source, EObject target) {
+ super(request);
+ this.source = source;
+ this.target = target;
+ if (request.getContainmentFeature() == null) {
+ setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+
+ // Find container element for the new link.
+ // Climb up by containment hierarchy starting from the source
+ // and return the first element that is instance of the container class.
+ for (EObject element = source; element != null; element = element.eContainer()) {
+ if (element instanceof Package) {
+ container = (Package) element;
+ super.setElementToEdit(container);
+ break;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (source == null && target == null) {
+ return false;
+ }
+ if (source != null && false == source instanceof Type) {
+ return false;
+ }
+ if (target != null && false == target instanceof Type) {
+ return false;
+ }
+ if (getSource() == null) {
+ return true; // link creation is in progress; source is not defined yet
+ }
+ // target may be null here but it's possible to check constraint
+ if (getContainer() == null) {
+ return false;
+ }
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canCreateAssociationClass_4017(getContainer(), getSource(), getTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected ConfigureRequest createConfigureRequest() {
+ ConfigureRequest request = super.createConfigureRequest();
+ request.setParameter(CreateRelationshipRequest.SOURCE, getSource());
+ request.setParameter(CreateRelationshipRequest.TARGET, getTarget());
+ return request;
+ }
+
+ /**
+ * @generated-not
+ */
+ protected EObject doDefaultElementCreation() {
+ CreateAssociationClassSupplement associationClassSupplement = new CreateAssociationClassSupplement(getContainer(), getSource(), getTarget());
+ associationClassSupplement.setRequest((CreateRelationshipRequest) getRequest());
+ AssociationClass newElement = (AssociationClass) associationClassSupplement.doDefaultElementCreation(getEditingDomain(), null);
+
+ UMLElementTypes.init_AssociationClass_4017(newElement);
+ return newElement;
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
+ }
+ return super.doExecuteWithResult(monitor, info);
+ }
+
+ /**
+ * @generated
+ */
+ public Package getContainer() {
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getPackage();
+ }
+
+ /**
+ * @generated
+ */
+ protected Type getSource() {
+ return (Type) source;
+ }
+
+ /**
+ * @generated
+ */
+ protected Type getTarget() {
+ return (Type) target;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setElementToEdit(EObject element) {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/AssociationClassCreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/AssociationClassCreateCommand.java
new file mode 100644
index 00000000000..ee16ba68b7f
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/AssociationClassCreateCommand.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.AssociationClass;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class AssociationClassCreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public AssociationClassCreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ AssociationClass newElement = UMLFactory.eINSTANCE.createAssociationClass();
+
+ Package owner = (Package) getElementToEdit();
+ owner.getPackagedElements().add(newElement);
+
+ UMLElementTypes.init_AssociationClass_2013(newElement);
+ return newElement;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getPackage();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/AssociationClassReorientCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/AssociationClassReorientCommand.java
new file mode 100644
index 00000000000..530e4e4fe78
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/AssociationClassReorientCommand.java
@@ -0,0 +1,178 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.uml2.uml.AssociationClass;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.Type;
+
+/**
+ * @generated
+ */
+public class AssociationClassReorientCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private final int reorientDirection;
+
+ /**
+ * @generated
+ */
+ private final EObject oldEnd;
+
+ /**
+ * @generated
+ */
+ private final EObject newEnd;
+
+ /**
+ * @generated
+ */
+ public AssociationClassReorientCommand(ReorientRelationshipRequest request) {
+ super(request.getLabel(), request.getRelationship(), request);
+ reorientDirection = request.getDirection();
+ oldEnd = request.getOldRelationshipEnd();
+ newEnd = request.getNewRelationshipEnd();
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (false == getElementToEdit() instanceof AssociationClass) {
+ return false;
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return canReorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
+ return canReorientTarget();
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientSource() {
+ if (!(oldEnd instanceof Type && newEnd instanceof Type)) {
+ return false;
+ }
+ if (getLink().getEndTypes().size() != 1) {
+ return false;
+ }
+ Type target = (Type) getLink().getEndTypes().get(0);
+ if (!(getLink().eContainer() instanceof Package)) {
+ return false;
+ }
+ Package container = (Package) getLink().eContainer();
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canExistAssociationClass_4017(container, getNewSource(), target);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientTarget() {
+ if (!(oldEnd instanceof Type && newEnd instanceof Type)) {
+ return false;
+ }
+ if (getLink().getEndTypes().size() != 1) {
+ return false;
+ }
+ Type source = (Type) getLink().getEndTypes().get(0);
+ if (!(getLink().eContainer() instanceof Package)) {
+ return false;
+ }
+ Package container = (Package) getLink().eContainer();
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canExistAssociationClass_4017(container, source, getNewTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in reorient link command"); //$NON-NLS-1$
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return reorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
+ return reorientTarget();
+ }
+ throw new IllegalStateException();
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientSource() throws ExecutionException {
+ getLink().getEndTypes().remove(getOldSource());
+ getLink().getEndTypes().add(getNewSource());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientTarget() throws ExecutionException {
+ getLink().getEndTypes().remove(getOldTarget());
+ getLink().getEndTypes().add(getNewTarget());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ /**
+ * @generated
+ */
+ protected AssociationClass getLink() {
+ return (AssociationClass) getElementToEdit();
+ }
+
+ /**
+ * @generated
+ */
+ protected Type getOldSource() {
+ return (Type) oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected Type getNewSource() {
+ return (Type) newEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected Type getOldTarget() {
+ return (Type) oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected Type getNewTarget() {
+ return (Type) newEnd;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/AssociationCreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/AssociationCreateCommand.java
new file mode 100644
index 00000000000..0804fba637c
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/AssociationCreateCommand.java
@@ -0,0 +1,164 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.custom.command.CreateAssociationSupplement;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.Association;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.Type;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class AssociationCreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ private Package container;
+
+ /**
+ * @generated
+ */
+ private final EObject source;
+
+ /**
+ * @generated
+ */
+ private final EObject target;
+
+ /**
+ * @generated
+ */
+ public AssociationCreateCommand(CreateRelationshipRequest request, EObject source, EObject target) {
+ super(request);
+ this.source = source;
+ this.target = target;
+ if (request.getContainmentFeature() == null) {
+ setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+
+ // Find container element for the new link.
+ // Climb up by containment hierarchy starting from the source
+ // and return the first element that is instance of the container class.
+ for (EObject element = source; element != null; element = element.eContainer()) {
+ if (element instanceof Package) {
+ container = (Package) element;
+ super.setElementToEdit(container);
+ break;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (source == null && target == null) {
+ return false;
+ }
+ if (source != null && false == source instanceof Type) {
+ return false;
+ }
+ if (target != null && false == target instanceof Type) {
+ return false;
+ }
+ if (getSource() == null) {
+ return true; // link creation is in progress; source is not defined yet
+ }
+ // target may be null here but it's possible to check constraint
+ if (getContainer() == null) {
+ return false;
+ }
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canCreateAssociation_4001(getContainer(), getSource(), getTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected ConfigureRequest createConfigureRequest() {
+ ConfigureRequest request = super.createConfigureRequest();
+ request.setParameter(CreateRelationshipRequest.SOURCE, getSource());
+ request.setParameter(CreateRelationshipRequest.TARGET, getTarget());
+ return request;
+ }
+
+ /**
+ * @generated-not
+ */
+ protected EObject doDefaultElementCreation() {
+ CreateAssociationSupplement associationSupplement = new CreateAssociationSupplement(getContainer(), getSource(), getTarget());
+ Association newElement = (Association) associationSupplement.doDefaultElementCreation(getEditingDomain(), null);
+ UMLElementTypes.init_Association_4001(newElement);
+ return newElement;
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
+ }
+ return super.doExecuteWithResult(monitor, info);
+ }
+
+ /**
+ * @generated
+ */
+ public Package getContainer() {
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getPackage();
+ }
+
+ /**
+ * @generated
+ */
+ protected Type getSource() {
+ return (Type) source;
+ }
+
+ /**
+ * @generated
+ */
+ protected Type getTarget() {
+ return (Type) target;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setElementToEdit(EObject element) {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/AssociationReorientCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/AssociationReorientCommand.java
new file mode 100644
index 00000000000..4d8f0c37a25
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/AssociationReorientCommand.java
@@ -0,0 +1,179 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.uml2.uml.Association;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.StructuredClassifier;
+import org.eclipse.uml2.uml.Type;
+
+/**
+ * @generated
+ */
+public class AssociationReorientCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private final EObject newEnd;
+
+ /**
+ * @generated
+ */
+ private final EObject oldEnd;
+
+ /**
+ * @generated
+ */
+ private final int reorientDirection;
+
+ /**
+ * @generated
+ */
+ public AssociationReorientCommand(ReorientRelationshipRequest request) {
+ super(request.getLabel(), request.getRelationship(), request);
+ reorientDirection = request.getDirection();
+ oldEnd = request.getOldRelationshipEnd();
+ newEnd = request.getNewRelationshipEnd();
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (false == getElementToEdit() instanceof Association) {
+ return false;
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return canReorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
+ return canReorientTarget();
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientSource() {
+ if (!(oldEnd instanceof Type && newEnd instanceof Type)) {
+ return false;
+ }
+ if (getLink().getEndTypes().size() != 1) {
+ return false;
+ }
+ Type target = (Type) getLink().getEndTypes().get(0);
+ if (!(getLink().eContainer() instanceof Package)) {
+ return false;
+ }
+ Package container = (Package) getLink().eContainer();
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canExistAssociation_4001(container, getNewSource(), target);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientTarget() {
+ if (!(oldEnd instanceof Type && newEnd instanceof Type)) {
+ return false;
+ }
+ if (getLink().getEndTypes().size() != 1) {
+ return false;
+ }
+ Type source = (Type) getLink().getEndTypes().get(0);
+ if (!(getLink().eContainer() instanceof Package)) {
+ return false;
+ }
+ Package container = (Package) getLink().eContainer();
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canExistAssociation_4001(container, source, getNewTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in reorient link command"); //$NON-NLS-1$
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return reorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
+ return reorientTarget();
+ }
+ throw new IllegalStateException();
+ }
+
+ /**
+ * @generated
+ */
+ protected Association getLink() {
+ return (Association) getElementToEdit();
+ }
+
+ /**
+ * @generated
+ */
+ protected Type getNewSource() {
+ return (Type) newEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected Type getNewTarget() {
+ return (Type) newEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected Type getOldSource() {
+ return (Type) oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected Type getOldTarget() {
+ return (Type) oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientSource() throws ExecutionException {
+ getLink().getEndTypes().remove(getOldSource());
+ getLink().getEndTypes().add(getNewSource());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientTarget() throws ExecutionException {
+ getLink().getEndTypes().remove(getOldTarget());
+ getLink().getEndTypes().add(getNewTarget());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Class2CreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Class2CreateCommand.java
new file mode 100644
index 00000000000..b215ca02bbe
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Class2CreateCommand.java
@@ -0,0 +1,69 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class Class2CreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public Class2CreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getClass_();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ Class newElement = UMLFactory.eINSTANCE.createClass();
+
+ Class owner = (Class) getElementToEdit();
+ owner.getNestedClassifiers().add(newElement);
+
+ UMLElementTypes.init_Class_3004(newElement);
+ return newElement;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Class3CreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Class3CreateCommand.java
new file mode 100644
index 00000000000..fc84021fcad
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Class3CreateCommand.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Interface;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class Class3CreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public Class3CreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getInterface();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ Class newElement = UMLFactory.eINSTANCE.createClass();
+
+ Interface owner = (Interface) getElementToEdit();
+ owner.getNestedClassifiers().add(newElement);
+
+ UMLElementTypes.init_Class_3008(newElement);
+ return newElement;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Class4CreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Class4CreateCommand.java
new file mode 100644
index 00000000000..9aad609e69c
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Class4CreateCommand.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class Class4CreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public Class4CreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getPackage();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ Class newElement = UMLFactory.eINSTANCE.createClass();
+
+ Package owner = (Package) getElementToEdit();
+ owner.getPackagedElements().add(newElement);
+
+ UMLElementTypes.init_Class_3010(newElement);
+ return newElement;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Class5CreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Class5CreateCommand.java
new file mode 100644
index 00000000000..486baa12905
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Class5CreateCommand.java
@@ -0,0 +1,69 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class Class5CreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public Class5CreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getClass_();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ Class newElement = UMLFactory.eINSTANCE.createClass();
+
+ Class owner = (Class) getElementToEdit();
+ owner.getNestedClassifiers().add(newElement);
+
+ UMLElementTypes.init_Class_3014(newElement);
+ return newElement;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/ClassCreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/ClassCreateCommand.java
new file mode 100644
index 00000000000..1309f0b6a3a
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/ClassCreateCommand.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class ClassCreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public ClassCreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getPackage();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ Class newElement = UMLFactory.eINSTANCE.createClass();
+
+ Package owner = (Package) getElementToEdit();
+ owner.getPackagedElements().add(newElement);
+
+ UMLElementTypes.init_Class_2008(newElement);
+ return newElement;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Comment2CreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Comment2CreateCommand.java
new file mode 100644
index 00000000000..572bde1bca1
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Comment2CreateCommand.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.Comment;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class Comment2CreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public Comment2CreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ Comment newElement = UMLFactory.eINSTANCE.createComment();
+
+ Element owner = (Element) getElementToEdit();
+ owner.getOwnedComments().add(newElement);
+
+ UMLElementTypes.init_Comment_3028(newElement);
+ return newElement;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/CommentAnnotatedElementCreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/CommentAnnotatedElementCreateCommand.java
new file mode 100644
index 00000000000..973e1707862
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/CommentAnnotatedElementCreateCommand.java
@@ -0,0 +1,97 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.uml2.uml.Comment;
+import org.eclipse.uml2.uml.Element;
+
+/**
+ * @generated
+ */
+public class CommentAnnotatedElementCreateCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private final EObject source;
+
+ /**
+ * @generated
+ */
+ private final EObject target;
+
+ /**
+ * @generated
+ */
+ public CommentAnnotatedElementCreateCommand(CreateRelationshipRequest request, EObject source, EObject target) {
+ super(request.getLabel(), null, request);
+ this.source = source;
+ this.target = target;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (source == null && target == null) {
+ return false;
+ }
+ if (source != null && false == source instanceof Comment) {
+ return false;
+ }
+ if (target != null && false == target instanceof Element) {
+ return false;
+ }
+ if (getSource() == null) {
+ return true; // link creation is in progress; source is not defined yet
+ }
+ // target may be null here but it's possible to check constraint
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canCreateCommentAnnotatedElement_4013(getSource(), getTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
+ }
+ if (getSource() != null && getTarget() != null) {
+ getSource().getAnnotatedElements().add(getTarget());
+ }
+ return CommandResult.newOKCommandResult();
+ }
+
+ /**
+ * @generated
+ */
+ protected Comment getSource() {
+ return (Comment) source;
+ }
+
+ /**
+ * @generated
+ */
+ protected Element getTarget() {
+ return (Element) target;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/CommentAnnotatedElementReorientCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/CommentAnnotatedElementReorientCommand.java
new file mode 100644
index 00000000000..30748e2c5f6
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/CommentAnnotatedElementReorientCommand.java
@@ -0,0 +1,161 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.uml2.uml.Comment;
+import org.eclipse.uml2.uml.Element;
+
+/**
+ * @generated
+ */
+public class CommentAnnotatedElementReorientCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private final int reorientDirection;
+
+ /**
+ * @generated
+ */
+ private final EObject referenceOwner;
+
+ /**
+ * @generated
+ */
+ private final EObject oldEnd;
+
+ /**
+ * @generated
+ */
+ private final EObject newEnd;
+
+ /**
+ * @generated
+ */
+ public CommentAnnotatedElementReorientCommand(ReorientReferenceRelationshipRequest request) {
+ super(request.getLabel(), null, request);
+ reorientDirection = request.getDirection();
+ referenceOwner = request.getReferenceOwner();
+ oldEnd = request.getOldRelationshipEnd();
+ newEnd = request.getNewRelationshipEnd();
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (false == referenceOwner instanceof Comment) {
+ return false;
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return canReorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
+ return canReorientTarget();
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientSource() {
+ if (!(oldEnd instanceof Element && newEnd instanceof Comment)) {
+ return false;
+ }
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canExistCommentAnnotatedElement_4013(getNewSource(), getOldTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientTarget() {
+ if (!(oldEnd instanceof Element && newEnd instanceof Element)) {
+ return false;
+ }
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canExistCommentAnnotatedElement_4013(getOldSource(), getNewTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in reorient link command"); //$NON-NLS-1$
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return reorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
+ return reorientTarget();
+ }
+ throw new IllegalStateException();
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientSource() throws ExecutionException {
+ getOldSource().getAnnotatedElements().remove(getOldTarget());
+ getNewSource().getAnnotatedElements().add(getOldTarget());
+ return CommandResult.newOKCommandResult(referenceOwner);
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientTarget() throws ExecutionException {
+ getOldSource().getAnnotatedElements().remove(getOldTarget());
+ getOldSource().getAnnotatedElements().add(getNewTarget());
+ return CommandResult.newOKCommandResult(referenceOwner);
+ }
+
+ /**
+ * @generated
+ */
+ protected Comment getOldSource() {
+ return (Comment) referenceOwner;
+ }
+
+ /**
+ * @generated
+ */
+ protected Comment getNewSource() {
+ return (Comment) newEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected Element getOldTarget() {
+ return (Element) oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected Element getNewTarget() {
+ return (Element) newEnd;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/CommentCreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/CommentCreateCommand.java
new file mode 100644
index 00000000000..d7409e48aea
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/CommentCreateCommand.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.Comment;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class CommentCreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public CommentCreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ Comment newElement = UMLFactory.eINSTANCE.createComment();
+
+ Element owner = (Element) getElementToEdit();
+ owner.getOwnedComments().add(newElement);
+
+ UMLElementTypes.init_Comment_2012(newElement);
+ return newElement;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Component2CreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Component2CreateCommand.java
new file mode 100644
index 00000000000..871663622d1
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Component2CreateCommand.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.Component;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class Component2CreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public Component2CreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getPackage();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ Component newElement = UMLFactory.eINSTANCE.createComponent();
+
+ Package owner = (Package) getElementToEdit();
+ owner.getPackagedElements().add(newElement);
+
+ UMLElementTypes.init_Component_3021(newElement);
+ return newElement;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/ComponentCreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/ComponentCreateCommand.java
new file mode 100644
index 00000000000..d7453c81aa2
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/ComponentCreateCommand.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.Component;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class ComponentCreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public ComponentCreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getPackage();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ Component newElement = UMLFactory.eINSTANCE.createComponent();
+
+ Package owner = (Package) getElementToEdit();
+ owner.getPackagedElements().add(newElement);
+
+ UMLElementTypes.init_Component_2002(newElement);
+ return newElement;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Constraint2CreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Constraint2CreateCommand.java
new file mode 100644
index 00000000000..ab7cab9fa28
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Constraint2CreateCommand.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.Constraint;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class Constraint2CreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public Constraint2CreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getPackage();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ Constraint newElement = UMLFactory.eINSTANCE.createConstraint();
+
+ Package owner = (Package) getElementToEdit();
+ owner.getPackagedElements().add(newElement);
+
+ UMLElementTypes.init_Constraint_3029(newElement);
+ return newElement;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/ConstraintConstrainedElementCreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/ConstraintConstrainedElementCreateCommand.java
new file mode 100644
index 00000000000..e85cf5a0cfd
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/ConstraintConstrainedElementCreateCommand.java
@@ -0,0 +1,97 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.uml2.uml.Constraint;
+import org.eclipse.uml2.uml.Element;
+
+/**
+ * @generated
+ */
+public class ConstraintConstrainedElementCreateCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private final EObject source;
+
+ /**
+ * @generated
+ */
+ private final EObject target;
+
+ /**
+ * @generated
+ */
+ public ConstraintConstrainedElementCreateCommand(CreateRelationshipRequest request, EObject source, EObject target) {
+ super(request.getLabel(), null, request);
+ this.source = source;
+ this.target = target;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (source == null && target == null) {
+ return false;
+ }
+ if (source != null && false == source instanceof Constraint) {
+ return false;
+ }
+ if (target != null && false == target instanceof Element) {
+ return false;
+ }
+ if (getSource() == null) {
+ return true; // link creation is in progress; source is not defined yet
+ }
+ // target may be null here but it's possible to check constraint
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canCreateConstraintConstrainedElement_4014(getSource(), getTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
+ }
+ if (getSource() != null && getTarget() != null) {
+ getSource().getConstrainedElements().add(getTarget());
+ }
+ return CommandResult.newOKCommandResult();
+ }
+
+ /**
+ * @generated
+ */
+ protected Constraint getSource() {
+ return (Constraint) source;
+ }
+
+ /**
+ * @generated
+ */
+ protected Element getTarget() {
+ return (Element) target;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/ConstraintConstrainedElementReorientCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/ConstraintConstrainedElementReorientCommand.java
new file mode 100644
index 00000000000..d543b88f259
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/ConstraintConstrainedElementReorientCommand.java
@@ -0,0 +1,161 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.uml2.uml.Constraint;
+import org.eclipse.uml2.uml.Element;
+
+/**
+ * @generated
+ */
+public class ConstraintConstrainedElementReorientCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private final int reorientDirection;
+
+ /**
+ * @generated
+ */
+ private final EObject referenceOwner;
+
+ /**
+ * @generated
+ */
+ private final EObject oldEnd;
+
+ /**
+ * @generated
+ */
+ private final EObject newEnd;
+
+ /**
+ * @generated
+ */
+ public ConstraintConstrainedElementReorientCommand(ReorientReferenceRelationshipRequest request) {
+ super(request.getLabel(), null, request);
+ reorientDirection = request.getDirection();
+ referenceOwner = request.getReferenceOwner();
+ oldEnd = request.getOldRelationshipEnd();
+ newEnd = request.getNewRelationshipEnd();
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (false == referenceOwner instanceof Constraint) {
+ return false;
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return canReorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
+ return canReorientTarget();
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientSource() {
+ if (!(oldEnd instanceof Element && newEnd instanceof Constraint)) {
+ return false;
+ }
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canExistConstraintConstrainedElement_4014(getNewSource(), getOldTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientTarget() {
+ if (!(oldEnd instanceof Element && newEnd instanceof Element)) {
+ return false;
+ }
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canExistConstraintConstrainedElement_4014(getOldSource(), getNewTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in reorient link command"); //$NON-NLS-1$
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return reorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
+ return reorientTarget();
+ }
+ throw new IllegalStateException();
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientSource() throws ExecutionException {
+ getOldSource().getConstrainedElements().remove(getOldTarget());
+ getNewSource().getConstrainedElements().add(getOldTarget());
+ return CommandResult.newOKCommandResult(referenceOwner);
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientTarget() throws ExecutionException {
+ getOldSource().getConstrainedElements().remove(getOldTarget());
+ getOldSource().getConstrainedElements().add(getNewTarget());
+ return CommandResult.newOKCommandResult(referenceOwner);
+ }
+
+ /**
+ * @generated
+ */
+ protected Constraint getOldSource() {
+ return (Constraint) referenceOwner;
+ }
+
+ /**
+ * @generated
+ */
+ protected Constraint getNewSource() {
+ return (Constraint) newEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected Element getOldTarget() {
+ return (Element) oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected Element getNewTarget() {
+ return (Element) newEnd;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/ConstraintCreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/ConstraintCreateCommand.java
new file mode 100644
index 00000000000..ecbd215f9d7
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/ConstraintCreateCommand.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.Constraint;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class ConstraintCreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public ConstraintCreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getPackage();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ Constraint newElement = UMLFactory.eINSTANCE.createConstraint();
+
+ Package owner = (Package) getElementToEdit();
+ owner.getPackagedElements().add(newElement);
+
+ UMLElementTypes.init_Constraint_2011(newElement);
+ return newElement;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/DataType2CreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/DataType2CreateCommand.java
new file mode 100644
index 00000000000..5b4fd78b0d6
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/DataType2CreateCommand.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.DataType;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class DataType2CreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public DataType2CreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getPackage();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ DataType newElement = UMLFactory.eINSTANCE.createDataType();
+
+ Package owner = (Package) getElementToEdit();
+ owner.getPackagedElements().add(newElement);
+
+ UMLElementTypes.init_DataType_3027(newElement);
+ return newElement;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/DataTypeCreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/DataTypeCreateCommand.java
new file mode 100644
index 00000000000..fa734a89291
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/DataTypeCreateCommand.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.DataType;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class DataTypeCreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public DataTypeCreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getPackage();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ DataType newElement = UMLFactory.eINSTANCE.createDataType();
+
+ Package owner = (Package) getElementToEdit();
+ owner.getPackagedElements().add(newElement);
+
+ UMLElementTypes.init_DataType_2010(newElement);
+ return newElement;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Dependency2CreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Dependency2CreateCommand.java
new file mode 100644
index 00000000000..3dc3c19b5da
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Dependency2CreateCommand.java
@@ -0,0 +1,53 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class Dependency2CreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public Dependency2CreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getPackage();
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Dependency2ReorientCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Dependency2ReorientCommand.java
new file mode 100644
index 00000000000..5a3dee1a28d
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Dependency2ReorientCommand.java
@@ -0,0 +1,165 @@
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.uml2.uml.Dependency;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.Package;
+
+/**
+ * @generated
+ */
+public class Dependency2ReorientCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private final int reorientDirection;
+
+ /**
+ * @generated
+ */
+ private final EObject oldEnd;
+
+ /**
+ * @generated
+ */
+ private final EObject newEnd;
+
+ /**
+ * @generated
+ */
+ public Dependency2ReorientCommand(ReorientRelationshipRequest request) {
+ super(request.getLabel(), request.getRelationship(), request);
+ reorientDirection = request.getDirection();
+ oldEnd = request.getOldRelationshipEnd();
+ newEnd = request.getNewRelationshipEnd();
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (false == getElementToEdit() instanceof Dependency) {
+ return false;
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return canReorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
+ return canReorientTarget();
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientSource() {
+ if (!(oldEnd instanceof NamedElement && newEnd instanceof NamedElement)) {
+ return false;
+ }
+ if (getLink().getSuppliers().size() != 1) {
+ return false;
+ }
+ NamedElement target = (NamedElement) getLink().getSuppliers().get(0);
+ if (!(getLink().eContainer() instanceof Package)) {
+ return false;
+ }
+ Package container = (Package) getLink().eContainer();
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canExistDependency_4018(container, getNewSource(), target);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientTarget() {
+ if (!(oldEnd instanceof NamedElement && newEnd instanceof NamedElement)) {
+ return false;
+ }
+ if (getLink().getClients().size() != 1) {
+ return false;
+ }
+ NamedElement source = (NamedElement) getLink().getClients().get(0);
+ if (!(getLink().eContainer() instanceof Package)) {
+ return false;
+ }
+ Package container = (Package) getLink().eContainer();
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canExistDependency_4018(container, source, getNewTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in reorient link command"); //$NON-NLS-1$
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return reorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
+ return reorientTarget();
+ }
+ throw new IllegalStateException();
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientSource() throws ExecutionException {
+ getLink().getClients().remove(getOldSource());
+ getLink().getClients().add(getNewSource());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientTarget() throws ExecutionException {
+ getLink().getSuppliers().remove(getOldTarget());
+ getLink().getSuppliers().add(getNewTarget());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ /**
+ * @generated
+ */
+ protected Dependency getLink() {
+ return (Dependency) getElementToEdit();
+ }
+
+ /**
+ * @generated
+ */
+ protected NamedElement getOldSource() {
+ return (NamedElement) oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected NamedElement getNewSource() {
+ return (NamedElement) newEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected NamedElement getOldTarget() {
+ return (NamedElement) oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected NamedElement getNewTarget() {
+ return (NamedElement) newEnd;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Dependency3CreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Dependency3CreateCommand.java
new file mode 100644
index 00000000000..c1f0d734ba1
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Dependency3CreateCommand.java
@@ -0,0 +1,152 @@
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.Dependency;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class Dependency3CreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ private final EObject source;
+
+ /**
+ * @generated
+ */
+ private final EObject target;
+
+ /**
+ * @generated
+ */
+ private Package container;
+
+ /**
+ * @generated
+ */
+ public Dependency3CreateCommand(CreateRelationshipRequest request, EObject source, EObject target) {
+ super(request);
+ this.source = source;
+ this.target = target;
+ if (request.getContainmentFeature() == null) {
+ setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+
+ // Find container element for the new link.
+ // Climb up by containment hierarchy starting from the source
+ // and return the first element that is instance of the container class.
+ for (EObject element = source; element != null; element = element.eContainer()) {
+ if (element instanceof Package) {
+ container = (Package) element;
+ super.setElementToEdit(container);
+ break;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (source == null && target == null) {
+ return false;
+ }
+ if (source != null && false == source instanceof NamedElement) {
+ return false;
+ }
+ if (target != null && false == target instanceof NamedElement) {
+ return false;
+ }
+ if (getSource() == null) {
+ return true; // link creation is in progress; source is not defined yet
+ }
+ // target may be null here but it's possible to check constraint
+ if (getContainer() == null) {
+ return false;
+ }
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canCreateDependency_4018(getContainer(), getSource(), getTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ Dependency newElement = UMLFactory.eINSTANCE.createDependency();
+ getContainer().getPackagedElements().add(newElement);
+ newElement.getClients().add(getSource());
+ newElement.getSuppliers().add(getTarget());
+ UMLElementTypes.init_Dependency_4018(newElement);
+ return newElement;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getPackage();
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
+ }
+ return super.doExecuteWithResult(monitor, info);
+ }
+
+ /**
+ * @generated
+ */
+ protected ConfigureRequest createConfigureRequest() {
+ ConfigureRequest request = super.createConfigureRequest();
+ request.setParameter(CreateRelationshipRequest.SOURCE, getSource());
+ request.setParameter(CreateRelationshipRequest.TARGET, getTarget());
+ return request;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setElementToEdit(EObject element) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @generated
+ */
+ protected NamedElement getSource() {
+ return (NamedElement) source;
+ }
+
+ /**
+ * @generated
+ */
+ protected NamedElement getTarget() {
+ return (NamedElement) target;
+ }
+
+ /**
+ * @generated
+ */
+ public Package getContainer() {
+ return container;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/DependencyCreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/DependencyCreateCommand.java
new file mode 100644
index 00000000000..c4d5789c7d8
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/DependencyCreateCommand.java
@@ -0,0 +1,165 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.Dependency;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class DependencyCreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ private Package container;
+
+ /**
+ * @generated
+ */
+ private final EObject source;
+
+ /**
+ * @generated
+ */
+ private final EObject target;
+
+ /**
+ * @generated
+ */
+ public DependencyCreateCommand(CreateRelationshipRequest request, EObject source, EObject target) {
+ super(request);
+ this.source = source;
+ this.target = target;
+ if (request.getContainmentFeature() == null) {
+ setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+
+ // Find container element for the new link.
+ // Climb up by containment hierarchy starting from the source
+ // and return the first element that is instance of the container class.
+ for (EObject element = source; element != null; element = element.eContainer()) {
+ if (element instanceof Package) {
+ container = (Package) element;
+ super.setElementToEdit(container);
+ break;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (source == null && target == null) {
+ return false;
+ }
+ if (source != null && false == source instanceof NamedElement) {
+ return false;
+ }
+ if (target != null && false == target instanceof NamedElement) {
+ return false;
+ }
+ if (getSource() == null) {
+ return true; // link creation is in progress; source is not defined yet
+ }
+ // target may be null here but it's possible to check constraint
+ if (getContainer() == null) {
+ return false;
+ }
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canCreateDependency_4008(getContainer(), getSource(), getTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected ConfigureRequest createConfigureRequest() {
+ ConfigureRequest request = super.createConfigureRequest();
+ request.setParameter(CreateRelationshipRequest.SOURCE, getSource());
+ request.setParameter(CreateRelationshipRequest.TARGET, getTarget());
+ return request;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ Dependency newElement = UMLFactory.eINSTANCE.createDependency();
+ getContainer().getPackagedElements().add(newElement);
+ newElement.getClients().add(getSource());
+ newElement.getSuppliers().add(getTarget());
+ UMLElementTypes.init_Dependency_4008(newElement);
+ return newElement;
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
+ }
+ return super.doExecuteWithResult(monitor, info);
+ }
+
+ /**
+ * @generated
+ */
+ public Package getContainer() {
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getPackage();
+ }
+
+ /**
+ * @generated
+ */
+ protected NamedElement getSource() {
+ return (NamedElement) source;
+ }
+
+ /**
+ * @generated
+ */
+ protected NamedElement getTarget() {
+ return (NamedElement) target;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setElementToEdit(EObject element) {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/DependencyReorientCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/DependencyReorientCommand.java
new file mode 100644
index 00000000000..1cee28776e6
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/DependencyReorientCommand.java
@@ -0,0 +1,178 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.uml2.uml.Dependency;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.Package;
+
+/**
+ * @generated
+ */
+public class DependencyReorientCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private final int reorientDirection;
+
+ /**
+ * @generated
+ */
+ private final EObject oldEnd;
+
+ /**
+ * @generated
+ */
+ private final EObject newEnd;
+
+ /**
+ * @generated
+ */
+ public DependencyReorientCommand(ReorientRelationshipRequest request) {
+ super(request.getLabel(), request.getRelationship(), request);
+ reorientDirection = request.getDirection();
+ oldEnd = request.getOldRelationshipEnd();
+ newEnd = request.getNewRelationshipEnd();
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (false == getElementToEdit() instanceof Dependency) {
+ return false;
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return canReorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
+ return canReorientTarget();
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientSource() {
+ if (!(oldEnd instanceof NamedElement && newEnd instanceof NamedElement)) {
+ return false;
+ }
+ if (getLink().getSuppliers().size() != 1) {
+ return false;
+ }
+ NamedElement target = (NamedElement) getLink().getSuppliers().get(0);
+ if (!(getLink().eContainer() instanceof Package)) {
+ return false;
+ }
+ Package container = (Package) getLink().eContainer();
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canExistDependency_4008(container, getNewSource(), target);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientTarget() {
+ if (!(oldEnd instanceof NamedElement && newEnd instanceof NamedElement)) {
+ return false;
+ }
+ if (getLink().getClients().size() != 1) {
+ return false;
+ }
+ NamedElement source = (NamedElement) getLink().getClients().get(0);
+ if (!(getLink().eContainer() instanceof Package)) {
+ return false;
+ }
+ Package container = (Package) getLink().eContainer();
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canExistDependency_4008(container, source, getNewTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in reorient link command"); //$NON-NLS-1$
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return reorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
+ return reorientTarget();
+ }
+ throw new IllegalStateException();
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientSource() throws ExecutionException {
+ getLink().getClients().remove(getOldSource());
+ getLink().getClients().add(getNewSource());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientTarget() throws ExecutionException {
+ getLink().getSuppliers().remove(getOldTarget());
+ getLink().getSuppliers().add(getNewTarget());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ /**
+ * @generated
+ */
+ protected Dependency getLink() {
+ return (Dependency) getElementToEdit();
+ }
+
+ /**
+ * @generated
+ */
+ protected NamedElement getOldSource() {
+ return (NamedElement) oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected NamedElement getNewSource() {
+ return (NamedElement) newEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected NamedElement getOldTarget() {
+ return (NamedElement) oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected NamedElement getNewTarget() {
+ return (NamedElement) newEnd;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/ElementImportCreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/ElementImportCreateCommand.java
new file mode 100644
index 00000000000..ee3153c7321
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/ElementImportCreateCommand.java
@@ -0,0 +1,140 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.ElementImport;
+import org.eclipse.uml2.uml.Namespace;
+import org.eclipse.uml2.uml.PackageableElement;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class ElementImportCreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ private final EObject source;
+
+ /**
+ * @generated
+ */
+ private final EObject target;
+
+ /**
+ * @generated
+ */
+ public ElementImportCreateCommand(CreateRelationshipRequest request, EObject source, EObject target) {
+ super(request);
+ this.source = source;
+ this.target = target;
+ if (request.getContainmentFeature() == null) {
+ setContainmentFeature(UMLPackage.eINSTANCE.getNamespace_ElementImport());
+ }
+
+ super.setElementToEdit(source);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (source == null && target == null) {
+ return false;
+ }
+ if (source != null && false == source instanceof Namespace) {
+ return false;
+ }
+ if (target != null && false == target instanceof PackageableElement) {
+ return false;
+ }
+ if (getSource() == null) {
+ return true; // link creation is in progress; source is not defined yet
+ }
+ // target may be null here but it's possible to check constraint
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canCreateElementImport_4009(getSource(), getTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ ElementImport newElement = UMLFactory.eINSTANCE.createElementImport();
+ getSource().getElementImports().add(newElement);
+ newElement.setImportedElement(getTarget());
+ UMLElementTypes.init_ElementImport_4009(newElement);
+ return newElement;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getNamespace();
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
+ }
+ return super.doExecuteWithResult(monitor, info);
+ }
+
+ /**
+ * @generated
+ */
+ protected ConfigureRequest createConfigureRequest() {
+ ConfigureRequest request = super.createConfigureRequest();
+ request.setParameter(CreateRelationshipRequest.SOURCE, getSource());
+ request.setParameter(CreateRelationshipRequest.TARGET, getTarget());
+ return request;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setElementToEdit(EObject element) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @generated
+ */
+ protected Namespace getSource() {
+ return (Namespace) source;
+ }
+
+ /**
+ * @generated
+ */
+ protected PackageableElement getTarget() {
+ return (PackageableElement) target;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/ElementImportReorientCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/ElementImportReorientCommand.java
new file mode 100644
index 00000000000..61455b81278
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/ElementImportReorientCommand.java
@@ -0,0 +1,166 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.uml2.uml.ElementImport;
+import org.eclipse.uml2.uml.Namespace;
+import org.eclipse.uml2.uml.PackageableElement;
+
+/**
+ * @generated
+ */
+public class ElementImportReorientCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private final int reorientDirection;
+
+ /**
+ * @generated
+ */
+ private final EObject oldEnd;
+
+ /**
+ * @generated
+ */
+ private final EObject newEnd;
+
+ /**
+ * @generated
+ */
+ public ElementImportReorientCommand(ReorientRelationshipRequest request) {
+ super(request.getLabel(), request.getRelationship(), request);
+ reorientDirection = request.getDirection();
+ oldEnd = request.getOldRelationshipEnd();
+ newEnd = request.getNewRelationshipEnd();
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (false == getElementToEdit() instanceof ElementImport) {
+ return false;
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return canReorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
+ return canReorientTarget();
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientSource() {
+ if (!(oldEnd instanceof Namespace && newEnd instanceof Namespace)) {
+ return false;
+ }
+ PackageableElement target = getLink().getImportedElement();
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canExistElementImport_4009(getNewSource(), target);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientTarget() {
+ if (!(oldEnd instanceof PackageableElement && newEnd instanceof PackageableElement)) {
+ return false;
+ }
+ if (!(getLink().eContainer() instanceof Namespace)) {
+ return false;
+ }
+ Namespace source = (Namespace) getLink().eContainer();
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canExistElementImport_4009(source, getNewTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in reorient link command"); //$NON-NLS-1$
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return reorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
+ return reorientTarget();
+ }
+ throw new IllegalStateException();
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientSource() throws ExecutionException {
+ getOldSource().getElementImports().remove(getLink());
+ getNewSource().getElementImports().add(getLink());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientTarget() throws ExecutionException {
+ getLink().setImportedElement(getNewTarget());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ /**
+ * @generated
+ */
+ protected ElementImport getLink() {
+ return (ElementImport) getElementToEdit();
+ }
+
+ /**
+ * @generated
+ */
+ protected Namespace getOldSource() {
+ return (Namespace) oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected Namespace getNewSource() {
+ return (Namespace) newEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected PackageableElement getOldTarget() {
+ return (PackageableElement) oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected PackageableElement getNewTarget() {
+ return (PackageableElement) newEnd;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Enumeration2CreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Enumeration2CreateCommand.java
new file mode 100644
index 00000000000..9897ab31c96
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Enumeration2CreateCommand.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.Enumeration;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class Enumeration2CreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public Enumeration2CreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getPackage();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ Enumeration newElement = UMLFactory.eINSTANCE.createEnumeration();
+
+ Package owner = (Package) getElementToEdit();
+ owner.getPackagedElements().add(newElement);
+
+ UMLElementTypes.init_Enumeration_3025(newElement);
+ return newElement;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/EnumerationCreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/EnumerationCreateCommand.java
new file mode 100644
index 00000000000..3703a7d959d
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/EnumerationCreateCommand.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.Enumeration;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class EnumerationCreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public EnumerationCreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getPackage();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ Enumeration newElement = UMLFactory.eINSTANCE.createEnumeration();
+
+ Package owner = (Package) getElementToEdit();
+ owner.getPackagedElements().add(newElement);
+
+ UMLElementTypes.init_Enumeration_2006(newElement);
+ return newElement;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/EnumerationLiteralCreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/EnumerationLiteralCreateCommand.java
new file mode 100644
index 00000000000..38e5b2ce9bc
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/EnumerationLiteralCreateCommand.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.Enumeration;
+import org.eclipse.uml2.uml.EnumerationLiteral;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class EnumerationLiteralCreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public EnumerationLiteralCreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ EnumerationLiteral newElement = UMLFactory.eINSTANCE.createEnumerationLiteral();
+
+ Enumeration owner = (Enumeration) getElementToEdit();
+ owner.getOwnedLiterals().add(newElement);
+
+ UMLElementTypes.init_EnumerationLiteral_3017(newElement);
+ return newElement;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getEnumeration();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/GeneralizationCreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/GeneralizationCreateCommand.java
new file mode 100644
index 00000000000..3d403aa79cf
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/GeneralizationCreateCommand.java
@@ -0,0 +1,164 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.uml2.uml.Classifier;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Generalization;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class GeneralizationCreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ private final EObject source;
+
+ /**
+ * @generated
+ */
+ private final EObject target;
+
+ /**
+ * @generated
+ */
+ public GeneralizationCreateCommand(CreateRelationshipRequest request, EObject source, EObject target) {
+ super(request);
+ this.source = source;
+ this.target = target;
+ if (request.getContainmentFeature() == null) {
+ setContainmentFeature(UMLPackage.eINSTANCE.getClassifier_Generalization());
+ }
+
+ super.setElementToEdit(source);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (source == null && target == null) {
+ return false;
+ }
+ if (source != null && false == source instanceof Classifier) {
+ return false;
+ }
+ if (target != null && false == target instanceof Classifier) {
+ return false;
+ }
+ if (getSource() == null) {
+ return true; // link creation is in progress; source is not defined yet
+ }
+ // target may be null here but it's possible to check constraint
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canCreateGeneralization_4002(getSource(), getTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected ConfigureRequest createConfigureRequest() {
+ ConfigureRequest request = super.createConfigureRequest();
+ request.setParameter(CreateRelationshipRequest.SOURCE, getSource());
+ request.setParameter(CreateRelationshipRequest.TARGET, getTarget());
+ return request;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ Generalization newElement = UMLFactory.eINSTANCE.createGeneralization();
+ getSource().getGeneralizations().add(newElement);
+ newElement.setGeneral(getTarget());
+ return newElement;
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
+ }
+ return super.doExecuteWithResult(monitor, info);
+ }
+
+ // we modify this method to avoid the bug of infinite loop on creation
+ // we don't know what the origin of this bug.
+ protected CommandResult doExecuteWithResult2(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+
+ // Do the default element creation
+ Element newElement = (Element) doDefaultElementCreation();
+
+ // // Configure the new element
+ // ConfigureRequest configureRequest = createConfigureRequest();
+ //
+ // ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ //
+ IStatus configureStatus = null;
+ //
+ // if (configureCommand != null && configureCommand.canExecute()) {
+ // configureStatus = configureCommand.execute(monitor, info);
+ // }
+
+ // Put the newly created element in the request so that the
+ // 'after' commands have access to it.
+ getCreateRequest().setNewElement(newElement);
+
+ return (configureStatus == null) ? CommandResult.newOKCommandResult(newElement) : new CommandResult(configureStatus, newElement);
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getClassifier();
+ }
+
+ /**
+ * @generated
+ */
+ protected Classifier getSource() {
+ return (Classifier) source;
+ }
+
+ /**
+ * @generated
+ */
+ protected Classifier getTarget() {
+ return (Classifier) target;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setElementToEdit(EObject element) {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/GeneralizationReorientCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/GeneralizationReorientCommand.java
new file mode 100644
index 00000000000..184f2adb034
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/GeneralizationReorientCommand.java
@@ -0,0 +1,165 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.uml2.uml.Classifier;
+import org.eclipse.uml2.uml.Generalization;
+
+/**
+ * @generated
+ */
+public class GeneralizationReorientCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private final EObject newEnd;
+
+ /**
+ * @generated
+ */
+ private final EObject oldEnd;
+
+ /**
+ * @generated
+ */
+ private final int reorientDirection;
+
+ /**
+ * @generated
+ */
+ public GeneralizationReorientCommand(ReorientRelationshipRequest request) {
+ super(request.getLabel(), request.getRelationship(), request);
+ reorientDirection = request.getDirection();
+ oldEnd = request.getOldRelationshipEnd();
+ newEnd = request.getNewRelationshipEnd();
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (false == getElementToEdit() instanceof Generalization) {
+ return false;
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return canReorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
+ return canReorientTarget();
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientSource() {
+ if (!(oldEnd instanceof Classifier && newEnd instanceof Classifier)) {
+ return false;
+ }
+ Classifier target = getLink().getGeneral();
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canExistGeneralization_4002(getNewSource(), target);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientTarget() {
+ if (!(oldEnd instanceof Classifier && newEnd instanceof Classifier)) {
+ return false;
+ }
+ if (!(getLink().eContainer() instanceof Classifier)) {
+ return false;
+ }
+ Classifier source = (Classifier) getLink().eContainer();
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canExistGeneralization_4002(source, getNewTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in reorient link command"); //$NON-NLS-1$
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return reorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
+ return reorientTarget();
+ }
+ throw new IllegalStateException();
+ }
+
+ /**
+ * @generated
+ */
+ protected Generalization getLink() {
+ return (Generalization) getElementToEdit();
+ }
+
+ /**
+ * @generated
+ */
+ protected Classifier getNewSource() {
+ return (Classifier) newEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected Classifier getNewTarget() {
+ return (Classifier) newEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected Classifier getOldSource() {
+ return (Classifier) oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected Classifier getOldTarget() {
+ return (Classifier) oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientSource() throws ExecutionException {
+ getOldSource().getGeneralizations().remove(getLink());
+ getNewSource().getGeneralizations().add(getLink());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientTarget() throws ExecutionException {
+ getLink().setGeneral(getNewTarget());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/InstanceSpecification2CreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/InstanceSpecification2CreateCommand.java
new file mode 100644
index 00000000000..d8cb7388c52
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/InstanceSpecification2CreateCommand.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.InstanceSpecification;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class InstanceSpecification2CreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public InstanceSpecification2CreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getPackage();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ InstanceSpecification newElement = UMLFactory.eINSTANCE.createInstanceSpecification();
+
+ Package owner = (Package) getElementToEdit();
+ owner.getPackagedElements().add(newElement);
+
+ UMLElementTypes.init_InstanceSpecification_3020(newElement);
+ return newElement;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/InstanceSpecificationCreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/InstanceSpecificationCreateCommand.java
new file mode 100644
index 00000000000..3280f3215b2
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/InstanceSpecificationCreateCommand.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.InstanceSpecification;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class InstanceSpecificationCreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public InstanceSpecificationCreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getPackage();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ InstanceSpecification newElement = UMLFactory.eINSTANCE.createInstanceSpecification();
+
+ Package owner = (Package) getElementToEdit();
+ owner.getPackagedElements().add(newElement);
+
+ UMLElementTypes.init_InstanceSpecification_2001(newElement);
+ return newElement;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Interface2CreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Interface2CreateCommand.java
new file mode 100644
index 00000000000..e0d139e07a5
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Interface2CreateCommand.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.Interface;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class Interface2CreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public Interface2CreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getPackage();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ Interface newElement = UMLFactory.eINSTANCE.createInterface();
+
+ Package owner = (Package) getElementToEdit();
+ owner.getPackagedElements().add(newElement);
+
+ UMLElementTypes.init_Interface_3023(newElement);
+ return newElement;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/InterfaceCreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/InterfaceCreateCommand.java
new file mode 100644
index 00000000000..ac1772fbda5
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/InterfaceCreateCommand.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.Interface;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class InterfaceCreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public InterfaceCreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getPackage();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ Interface newElement = UMLFactory.eINSTANCE.createInterface();
+
+ Package owner = (Package) getElementToEdit();
+ owner.getPackagedElements().add(newElement);
+
+ UMLElementTypes.init_Interface_2004(newElement);
+ return newElement;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/InterfaceRealizationCreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/InterfaceRealizationCreateCommand.java
new file mode 100644
index 00000000000..8454a4a3a88
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/InterfaceRealizationCreateCommand.java
@@ -0,0 +1,140 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.BehavioredClassifier;
+import org.eclipse.uml2.uml.Interface;
+import org.eclipse.uml2.uml.InterfaceRealization;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class InterfaceRealizationCreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ private final EObject source;
+
+ /**
+ * @generated
+ */
+ private final EObject target;
+
+ /**
+ * @generated
+ */
+ public InterfaceRealizationCreateCommand(CreateRelationshipRequest request, EObject source, EObject target) {
+ super(request);
+ this.source = source;
+ this.target = target;
+ if (request.getContainmentFeature() == null) {
+ setContainmentFeature(UMLPackage.eINSTANCE.getBehavioredClassifier_InterfaceRealization());
+ }
+
+ super.setElementToEdit(source);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (source == null && target == null) {
+ return false;
+ }
+ if (source != null && false == source instanceof BehavioredClassifier) {
+ return false;
+ }
+ if (target != null && false == target instanceof Interface) {
+ return false;
+ }
+ if (getSource() == null) {
+ return true; // link creation is in progress; source is not defined yet
+ }
+ // target may be null here but it's possible to check constraint
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canCreateInterfaceRealization_4003(getSource(), getTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ InterfaceRealization newElement = UMLFactory.eINSTANCE.createInterfaceRealization();
+ getSource().getInterfaceRealizations().add(newElement);
+ newElement.setContract(getTarget());
+ UMLElementTypes.init_InterfaceRealization_4003(newElement);
+ return newElement;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getBehavioredClassifier();
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
+ }
+ return super.doExecuteWithResult(monitor, info);
+ }
+
+ /**
+ * @generated
+ */
+ protected ConfigureRequest createConfigureRequest() {
+ ConfigureRequest request = super.createConfigureRequest();
+ request.setParameter(CreateRelationshipRequest.SOURCE, getSource());
+ request.setParameter(CreateRelationshipRequest.TARGET, getTarget());
+ return request;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setElementToEdit(EObject element) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @generated
+ */
+ protected BehavioredClassifier getSource() {
+ return (BehavioredClassifier) source;
+ }
+
+ /**
+ * @generated
+ */
+ protected Interface getTarget() {
+ return (Interface) target;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/InterfaceRealizationReorientCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/InterfaceRealizationReorientCommand.java
new file mode 100644
index 00000000000..da5012529d5
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/InterfaceRealizationReorientCommand.java
@@ -0,0 +1,166 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.uml2.uml.BehavioredClassifier;
+import org.eclipse.uml2.uml.Interface;
+import org.eclipse.uml2.uml.InterfaceRealization;
+
+/**
+ * @generated
+ */
+public class InterfaceRealizationReorientCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private final int reorientDirection;
+
+ /**
+ * @generated
+ */
+ private final EObject oldEnd;
+
+ /**
+ * @generated
+ */
+ private final EObject newEnd;
+
+ /**
+ * @generated
+ */
+ public InterfaceRealizationReorientCommand(ReorientRelationshipRequest request) {
+ super(request.getLabel(), request.getRelationship(), request);
+ reorientDirection = request.getDirection();
+ oldEnd = request.getOldRelationshipEnd();
+ newEnd = request.getNewRelationshipEnd();
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (false == getElementToEdit() instanceof InterfaceRealization) {
+ return false;
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return canReorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
+ return canReorientTarget();
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientSource() {
+ if (!(oldEnd instanceof BehavioredClassifier && newEnd instanceof BehavioredClassifier)) {
+ return false;
+ }
+ Interface target = getLink().getContract();
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canExistInterfaceRealization_4003(getNewSource(), target);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientTarget() {
+ if (!(oldEnd instanceof Interface && newEnd instanceof Interface)) {
+ return false;
+ }
+ if (!(getLink().eContainer() instanceof BehavioredClassifier)) {
+ return false;
+ }
+ BehavioredClassifier source = (BehavioredClassifier) getLink().eContainer();
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canExistInterfaceRealization_4003(source, getNewTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in reorient link command"); //$NON-NLS-1$
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return reorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
+ return reorientTarget();
+ }
+ throw new IllegalStateException();
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientSource() throws ExecutionException {
+ getOldSource().getInterfaceRealizations().remove(getLink());
+ getNewSource().getInterfaceRealizations().add(getLink());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientTarget() throws ExecutionException {
+ getLink().setContract(getNewTarget());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ /**
+ * @generated
+ */
+ protected InterfaceRealization getLink() {
+ return (InterfaceRealization) getElementToEdit();
+ }
+
+ /**
+ * @generated
+ */
+ protected BehavioredClassifier getOldSource() {
+ return (BehavioredClassifier) oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected BehavioredClassifier getNewSource() {
+ return (BehavioredClassifier) newEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected Interface getOldTarget() {
+ return (Interface) oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected Interface getNewTarget() {
+ return (Interface) newEnd;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Model2CreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Model2CreateCommand.java
new file mode 100644
index 00000000000..b7a9cb45465
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Model2CreateCommand.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.Model;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class Model2CreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public Model2CreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getPackage();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ Model newElement = UMLFactory.eINSTANCE.createModel();
+
+ Package owner = (Package) getElementToEdit();
+ owner.getPackagedElements().add(newElement);
+
+ UMLElementTypes.init_Model_3024(newElement);
+ return newElement;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/ModelCreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/ModelCreateCommand.java
new file mode 100644
index 00000000000..321e54ca6a4
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/ModelCreateCommand.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.Model;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class ModelCreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public ModelCreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getPackage();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ Model newElement = UMLFactory.eINSTANCE.createModel();
+
+ Package owner = (Package) getElementToEdit();
+ owner.getPackagedElements().add(newElement);
+
+ UMLElementTypes.init_Model_2005(newElement);
+ return newElement;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Operation2CreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Operation2CreateCommand.java
new file mode 100644
index 00000000000..c4dd9187a49
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Operation2CreateCommand.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.Interface;
+import org.eclipse.uml2.uml.Operation;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class Operation2CreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public Operation2CreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getInterface();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ Operation newElement = UMLFactory.eINSTANCE.createOperation();
+
+ Interface owner = (Interface) getElementToEdit();
+ owner.getOwnedOperations().add(newElement);
+
+ UMLElementTypes.init_Operation_3007(newElement);
+ return newElement;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Operation3CreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Operation3CreateCommand.java
new file mode 100644
index 00000000000..d7a0c0daff2
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Operation3CreateCommand.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Operation;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class Operation3CreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public Operation3CreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getClass_();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ Operation newElement = UMLFactory.eINSTANCE.createOperation();
+
+ Class owner = (Class) getElementToEdit();
+ owner.getOwnedOperations().add(newElement);
+
+ UMLElementTypes.init_Operation_3013(newElement);
+ return newElement;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Operation4CreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Operation4CreateCommand.java
new file mode 100644
index 00000000000..c3108f54c7e
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Operation4CreateCommand.java
@@ -0,0 +1,71 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.DataType;
+import org.eclipse.uml2.uml.Operation;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class Operation4CreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public Operation4CreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getDataType();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ Operation newElement = UMLFactory.eINSTANCE.createOperation();
+
+ DataType owner = (DataType) getElementToEdit();
+ owner.getOwnedOperations().add(newElement);
+
+ UMLElementTypes.init_Operation_3019(newElement);
+ return newElement;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Operation5CreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Operation5CreateCommand.java
new file mode 100644
index 00000000000..0d29f12d38c
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Operation5CreateCommand.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.DataType;
+import org.eclipse.uml2.uml.Operation;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class Operation5CreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public Operation5CreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ Operation newElement = UMLFactory.eINSTANCE.createOperation();
+
+ DataType owner = (DataType) getElementToEdit();
+ owner.getOwnedOperations().add(newElement);
+
+ UMLElementTypes.init_Operation_3007(newElement);
+ return newElement;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getDataType();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/OperationCreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/OperationCreateCommand.java
new file mode 100644
index 00000000000..56209c47dd7
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/OperationCreateCommand.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Operation;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class OperationCreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public OperationCreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getClass_();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ Operation newElement = UMLFactory.eINSTANCE.createOperation();
+
+ Class owner = (Class) getElementToEdit();
+ owner.getOwnedOperations().add(newElement);
+
+ UMLElementTypes.init_Operation_3003(newElement);
+ return newElement;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Package2CreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Package2CreateCommand.java
new file mode 100644
index 00000000000..a311bf6fe5e
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Package2CreateCommand.java
@@ -0,0 +1,69 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class Package2CreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public Package2CreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getPackage();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ Package newElement = UMLFactory.eINSTANCE.createPackage();
+
+ Package owner = (Package) getElementToEdit();
+ owner.getPackagedElements().add(newElement);
+
+ UMLElementTypes.init_Package_3009(newElement);
+ return newElement;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/PackageCreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/PackageCreateCommand.java
new file mode 100644
index 00000000000..82a96ce2365
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/PackageCreateCommand.java
@@ -0,0 +1,69 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class PackageCreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public PackageCreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getPackage();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ Package newElement = UMLFactory.eINSTANCE.createPackage();
+
+ Package owner = (Package) getElementToEdit();
+ owner.getPackagedElements().add(newElement);
+
+ UMLElementTypes.init_Package_2007(newElement);
+ return newElement;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/PackageImportCreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/PackageImportCreateCommand.java
new file mode 100644
index 00000000000..f7f3105061f
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/PackageImportCreateCommand.java
@@ -0,0 +1,138 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.uml2.uml.Namespace;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.PackageImport;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class PackageImportCreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ private final EObject source;
+
+ /**
+ * @generated
+ */
+ private final EObject target;
+
+ /**
+ * @generated
+ */
+ public PackageImportCreateCommand(CreateRelationshipRequest request, EObject source, EObject target) {
+ super(request);
+ this.source = source;
+ this.target = target;
+ if (request.getContainmentFeature() == null) {
+ setContainmentFeature(UMLPackage.eINSTANCE.getNamespace_PackageImport());
+ }
+
+ super.setElementToEdit(source);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (source == null && target == null) {
+ return false;
+ }
+ if (source != null && false == source instanceof Namespace) {
+ return false;
+ }
+ if (target != null && false == target instanceof Package) {
+ return false;
+ }
+ if (getSource() == null) {
+ return true; // link creation is in progress; source is not defined yet
+ }
+ // target may be null here but it's possible to check constraint
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canCreatePackageImport_4010(getSource(), getTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ PackageImport newElement = UMLFactory.eINSTANCE.createPackageImport();
+ getSource().getPackageImports().add(newElement);
+ newElement.setImportedPackage(getTarget());
+ return newElement;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getNamespace();
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
+ }
+ return super.doExecuteWithResult(monitor, info);
+ }
+
+ /**
+ * @generated
+ */
+ protected ConfigureRequest createConfigureRequest() {
+ ConfigureRequest request = super.createConfigureRequest();
+ request.setParameter(CreateRelationshipRequest.SOURCE, getSource());
+ request.setParameter(CreateRelationshipRequest.TARGET, getTarget());
+ return request;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setElementToEdit(EObject element) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @generated
+ */
+ protected Namespace getSource() {
+ return (Namespace) source;
+ }
+
+ /**
+ * @generated
+ */
+ protected Package getTarget() {
+ return (Package) target;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/PackageImportReorientCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/PackageImportReorientCommand.java
new file mode 100644
index 00000000000..185cd85428e
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/PackageImportReorientCommand.java
@@ -0,0 +1,166 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.uml2.uml.Namespace;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.PackageImport;
+
+/**
+ * @generated
+ */
+public class PackageImportReorientCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private final int reorientDirection;
+
+ /**
+ * @generated
+ */
+ private final EObject oldEnd;
+
+ /**
+ * @generated
+ */
+ private final EObject newEnd;
+
+ /**
+ * @generated
+ */
+ public PackageImportReorientCommand(ReorientRelationshipRequest request) {
+ super(request.getLabel(), request.getRelationship(), request);
+ reorientDirection = request.getDirection();
+ oldEnd = request.getOldRelationshipEnd();
+ newEnd = request.getNewRelationshipEnd();
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (false == getElementToEdit() instanceof PackageImport) {
+ return false;
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return canReorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
+ return canReorientTarget();
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientSource() {
+ if (!(oldEnd instanceof Namespace && newEnd instanceof Namespace)) {
+ return false;
+ }
+ Package target = getLink().getImportedPackage();
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canExistPackageImport_4010(getNewSource(), target);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientTarget() {
+ if (!(oldEnd instanceof Package && newEnd instanceof Package)) {
+ return false;
+ }
+ if (!(getLink().eContainer() instanceof Namespace)) {
+ return false;
+ }
+ Namespace source = (Namespace) getLink().eContainer();
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canExistPackageImport_4010(source, getNewTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in reorient link command"); //$NON-NLS-1$
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return reorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
+ return reorientTarget();
+ }
+ throw new IllegalStateException();
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientSource() throws ExecutionException {
+ getOldSource().getPackageImports().remove(getLink());
+ getNewSource().getPackageImports().add(getLink());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientTarget() throws ExecutionException {
+ getLink().setImportedPackage(getNewTarget());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ /**
+ * @generated
+ */
+ protected PackageImport getLink() {
+ return (PackageImport) getElementToEdit();
+ }
+
+ /**
+ * @generated
+ */
+ protected Namespace getOldSource() {
+ return (Namespace) oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected Namespace getNewSource() {
+ return (Namespace) newEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected Package getOldTarget() {
+ return (Package) oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected Package getNewTarget() {
+ return (Package) newEnd;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/PackageMergeCreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/PackageMergeCreateCommand.java
new file mode 100644
index 00000000000..a18b358a733
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/PackageMergeCreateCommand.java
@@ -0,0 +1,162 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.PackageMerge;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class PackageMergeCreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ private final EObject source;
+
+ /**
+ * @generated
+ */
+ private final EObject target;
+
+ /**
+ * @generated
+ */
+ private Package container;
+
+ /**
+ * @generated
+ */
+ public PackageMergeCreateCommand(CreateRelationshipRequest request, EObject source, EObject target) {
+ super(request);
+ this.source = source;
+ this.target = target;
+ if (request.getContainmentFeature() == null) {
+ setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackageMerge());
+ }
+
+ // Find container element for the new link.
+ // Climb up by containment hierarchy starting from the source
+ // and return the first element that is instance of the container class.
+ for (EObject element = source; element != null; element = element.eContainer()) {
+ if (element instanceof Package) {
+ container = (Package) element;
+ super.setElementToEdit(container);
+ break;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (source == null && target == null) {
+ return false;
+ }
+ if (source != null && false == source instanceof Package) {
+ return false;
+ }
+ if (target != null && false == target instanceof Package) {
+ return false;
+ }
+ if (getSource() == null) {
+ return true; // link creation is in progress; source is not defined yet
+ }
+ // target may be null here but it's possible to check constraint
+ if (getContainer() == null) {
+ return false;
+ }
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canCreatePackageMerge_4011(getContainer(), getSource(), getTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ PackageMerge newElement = UMLFactory.eINSTANCE.createPackageMerge();
+ getContainer().getPackageMerges().add(newElement);
+ newElement.setReceivingPackage(getSource());
+ newElement.setMergedPackage(getTarget());
+ return newElement;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getPackage();
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
+ }
+ return super.doExecuteWithResult(monitor, info);
+ }
+
+ /**
+ * @generated
+ */
+ protected ConfigureRequest createConfigureRequest() {
+ ConfigureRequest request = super.createConfigureRequest();
+ request.setParameter(CreateRelationshipRequest.SOURCE, getSource());
+ request.setParameter(CreateRelationshipRequest.TARGET, getTarget());
+ return request;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setElementToEdit(EObject element) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @generated
+ */
+ protected Package getSource() {
+ return (Package) source;
+ }
+
+ /**
+ * @generated
+ */
+ protected Package getTarget() {
+ return (Package) target;
+ }
+
+ /**
+ * @generated
+ */
+ public Package getContainer() {
+ return container;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/PackageMergeReorientCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/PackageMergeReorientCommand.java
new file mode 100644
index 00000000000..6bd989c81c9
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/PackageMergeReorientCommand.java
@@ -0,0 +1,169 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.PackageMerge;
+
+/**
+ * @generated
+ */
+public class PackageMergeReorientCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private final int reorientDirection;
+
+ /**
+ * @generated
+ */
+ private final EObject oldEnd;
+
+ /**
+ * @generated
+ */
+ private final EObject newEnd;
+
+ /**
+ * @generated
+ */
+ public PackageMergeReorientCommand(ReorientRelationshipRequest request) {
+ super(request.getLabel(), request.getRelationship(), request);
+ reorientDirection = request.getDirection();
+ oldEnd = request.getOldRelationshipEnd();
+ newEnd = request.getNewRelationshipEnd();
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (false == getElementToEdit() instanceof PackageMerge) {
+ return false;
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return canReorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
+ return canReorientTarget();
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientSource() {
+ if (!(oldEnd instanceof Package && newEnd instanceof Package)) {
+ return false;
+ }
+ Package target = getLink().getMergedPackage();
+ if (!(getLink().eContainer() instanceof Package)) {
+ return false;
+ }
+ Package container = (Package) getLink().eContainer();
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canExistPackageMerge_4011(container, getNewSource(), target);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientTarget() {
+ if (!(oldEnd instanceof Package && newEnd instanceof Package)) {
+ return false;
+ }
+ Package source = getLink().getReceivingPackage();
+ if (!(getLink().eContainer() instanceof Package)) {
+ return false;
+ }
+ Package container = (Package) getLink().eContainer();
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canExistPackageMerge_4011(container, source, getNewTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in reorient link command"); //$NON-NLS-1$
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return reorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
+ return reorientTarget();
+ }
+ throw new IllegalStateException();
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientSource() throws ExecutionException {
+ getLink().setReceivingPackage(getNewSource());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientTarget() throws ExecutionException {
+ getLink().setMergedPackage(getNewTarget());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ /**
+ * @generated
+ */
+ protected PackageMerge getLink() {
+ return (PackageMerge) getElementToEdit();
+ }
+
+ /**
+ * @generated
+ */
+ protected Package getOldSource() {
+ return (Package) oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected Package getNewSource() {
+ return (Package) newEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected Package getOldTarget() {
+ return (Package) oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected Package getNewTarget() {
+ return (Package) newEnd;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/PrimitiveType2CreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/PrimitiveType2CreateCommand.java
new file mode 100644
index 00000000000..47296843d2b
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/PrimitiveType2CreateCommand.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.PrimitiveType;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class PrimitiveType2CreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public PrimitiveType2CreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getPackage();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ PrimitiveType newElement = UMLFactory.eINSTANCE.createPrimitiveType();
+
+ Package owner = (Package) getElementToEdit();
+ owner.getPackagedElements().add(newElement);
+
+ UMLElementTypes.init_PrimitiveType_3026(newElement);
+ return newElement;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/PrimitiveTypeCreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/PrimitiveTypeCreateCommand.java
new file mode 100644
index 00000000000..3be7e0cc8ee
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/PrimitiveTypeCreateCommand.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.PrimitiveType;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class PrimitiveTypeCreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public PrimitiveTypeCreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getPackage();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ PrimitiveType newElement = UMLFactory.eINSTANCE.createPrimitiveType();
+
+ Package owner = (Package) getElementToEdit();
+ owner.getPackagedElements().add(newElement);
+
+ UMLElementTypes.init_PrimitiveType_2009(newElement);
+ return newElement;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/ProfileApplicationCreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/ProfileApplicationCreateCommand.java
new file mode 100644
index 00000000000..c43e3a0b144
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/ProfileApplicationCreateCommand.java
@@ -0,0 +1,138 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.Profile;
+import org.eclipse.uml2.uml.ProfileApplication;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class ProfileApplicationCreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ private final EObject source;
+
+ /**
+ * @generated
+ */
+ private final EObject target;
+
+ /**
+ * @generated
+ */
+ public ProfileApplicationCreateCommand(CreateRelationshipRequest request, EObject source, EObject target) {
+ super(request);
+ this.source = source;
+ this.target = target;
+ if (request.getContainmentFeature() == null) {
+ setContainmentFeature(UMLPackage.eINSTANCE.getPackage_ProfileApplication());
+ }
+
+ super.setElementToEdit(source);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (source == null && target == null) {
+ return false;
+ }
+ if (source != null && false == source instanceof Package) {
+ return false;
+ }
+ if (target != null && false == target instanceof Profile) {
+ return false;
+ }
+ if (getSource() == null) {
+ return true; // link creation is in progress; source is not defined yet
+ }
+ // target may be null here but it's possible to check constraint
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canCreateProfileApplication_4012(getSource(), getTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ ProfileApplication newElement = UMLFactory.eINSTANCE.createProfileApplication();
+ getSource().getProfileApplications().add(newElement);
+ newElement.setAppliedProfile(getTarget());
+ return newElement;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getPackage();
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
+ }
+ return super.doExecuteWithResult(monitor, info);
+ }
+
+ /**
+ * @generated
+ */
+ protected ConfigureRequest createConfigureRequest() {
+ ConfigureRequest request = super.createConfigureRequest();
+ request.setParameter(CreateRelationshipRequest.SOURCE, getSource());
+ request.setParameter(CreateRelationshipRequest.TARGET, getTarget());
+ return request;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setElementToEdit(EObject element) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @generated
+ */
+ protected Package getSource() {
+ return (Package) source;
+ }
+
+ /**
+ * @generated
+ */
+ protected Profile getTarget() {
+ return (Profile) target;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/ProfileApplicationReorientCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/ProfileApplicationReorientCommand.java
new file mode 100644
index 00000000000..768b9138170
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/ProfileApplicationReorientCommand.java
@@ -0,0 +1,166 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.Profile;
+import org.eclipse.uml2.uml.ProfileApplication;
+
+/**
+ * @generated
+ */
+public class ProfileApplicationReorientCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private final int reorientDirection;
+
+ /**
+ * @generated
+ */
+ private final EObject oldEnd;
+
+ /**
+ * @generated
+ */
+ private final EObject newEnd;
+
+ /**
+ * @generated
+ */
+ public ProfileApplicationReorientCommand(ReorientRelationshipRequest request) {
+ super(request.getLabel(), request.getRelationship(), request);
+ reorientDirection = request.getDirection();
+ oldEnd = request.getOldRelationshipEnd();
+ newEnd = request.getNewRelationshipEnd();
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (false == getElementToEdit() instanceof ProfileApplication) {
+ return false;
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return canReorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
+ return canReorientTarget();
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientSource() {
+ if (!(oldEnd instanceof Package && newEnd instanceof Package)) {
+ return false;
+ }
+ Profile target = getLink().getAppliedProfile();
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canExistProfileApplication_4012(getNewSource(), target);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientTarget() {
+ if (!(oldEnd instanceof Profile && newEnd instanceof Profile)) {
+ return false;
+ }
+ if (!(getLink().eContainer() instanceof Package)) {
+ return false;
+ }
+ Package source = (Package) getLink().eContainer();
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canExistProfileApplication_4012(source, getNewTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in reorient link command"); //$NON-NLS-1$
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return reorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
+ return reorientTarget();
+ }
+ throw new IllegalStateException();
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientSource() throws ExecutionException {
+ getOldSource().getProfileApplications().remove(getLink());
+ getNewSource().getProfileApplications().add(getLink());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientTarget() throws ExecutionException {
+ getLink().setAppliedProfile(getNewTarget());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ /**
+ * @generated
+ */
+ protected ProfileApplication getLink() {
+ return (ProfileApplication) getElementToEdit();
+ }
+
+ /**
+ * @generated
+ */
+ protected Package getOldSource() {
+ return (Package) oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected Package getNewSource() {
+ return (Package) newEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected Profile getOldTarget() {
+ return (Profile) oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected Profile getNewTarget() {
+ return (Profile) newEnd;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Property2CreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Property2CreateCommand.java
new file mode 100644
index 00000000000..0b2fa3dc636
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Property2CreateCommand.java
@@ -0,0 +1,105 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.Signal;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class Property2CreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public Property2CreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ Property newElement = UMLFactory.eINSTANCE.createProperty();
+
+ Signal owner = (Signal) getElementToEdit();
+ owner.getOwnedAttributes().add(newElement);
+
+ UMLElementTypes.init_Property_3005(newElement);
+ return newElement;
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ // we modify this method to avoid the bug of infinite loop on creation
+ // we don't know what the origin of this bug.
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+
+ // Do the default element creation
+ Element newElement = (Element) doDefaultElementCreation();
+
+ // // Configure the new element
+ // ConfigureRequest configureRequest = createConfigureRequest();
+ //
+ // ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ //
+ IStatus configureStatus = null;
+ //
+ // if (configureCommand != null && configureCommand.canExecute()) {
+ // configureStatus = configureCommand.execute(monitor, info);
+ // }
+
+ // Put the newly created element in the request so that the
+ // 'after' commands have access to it.
+ getCreateRequest().setNewElement(newElement);
+
+ return (configureStatus == null) ? CommandResult.newOKCommandResult(newElement) : new CommandResult(configureStatus, newElement);
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getSignal();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Property3CreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Property3CreateCommand.java
new file mode 100644
index 00000000000..2f8726cae49
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Property3CreateCommand.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.Interface;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class Property3CreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public Property3CreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getInterface();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ Property newElement = UMLFactory.eINSTANCE.createProperty();
+
+ Interface owner = (Interface) getElementToEdit();
+ owner.getOwnedAttributes().add(newElement);
+
+ UMLElementTypes.init_Property_3006(newElement);
+ return newElement;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Property4CreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Property4CreateCommand.java
new file mode 100644
index 00000000000..cd3895f329b
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Property4CreateCommand.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.StructuredClassifier;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class Property4CreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public Property4CreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getStructuredClassifier();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ Property newElement = UMLFactory.eINSTANCE.createProperty();
+
+ StructuredClassifier owner = (StructuredClassifier) getElementToEdit();
+ owner.getOwnedAttributes().add(newElement);
+
+ UMLElementTypes.init_Property_3012(newElement);
+ return newElement;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Property5CreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Property5CreateCommand.java
new file mode 100644
index 00000000000..4cdcbc56c0d
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Property5CreateCommand.java
@@ -0,0 +1,72 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.DataType;
+import org.eclipse.uml2.uml.Enumeration;
+import org.eclipse.uml2.uml.EnumerationLiteral;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class Property5CreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public Property5CreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getDataType();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ Property newElement = UMLFactory.eINSTANCE.createProperty();
+
+ DataType owner = (DataType) getElementToEdit();
+ owner.getOwnedAttributes().add(newElement);
+
+ UMLElementTypes.init_Property_3018(newElement);
+ return newElement;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/PropertyCreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/PropertyCreateCommand.java
new file mode 100644
index 00000000000..d56c3a57aff
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/PropertyCreateCommand.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.StructuredClassifier;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class PropertyCreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public PropertyCreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getStructuredClassifier();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ Property newElement = UMLFactory.eINSTANCE.createProperty();
+
+ StructuredClassifier owner = (StructuredClassifier) getElementToEdit();
+ owner.getOwnedAttributes().add(newElement);
+
+ UMLElementTypes.init_Property_3002(newElement);
+ return newElement;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/RealizationCreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/RealizationCreateCommand.java
new file mode 100644
index 00000000000..6b6149f8bda
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/RealizationCreateCommand.java
@@ -0,0 +1,165 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.Realization;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class RealizationCreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ private final EObject source;
+
+ /**
+ * @generated
+ */
+ private final EObject target;
+
+ /**
+ * @generated
+ */
+ private Package container;
+
+ /**
+ * @generated
+ */
+ public RealizationCreateCommand(CreateRelationshipRequest request, EObject source, EObject target) {
+ super(request);
+ this.source = source;
+ this.target = target;
+ if (request.getContainmentFeature() == null) {
+ setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+
+ // Find container element for the new link.
+ // Climb up by containment hierarchy starting from the source
+ // and return the first element that is instance of the container class.
+ for (EObject element = source; element != null; element = element.eContainer()) {
+ if (element instanceof Package) {
+ container = (Package) element;
+ super.setElementToEdit(container);
+ break;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (source == null && target == null) {
+ return false;
+ }
+ if (source != null && false == source instanceof NamedElement) {
+ return false;
+ }
+ if (target != null && false == target instanceof NamedElement) {
+ return false;
+ }
+ if (getSource() == null) {
+ return true; // link creation is in progress; source is not defined yet
+ }
+ // target may be null here but it's possible to check constraint
+ if (getContainer() == null) {
+ return false;
+ }
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canCreateRealization_4005(getContainer(), getSource(), getTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ Realization newElement = UMLFactory.eINSTANCE.createRealization();
+ getContainer().getPackagedElements().add(newElement);
+ newElement.getClients().add(getSource());
+ newElement.getSuppliers().add(getTarget());
+ UMLElementTypes.init_Realization_4005(newElement);
+ return newElement;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getPackage();
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
+ }
+ return super.doExecuteWithResult(monitor, info);
+ }
+
+ /**
+ * @generated
+ */
+ protected ConfigureRequest createConfigureRequest() {
+ ConfigureRequest request = super.createConfigureRequest();
+ request.setParameter(CreateRelationshipRequest.SOURCE, getSource());
+ request.setParameter(CreateRelationshipRequest.TARGET, getTarget());
+ return request;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setElementToEdit(EObject element) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @generated
+ */
+ protected NamedElement getSource() {
+ return (NamedElement) source;
+ }
+
+ /**
+ * @generated
+ */
+ protected NamedElement getTarget() {
+ return (NamedElement) target;
+ }
+
+ /**
+ * @generated
+ */
+ public Package getContainer() {
+ return container;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/RealizationReorientCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/RealizationReorientCommand.java
new file mode 100644
index 00000000000..4369d1da8b3
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/RealizationReorientCommand.java
@@ -0,0 +1,178 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.Realization;
+
+/**
+ * @generated
+ */
+public class RealizationReorientCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private final int reorientDirection;
+
+ /**
+ * @generated
+ */
+ private final EObject oldEnd;
+
+ /**
+ * @generated
+ */
+ private final EObject newEnd;
+
+ /**
+ * @generated
+ */
+ public RealizationReorientCommand(ReorientRelationshipRequest request) {
+ super(request.getLabel(), request.getRelationship(), request);
+ reorientDirection = request.getDirection();
+ oldEnd = request.getOldRelationshipEnd();
+ newEnd = request.getNewRelationshipEnd();
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (false == getElementToEdit() instanceof Realization) {
+ return false;
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return canReorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
+ return canReorientTarget();
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientSource() {
+ if (!(oldEnd instanceof NamedElement && newEnd instanceof NamedElement)) {
+ return false;
+ }
+ if (getLink().getSuppliers().size() != 1) {
+ return false;
+ }
+ NamedElement target = (NamedElement) getLink().getSuppliers().get(0);
+ if (!(getLink().eContainer() instanceof Package)) {
+ return false;
+ }
+ Package container = (Package) getLink().eContainer();
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canExistRealization_4005(container, getNewSource(), target);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientTarget() {
+ if (!(oldEnd instanceof NamedElement && newEnd instanceof NamedElement)) {
+ return false;
+ }
+ if (getLink().getClients().size() != 1) {
+ return false;
+ }
+ NamedElement source = (NamedElement) getLink().getClients().get(0);
+ if (!(getLink().eContainer() instanceof Package)) {
+ return false;
+ }
+ Package container = (Package) getLink().eContainer();
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canExistRealization_4005(container, source, getNewTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in reorient link command"); //$NON-NLS-1$
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return reorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
+ return reorientTarget();
+ }
+ throw new IllegalStateException();
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientSource() throws ExecutionException {
+ getLink().getClients().remove(getOldSource());
+ getLink().getClients().add(getNewSource());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientTarget() throws ExecutionException {
+ getLink().getSuppliers().remove(getOldTarget());
+ getLink().getSuppliers().add(getNewTarget());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ /**
+ * @generated
+ */
+ protected Realization getLink() {
+ return (Realization) getElementToEdit();
+ }
+
+ /**
+ * @generated
+ */
+ protected NamedElement getOldSource() {
+ return (NamedElement) oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected NamedElement getNewSource() {
+ return (NamedElement) newEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected NamedElement getOldTarget() {
+ return (NamedElement) oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected NamedElement getNewTarget() {
+ return (NamedElement) newEnd;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/ReceptionCreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/ReceptionCreateCommand.java
new file mode 100644
index 00000000000..a17274c40f4
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/ReceptionCreateCommand.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Reception;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class ReceptionCreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public ReceptionCreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getClass_();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ Reception newElement = UMLFactory.eINSTANCE.createReception();
+
+ Class owner = (Class) getElementToEdit();
+ owner.getOwnedReceptions().add(newElement);
+
+ UMLElementTypes.init_Reception_3011(newElement);
+ return newElement;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/RedefinableTemplateSignatureCreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/RedefinableTemplateSignatureCreateCommand.java
new file mode 100644
index 00000000000..b57b08fdb4d
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/RedefinableTemplateSignatureCreateCommand.java
@@ -0,0 +1,65 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.uml2.uml.TemplateableElement;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class RedefinableTemplateSignatureCreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public RedefinableTemplateSignatureCreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ TemplateableElement container = (TemplateableElement) getElementToEdit();
+ if (container.getOwnedTemplateSignature() != null) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getTemplateableElement();
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Signal2CreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Signal2CreateCommand.java
new file mode 100644
index 00000000000..e9cc5d3ddd8
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Signal2CreateCommand.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.Signal;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class Signal2CreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public Signal2CreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getPackage();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ Signal newElement = UMLFactory.eINSTANCE.createSignal();
+
+ Package owner = (Package) getElementToEdit();
+ owner.getPackagedElements().add(newElement);
+
+ UMLElementTypes.init_Signal_3022(newElement);
+ return newElement;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/SignalCreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/SignalCreateCommand.java
new file mode 100644
index 00000000000..14b2c413bbc
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/SignalCreateCommand.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.Signal;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class SignalCreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public SignalCreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getPackage();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ Signal newElement = UMLFactory.eINSTANCE.createSignal();
+
+ Package owner = (Package) getElementToEdit();
+ owner.getPackagedElements().add(newElement);
+
+ UMLElementTypes.init_Signal_2003(newElement);
+ return newElement;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/SlotCreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/SlotCreateCommand.java
new file mode 100644
index 00000000000..eaa1e87f3f8
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/SlotCreateCommand.java
@@ -0,0 +1,53 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class SlotCreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public SlotCreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getInstanceSpecification();
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/SubstitutionCreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/SubstitutionCreateCommand.java
new file mode 100644
index 00000000000..6b1965f897a
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/SubstitutionCreateCommand.java
@@ -0,0 +1,164 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.Classifier;
+import org.eclipse.uml2.uml.Substitution;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class SubstitutionCreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ private final EObject source;
+
+ /**
+ * @generated
+ */
+ private final EObject target;
+
+ /**
+ * @generated
+ */
+ private Classifier container;
+
+ /**
+ * @generated
+ */
+ public SubstitutionCreateCommand(CreateRelationshipRequest request, EObject source, EObject target) {
+ super(request);
+ this.source = source;
+ this.target = target;
+ if (request.getContainmentFeature() == null) {
+ setContainmentFeature(UMLPackage.eINSTANCE.getClassifier_Substitution());
+ }
+
+ // Find container element for the new link.
+ // Climb up by containment hierarchy starting from the source
+ // and return the first element that is instance of the container class.
+ for (EObject element = source; element != null; element = element.eContainer()) {
+ if (element instanceof Classifier) {
+ container = (Classifier) element;
+ super.setElementToEdit(container);
+ break;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (source == null && target == null) {
+ return false;
+ }
+ if (source != null && false == source instanceof Classifier) {
+ return false;
+ }
+ if (target != null && false == target instanceof Classifier) {
+ return false;
+ }
+ if (getSource() == null) {
+ return true; // link creation is in progress; source is not defined yet
+ }
+ // target may be null here but it's possible to check constraint
+ if (getContainer() == null) {
+ return false;
+ }
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canCreateSubstitution_4004(getContainer(), getSource(), getTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ Substitution newElement = UMLFactory.eINSTANCE.createSubstitution();
+ getContainer().getSubstitutions().add(newElement);
+ newElement.setSubstitutingClassifier(getSource());
+ newElement.setContract(getTarget());
+ UMLElementTypes.init_Substitution_4004(newElement);
+ return newElement;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getClassifier();
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
+ }
+ return super.doExecuteWithResult(monitor, info);
+ }
+
+ /**
+ * @generated
+ */
+ protected ConfigureRequest createConfigureRequest() {
+ ConfigureRequest request = super.createConfigureRequest();
+ request.setParameter(CreateRelationshipRequest.SOURCE, getSource());
+ request.setParameter(CreateRelationshipRequest.TARGET, getTarget());
+ return request;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setElementToEdit(EObject element) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @generated
+ */
+ protected Classifier getSource() {
+ return (Classifier) source;
+ }
+
+ /**
+ * @generated
+ */
+ protected Classifier getTarget() {
+ return (Classifier) target;
+ }
+
+ /**
+ * @generated
+ */
+ public Classifier getContainer() {
+ return container;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/SubstitutionReorientCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/SubstitutionReorientCommand.java
new file mode 100644
index 00000000000..116aacdf061
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/SubstitutionReorientCommand.java
@@ -0,0 +1,169 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.uml2.uml.Classifier;
+import org.eclipse.uml2.uml.Substitution;
+
+/**
+ * @generated
+ */
+public class SubstitutionReorientCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private final int reorientDirection;
+
+ /**
+ * @generated
+ */
+ private final EObject oldEnd;
+
+ /**
+ * @generated
+ */
+ private final EObject newEnd;
+
+ /**
+ * @generated
+ */
+ public SubstitutionReorientCommand(ReorientRelationshipRequest request) {
+ super(request.getLabel(), request.getRelationship(), request);
+ reorientDirection = request.getDirection();
+ oldEnd = request.getOldRelationshipEnd();
+ newEnd = request.getNewRelationshipEnd();
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (false == getElementToEdit() instanceof Substitution) {
+ return false;
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return canReorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
+ return canReorientTarget();
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientSource() {
+ if (!(oldEnd instanceof Classifier && newEnd instanceof Classifier)) {
+ return false;
+ }
+ Classifier target = getLink().getContract();
+ if (!(getLink().eContainer() instanceof Classifier)) {
+ return false;
+ }
+ Classifier container = (Classifier) getLink().eContainer();
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canExistSubstitution_4004(container, getNewSource(), target);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientTarget() {
+ if (!(oldEnd instanceof Classifier && newEnd instanceof Classifier)) {
+ return false;
+ }
+ Classifier source = getLink().getSubstitutingClassifier();
+ if (!(getLink().eContainer() instanceof Classifier)) {
+ return false;
+ }
+ Classifier container = (Classifier) getLink().eContainer();
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canExistSubstitution_4004(container, source, getNewTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in reorient link command"); //$NON-NLS-1$
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return reorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
+ return reorientTarget();
+ }
+ throw new IllegalStateException();
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientSource() throws ExecutionException {
+ getLink().setSubstitutingClassifier(getNewSource());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientTarget() throws ExecutionException {
+ getLink().setContract(getNewTarget());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ /**
+ * @generated
+ */
+ protected Substitution getLink() {
+ return (Substitution) getElementToEdit();
+ }
+
+ /**
+ * @generated
+ */
+ protected Classifier getOldSource() {
+ return (Classifier) oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected Classifier getNewSource() {
+ return (Classifier) newEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected Classifier getOldTarget() {
+ return (Classifier) oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected Classifier getNewTarget() {
+ return (Classifier) newEnd;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/TemplateBindingCreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/TemplateBindingCreateCommand.java
new file mode 100644
index 00000000000..dc1ddf525ce
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/TemplateBindingCreateCommand.java
@@ -0,0 +1,166 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.TemplateBinding;
+import org.eclipse.uml2.uml.TemplateableElement;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class TemplateBindingCreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ private TemplateableElement container;
+
+ /**
+ * @generated
+ */
+ private final EObject source;
+
+ /**
+ * @generated
+ */
+ private final EObject target;
+
+ /**
+ * @generated
+ */
+ public TemplateBindingCreateCommand(CreateRelationshipRequest request, EObject source, EObject target) {
+ super(request);
+ this.source = source;
+ this.target = target;
+ if (request.getContainmentFeature() == null) {
+ setContainmentFeature(UMLPackage.eINSTANCE.getTemplateableElement_TemplateBinding());
+ }
+
+ // Find container element for the new link.
+ // Climb up by containment hierarchy starting from the source
+ // and return the first element that is instance of the container class.
+ for (EObject element = source; element != null; element = element.eContainer()) {
+ if (element instanceof TemplateableElement) {
+ container = (TemplateableElement) element;
+ super.setElementToEdit(container);
+ break;
+ }
+ }
+ }
+
+ /**
+ * @generated-not
+ */
+ public boolean canExecute() {
+ if (source == null && target == null) {
+ return false;
+ }
+ if (source != null && false == source instanceof TemplateableElement) {
+ return false;
+ }
+ if (target != null && false == target instanceof TemplateableElement) {
+ return false;
+ }
+ if (true == target instanceof TemplateableElement && ((TemplateableElement) target).getOwnedTemplateSignature() == null) {
+ return false;
+ }
+ if (getSource() == null) {
+ return true; // link creation is in progress; source is not defined yet
+ }
+ // target may be null here but it's possible to check constraint
+ if (getContainer() == null) {
+ return false;
+ }
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canCreateTemplateBinding_4015(getContainer(), getSource(), getTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected ConfigureRequest createConfigureRequest() {
+ ConfigureRequest request = super.createConfigureRequest();
+ request.setParameter(CreateRelationshipRequest.SOURCE, getSource());
+ request.setParameter(CreateRelationshipRequest.TARGET, getTarget());
+ return request;
+ }
+
+ /**
+ * @generated-not
+ */
+ protected EObject doDefaultElementCreation() {
+ TemplateBinding newElement = UMLFactory.eINSTANCE.createTemplateBinding();
+ getContainer().getTemplateBindings().add(newElement);
+ newElement.setBoundElement(getSource());
+ newElement.setSignature(((TemplateableElement) getTarget()).getOwnedTemplateSignature());
+ return newElement;
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
+ }
+ return super.doExecuteWithResult(monitor, info);
+ }
+
+ /**
+ * @generated
+ */
+ public TemplateableElement getContainer() {
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getTemplateableElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected TemplateableElement getSource() {
+ return (TemplateableElement) source;
+ }
+
+ /**
+ * @generated
+ */
+ protected Element getTarget() {
+ return (Element) target;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setElementToEdit(EObject element) {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/TemplateBindingReorientCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/TemplateBindingReorientCommand.java
new file mode 100644
index 00000000000..e8d871483c4
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/TemplateBindingReorientCommand.java
@@ -0,0 +1,175 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.TemplateBinding;
+import org.eclipse.uml2.uml.TemplateSignature;
+import org.eclipse.uml2.uml.TemplateableElement;
+
+/**
+ * @generated
+ */
+public class TemplateBindingReorientCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private final int reorientDirection;
+
+ /**
+ * @generated
+ */
+ private final EObject oldEnd;
+
+ /**
+ * @generated
+ */
+ private final EObject newEnd;
+
+ /**
+ * @generated
+ */
+ public TemplateBindingReorientCommand(ReorientRelationshipRequest request) {
+ super(request.getLabel(), request.getRelationship(), request);
+ reorientDirection = request.getDirection();
+ oldEnd = request.getOldRelationshipEnd();
+ newEnd = request.getNewRelationshipEnd();
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (false == getElementToEdit() instanceof TemplateBinding) {
+ return false;
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return canReorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
+ return canReorientTarget();
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientSource() {
+ if (!(oldEnd instanceof TemplateableElement && newEnd instanceof TemplateableElement)) {
+ return false;
+ }
+ if (getLink().getTargets().size() != 1) {
+ return false;
+ }
+ Element target = (Element) getLink().getTargets().get(0);
+ if (!(getLink().eContainer() instanceof TemplateableElement)) {
+ return false;
+ }
+ TemplateableElement container = (TemplateableElement) getLink().eContainer();
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canExistTemplateBinding_4015(container, getNewSource(), target);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientTarget() {
+ if (!(oldEnd instanceof Element && newEnd instanceof Element)) {
+ return false;
+ }
+ TemplateableElement source = getLink().getBoundElement();
+ if (!(getLink().eContainer() instanceof TemplateableElement)) {
+ return false;
+ }
+ TemplateableElement container = (TemplateableElement) getLink().eContainer();
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canExistTemplateBinding_4015(container, source, getNewTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in reorient link command"); //$NON-NLS-1$
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return reorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
+ return reorientTarget();
+ }
+ throw new IllegalStateException();
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientSource() throws ExecutionException {
+ getLink().setBoundElement(getNewSource());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientTarget() throws ExecutionException {
+ getLink().getTargets().remove(getOldTarget());
+ getLink().getTargets().add(getNewTarget());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ /**
+ * @generated
+ */
+ protected TemplateBinding getLink() {
+ return (TemplateBinding) getElementToEdit();
+ }
+
+ /**
+ * @generated
+ */
+ protected TemplateableElement getOldSource() {
+ return (TemplateableElement) oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected TemplateableElement getNewSource() {
+ return (TemplateableElement) newEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected Element getOldTarget() {
+ return (Element) oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected Element getNewTarget() {
+ return (Element) newEnd;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/TemplateParameterCreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/TemplateParameterCreateCommand.java
new file mode 100644
index 00000000000..d078dda8ede
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/TemplateParameterCreateCommand.java
@@ -0,0 +1,71 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.uml2.uml.TemplateParameter;
+import org.eclipse.uml2.uml.TemplateSignature;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class TemplateParameterCreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public TemplateParameterCreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getTemplateSignature();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ TemplateParameter newElement = UMLFactory.eINSTANCE.createTemplateParameter();
+
+ TemplateSignature owner = (TemplateSignature) getElementToEdit();
+ owner.getOwnedParameters().add(newElement);
+
+ TemplateSignature childHolder = (TemplateSignature) getElementToEdit();
+ childHolder.getParameters().add(newElement);
+
+ return newElement;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/UMLReorientConnectionViewCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/UMLReorientConnectionViewCommand.java
new file mode 100644
index 00000000000..7d983df2ac4
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/UMLReorientConnectionViewCommand.java
@@ -0,0 +1,80 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class UMLReorientConnectionViewCommand extends AbstractTransactionalCommand {
+
+ /**
+ * @generated
+ */
+ private IAdaptable edgeAdaptor;
+
+ /**
+ * @generated
+ */
+ public UMLReorientConnectionViewCommand(TransactionalEditingDomain editingDomain, String label) {
+ super(editingDomain, label, null);
+ }
+
+ /**
+ * @generated
+ */
+ public List getAffectedFiles() {
+ View view = (View) edgeAdaptor.getAdapter(View.class);
+ if (view != null) {
+ return getWorkspaceFiles(view);
+ }
+ return super.getAffectedFiles();
+ }
+
+ /**
+ * @generated
+ */
+ public IAdaptable getEdgeAdaptor() {
+ return edgeAdaptor;
+ }
+
+ /**
+ * @generated
+ */
+ public void setEdgeAdaptor(IAdaptable edgeAdaptor) {
+ this.edgeAdaptor = edgeAdaptor;
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info) {
+ assert null != edgeAdaptor : "Null child in UMLReorientConnectionViewCommand"; //$NON-NLS-1$
+ Edge edge = (Edge) getEdgeAdaptor().getAdapter(Edge.class);
+ assert null != edge : "Null edge in UMLReorientConnectionViewCommand"; //$NON-NLS-1$
+ View tempView = edge.getSource();
+ edge.setSource(edge.getTarget());
+ edge.setTarget(tempView);
+ return CommandResult.newOKCommandResult();
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/UsageCreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/UsageCreateCommand.java
new file mode 100644
index 00000000000..d90beabdcb0
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/UsageCreateCommand.java
@@ -0,0 +1,165 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+import org.eclipse.uml2.uml.Usage;
+
+/**
+ * @generated
+ */
+public class UsageCreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ private final EObject source;
+
+ /**
+ * @generated
+ */
+ private final EObject target;
+
+ /**
+ * @generated
+ */
+ private Package container;
+
+ /**
+ * @generated
+ */
+ public UsageCreateCommand(CreateRelationshipRequest request, EObject source, EObject target) {
+ super(request);
+ this.source = source;
+ this.target = target;
+ if (request.getContainmentFeature() == null) {
+ setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+
+ // Find container element for the new link.
+ // Climb up by containment hierarchy starting from the source
+ // and return the first element that is instance of the container class.
+ for (EObject element = source; element != null; element = element.eContainer()) {
+ if (element instanceof Package) {
+ container = (Package) element;
+ super.setElementToEdit(container);
+ break;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (source == null && target == null) {
+ return false;
+ }
+ if (source != null && false == source instanceof NamedElement) {
+ return false;
+ }
+ if (target != null && false == target instanceof NamedElement) {
+ return false;
+ }
+ if (getSource() == null) {
+ return true; // link creation is in progress; source is not defined yet
+ }
+ // target may be null here but it's possible to check constraint
+ if (getContainer() == null) {
+ return false;
+ }
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canCreateUsage_4007(getContainer(), getSource(), getTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ Usage newElement = UMLFactory.eINSTANCE.createUsage();
+ getContainer().getPackagedElements().add(newElement);
+ newElement.getClients().add(getSource());
+ newElement.getSuppliers().add(getTarget());
+ UMLElementTypes.init_Usage_4007(newElement);
+ return newElement;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getPackage();
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
+ }
+ return super.doExecuteWithResult(monitor, info);
+ }
+
+ /**
+ * @generated
+ */
+ protected ConfigureRequest createConfigureRequest() {
+ ConfigureRequest request = super.createConfigureRequest();
+ request.setParameter(CreateRelationshipRequest.SOURCE, getSource());
+ request.setParameter(CreateRelationshipRequest.TARGET, getTarget());
+ return request;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setElementToEdit(EObject element) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @generated
+ */
+ protected NamedElement getSource() {
+ return (NamedElement) source;
+ }
+
+ /**
+ * @generated
+ */
+ protected NamedElement getTarget() {
+ return (NamedElement) target;
+ }
+
+ /**
+ * @generated
+ */
+ public Package getContainer() {
+ return container;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/UsageReorientCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/UsageReorientCommand.java
new file mode 100644
index 00000000000..c3240bb0b11
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/UsageReorientCommand.java
@@ -0,0 +1,178 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.Usage;
+
+/**
+ * @generated
+ */
+public class UsageReorientCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private final int reorientDirection;
+
+ /**
+ * @generated
+ */
+ private final EObject oldEnd;
+
+ /**
+ * @generated
+ */
+ private final EObject newEnd;
+
+ /**
+ * @generated
+ */
+ public UsageReorientCommand(ReorientRelationshipRequest request) {
+ super(request.getLabel(), request.getRelationship(), request);
+ reorientDirection = request.getDirection();
+ oldEnd = request.getOldRelationshipEnd();
+ newEnd = request.getNewRelationshipEnd();
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (false == getElementToEdit() instanceof Usage) {
+ return false;
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return canReorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
+ return canReorientTarget();
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientSource() {
+ if (!(oldEnd instanceof NamedElement && newEnd instanceof NamedElement)) {
+ return false;
+ }
+ if (getLink().getSuppliers().size() != 1) {
+ return false;
+ }
+ NamedElement target = (NamedElement) getLink().getSuppliers().get(0);
+ if (!(getLink().eContainer() instanceof Package)) {
+ return false;
+ }
+ Package container = (Package) getLink().eContainer();
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canExistUsage_4007(container, getNewSource(), target);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientTarget() {
+ if (!(oldEnd instanceof NamedElement && newEnd instanceof NamedElement)) {
+ return false;
+ }
+ if (getLink().getClients().size() != 1) {
+ return false;
+ }
+ NamedElement source = (NamedElement) getLink().getClients().get(0);
+ if (!(getLink().eContainer() instanceof Package)) {
+ return false;
+ }
+ Package container = (Package) getLink().eContainer();
+ return UMLBaseItemSemanticEditPolicy.LinkConstraints.canExistUsage_4007(container, source, getNewTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in reorient link command"); //$NON-NLS-1$
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return reorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
+ return reorientTarget();
+ }
+ throw new IllegalStateException();
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientSource() throws ExecutionException {
+ getLink().getClients().remove(getOldSource());
+ getLink().getClients().add(getNewSource());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientTarget() throws ExecutionException {
+ getLink().getSuppliers().remove(getOldTarget());
+ getLink().getSuppliers().add(getNewTarget());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ /**
+ * @generated
+ */
+ protected Usage getLink() {
+ return (Usage) getElementToEdit();
+ }
+
+ /**
+ * @generated
+ */
+ protected NamedElement getOldSource() {
+ return (NamedElement) oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected NamedElement getNewSource() {
+ return (NamedElement) newEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected NamedElement getOldTarget() {
+ return (NamedElement) oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected NamedElement getNewTarget() {
+ return (NamedElement) newEnd;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/AbstractionEditHelper.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/AbstractionEditHelper.java
new file mode 100644
index 00000000000..cb471693bae
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/AbstractionEditHelper.java
@@ -0,0 +1,20 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.helpers;
+
+/**
+ * @generated
+ */
+public class AbstractionEditHelper extends UMLBaseEditHelper {
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/AssociationClassEditHelper.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/AssociationClassEditHelper.java
new file mode 100644
index 00000000000..3d2f1b72a11
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/AssociationClassEditHelper.java
@@ -0,0 +1,20 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.helpers;
+
+/**
+ * @generated
+ */
+public class AssociationClassEditHelper extends UMLBaseEditHelper {
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/AssociationEditHelper.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/AssociationEditHelper.java
new file mode 100644
index 00000000000..62cc9203580
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/AssociationEditHelper.java
@@ -0,0 +1,20 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.helpers;
+
+/**
+ * @generated
+ */
+public class AssociationEditHelper extends UMLBaseEditHelper {
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/ClassEditHelper.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/ClassEditHelper.java
new file mode 100644
index 00000000000..bcac76a97a2
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/ClassEditHelper.java
@@ -0,0 +1,20 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.helpers;
+
+/**
+ * @generated
+ */
+public class ClassEditHelper extends UMLBaseEditHelper {
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/CommentEditHelper.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/CommentEditHelper.java
new file mode 100644
index 00000000000..f3ad8a7c5a9
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/CommentEditHelper.java
@@ -0,0 +1,20 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.helpers;
+
+/**
+ * @generated
+ */
+public class CommentEditHelper extends UMLBaseEditHelper {
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/ComponentEditHelper.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/ComponentEditHelper.java
new file mode 100644
index 00000000000..23df10f1b16
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/ComponentEditHelper.java
@@ -0,0 +1,20 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.helpers;
+
+/**
+ * @generated
+ */
+public class ComponentEditHelper extends UMLBaseEditHelper {
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/ConstraintEditHelper.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/ConstraintEditHelper.java
new file mode 100644
index 00000000000..9082e162730
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/ConstraintEditHelper.java
@@ -0,0 +1,20 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.helpers;
+
+/**
+ * @generated
+ */
+public class ConstraintEditHelper extends UMLBaseEditHelper {
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/DataTypeEditHelper.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/DataTypeEditHelper.java
new file mode 100644
index 00000000000..bb740294edd
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/DataTypeEditHelper.java
@@ -0,0 +1,20 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.helpers;
+
+/**
+ * @generated
+ */
+public class DataTypeEditHelper extends UMLBaseEditHelper {
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/DependencyEditHelper.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/DependencyEditHelper.java
new file mode 100644
index 00000000000..cca2c64a77a
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/DependencyEditHelper.java
@@ -0,0 +1,20 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.helpers;
+
+/**
+ * @generated
+ */
+public class DependencyEditHelper extends UMLBaseEditHelper {
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/ElementImportEditHelper.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/ElementImportEditHelper.java
new file mode 100644
index 00000000000..da5059234f0
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/ElementImportEditHelper.java
@@ -0,0 +1,20 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.helpers;
+
+/**
+ * @generated
+ */
+public class ElementImportEditHelper extends UMLBaseEditHelper {
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/EnumerationEditHelper.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/EnumerationEditHelper.java
new file mode 100644
index 00000000000..40679285d5d
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/EnumerationEditHelper.java
@@ -0,0 +1,20 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.helpers;
+
+/**
+ * @generated
+ */
+public class EnumerationEditHelper extends UMLBaseEditHelper {
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/EnumerationLiteralEditHelper.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/EnumerationLiteralEditHelper.java
new file mode 100644
index 00000000000..b51ed34581d
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/EnumerationLiteralEditHelper.java
@@ -0,0 +1,20 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.helpers;
+
+/**
+ * @generated
+ */
+public class EnumerationLiteralEditHelper extends UMLBaseEditHelper {
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/GeneralizationEditHelper.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/GeneralizationEditHelper.java
new file mode 100644
index 00000000000..e0e54a4495b
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/GeneralizationEditHelper.java
@@ -0,0 +1,20 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.helpers;
+
+/**
+ * @generated
+ */
+public class GeneralizationEditHelper extends UMLBaseEditHelper {
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/InstanceSpecificationEditHelper.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/InstanceSpecificationEditHelper.java
new file mode 100644
index 00000000000..4961d4dafc2
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/InstanceSpecificationEditHelper.java
@@ -0,0 +1,20 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.helpers;
+
+/**
+ * @generated
+ */
+public class InstanceSpecificationEditHelper extends UMLBaseEditHelper {
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/InterfaceEditHelper.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/InterfaceEditHelper.java
new file mode 100644
index 00000000000..37bcf04f50c
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/InterfaceEditHelper.java
@@ -0,0 +1,20 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.helpers;
+
+/**
+ * @generated
+ */
+public class InterfaceEditHelper extends UMLBaseEditHelper {
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/InterfaceRealizationEditHelper.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/InterfaceRealizationEditHelper.java
new file mode 100644
index 00000000000..7153ab219a1
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/InterfaceRealizationEditHelper.java
@@ -0,0 +1,20 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.helpers;
+
+/**
+ * @generated
+ */
+public class InterfaceRealizationEditHelper extends UMLBaseEditHelper {
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/ModelEditHelper.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/ModelEditHelper.java
new file mode 100644
index 00000000000..449a64679c1
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/ModelEditHelper.java
@@ -0,0 +1,20 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.helpers;
+
+/**
+ * @generated
+ */
+public class ModelEditHelper extends UMLBaseEditHelper {
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/OperationEditHelper.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/OperationEditHelper.java
new file mode 100644
index 00000000000..a2c42dabb22
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/OperationEditHelper.java
@@ -0,0 +1,20 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.helpers;
+
+/**
+ * @generated
+ */
+public class OperationEditHelper extends UMLBaseEditHelper {
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/PackageEditHelper.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/PackageEditHelper.java
new file mode 100644
index 00000000000..e89121d4fbf
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/PackageEditHelper.java
@@ -0,0 +1,20 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.helpers;
+
+/**
+ * @generated
+ */
+public class PackageEditHelper extends UMLBaseEditHelper {
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/PackageImportEditHelper.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/PackageImportEditHelper.java
new file mode 100644
index 00000000000..0063b61de9c
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/PackageImportEditHelper.java
@@ -0,0 +1,20 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.helpers;
+
+/**
+ * @generated
+ */
+public class PackageImportEditHelper extends UMLBaseEditHelper {
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/PackageMergeEditHelper.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/PackageMergeEditHelper.java
new file mode 100644
index 00000000000..0f6318827ca
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/PackageMergeEditHelper.java
@@ -0,0 +1,20 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.helpers;
+
+/**
+ * @generated
+ */
+public class PackageMergeEditHelper extends UMLBaseEditHelper {
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/PrimitiveTypeEditHelper.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/PrimitiveTypeEditHelper.java
new file mode 100644
index 00000000000..655ff16644a
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/PrimitiveTypeEditHelper.java
@@ -0,0 +1,20 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.helpers;
+
+/**
+ * @generated
+ */
+public class PrimitiveTypeEditHelper extends UMLBaseEditHelper {
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/ProfileApplicationEditHelper.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/ProfileApplicationEditHelper.java
new file mode 100644
index 00000000000..bd6d8e0669e
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/ProfileApplicationEditHelper.java
@@ -0,0 +1,20 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.helpers;
+
+/**
+ * @generated
+ */
+public class ProfileApplicationEditHelper extends UMLBaseEditHelper {
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/PropertyEditHelper.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/PropertyEditHelper.java
new file mode 100644
index 00000000000..1803eacb98f
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/PropertyEditHelper.java
@@ -0,0 +1,20 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.helpers;
+
+/**
+ * @generated
+ */
+public class PropertyEditHelper extends UMLBaseEditHelper {
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/RealizationEditHelper.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/RealizationEditHelper.java
new file mode 100644
index 00000000000..11664a12b77
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/RealizationEditHelper.java
@@ -0,0 +1,20 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.helpers;
+
+/**
+ * @generated
+ */
+public class RealizationEditHelper extends UMLBaseEditHelper {
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/ReceptionEditHelper.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/ReceptionEditHelper.java
new file mode 100644
index 00000000000..6c2cd7a35e4
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/ReceptionEditHelper.java
@@ -0,0 +1,20 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.helpers;
+
+/**
+ * @generated
+ */
+public class ReceptionEditHelper extends UMLBaseEditHelper {
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/RedefinableTemplateSignatureEditHelper.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/RedefinableTemplateSignatureEditHelper.java
new file mode 100644
index 00000000000..ffbd7f31de5
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/RedefinableTemplateSignatureEditHelper.java
@@ -0,0 +1,20 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.helpers;
+
+/**
+ * @generated
+ */
+public class RedefinableTemplateSignatureEditHelper extends UMLBaseEditHelper {
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/SignalEditHelper.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/SignalEditHelper.java
new file mode 100644
index 00000000000..a39562a5950
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/SignalEditHelper.java
@@ -0,0 +1,20 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.helpers;
+
+/**
+ * @generated
+ */
+public class SignalEditHelper extends UMLBaseEditHelper {
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/SlotEditHelper.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/SlotEditHelper.java
new file mode 100644
index 00000000000..69ec129de76
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/SlotEditHelper.java
@@ -0,0 +1,20 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.helpers;
+
+/**
+ * @generated
+ */
+public class SlotEditHelper extends UMLBaseEditHelper {
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/SubstitutionEditHelper.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/SubstitutionEditHelper.java
new file mode 100644
index 00000000000..f75b91408df
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/SubstitutionEditHelper.java
@@ -0,0 +1,20 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.helpers;
+
+/**
+ * @generated
+ */
+public class SubstitutionEditHelper extends UMLBaseEditHelper {
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/TemplateBindingEditHelper.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/TemplateBindingEditHelper.java
new file mode 100644
index 00000000000..1a2d8b25adf
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/TemplateBindingEditHelper.java
@@ -0,0 +1,20 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.helpers;
+
+/**
+ * @generated
+ */
+public class TemplateBindingEditHelper extends UMLBaseEditHelper {
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/TemplateParameterEditHelper.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/TemplateParameterEditHelper.java
new file mode 100644
index 00000000000..1a4a75a1868
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/TemplateParameterEditHelper.java
@@ -0,0 +1,20 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.helpers;
+
+/**
+ * @generated
+ */
+public class TemplateParameterEditHelper extends UMLBaseEditHelper {
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/UMLBaseEditHelper.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/UMLBaseEditHelper.java
new file mode 100644
index 00000000000..5eac3401ec4
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/UMLBaseEditHelper.java
@@ -0,0 +1,81 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.helpers;
+
+import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelper;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
+
+/**
+ * @generated
+ */
+public class UMLBaseEditHelper extends AbstractEditHelper {
+
+ /**
+ * @generated
+ */
+ public static final String EDIT_POLICY_COMMAND = "edit policy command"; //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ protected ICommand getInsteadCommand(IEditCommandRequest req) {
+ ICommand epCommand = (ICommand) req.getParameter(EDIT_POLICY_COMMAND);
+ req.setParameter(EDIT_POLICY_COMMAND, null);
+ ICommand ehCommand = super.getInsteadCommand(req);
+ if (epCommand == null) {
+ return ehCommand;
+ }
+ if (ehCommand == null) {
+ return epCommand;
+ }
+ CompositeCommand command = new CompositeCommand(null);
+ command.add(epCommand);
+ command.add(ehCommand);
+ return command;
+ }
+
+ /**
+ * @generated
+ */
+ protected ICommand getCreateCommand(CreateElementRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected ICommand getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected ICommand getDestroyElementCommand(DestroyElementRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected ICommand getDestroyReferenceCommand(DestroyReferenceRequest req) {
+ return null;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/UsageEditHelper.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/UsageEditHelper.java
new file mode 100644
index 00000000000..a748e1fab5e
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/helpers/UsageEditHelper.java
@@ -0,0 +1,20 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.helpers;
+
+/**
+ * @generated
+ */
+public class UsageEditHelper extends UMLBaseEditHelper {
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AbstractionEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AbstractionEditPart.java
new file mode 100644
index 00000000000..c74564d156c
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AbstractionEditPart.java
@@ -0,0 +1,173 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Connection;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.AbstractionItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.common.figure.edge.DashEdgeFigure;
+
+/**
+ * @generated
+ */
+public class AbstractionEditPart extends ConnectionNodeEditPart implements ITreeBranchEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 4006;
+
+ /**
+ * @generated
+ */
+ public AbstractionEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new AbstractionItemSemanticEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof AbstractionNameEditPart) {
+ ((AbstractionNameEditPart) childEditPart).setLabel(getPrimaryShape().getDependencyNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof AbstractionName2EditPart) {
+ ((AbstractionName2EditPart) childEditPart).setLabel(getPrimaryShape().getAppliedStereotypeLabel());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+
+ protected Connection createConnectionFigure() {
+ return new DependencyDescriptor();
+ }
+
+ /**
+ * @generated
+ */
+ public DependencyDescriptor getPrimaryShape() {
+ return (DependencyDescriptor) getFigure();
+ }
+
+ /**
+ * @generated
+ */
+ public class DependencyDescriptor extends DashEdgeFigure {
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fDependencyNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fAppliedStereotypeLabel;
+
+ /**
+ * @generated
+ */
+ public DependencyDescriptor() {
+
+ this.setForegroundColor(ColorConstants.black);
+ this.setBackgroundColor(ColorConstants.black);
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ fDependencyNameLabel = new WrappingLabel();
+ fDependencyNameLabel.setText("");
+
+ this.add(fDependencyNameLabel);
+
+ fAppliedStereotypeLabel = new WrappingLabel();
+ fAppliedStereotypeLabel.setText("");
+
+ this.add(fAppliedStereotypeLabel);
+
+ }
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getDependencyNameLabel() {
+ return fDependencyNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getAppliedStereotypeLabel() {
+ return fAppliedStereotypeLabel;
+ }
+
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AbstractionName2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AbstractionName2EditPart.java
new file mode 100644
index 00000000000..aa9df9d2580
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AbstractionName2EditPart.java
@@ -0,0 +1,529 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class AbstractionName2EditPart extends LabelEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 6015;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionName2EditPart.VISUAL_ID), new Point(0, 60));
+ }
+
+ /**
+ * @generated
+ */
+ public AbstractionName2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ public int getKeyPoint() {
+ return ConnectionLocator.MIDDLE;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Abstraction_4006, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AbstractionNameEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AbstractionNameEditPart.java
new file mode 100644
index 00000000000..c90ab5e047d
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AbstractionNameEditPart.java
@@ -0,0 +1,529 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class AbstractionNameEditPart extends LabelEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 6014;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionNameEditPart.VISUAL_ID), new Point(0, 40));
+ }
+
+ /**
+ * @generated
+ */
+ public AbstractionNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ public int getKeyPoint() {
+ return ConnectionLocator.MIDDLE;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Abstraction_4006, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Association2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Association2EditPart.java
new file mode 100644
index 00000000000..cd8ad15fa5e
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Association2EditPart.java
@@ -0,0 +1,261 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Shape;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.PointList;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.Association2ItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.OpenDiagramEditPolicy;
+
+/**
+ * @generated
+ */
+public class Association2EditPart extends ShapeNodeEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 2015;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public Association2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new Association2ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy());
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+ LayoutEditPolicy lep = new LayoutEditPolicy() {
+
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ AssociationNodeDescriptor figure = new AssociationNodeDescriptor();
+ return primaryShape = figure;
+ }
+
+ /**
+ * @generated
+ */
+ public AssociationNodeDescriptor getPrimaryShape() {
+ return (AssociationNodeDescriptor) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(40), getMapMode().DPtoLP(40));
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model
+ * so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ protected NodeFigure createNodeFigure() {
+ NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ IFigure shape = createNodeShape();
+ figure.add(shape);
+ contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane.
+ * Respects layout one may have set for generated figure.
+ * @param nodeShape instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ public class AssociationNodeDescriptor extends Shape {
+
+ /**
+ * @generated
+ */
+ public AssociationNodeDescriptor() {
+ this.addPoint(new Point(getMapMode().DPtoLP(5), getMapMode().DPtoLP(0)));
+ this.addPoint(new Point(getMapMode().DPtoLP(5), getMapMode().DPtoLP(10)));
+ this.addPoint(new Point(getMapMode().DPtoLP(10), getMapMode().DPtoLP(5)));
+ this.addPoint(new Point(getMapMode().DPtoLP(0), getMapMode().DPtoLP(5)));
+ this.setFill(true);
+ this.setForegroundColor(ColorConstants.black);
+ this.setBackgroundColor(ColorConstants.white);
+ }
+
+ /**
+ * @generated
+ */
+ private final PointList myTemplate = new PointList();
+
+ /**
+ * @generated
+ */
+ private Rectangle myTemplateBounds;
+
+ /**
+ * @generated
+ */
+ public void addPoint(Point point) {
+ myTemplate.addPoint(point);
+ myTemplateBounds = null;
+ }
+
+ /**
+ * @generated
+ */
+ protected void fillShape(Graphics graphics) {
+ Rectangle bounds = getBounds();
+ graphics.pushState();
+ graphics.translate(bounds.x, bounds.y);
+ graphics.fillPolygon(scalePointList());
+ graphics.popState();
+ }
+
+ /**
+ * @generated
+ */
+ protected void outlineShape(Graphics graphics) {
+ Rectangle bounds = getBounds();
+ graphics.pushState();
+ graphics.translate(bounds.x, bounds.y);
+ graphics.drawPolygon(scalePointList());
+ graphics.popState();
+ }
+
+ /**
+ * @generated
+ */
+ private Rectangle getTemplateBounds() {
+ if (myTemplateBounds == null) {
+ myTemplateBounds = myTemplate.getBounds().getCopy().union(0, 0);
+ //just safety -- we are going to use this as divider
+ if (myTemplateBounds.width < 1) {
+ myTemplateBounds.width = 1;
+ }
+ if (myTemplateBounds.height < 1) {
+ myTemplateBounds.height = 1;
+ }
+ }
+ return myTemplateBounds;
+ }
+
+ /**
+ * @generated
+ */
+ private int[] scalePointList() {
+ Rectangle pointsBounds = getTemplateBounds();
+ Rectangle actualBounds = getBounds();
+
+ float xScale = ((float) actualBounds.width) / pointsBounds.width;
+ float yScale = ((float) actualBounds.height) / pointsBounds.height;
+
+ if (xScale == 1 && yScale == 1) {
+ return myTemplate.toIntArray();
+ }
+ int[] scaled = (int[]) myTemplate.toIntArray().clone();
+ for (int i = 0; i < scaled.length; i += 2) {
+ scaled[i] = (int) Math.floor(scaled[i] * xScale);
+ scaled[i + 1] = (int) Math.floor(scaled[i + 1] * yScale);
+ }
+ return scaled;
+ }
+
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Association3EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Association3EditPart.java
new file mode 100644
index 00000000000..bfde3c1dc2a
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Association3EditPart.java
@@ -0,0 +1,148 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Connection;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.Association3ItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.common.figure.edge.CAssociationBranchFigure;
+
+/**
+ * @generated
+ */
+public class Association3EditPart extends ConnectionNodeEditPart implements ITreeBranchEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 4019;
+
+ /**
+ * @generated
+ */
+ public Association3EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new Association3ItemSemanticEditPolicy());
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model
+ * so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+
+ protected Connection createConnectionFigure() {
+ return new AssociationBranchDescriptor();
+ }
+
+ /**
+ * @generated
+ */
+ public AssociationBranchDescriptor getPrimaryShape() {
+ return (AssociationBranchDescriptor) getFigure();
+ }
+
+ /**
+ * @generated
+ */
+ public class AssociationBranchDescriptor extends CAssociationBranchFigure {
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fRoleLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fMultiplicityLabel;
+
+ /**
+ * @generated
+ */
+ public AssociationBranchDescriptor() {
+
+ this.setForegroundColor(ColorConstants.black);
+ this.setBackgroundColor(ColorConstants.black);
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ fRoleLabel = new WrappingLabel();
+ fRoleLabel.setText("");
+
+ this.add(fRoleLabel);
+
+ fMultiplicityLabel = new WrappingLabel();
+ fMultiplicityLabel.setText("");
+
+ this.add(fMultiplicityLabel);
+
+ }
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getRoleLabel() {
+ return fRoleLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getMultiplicityLabel() {
+ return fMultiplicityLabel;
+ }
+
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationClass2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationClass2EditPart.java
new file mode 100644
index 00000000000..93243a5351c
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationClass2EditPart.java
@@ -0,0 +1,215 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Connection;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.AssociationClass2ItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.common.figure.edge.CAssociationFigure;
+
+/**
+ * @generated
+ */
+public class AssociationClass2EditPart extends ConnectionNodeEditPart implements ITreeBranchEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 4017;
+
+ /**
+ * @generated
+ */
+ public AssociationClass2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new AssociationClass2ItemSemanticEditPolicy());
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+
+ protected Connection createConnectionFigure() {
+ return new AssociationDescriptor();
+ }
+
+ /**
+ * @generated
+ */
+ public AssociationDescriptor getPrimaryShape() {
+ return (AssociationDescriptor) getFigure();
+ }
+
+ /**
+ * @generated
+ */
+ public class AssociationDescriptor extends CAssociationFigure {
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fAssociationNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fAppliedStereotypeAssociationLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fRoleSourceLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fMultiplicitySourceLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fRoleTargetLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fMultiplicityTargetLabel;
+
+ /**
+ * @generated
+ */
+ public AssociationDescriptor() {
+
+ this.setForegroundColor(ColorConstants.black);
+ this.setBackgroundColor(ColorConstants.black);
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ fAssociationNameLabel = new WrappingLabel();
+ fAssociationNameLabel.setText("");
+
+ this.add(fAssociationNameLabel);
+
+ fAppliedStereotypeAssociationLabel = new WrappingLabel();
+ fAppliedStereotypeAssociationLabel.setText("");
+
+ this.add(fAppliedStereotypeAssociationLabel);
+
+ fRoleSourceLabel = new WrappingLabel();
+ fRoleSourceLabel.setText("");
+
+ this.add(fRoleSourceLabel);
+
+ fMultiplicitySourceLabel = new WrappingLabel();
+ fMultiplicitySourceLabel.setText("");
+
+ this.add(fMultiplicitySourceLabel);
+
+ fRoleTargetLabel = new WrappingLabel();
+ fRoleTargetLabel.setText("");
+
+ this.add(fRoleTargetLabel);
+
+ fMultiplicityTargetLabel = new WrappingLabel();
+ fMultiplicityTargetLabel.setText("");
+
+ this.add(fMultiplicityTargetLabel);
+
+ }
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getAssociationNameLabel() {
+ return fAssociationNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getAppliedStereotypeAssociationLabel() {
+ return fAppliedStereotypeAssociationLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getRoleSourceLabel() {
+ return fRoleSourceLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getMultiplicitySourceLabel() {
+ return fMultiplicitySourceLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getRoleTargetLabel() {
+ return fRoleTargetLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getMultiplicityTargetLabel() {
+ return fMultiplicityTargetLabel;
+ }
+
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationClassAttributeCompartmentEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationClassAttributeCompartmentEditPart.java
new file mode 100644
index 00000000000..baf8d77eb77
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationClassAttributeCompartmentEditPart.java
@@ -0,0 +1,92 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.AssociationClassAttributeCompartmentCanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.AssociationClassAttributeCompartmentItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.Messages;
+
+/**
+ * @generated
+ */
+public class AssociationClassAttributeCompartmentEditPart extends ListCompartmentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 7034;
+
+ /**
+ * @generated
+ */
+ public AssociationClassAttributeCompartmentEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean hasModelChildrenChanged(Notification evt) {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public String getCompartmentName() {
+ return Messages.AssociationClassAttributeCompartmentEditPart_title;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure createFigure() {
+ ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new AssociationClassAttributeCompartmentItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new AssociationClassAttributeCompartmentCanonicalEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected void setRatio(Double ratio) {
+ if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationClassEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationClassEditPart.java
new file mode 100644
index 00000000000..a71590a3519
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationClassEditPart.java
@@ -0,0 +1,450 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.AssociationClassItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.OpenDiagramEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.common.figure.node.CClassifierFigure;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @generated
+ */
+public class AssociationClassEditPart extends ShapeNodeEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 2013;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public AssociationClassEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy() {
+
+ public Command getCommand(Request request) {
+ if (understandsRequest(request)) {
+ if (request instanceof CreateViewAndElementRequest) {
+ CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest) request).getViewAndElementDescriptor().getCreateElementRequestAdapter();
+ IElementType type = (IElementType) adapter.getAdapter(IElementType.class);
+ if (type == UMLElementTypes.Property_3002) {
+ EditPart compartmentEditPart = getChildBySemanticHint(UMLVisualIDRegistry.getType(AssociationClassAttributeCompartmentEditPart.VISUAL_ID));
+ return compartmentEditPart == null ? null : compartmentEditPart.getCommand(request);
+ }
+ }
+ return super.getCommand(request);
+ }
+ return null;
+ }
+ });
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new AssociationClassItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy());
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+ LayoutEditPolicy lep = new LayoutEditPolicy() {
+
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ ClassifierDescriptor figure = new ClassifierDescriptor();
+ return primaryShape = figure;
+ }
+
+ /**
+ * @generated
+ */
+ public ClassifierDescriptor getPrimaryShape() {
+ return (ClassifierDescriptor) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof AssociationClassNameEditPart) {
+ ((AssociationClassNameEditPart) childEditPart).setLabel(getPrimaryShape().getClassifierStereotypeLabel());
+ return true;
+ }
+ if (childEditPart instanceof AssociationClassName2EditPart) {
+ ((AssociationClassName2EditPart) childEditPart).setLabel(getPrimaryShape().getClassifierNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof AssociationClassQualifiedNameEditPart) {
+ ((AssociationClassQualifiedNameEditPart) childEditPart).setLabel(getPrimaryShape().getClassifierQualifiedNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof AssociationClassAttributeCompartmentEditPart) {
+ IFigure pane = getPrimaryShape().getAttributeCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((AssociationClassAttributeCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+
+ if (childEditPart instanceof AssociationClassAttributeCompartmentEditPart) {
+ IFigure pane = getPrimaryShape().getAttributeCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.remove(((AssociationClassAttributeCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+
+ if (editPart instanceof AssociationClassAttributeCompartmentEditPart) {
+ return getPrimaryShape().getAttributeCompartmentFigure();
+ }
+ return super.getContentPaneFor(editPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(40), getMapMode().DPtoLP(40));
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ protected NodeFigure createNodeFigure() {
+ NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ IFigure shape = createNodeShape();
+ figure.add(shape);
+ contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(getMapMode().DPtoLP(5));
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(AssociationClassNameEditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ public class ClassifierDescriptor extends CClassifierFigure {
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fClassifierNameLabel;
+
+ /**
+ * @generated
+ */
+ private RectangleFigure fAttributeCompartmentFigure;
+
+ /**
+ * @generated
+ */
+ private RectangleFigure fOperationCompartmentFigure;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fClassifierStereotypeLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fClassifierQualifiedNameLabel;
+
+ /**
+ * @generated
+ */
+ private RectangleFigure fNestedClassifierFigure;
+
+ /**
+ * @generated
+ */
+ public ClassifierDescriptor() {
+
+ this.setForegroundColor(THIS_FORE);
+ this.setBackgroundColor(THIS_BACK);
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ fClassifierStereotypeLabel = new WrappingLabel();
+ fClassifierStereotypeLabel.setText("");
+
+ fClassifierStereotypeLabel.setFont(FCLASSIFIERSTEREOTYPELABEL_FONT);
+
+ this.add(fClassifierStereotypeLabel);
+
+ fClassifierNameLabel = new WrappingLabel();
+ fClassifierNameLabel.setText("");
+
+ fClassifierNameLabel.setFont(FCLASSIFIERNAMELABEL_FONT);
+
+ this.add(fClassifierNameLabel);
+
+ fClassifierQualifiedNameLabel = new WrappingLabel();
+ fClassifierQualifiedNameLabel.setText("");
+
+ fClassifierQualifiedNameLabel.setFont(FCLASSIFIERQUALIFIEDNAMELABEL_FONT);
+
+ this.add(fClassifierQualifiedNameLabel);
+
+ fAttributeCompartmentFigure = new RectangleFigure();
+ fAttributeCompartmentFigure.setFill(false);
+
+ this.add(fAttributeCompartmentFigure);
+ fAttributeCompartmentFigure.setLayoutManager(new StackLayout());
+
+ fOperationCompartmentFigure = new RectangleFigure();
+ fOperationCompartmentFigure.setFill(false);
+
+ this.add(fOperationCompartmentFigure);
+ fOperationCompartmentFigure.setLayoutManager(new StackLayout());
+
+ fNestedClassifierFigure = new RectangleFigure();
+ fNestedClassifierFigure.setFill(false);
+
+ this.add(fNestedClassifierFigure);
+ fNestedClassifierFigure.setLayoutManager(new StackLayout());
+
+ }
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getClassifierNameLabel() {
+ return fClassifierNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public RectangleFigure getAttributeCompartmentFigure() {
+ return fAttributeCompartmentFigure;
+ }
+
+ /**
+ * @generated
+ */
+ public RectangleFigure getOperationCompartmentFigure() {
+ return fOperationCompartmentFigure;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getClassifierStereotypeLabel() {
+ return fClassifierStereotypeLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getClassifierQualifiedNameLabel() {
+ return fClassifierQualifiedNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public RectangleFigure getNestedClassifierFigure() {
+ return fNestedClassifierFigure;
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ static final Color THIS_FORE = new Color(null, 177, 207, 229);
+
+ /**
+ * @generated
+ */
+ static final Color THIS_BACK = new Color(null, 235, 248, 255);
+
+ /**
+ * @generated
+ */
+ static final Font FCLASSIFIERSTEREOTYPELABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.NORMAL);
+
+ /**
+ * @generated
+ */
+ static final Font FCLASSIFIERNAMELABEL_FONT = new Font(Display.getCurrent(), "Arial", 10, SWT.BOLD);
+
+ /**
+ * @generated
+ */
+ static final Font FCLASSIFIERQUALIFIEDNAMELABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.ITALIC);
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationClassName2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationClassName2EditPart.java
new file mode 100644
index 00000000000..072430bb980
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationClassName2EditPart.java
@@ -0,0 +1,554 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class AssociationClassName2EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5066;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public AssociationClassName2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ EObject parserElement = getParserElement();
+ if (parserElement == null) {
+ return null;
+ }
+ return UMLElementTypes.getImage(parserElement.eClass());
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.AssociationClass_2013, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationClassNameEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationClassNameEditPart.java
new file mode 100644
index 00000000000..333c6376da4
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationClassNameEditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class AssociationClassNameEditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5065;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public AssociationClassNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.AssociationClass_2013, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationClassQualifiedNameEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationClassQualifiedNameEditPart.java
new file mode 100644
index 00000000000..9f41b22db75
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationClassQualifiedNameEditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class AssociationClassQualifiedNameEditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5067;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public AssociationClassQualifiedNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.AssociationClass_2013, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationEditPart.java
new file mode 100644
index 00000000000..a7904e03aa1
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationEditPart.java
@@ -0,0 +1,257 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Connection;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.AssociationItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.common.figure.edge.CAssociationFigure;
+
+/**
+ * @generated
+ */
+public class AssociationEditPart extends ConnectionNodeEditPart implements ITreeBranchEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 4001;
+
+ /**
+ * @generated
+ */
+ public AssociationEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new AssociationItemSemanticEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof AssociationNameEditPart) {
+ ((AssociationNameEditPart) childEditPart).setLabel(getPrimaryShape().getAppliedStereotypeAssociationLabel());
+ return true;
+ }
+ if (childEditPart instanceof AssociationName2EditPart) {
+ ((AssociationName2EditPart) childEditPart).setLabel(getPrimaryShape().getAssociationNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof AssociationName3EditPart) {
+ ((AssociationName3EditPart) childEditPart).setLabel(getPrimaryShape().getRoleSourceLabel());
+ return true;
+ }
+ if (childEditPart instanceof AssociationName4EditPart) {
+ ((AssociationName4EditPart) childEditPart).setLabel(getPrimaryShape().getMultiplicitySourceLabel());
+ return true;
+ }
+ if (childEditPart instanceof AssociationName5EditPart) {
+ ((AssociationName5EditPart) childEditPart).setLabel(getPrimaryShape().getMultiplicityTargetLabel());
+ return true;
+ }
+ if (childEditPart instanceof AssociationName6EditPart) {
+ ((AssociationName6EditPart) childEditPart).setLabel(getPrimaryShape().getRoleTargetLabel());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+
+ protected Connection createConnectionFigure() {
+ return new AssociationDescriptor();
+ }
+
+ /**
+ * @generated
+ */
+ public AssociationDescriptor getPrimaryShape() {
+ return (AssociationDescriptor) getFigure();
+ }
+
+ /**
+ * @generated
+ */
+ public class AssociationDescriptor extends CAssociationFigure {
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fAssociationNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fAppliedStereotypeAssociationLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fRoleSourceLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fMultiplicitySourceLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fRoleTargetLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fMultiplicityTargetLabel;
+
+ /**
+ * @generated
+ */
+ public AssociationDescriptor() {
+
+ this.setForegroundColor(ColorConstants.black);
+ this.setBackgroundColor(ColorConstants.black);
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ fAssociationNameLabel = new WrappingLabel();
+ fAssociationNameLabel.setText("");
+
+ this.add(fAssociationNameLabel);
+
+ fAppliedStereotypeAssociationLabel = new WrappingLabel();
+ fAppliedStereotypeAssociationLabel.setText("");
+
+ this.add(fAppliedStereotypeAssociationLabel);
+
+ fRoleSourceLabel = new WrappingLabel();
+ fRoleSourceLabel.setText("");
+
+ this.add(fRoleSourceLabel);
+
+ fMultiplicitySourceLabel = new WrappingLabel();
+ fMultiplicitySourceLabel.setText("");
+
+ this.add(fMultiplicitySourceLabel);
+
+ fRoleTargetLabel = new WrappingLabel();
+ fRoleTargetLabel.setText("");
+
+ this.add(fRoleTargetLabel);
+
+ fMultiplicityTargetLabel = new WrappingLabel();
+ fMultiplicityTargetLabel.setText("");
+
+ this.add(fMultiplicityTargetLabel);
+
+ }
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getAssociationNameLabel() {
+ return fAssociationNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getAppliedStereotypeAssociationLabel() {
+ return fAppliedStereotypeAssociationLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getRoleSourceLabel() {
+ return fRoleSourceLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getMultiplicitySourceLabel() {
+ return fMultiplicitySourceLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getRoleTargetLabel() {
+ return fRoleTargetLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getMultiplicityTargetLabel() {
+ return fMultiplicityTargetLabel;
+ }
+
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationName2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationName2EditPart.java
new file mode 100644
index 00000000000..e260af93ace
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationName2EditPart.java
@@ -0,0 +1,529 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class AssociationName2EditPart extends LabelEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 6002;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationName2EditPart.VISUAL_ID), new Point(0, 60));
+ }
+
+ /**
+ * @generated
+ */
+ public AssociationName2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ public int getKeyPoint() {
+ return ConnectionLocator.MIDDLE;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Association_4001, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationName3EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationName3EditPart.java
new file mode 100644
index 00000000000..dca68f1d722
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationName3EditPart.java
@@ -0,0 +1,531 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.uml2.uml.Association;
+import org.eclipse.uml2.uml.Property;
+
+/**
+ * @generated
+ */
+public class AssociationName3EditPart extends LabelEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 6003;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationName3EditPart.VISUAL_ID), new Point(0, 80));
+ }
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ public AssociationName3EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ public int getKeyPoint() {
+ return ConnectionLocator.SOURCE;
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Association_4001, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationName4EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationName4EditPart.java
new file mode 100644
index 00000000000..a963e570c99
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationName4EditPart.java
@@ -0,0 +1,531 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.uml2.uml.Association;
+import org.eclipse.uml2.uml.Property;
+
+/**
+ * @generated
+ */
+public class AssociationName4EditPart extends LabelEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 6004;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationName4EditPart.VISUAL_ID), new Point(0, 100));
+ }
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ public AssociationName4EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ public int getKeyPoint() {
+ return ConnectionLocator.SOURCE;
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Association_4001, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationName5EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationName5EditPart.java
new file mode 100644
index 00000000000..19f81818391
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationName5EditPart.java
@@ -0,0 +1,531 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.uml2.uml.Association;
+import org.eclipse.uml2.uml.Property;
+
+/**
+ * @generated
+ */
+public class AssociationName5EditPart extends LabelEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 6005;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationName5EditPart.VISUAL_ID), new Point(0, 120));
+ }
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ public AssociationName5EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ public int getKeyPoint() {
+ return ConnectionLocator.TARGET;
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Association_4001, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationName6EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationName6EditPart.java
new file mode 100644
index 00000000000..5bb1ce833f2
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationName6EditPart.java
@@ -0,0 +1,531 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.uml2.uml.Association;
+import org.eclipse.uml2.uml.Property;
+
+/**
+ * @generated
+ */
+public class AssociationName6EditPart extends LabelEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 6006;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationName6EditPart.VISUAL_ID), new Point(0, 140));
+ }
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ public AssociationName6EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ public int getKeyPoint() {
+ return ConnectionLocator.TARGET;
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Association_4001, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationNameEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationNameEditPart.java
new file mode 100644
index 00000000000..fa5524c2ef0
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/AssociationNameEditPart.java
@@ -0,0 +1,529 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class AssociationNameEditPart extends LabelEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 6001;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationNameEditPart.VISUAL_ID), new Point(0, 40));
+ }
+
+ /**
+ * @generated
+ */
+ public AssociationNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ public int getKeyPoint() {
+ return ConnectionLocator.MIDDLE;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Association_4001, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Class2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Class2EditPart.java
new file mode 100644
index 00000000000..a69437e88c0
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Class2EditPart.java
@@ -0,0 +1,561 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.DragTracker;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.requests.SelectionRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ListItemComponentEditPolicy;
+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.DragEditPartsTrackerEx;
+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.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.Class2ItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextNonResizableEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class Class2EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 3004;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ public Class2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new Class2ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new UMLTextNonResizableEditPolicy());
+ installEditPolicy(EditPolicy.COMPONENT_ROLE, new ListItemComponentEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ IFigure label = createFigurePrim();
+ defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigurePrim() {
+ return new WrappingLabel();
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public DragTracker getDragTracker(Request request) {
+ if (request instanceof SelectionRequest && ((SelectionRequest) request).getLastButtonPressed() == 3) {
+ return null;
+ }
+ return new DragEditPartsTrackerEx(this);
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ EObject parserElement = getParserElement();
+ if (parserElement == null) {
+ return null;
+ }
+ return UMLElementTypes.getImage(parserElement.eClass());
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Class_3004, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Class3EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Class3EditPart.java
new file mode 100644
index 00000000000..014628b2d1a
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Class3EditPart.java
@@ -0,0 +1,561 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.DragTracker;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.requests.SelectionRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ListItemComponentEditPolicy;
+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.DragEditPartsTrackerEx;
+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.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.Class3ItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextNonResizableEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class Class3EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 3008;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public Class3EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ public DragTracker getDragTracker(Request request) {
+ if (request instanceof SelectionRequest && ((SelectionRequest) request).getLastButtonPressed() == 3) {
+ return null;
+ }
+ return new DragEditPartsTrackerEx(this);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new Class3ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new UMLTextNonResizableEditPolicy());
+ installEditPolicy(EditPolicy.COMPONENT_ROLE, new ListItemComponentEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ EObject parserElement = getParserElement();
+ if (parserElement == null) {
+ return null;
+ }
+ return UMLElementTypes.getImage(parserElement.eClass());
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Class_3008, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ IFigure label = createFigurePrim();
+ defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigurePrim() {
+ return new WrappingLabel();
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Class4EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Class4EditPart.java
new file mode 100644
index 00000000000..916f6414655
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Class4EditPart.java
@@ -0,0 +1,534 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.Class4CanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.Class4ItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.OpenDiagramEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.common.editpolicies.BorderItemResizableEditPolicy;
+import org.eclipse.papyrus.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy;
+import org.eclipse.papyrus.diagram.common.figure.node.CClassifierFigure;
+import org.eclipse.papyrus.diagram.common.locator.TemplateClassifierBorderItemLocator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @generated
+ */
+public class Class4EditPart extends AbstractBorderedShapeEditPart {
+
+ /**
+ * @generated
+ */
+ public class ClassifierDescriptor extends CClassifierFigure {
+
+ /**
+ * @generated
+ */
+ private RectangleFigure fAttributeCompartmentFigure;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fClassifierNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fClassifierQualifiedNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fClassifierStereotypeLabel;
+
+ /**
+ * @generated
+ */
+ private RectangleFigure fNestedClassifierFigure;
+
+ /**
+ * @generated
+ */
+ private RectangleFigure fOperationCompartmentFigure;
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ public ClassifierDescriptor() {
+
+ this.setForegroundColor(THIS_FORE);
+ this.setBackgroundColor(THIS_BACK);
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ fClassifierStereotypeLabel = new WrappingLabel();
+ fClassifierStereotypeLabel.setText("");
+
+ fClassifierStereotypeLabel.setFont(FCLASSIFIERSTEREOTYPELABEL_FONT);
+
+ this.add(fClassifierStereotypeLabel);
+
+ fClassifierNameLabel = new WrappingLabel();
+ fClassifierNameLabel.setText("");
+
+ fClassifierNameLabel.setFont(FCLASSIFIERNAMELABEL_FONT);
+
+ this.add(fClassifierNameLabel);
+
+ fClassifierQualifiedNameLabel = new WrappingLabel();
+ fClassifierQualifiedNameLabel.setText("");
+
+ fClassifierQualifiedNameLabel.setFont(FCLASSIFIERQUALIFIEDNAMELABEL_FONT);
+
+ this.add(fClassifierQualifiedNameLabel);
+
+ fAttributeCompartmentFigure = new RectangleFigure();
+ fAttributeCompartmentFigure.setFill(false);
+
+ this.add(fAttributeCompartmentFigure);
+ fAttributeCompartmentFigure.setLayoutManager(new StackLayout());
+
+ fOperationCompartmentFigure = new RectangleFigure();
+ fOperationCompartmentFigure.setFill(false);
+
+ this.add(fOperationCompartmentFigure);
+ fOperationCompartmentFigure.setLayoutManager(new StackLayout());
+
+ fNestedClassifierFigure = new RectangleFigure();
+ fNestedClassifierFigure.setFill(false);
+
+ this.add(fNestedClassifierFigure);
+ fNestedClassifierFigure.setLayoutManager(new StackLayout());
+
+ }
+
+ /**
+ * @generated
+ */
+ public RectangleFigure getAttributeCompartmentFigure() {
+ return fAttributeCompartmentFigure;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getClassifierNameLabel() {
+ return fClassifierNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getClassifierQualifiedNameLabel() {
+ return fClassifierQualifiedNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getClassifierStereotypeLabel() {
+ return fClassifierStereotypeLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public RectangleFigure getNestedClassifierFigure() {
+ return fNestedClassifierFigure;
+ }
+
+ /**
+ * @generated
+ */
+ public RectangleFigure getOperationCompartmentFigure() {
+ return fOperationCompartmentFigure;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ static final Font FCLASSIFIERNAMELABEL_FONT = new Font(Display.getCurrent(), "Arial", 10, SWT.BOLD);
+
+ /**
+ * @generated
+ */
+ static final Font FCLASSIFIERQUALIFIEDNAMELABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.ITALIC);
+
+ /**
+ * @generated
+ */
+ static final Font FCLASSIFIERSTEREOTYPELABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.NORMAL);
+
+ /**
+ * @generated
+ */
+ static final Color THIS_BACK = new Color(null, 235, 248, 255);
+
+ /**
+ * @generated
+ */
+ static final Color THIS_FORE = new Color(null, 177, 207, 229);
+
+ static final Color THIS_GRADIENT = new Color(null, 177, 207, 229);
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 3010;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public Class4EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof ClassName3EditPart) {
+ ((ClassName3EditPart) childEditPart).setLabel(getPrimaryShape().getClassifierStereotypeLabel());
+ return true;
+ }
+ if (childEditPart instanceof ClassName4EditPart) {
+ ((ClassName4EditPart) childEditPart).setLabel(getPrimaryShape().getClassifierNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof ClassQualifiedName2EditPart) {
+ ((ClassQualifiedName2EditPart) childEditPart).setLabel(getPrimaryShape().getClassifierQualifiedNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof ClassAttributeCompartmentEditPart) {
+ IFigure pane = getPrimaryShape().getAttributeCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((ClassAttributeCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof ClassOperationCompartmentEditPart) {
+ IFigure pane = getPrimaryShape().getOperationCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((ClassOperationCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof ClassNestedClassifierCompartmentEditPart) {
+ IFigure pane = getPrimaryShape().getNestedClassifierFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((ClassNestedClassifierCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof RedefinableTemplateSignatureEditPart) {
+ // BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.NORTH);
+ BorderItemLocator locator = new TemplateClassifierBorderItemLocator(getMainFigure(), PositionConstants.NORTH);
+ getBorderedFigure().getBorderItemContainer().add(((RedefinableTemplateSignatureEditPart) childEditPart).getFigure(), locator);
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy() {
+
+ public Command getCommand(Request request) {
+ if (understandsRequest(request)) {
+ if (request instanceof CreateViewAndElementRequest) {
+ CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest) request).getViewAndElementDescriptor().getCreateElementRequestAdapter();
+ IElementType type = (IElementType) adapter.getAdapter(IElementType.class);
+ if (type == UMLElementTypes.Property_3012) {
+ EditPart compartmentEditPart = getChildBySemanticHint(UMLVisualIDRegistry.getType(ClassAttributeCompartmentEditPart.VISUAL_ID));
+ return compartmentEditPart == null ? null : compartmentEditPart.getCommand(request);
+ }
+ if (type == UMLElementTypes.Reception_3011) {
+ EditPart compartmentEditPart = getChildBySemanticHint(UMLVisualIDRegistry.getType(ClassOperationCompartmentEditPart.VISUAL_ID));
+ return compartmentEditPart == null ? null : compartmentEditPart.getCommand(request);
+ }
+ if (type == UMLElementTypes.Operation_3013) {
+ EditPart compartmentEditPart = getChildBySemanticHint(UMLVisualIDRegistry.getType(ClassOperationCompartmentEditPart.VISUAL_ID));
+ return compartmentEditPart == null ? null : compartmentEditPart.getCommand(request);
+ }
+ if (type == UMLElementTypes.Class_3014) {
+ EditPart compartmentEditPart = getChildBySemanticHint(UMLVisualIDRegistry.getType(ClassNestedClassifierCompartmentEditPart.VISUAL_ID));
+ return compartmentEditPart == null ? null : compartmentEditPart.getCommand(request);
+ }
+ }
+ return super.getCommand(request);
+ }
+ return null;
+ }
+ });
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new Class4ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new Class4CanonicalEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy());
+ installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy());
+
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+ LayoutEditPolicy lep = new LayoutEditPolicy() {
+
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ if (child instanceof IBorderItemEditPart) {
+ // return new BorderItemSelectionEditPolicy();
+ return new BorderItemResizableEditPolicy();
+ }
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ protected NodeFigure createMainFigure() {
+ NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ IFigure shape = createNodeShape();
+ figure.add(shape);
+ contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(40), getMapMode().DPtoLP(40));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ ClassifierDescriptor figure = new ClassifierDescriptor();
+ return primaryShape = figure;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+
+ if (editPart instanceof ClassAttributeCompartmentEditPart) {
+ return getPrimaryShape().getAttributeCompartmentFigure();
+ }
+ if (editPart instanceof ClassOperationCompartmentEditPart) {
+ return getPrimaryShape().getOperationCompartmentFigure();
+ }
+ if (editPart instanceof ClassNestedClassifierCompartmentEditPart) {
+ return getPrimaryShape().getNestedClassifierFigure();
+ }
+ if (editPart instanceof RedefinableTemplateSignatureEditPart) {
+ return getBorderedFigure().getBorderItemContainer();
+ }
+ return super.getContentPaneFor(editPart);
+ }
+
+ /**
+ * @generated
+ */
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(ClassName3EditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ public ClassifierDescriptor getPrimaryShape() {
+ return (ClassifierDescriptor) primaryShape;
+ }
+
+ // custom code in order to refresh the figure if the class is active
+ protected void handleNotificationEvent(Notification event) {
+ super.handleNotificationEvent(event);
+ if (resolveSemanticElement().equals(event.getNotifier()) && (event.getFeature() instanceof EAttribute) && ((EAttribute) (event.getFeature())).getName().equals("isActive")) {
+ ((CClassifierFigure) getFigure()).setActive(event.getNewBooleanValue());
+ refreshVisuals();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+
+ if (childEditPart instanceof ClassAttributeCompartmentEditPart) {
+ IFigure pane = getPrimaryShape().getAttributeCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.remove(((ClassAttributeCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof ClassOperationCompartmentEditPart) {
+ IFigure pane = getPrimaryShape().getOperationCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.remove(((ClassOperationCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof ClassNestedClassifierCompartmentEditPart) {
+ IFigure pane = getPrimaryShape().getNestedClassifierFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.remove(((ClassNestedClassifierCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof RedefinableTemplateSignatureEditPart) {
+ getBorderedFigure().getBorderItemContainer().remove(((RedefinableTemplateSignatureEditPart) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(getMapMode().DPtoLP(5));
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Class5EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Class5EditPart.java
new file mode 100644
index 00000000000..de0b77a4884
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Class5EditPart.java
@@ -0,0 +1,561 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.DragTracker;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.requests.SelectionRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ListItemComponentEditPolicy;
+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.DragEditPartsTrackerEx;
+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.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.Class5ItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextNonResizableEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class Class5EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 3014;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public Class5EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ public DragTracker getDragTracker(Request request) {
+ if (request instanceof SelectionRequest && ((SelectionRequest) request).getLastButtonPressed() == 3) {
+ return null;
+ }
+ return new DragEditPartsTrackerEx(this);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new Class5ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new UMLTextNonResizableEditPolicy());
+ installEditPolicy(EditPolicy.COMPONENT_ROLE, new ListItemComponentEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ EObject parserElement = getParserElement();
+ if (parserElement == null) {
+ return null;
+ }
+ return UMLElementTypes.getImage(parserElement.eClass());
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Class_3014, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ IFigure label = createFigurePrim();
+ defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigurePrim() {
+ return new WrappingLabel();
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassAttributeCompartment2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassAttributeCompartment2EditPart.java
new file mode 100644
index 00000000000..7ca5844fc6b
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassAttributeCompartment2EditPart.java
@@ -0,0 +1,92 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.ClassAttributeCompartment2CanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.ClassAttributeCompartment2ItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.Messages;
+
+/**
+ * @generated
+ */
+public class ClassAttributeCompartment2EditPart extends ListCompartmentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 7017;
+
+ /**
+ * @generated
+ */
+ public ClassAttributeCompartment2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean hasModelChildrenChanged(Notification evt) {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public String getCompartmentName() {
+ return Messages.ClassAttributeCompartment2EditPart_title;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure createFigure() {
+ ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ClassAttributeCompartment2ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new ClassAttributeCompartment2CanonicalEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected void setRatio(Double ratio) {
+ if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassAttributeCompartmentEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassAttributeCompartmentEditPart.java
new file mode 100644
index 00000000000..ca1cbdf5070
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassAttributeCompartmentEditPart.java
@@ -0,0 +1,92 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.ClassAttributeCompartmentCanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.ClassAttributeCompartmentItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.Messages;
+
+/**
+ * @generated
+ */
+public class ClassAttributeCompartmentEditPart extends ListCompartmentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 7011;
+
+ /**
+ * @generated
+ */
+ public ClassAttributeCompartmentEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean hasModelChildrenChanged(Notification evt) {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public String getCompartmentName() {
+ return Messages.ClassAttributeCompartmentEditPart_title;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure createFigure() {
+ ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ClassAttributeCompartmentItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new ClassAttributeCompartmentCanonicalEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected void setRatio(Double ratio) {
+ if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassEditPart.java
new file mode 100644
index 00000000000..7351a9ee380
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassEditPart.java
@@ -0,0 +1,539 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.ClassCanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.ClassItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.OpenDiagramEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.common.editpolicies.BorderItemResizableEditPolicy;
+import org.eclipse.papyrus.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy;
+import org.eclipse.papyrus.diagram.common.figure.node.CClassifierFigure;
+import org.eclipse.papyrus.diagram.common.locator.TemplateClassifierBorderItemLocator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @generated
+ */
+public class ClassEditPart extends AbstractBorderedShapeEditPart {
+
+ /**
+ * @generated
+ */
+ public class ClassifierDescriptor extends CClassifierFigure {
+
+ /**
+ * @generated
+ */
+ private RectangleFigure fAttributeCompartmentFigure;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fClassifierNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fClassifierQualifiedNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fClassifierStereotypeLabel;
+
+ /**
+ * @generated
+ */
+ private RectangleFigure fNestedClassifierFigure;
+
+ /**
+ * @generated
+ */
+ private RectangleFigure fOperationCompartmentFigure;
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ public ClassifierDescriptor() {
+
+ this.setForegroundColor(THIS_FORE);
+ this.setBackgroundColor(THIS_BACK);
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ fClassifierStereotypeLabel = new WrappingLabel();
+ fClassifierStereotypeLabel.setText("");
+
+ fClassifierStereotypeLabel.setFont(FCLASSIFIERSTEREOTYPELABEL_FONT);
+
+ this.add(fClassifierStereotypeLabel);
+
+ fClassifierNameLabel = new WrappingLabel();
+ fClassifierNameLabel.setText("");
+
+ fClassifierNameLabel.setFont(FCLASSIFIERNAMELABEL_FONT);
+
+ this.add(fClassifierNameLabel);
+
+ fClassifierQualifiedNameLabel = new WrappingLabel();
+ fClassifierQualifiedNameLabel.setText("");
+
+ fClassifierQualifiedNameLabel.setFont(FCLASSIFIERQUALIFIEDNAMELABEL_FONT);
+
+ this.add(fClassifierQualifiedNameLabel);
+
+ fAttributeCompartmentFigure = new RectangleFigure();
+ fAttributeCompartmentFigure.setFill(false);
+
+ this.add(fAttributeCompartmentFigure);
+ fAttributeCompartmentFigure.setLayoutManager(new StackLayout());
+
+ fOperationCompartmentFigure = new RectangleFigure();
+ fOperationCompartmentFigure.setFill(false);
+
+ this.add(fOperationCompartmentFigure);
+ fOperationCompartmentFigure.setLayoutManager(new StackLayout());
+
+ fNestedClassifierFigure = new RectangleFigure();
+ fNestedClassifierFigure.setFill(false);
+
+ this.add(fNestedClassifierFigure);
+ fNestedClassifierFigure.setLayoutManager(new StackLayout());
+
+ }
+
+ /**
+ * @generated
+ */
+ public RectangleFigure getAttributeCompartmentFigure() {
+ return fAttributeCompartmentFigure;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getClassifierNameLabel() {
+ return fClassifierNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getClassifierQualifiedNameLabel() {
+ return fClassifierQualifiedNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getClassifierStereotypeLabel() {
+ return fClassifierStereotypeLabel;
+ }
+
+ @Override
+ public Color getGradientColor() {
+ return THIS_GRADIENT;
+ }
+
+ /**
+ * @generated
+ */
+ public RectangleFigure getNestedClassifierFigure() {
+ return fNestedClassifierFigure;
+ }
+
+ /**
+ * @generated
+ */
+ public RectangleFigure getOperationCompartmentFigure() {
+ return fOperationCompartmentFigure;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ static final Font FCLASSIFIERNAMELABEL_FONT = new Font(Display.getCurrent(), "Arial", 10, SWT.BOLD);
+
+ /**
+ * @generated
+ */
+ static final Font FCLASSIFIERQUALIFIEDNAMELABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.ITALIC);
+
+ /**
+ * @generated
+ */
+ static final Font FCLASSIFIERSTEREOTYPELABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.NORMAL);
+
+ /**
+ * @generated
+ */
+ static final Color THIS_BACK = new Color(null, 235, 248, 255);
+
+ /**
+ * @generated
+ */
+ static final Color THIS_FORE = new Color(null, 177, 207, 229);
+
+ static final Color THIS_GRADIENT = new Color(null, 177, 207, 229);
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 2008;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public ClassEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof ClassNameEditPart) {
+ ((ClassNameEditPart) childEditPart).setLabel(getPrimaryShape().getClassifierStereotypeLabel());
+ return true;
+ }
+ if (childEditPart instanceof ClassName2EditPart) {
+ ((ClassName2EditPart) childEditPart).setLabel(getPrimaryShape().getClassifierNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof ClassQualifiedNameEditPart) {
+ ((ClassQualifiedNameEditPart) childEditPart).setLabel(getPrimaryShape().getClassifierQualifiedNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof ClassAttributeCompartment2EditPart) {
+ IFigure pane = getPrimaryShape().getAttributeCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((ClassAttributeCompartment2EditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof ClassOperationCompartment2EditPart) {
+ IFigure pane = getPrimaryShape().getOperationCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((ClassOperationCompartment2EditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof ClassNestedClassifierCompartment2EditPart) {
+ IFigure pane = getPrimaryShape().getNestedClassifierFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((ClassNestedClassifierCompartment2EditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof RedefinableTemplateSignatureEditPart) {
+ // BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.NORTH);
+ BorderItemLocator locator = new TemplateClassifierBorderItemLocator(getMainFigure(), PositionConstants.NORTH);
+ getBorderedFigure().getBorderItemContainer().add(((RedefinableTemplateSignatureEditPart) childEditPart).getFigure(), locator);
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy() {
+
+ public Command getCommand(Request request) {
+ if (understandsRequest(request)) {
+ if (request instanceof CreateViewAndElementRequest) {
+ CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest) request).getViewAndElementDescriptor().getCreateElementRequestAdapter();
+ IElementType type = (IElementType) adapter.getAdapter(IElementType.class);
+ if (type == UMLElementTypes.Property_3012) {
+ EditPart compartmentEditPart = getChildBySemanticHint(UMLVisualIDRegistry.getType(ClassAttributeCompartment2EditPart.VISUAL_ID));
+ return compartmentEditPart == null ? null : compartmentEditPart.getCommand(request);
+ }
+ if (type == UMLElementTypes.Reception_3011) {
+ EditPart compartmentEditPart = getChildBySemanticHint(UMLVisualIDRegistry.getType(ClassOperationCompartment2EditPart.VISUAL_ID));
+ return compartmentEditPart == null ? null : compartmentEditPart.getCommand(request);
+ }
+ if (type == UMLElementTypes.Operation_3013) {
+ EditPart compartmentEditPart = getChildBySemanticHint(UMLVisualIDRegistry.getType(ClassOperationCompartment2EditPart.VISUAL_ID));
+ return compartmentEditPart == null ? null : compartmentEditPart.getCommand(request);
+ }
+ if (type == UMLElementTypes.Class_3014) {
+ EditPart compartmentEditPart = getChildBySemanticHint(UMLVisualIDRegistry.getType(ClassNestedClassifierCompartment2EditPart.VISUAL_ID));
+ return compartmentEditPart == null ? null : compartmentEditPart.getCommand(request);
+ }
+ }
+ return super.getCommand(request);
+ }
+ return null;
+ }
+ });
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ClassItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new ClassCanonicalEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy());
+ installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy());
+
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+ LayoutEditPolicy lep = new LayoutEditPolicy() {
+
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ if (child instanceof IBorderItemEditPart) {
+ // return new BorderItemSelectionEditPolicy();
+ return new BorderItemResizableEditPolicy();
+ }
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ protected NodeFigure createMainFigure() {
+ NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ IFigure shape = createNodeShape();
+ figure.add(shape);
+ contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(40), getMapMode().DPtoLP(40));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ ClassifierDescriptor figure = new ClassifierDescriptor();
+ return primaryShape = figure;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+
+ if (editPart instanceof ClassAttributeCompartment2EditPart) {
+ return getPrimaryShape().getAttributeCompartmentFigure();
+ }
+ if (editPart instanceof ClassOperationCompartment2EditPart) {
+ return getPrimaryShape().getOperationCompartmentFigure();
+ }
+ if (editPart instanceof ClassNestedClassifierCompartment2EditPart) {
+ return getPrimaryShape().getNestedClassifierFigure();
+ }
+ if (editPart instanceof RedefinableTemplateSignatureEditPart) {
+ return getBorderedFigure().getBorderItemContainer();
+ }
+ return super.getContentPaneFor(editPart);
+ }
+
+ /**
+ * @generated not
+ */
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(ClassName2EditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ public ClassifierDescriptor getPrimaryShape() {
+ return (ClassifierDescriptor) primaryShape;
+ }
+
+ // custom code in order to refresh the figure if the class is active
+ protected void handleNotificationEvent(Notification event) {
+ super.handleNotificationEvent(event);
+ if (resolveSemanticElement().equals(event.getNotifier()) && (event.getFeature() instanceof EAttribute) && ((EAttribute) (event.getFeature())).getName().equals("isActive")) {
+ ((CClassifierFigure) getFigure()).setActive(event.getNewBooleanValue());
+ refreshVisuals();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+
+ if (childEditPart instanceof ClassAttributeCompartment2EditPart) {
+ IFigure pane = getPrimaryShape().getAttributeCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.remove(((ClassAttributeCompartment2EditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof ClassOperationCompartment2EditPart) {
+ IFigure pane = getPrimaryShape().getOperationCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.remove(((ClassOperationCompartment2EditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof ClassNestedClassifierCompartment2EditPart) {
+ IFigure pane = getPrimaryShape().getNestedClassifierFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.remove(((ClassNestedClassifierCompartment2EditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof RedefinableTemplateSignatureEditPart) {
+ getBorderedFigure().getBorderItemContainer().remove(((RedefinableTemplateSignatureEditPart) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(getMapMode().DPtoLP(5));
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassName2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassName2EditPart.java
new file mode 100644
index 00000000000..f208abdfae2
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassName2EditPart.java
@@ -0,0 +1,554 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class ClassName2EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5029;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ public ClassName2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ EObject parserElement = getParserElement();
+ if (parserElement == null) {
+ return null;
+ }
+ return UMLElementTypes.getImage(parserElement.eClass());
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Class_2008, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated not
+ */
+ protected boolean isEditable() {
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassName3EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassName3EditPart.java
new file mode 100644
index 00000000000..f4209ae7cf8
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassName3EditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class ClassName3EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5013;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public ClassName3EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Class_3010, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassName4EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassName4EditPart.java
new file mode 100644
index 00000000000..8ca85c006ba
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassName4EditPart.java
@@ -0,0 +1,554 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class ClassName4EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5014;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public ClassName4EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ EObject parserElement = getParserElement();
+ if (parserElement == null) {
+ return null;
+ }
+ return UMLElementTypes.getImage(parserElement.eClass());
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Class_3010, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassNameEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassNameEditPart.java
new file mode 100644
index 00000000000..a0dbb98948b
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassNameEditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class ClassNameEditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5028;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public ClassNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Class_2008, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassNestedClassifierCompartment2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassNestedClassifierCompartment2EditPart.java
new file mode 100644
index 00000000000..07de3802b94
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassNestedClassifierCompartment2EditPart.java
@@ -0,0 +1,92 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.ClassNestedClassifierCompartment2CanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.ClassNestedClassifierCompartment2ItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.Messages;
+
+/**
+ * @generated
+ */
+public class ClassNestedClassifierCompartment2EditPart extends ListCompartmentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 7019;
+
+ /**
+ * @generated
+ */
+ public ClassNestedClassifierCompartment2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean hasModelChildrenChanged(Notification evt) {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public String getCompartmentName() {
+ return Messages.ClassNestedClassifierCompartment2EditPart_title;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure createFigure() {
+ ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ClassNestedClassifierCompartment2ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new ClassNestedClassifierCompartment2CanonicalEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected void setRatio(Double ratio) {
+ if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassNestedClassifierCompartmentEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassNestedClassifierCompartmentEditPart.java
new file mode 100644
index 00000000000..12ebd01ec13
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassNestedClassifierCompartmentEditPart.java
@@ -0,0 +1,92 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.ClassNestedClassifierCompartmentCanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.ClassNestedClassifierCompartmentItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.Messages;
+
+/**
+ * @generated
+ */
+public class ClassNestedClassifierCompartmentEditPart extends ListCompartmentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 7013;
+
+ /**
+ * @generated
+ */
+ public ClassNestedClassifierCompartmentEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean hasModelChildrenChanged(Notification evt) {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public String getCompartmentName() {
+ return Messages.ClassNestedClassifierCompartmentEditPart_title;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure createFigure() {
+ ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ClassNestedClassifierCompartmentItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new ClassNestedClassifierCompartmentCanonicalEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected void setRatio(Double ratio) {
+ if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassOperationCompartment2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassOperationCompartment2EditPart.java
new file mode 100644
index 00000000000..aff560ee791
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassOperationCompartment2EditPart.java
@@ -0,0 +1,92 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.ClassOperationCompartment2CanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.ClassOperationCompartment2ItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.Messages;
+
+/**
+ * @generated
+ */
+public class ClassOperationCompartment2EditPart extends ListCompartmentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 7018;
+
+ /**
+ * @generated
+ */
+ public ClassOperationCompartment2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean hasModelChildrenChanged(Notification evt) {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public String getCompartmentName() {
+ return Messages.ClassOperationCompartment2EditPart_title;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure createFigure() {
+ ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ClassOperationCompartment2ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new ClassOperationCompartment2CanonicalEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected void setRatio(Double ratio) {
+ if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassOperationCompartmentEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassOperationCompartmentEditPart.java
new file mode 100644
index 00000000000..a234eb9f2a3
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassOperationCompartmentEditPart.java
@@ -0,0 +1,92 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.ClassOperationCompartmentCanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.ClassOperationCompartmentItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.Messages;
+
+/**
+ * @generated
+ */
+public class ClassOperationCompartmentEditPart extends ListCompartmentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 7012;
+
+ /**
+ * @generated
+ */
+ public ClassOperationCompartmentEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean hasModelChildrenChanged(Notification evt) {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public String getCompartmentName() {
+ return Messages.ClassOperationCompartmentEditPart_title;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure createFigure() {
+ ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ClassOperationCompartmentItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new ClassOperationCompartmentCanonicalEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected void setRatio(Double ratio) {
+ if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassQualifiedName2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassQualifiedName2EditPart.java
new file mode 100644
index 00000000000..01fd281a2d3
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassQualifiedName2EditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class ClassQualifiedName2EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5015;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public ClassQualifiedName2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Class_3010, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassQualifiedNameEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassQualifiedNameEditPart.java
new file mode 100644
index 00000000000..e01585525b9
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ClassQualifiedNameEditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class ClassQualifiedNameEditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5030;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public ClassQualifiedNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Class_2008, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Comment2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Comment2EditPart.java
new file mode 100644
index 00000000000..c3150da0e92
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Comment2EditPart.java
@@ -0,0 +1,298 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.Comment2ItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.OpenDiagramEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.common.figure.node.CornerBentFigure;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @generated
+ */
+public class Comment2EditPart extends ShapeNodeEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 3028;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public Comment2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new Comment2ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy());
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+ LayoutEditPolicy lep = new LayoutEditPolicy() {
+
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ CornerBentDescriptor figure = new CornerBentDescriptor();
+ return primaryShape = figure;
+ }
+
+ /**
+ * @generated
+ */
+ public CornerBentDescriptor getPrimaryShape() {
+ return (CornerBentDescriptor) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof CommentBody2EditPart) {
+ ((CommentBody2EditPart) childEditPart).setLabel(getPrimaryShape().getCornerBentContentLabel());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+
+ return super.getContentPaneFor(editPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(40), getMapMode().DPtoLP(40));
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ protected NodeFigure createNodeFigure() {
+ NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ IFigure shape = createNodeShape();
+ figure.add(shape);
+ contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(getMapMode().DPtoLP(5));
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(CommentBody2EditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ public class CornerBentDescriptor extends CornerBentFigure {
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fCornerBentContentLabel;
+
+ /**
+ * @generated
+ */
+ public CornerBentDescriptor() {
+
+ this.setForegroundColor(ColorConstants.black);
+ this.setBackgroundColor(THIS_BACK);
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ fCornerBentContentLabel = new WrappingLabel();
+ fCornerBentContentLabel.setText("");
+
+ fCornerBentContentLabel.setFont(FCORNERBENTCONTENTLABEL_FONT);
+
+ this.add(fCornerBentContentLabel);
+
+ }
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getCornerBentContentLabel() {
+ return fCornerBentContentLabel;
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ static final Color THIS_BACK = new Color(null, 248, 249, 214);
+
+ /**
+ * @generated
+ */
+ static final Font FCORNERBENTCONTENTLABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.NORMAL);
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/CommentAnnotatedElementEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/CommentAnnotatedElementEditPart.java
new file mode 100644
index 00000000000..adedda64ef6
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/CommentAnnotatedElementEditPart.java
@@ -0,0 +1,84 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.Connection;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.CommentAnnotatedElementItemSemanticEditPolicy;
+
+/**
+ * @generated
+ */
+public class CommentAnnotatedElementEditPart extends ConnectionNodeEditPart implements ITreeBranchEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 4013;
+
+ /**
+ * @generated
+ */
+ public CommentAnnotatedElementEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CommentAnnotatedElementItemSemanticEditPolicy());
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+
+ protected Connection createConnectionFigure() {
+ return new CommentLinkDescriptor();
+ }
+
+ /**
+ * @generated
+ */
+ public CommentLinkDescriptor getPrimaryShape() {
+ return (CommentLinkDescriptor) getFigure();
+ }
+
+ /**
+ * @generated
+ */
+ public class CommentLinkDescriptor extends PolylineConnectionEx {
+
+ /**
+ * @generated
+ */
+ public CommentLinkDescriptor() {
+ this.setLineStyle(Graphics.LINE_DASH);
+
+ }
+
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/CommentBody2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/CommentBody2EditPart.java
new file mode 100644
index 00000000000..e2fa6600733
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/CommentBody2EditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class CommentBody2EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5063;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public CommentBody2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Comment_3028, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/CommentBodyEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/CommentBodyEditPart.java
new file mode 100644
index 00000000000..8894dc254c4
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/CommentBodyEditPart.java
@@ -0,0 +1,663 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.text.FlowPage;
+import org.eclipse.draw2d.text.TextFlow;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.CellEditorLocator;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.papyrus.diagram.common.directedit.FigureControler;
+import org.eclipse.papyrus.diagram.common.directedit.ILabelControler;
+import org.eclipse.papyrus.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.diagram.common.directedit.PropertyAccessor;
+import org.eclipse.papyrus.diagram.common.directedit.TextFlowCellEditorLocator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.uml2.uml.Comment;
+
+/**
+ * @generated
+ */
+public class CommentBodyEditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5038;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ public CommentBodyEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Comment_2012, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @custom Init the label direct edit manager. This method should be called when a Direct Edit request is performed.
+ */
+ protected void initLabelEditManager() {
+ if (manager == null) {
+ // locator for the cell editor (on the name label)
+ CellEditorLocator locator = null;
+ final IFigure textFigure = (IFigure) (((FlowPage) ((WrappingLabel) getFigure()).getTextFigure()).getChildren().get(0));
+ if (textFigure instanceof TextFlow) {
+ locator = new TextFlowCellEditorLocator((TextFlow) textFigure);
+ }
+
+ // defining how properties are modified in the model
+ PropertyAccessor accessor = new PropertyAccessor() {
+
+ public String getPropertyName() {
+ return "Body";
+ }
+
+ public String getValue() {
+ return ((Comment) getParserElement()).getBody();
+ }
+
+ public void setValue(String value) {
+ ((Comment) getParserElement()).setBody(value);
+ }
+ };
+ // defines the controler: link between model and view
+ ILabelControler labelControler = new FigureControler(textFigure, accessor);
+
+ // creates the editing manager.
+ manager = new MultilineLabelDirectEditManager(this, locator, labelControler);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ // protected void performDirectEdit() {
+ // getManager().show();
+ // }
+ /**
+ * {@inheritDoc}
+ */
+ // custom code
+ public void performDirectEdit(Request req) {
+ initLabelEditManager();
+ manager.show();
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ // custom code
+ public void performRequest(Request request) {
+ if (RequestConstants.REQ_DIRECT_EDIT.equals(request.getType())) {
+ performDirectEdit(request);
+ }
+ }
+
+ /**
+ * @generated-not
+ */
+ // private void performDirectEdit(char initialCharacter) {
+ // if (getManager() instanceof TextDirectEditManager) {
+ // ((TextDirectEditManager) getManager()).show(initialCharacter);
+ // } else {
+ // performDirectEdit();
+ // }
+ // }
+ /**
+ * @generated-not
+ */
+ // protected void performDirectEdit(Point eventLocation) {
+ // if (getManager().getClass() == TextDirectEditManager.class) {
+ // ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ // }
+ // }
+ /**
+ * @generated-not
+ */
+ // protected void performDirectEditRequest(Request request) {
+ // final Request theRequest = request;
+ // try {
+ // getEditingDomain().runExclusive(new Runnable() {
+ //
+ // public void run() {
+ // if (isActive() && isEditable()) {
+ // if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ // Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ // performDirectEdit(initialChar.charValue());
+ // } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ // DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ // performDirectEdit(editRequest.getLocation());
+ // } else {
+ // performDirectEdit();
+ // }
+ // }
+ // }
+ // });
+ // } catch (InterruptedException e) {
+ // e.printStackTrace();
+ // }
+ // }
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/CommentEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/CommentEditPart.java
new file mode 100644
index 00000000000..1934d85ae91
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/CommentEditPart.java
@@ -0,0 +1,299 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.CommentItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.OpenDiagramEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.common.figure.node.CornerBentFigure;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @generated
+ */
+public class CommentEditPart extends ShapeNodeEditPart {
+
+ /**
+ * @generated
+ */
+ public class CornerBentDescriptor extends CornerBentFigure {
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fCornerBentContentLabel;
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ public CornerBentDescriptor() {
+
+ this.setForegroundColor(ColorConstants.black);
+ this.setBackgroundColor(THIS_BACK);
+ createContents();
+ }
+
+ /**
+ * @generated-not
+ */
+ private void createContents() {
+
+ fCornerBentContentLabel = new WrappingLabel();
+ fCornerBentContentLabel.setText("");
+ // fCornerBentContentLabel.setTextStrikeThrough(true);
+ fCornerBentContentLabel.setTextWrap(true);
+ fCornerBentContentLabel.setFont(FCORNERBENTCONTENTLABEL_FONT);
+
+ this.add(fCornerBentContentLabel);
+
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getCornerBentContentLabel() {
+ return fCornerBentContentLabel;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ static final Color THIS_BACK = new Color(null, 248, 249, 214);
+
+ /**
+ * @generated
+ */
+ static final Font FCORNERBENTCONTENTLABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.NORMAL);
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 2012;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public CommentEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof CommentBodyEditPart) {
+ ((CommentBodyEditPart) childEditPart).setLabel(getPrimaryShape().getCornerBentContentLabel());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CommentItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy());
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+ LayoutEditPolicy lep = new LayoutEditPolicy() {
+
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ protected NodeFigure createNodeFigure() {
+ NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ IFigure shape = createNodeShape();
+ figure.add(shape);
+ contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(40), getMapMode().DPtoLP(40));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ CornerBentDescriptor figure = new CornerBentDescriptor();
+ return primaryShape = figure;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+
+ return super.getContentPaneFor(editPart);
+ }
+
+ /**
+ * @generated
+ */
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(CommentBodyEditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ public CornerBentDescriptor getPrimaryShape() {
+ return (CornerBentDescriptor) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+
+ return false;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(getMapMode().DPtoLP(5));
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/CommentLinkDescriptorEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/CommentLinkDescriptorEditPart.java
new file mode 100644
index 00000000000..315a2797035
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/CommentLinkDescriptorEditPart.java
@@ -0,0 +1,86 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.Connection;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ViewComponentEditPolicy;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class CommentLinkDescriptorEditPart extends ConnectionNodeEditPart implements ITreeBranchEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 4016;
+
+ /**
+ * @generated
+ */
+ public CommentLinkDescriptorEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.COMPONENT_ROLE, new ViewComponentEditPolicy());
+ removeEditPolicy(EditPolicyRoles.SEMANTIC_ROLE);
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+
+ protected Connection createConnectionFigure() {
+ return new CommentLinkDescriptor();
+ }
+
+ /**
+ * @generated
+ */
+ public CommentLinkDescriptor getPrimaryShape() {
+ return (CommentLinkDescriptor) getFigure();
+ }
+
+ /**
+ * @generated
+ */
+ public class CommentLinkDescriptor extends PolylineConnectionEx {
+
+ /**
+ * @generated
+ */
+ public CommentLinkDescriptor() {
+ this.setLineStyle(Graphics.LINE_DASH);
+
+ }
+
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Component2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Component2EditPart.java
new file mode 100644
index 00000000000..9902a8ee70a
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Component2EditPart.java
@@ -0,0 +1,517 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.Component2CanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.Component2ItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.OpenDiagramEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.common.editpolicies.BorderItemResizableEditPolicy;
+import org.eclipse.papyrus.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy;
+import org.eclipse.papyrus.diagram.common.figure.node.CClassifierFigure;
+import org.eclipse.papyrus.diagram.common.locator.TemplateClassifierBorderItemLocator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @generated
+ */
+public class Component2EditPart extends AbstractBorderedShapeEditPart {
+
+ /**
+ * @generated
+ */
+ public class ClassifierDescriptor extends CClassifierFigure {
+
+ /**
+ * @generated
+ */
+ private RectangleFigure fAttributeCompartmentFigure;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fClassifierNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fClassifierQualifiedNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fClassifierStereotypeLabel;
+
+ /**
+ * @generated
+ */
+ private RectangleFigure fNestedClassifierFigure;
+
+ /**
+ * @generated
+ */
+ private RectangleFigure fOperationCompartmentFigure;
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ public ClassifierDescriptor() {
+
+ this.setForegroundColor(THIS_FORE);
+ this.setBackgroundColor(THIS_BACK);
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ fClassifierStereotypeLabel = new WrappingLabel();
+ fClassifierStereotypeLabel.setText("");
+
+ fClassifierStereotypeLabel.setFont(FCLASSIFIERSTEREOTYPELABEL_FONT);
+
+ this.add(fClassifierStereotypeLabel);
+
+ fClassifierNameLabel = new WrappingLabel();
+ fClassifierNameLabel.setText("");
+
+ fClassifierNameLabel.setFont(FCLASSIFIERNAMELABEL_FONT);
+
+ this.add(fClassifierNameLabel);
+
+ fClassifierQualifiedNameLabel = new WrappingLabel();
+ fClassifierQualifiedNameLabel.setText("");
+
+ fClassifierQualifiedNameLabel.setFont(FCLASSIFIERQUALIFIEDNAMELABEL_FONT);
+
+ this.add(fClassifierQualifiedNameLabel);
+
+ fAttributeCompartmentFigure = new RectangleFigure();
+ fAttributeCompartmentFigure.setFill(false);
+
+ this.add(fAttributeCompartmentFigure);
+ fAttributeCompartmentFigure.setLayoutManager(new StackLayout());
+
+ fOperationCompartmentFigure = new RectangleFigure();
+ fOperationCompartmentFigure.setFill(false);
+
+ this.add(fOperationCompartmentFigure);
+ fOperationCompartmentFigure.setLayoutManager(new StackLayout());
+
+ fNestedClassifierFigure = new RectangleFigure();
+ fNestedClassifierFigure.setFill(false);
+
+ this.add(fNestedClassifierFigure);
+ fNestedClassifierFigure.setLayoutManager(new StackLayout());
+
+ }
+
+ /**
+ * @generated
+ */
+ public RectangleFigure getAttributeCompartmentFigure() {
+ return fAttributeCompartmentFigure;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getClassifierNameLabel() {
+ return fClassifierNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getClassifierQualifiedNameLabel() {
+ return fClassifierQualifiedNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getClassifierStereotypeLabel() {
+ return fClassifierStereotypeLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public RectangleFigure getNestedClassifierFigure() {
+ return fNestedClassifierFigure;
+ }
+
+ /**
+ * @generated
+ */
+ public RectangleFigure getOperationCompartmentFigure() {
+ return fOperationCompartmentFigure;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ static final Font FCLASSIFIERNAMELABEL_FONT = new Font(Display.getCurrent(), "Arial", 10, SWT.BOLD);
+
+ /**
+ * @generated
+ */
+ static final Font FCLASSIFIERQUALIFIEDNAMELABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.ITALIC);
+
+ /**
+ * @generated
+ */
+ static final Font FCLASSIFIERSTEREOTYPELABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.NORMAL);
+
+ /**
+ * @generated
+ */
+ static final Color THIS_BACK = new Color(null, 235, 248, 255);
+
+ /**
+ * @generated
+ */
+ static final Color THIS_FORE = new Color(null, 177, 207, 229);
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 3021;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public Component2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof ComponentName3EditPart) {
+ ((ComponentName3EditPart) childEditPart).setLabel(getPrimaryShape().getClassifierStereotypeLabel());
+ return true;
+ }
+ if (childEditPart instanceof ComponentName4EditPart) {
+ ((ComponentName4EditPart) childEditPart).setLabel(getPrimaryShape().getClassifierNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof ComponentQualifiedName2EditPart) {
+ ((ComponentQualifiedName2EditPart) childEditPart).setLabel(getPrimaryShape().getClassifierQualifiedNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof ComponentAttributeCompartment2EditPart) {
+ IFigure pane = getPrimaryShape().getAttributeCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((ComponentAttributeCompartment2EditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof ComponentOperationCompartment2EditPart) {
+ IFigure pane = getPrimaryShape().getOperationCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((ComponentOperationCompartment2EditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof ComponentNestedClassifierCompartment2EditPart) {
+ IFigure pane = getPrimaryShape().getNestedClassifierFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((ComponentNestedClassifierCompartment2EditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof RedefinableTemplateSignatureEditPart) {
+ // BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.NORTH);
+ BorderItemLocator locator = new TemplateClassifierBorderItemLocator(getMainFigure(), PositionConstants.NORTH);
+ getBorderedFigure().getBorderItemContainer().add(((RedefinableTemplateSignatureEditPart) childEditPart).getFigure(), locator);
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy() {
+
+ public Command getCommand(Request request) {
+ if (understandsRequest(request)) {
+ if (request instanceof CreateViewAndElementRequest) {
+ CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest) request).getViewAndElementDescriptor().getCreateElementRequestAdapter();
+ IElementType type = (IElementType) adapter.getAdapter(IElementType.class);
+ if (type == UMLElementTypes.Property_3002) {
+ EditPart compartmentEditPart = getChildBySemanticHint(UMLVisualIDRegistry.getType(ComponentAttributeCompartment2EditPart.VISUAL_ID));
+ return compartmentEditPart == null ? null : compartmentEditPart.getCommand(request);
+ }
+ if (type == UMLElementTypes.Operation_3003) {
+ EditPart compartmentEditPart = getChildBySemanticHint(UMLVisualIDRegistry.getType(ComponentOperationCompartment2EditPart.VISUAL_ID));
+ return compartmentEditPart == null ? null : compartmentEditPart.getCommand(request);
+ }
+ if (type == UMLElementTypes.Class_3004) {
+ EditPart compartmentEditPart = getChildBySemanticHint(UMLVisualIDRegistry.getType(ComponentNestedClassifierCompartment2EditPart.VISUAL_ID));
+ return compartmentEditPart == null ? null : compartmentEditPart.getCommand(request);
+ }
+ }
+ return super.getCommand(request);
+ }
+ return null;
+ }
+ });
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new Component2ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new Component2CanonicalEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy());
+ installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy());
+
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+ LayoutEditPolicy lep = new LayoutEditPolicy() {
+
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ if (child instanceof IBorderItemEditPart) {
+ // return new BorderItemSelectionEditPolicy();
+ return new BorderItemResizableEditPolicy();
+ }
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ protected NodeFigure createMainFigure() {
+ NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ IFigure shape = createNodeShape();
+ figure.add(shape);
+ contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(40), getMapMode().DPtoLP(40));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ ClassifierDescriptor figure = new ClassifierDescriptor();
+ return primaryShape = figure;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+
+ if (editPart instanceof ComponentAttributeCompartment2EditPart) {
+ return getPrimaryShape().getAttributeCompartmentFigure();
+ }
+ if (editPart instanceof ComponentOperationCompartment2EditPart) {
+ return getPrimaryShape().getOperationCompartmentFigure();
+ }
+ if (editPart instanceof ComponentNestedClassifierCompartment2EditPart) {
+ return getPrimaryShape().getNestedClassifierFigure();
+ }
+ if (editPart instanceof RedefinableTemplateSignatureEditPart) {
+ return getBorderedFigure().getBorderItemContainer();
+ }
+ return super.getContentPaneFor(editPart);
+ }
+
+ /**
+ * @generated
+ */
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(ComponentName3EditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ public ClassifierDescriptor getPrimaryShape() {
+ return (ClassifierDescriptor) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+
+ if (childEditPart instanceof ComponentAttributeCompartment2EditPart) {
+ IFigure pane = getPrimaryShape().getAttributeCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.remove(((ComponentAttributeCompartment2EditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof ComponentOperationCompartment2EditPart) {
+ IFigure pane = getPrimaryShape().getOperationCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.remove(((ComponentOperationCompartment2EditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof ComponentNestedClassifierCompartment2EditPart) {
+ IFigure pane = getPrimaryShape().getNestedClassifierFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.remove(((ComponentNestedClassifierCompartment2EditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof RedefinableTemplateSignatureEditPart) {
+ getBorderedFigure().getBorderItemContainer().remove(((RedefinableTemplateSignatureEditPart) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(getMapMode().DPtoLP(5));
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentAttributeCompartment2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentAttributeCompartment2EditPart.java
new file mode 100644
index 00000000000..2816c2bb534
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentAttributeCompartment2EditPart.java
@@ -0,0 +1,92 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.ComponentAttributeCompartment2CanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.ComponentAttributeCompartment2ItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.Messages;
+
+/**
+ * @generated
+ */
+public class ComponentAttributeCompartment2EditPart extends ListCompartmentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 7023;
+
+ /**
+ * @generated
+ */
+ public ComponentAttributeCompartment2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean hasModelChildrenChanged(Notification evt) {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public String getCompartmentName() {
+ return Messages.ComponentAttributeCompartment2EditPart_title;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure createFigure() {
+ ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ComponentAttributeCompartment2ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new ComponentAttributeCompartment2CanonicalEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected void setRatio(Double ratio) {
+ if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentAttributeCompartmentEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentAttributeCompartmentEditPart.java
new file mode 100644
index 00000000000..c9d0ae72495
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentAttributeCompartmentEditPart.java
@@ -0,0 +1,92 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.ComponentAttributeCompartmentCanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.ComponentAttributeCompartmentItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.Messages;
+
+/**
+ * @generated
+ */
+public class ComponentAttributeCompartmentEditPart extends ListCompartmentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 7002;
+
+ /**
+ * @generated
+ */
+ public ComponentAttributeCompartmentEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean hasModelChildrenChanged(Notification evt) {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public String getCompartmentName() {
+ return Messages.ComponentAttributeCompartmentEditPart_title;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure createFigure() {
+ ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ComponentAttributeCompartmentItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new ComponentAttributeCompartmentCanonicalEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected void setRatio(Double ratio) {
+ if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentEditPart.java
new file mode 100644
index 00000000000..2b200c447f7
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentEditPart.java
@@ -0,0 +1,524 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.ComponentCanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.ComponentItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.OpenDiagramEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.common.editpolicies.BorderItemResizableEditPolicy;
+import org.eclipse.papyrus.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy;
+import org.eclipse.papyrus.diagram.common.figure.node.CClassifierFigure;
+import org.eclipse.papyrus.diagram.common.locator.TemplateClassifierBorderItemLocator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @generated
+ */
+public class ComponentEditPart extends AbstractBorderedShapeEditPart {
+
+ /**
+ * @generated
+ */
+ public class ClassifierDescriptor extends CClassifierFigure {
+
+ /**
+ * @generated
+ */
+ private RectangleFigure fAttributeCompartmentFigure;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fClassifierNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fClassifierQualifiedNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fClassifierStereotypeLabel;
+
+ /**
+ * @generated
+ */
+ private RectangleFigure fNestedClassifierFigure;
+
+ /**
+ * @generated
+ */
+ private RectangleFigure fOperationCompartmentFigure;
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ public ClassifierDescriptor() {
+
+ this.setForegroundColor(THIS_FORE);
+ this.setBackgroundColor(THIS_BACK);
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ fClassifierStereotypeLabel = new WrappingLabel();
+ fClassifierStereotypeLabel.setText("");
+
+ fClassifierStereotypeLabel.setFont(FCLASSIFIERSTEREOTYPELABEL_FONT);
+
+ this.add(fClassifierStereotypeLabel);
+
+ fClassifierNameLabel = new WrappingLabel();
+ fClassifierNameLabel.setText("");
+
+ fClassifierNameLabel.setFont(FCLASSIFIERNAMELABEL_FONT);
+
+ this.add(fClassifierNameLabel);
+
+ fClassifierQualifiedNameLabel = new WrappingLabel();
+ fClassifierQualifiedNameLabel.setText("");
+
+ fClassifierQualifiedNameLabel.setFont(FCLASSIFIERQUALIFIEDNAMELABEL_FONT);
+
+ this.add(fClassifierQualifiedNameLabel);
+
+ fAttributeCompartmentFigure = new RectangleFigure();
+ fAttributeCompartmentFigure.setFill(false);
+
+ this.add(fAttributeCompartmentFigure);
+ fAttributeCompartmentFigure.setLayoutManager(new StackLayout());
+
+ fOperationCompartmentFigure = new RectangleFigure();
+ fOperationCompartmentFigure.setFill(false);
+
+ this.add(fOperationCompartmentFigure);
+ fOperationCompartmentFigure.setLayoutManager(new StackLayout());
+
+ fNestedClassifierFigure = new RectangleFigure();
+ fNestedClassifierFigure.setFill(false);
+
+ this.add(fNestedClassifierFigure);
+ fNestedClassifierFigure.setLayoutManager(new StackLayout());
+
+ }
+
+ /**
+ * @generated
+ */
+ public RectangleFigure getAttributeCompartmentFigure() {
+ return fAttributeCompartmentFigure;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getClassifierNameLabel() {
+ return fClassifierNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getClassifierQualifiedNameLabel() {
+ return fClassifierQualifiedNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getClassifierStereotypeLabel() {
+ return fClassifierStereotypeLabel;
+ }
+
+ @Override
+ public Color getGradientColor() {
+ return THIS_GRADIENT;
+ }
+
+ /**
+ * @generated
+ */
+ public RectangleFigure getNestedClassifierFigure() {
+ return fNestedClassifierFigure;
+ }
+
+ /**
+ * @generated
+ */
+ public RectangleFigure getOperationCompartmentFigure() {
+ return fOperationCompartmentFigure;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ static final Font FCLASSIFIERNAMELABEL_FONT = new Font(Display.getCurrent(), "Arial", 10, SWT.BOLD);
+
+ /**
+ * @generated
+ */
+ static final Font FCLASSIFIERQUALIFIEDNAMELABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.ITALIC);
+
+ /**
+ * @generated
+ */
+ static final Font FCLASSIFIERSTEREOTYPELABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.NORMAL);
+
+ /**
+ * @generated
+ */
+ static final Color THIS_BACK = new Color(null, 235, 248, 255);
+
+ /**
+ * @generated
+ */
+ static final Color THIS_FORE = new Color(null, 177, 207, 229);
+
+ static final Color THIS_GRADIENT = new Color(null, 177, 207, 229);
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 2002;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public ComponentEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof ComponentNameEditPart) {
+ ((ComponentNameEditPart) childEditPart).setLabel(getPrimaryShape().getClassifierStereotypeLabel());
+ return true;
+ }
+ if (childEditPart instanceof ComponentName2EditPart) {
+ ((ComponentName2EditPart) childEditPart).setLabel(getPrimaryShape().getClassifierNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof ComponentQualifiedNameEditPart) {
+ ((ComponentQualifiedNameEditPart) childEditPart).setLabel(getPrimaryShape().getClassifierQualifiedNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof ComponentAttributeCompartmentEditPart) {
+ IFigure pane = getPrimaryShape().getAttributeCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((ComponentAttributeCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof ComponentOperationCompartmentEditPart) {
+ IFigure pane = getPrimaryShape().getOperationCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((ComponentOperationCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof ComponentNestedClassifierCompartmentEditPart) {
+ IFigure pane = getPrimaryShape().getNestedClassifierFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((ComponentNestedClassifierCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof RedefinableTemplateSignatureEditPart) {
+ // BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.NORTH);
+ BorderItemLocator locator = new TemplateClassifierBorderItemLocator(getMainFigure(), PositionConstants.NORTH);
+ getBorderedFigure().getBorderItemContainer().add(((RedefinableTemplateSignatureEditPart) childEditPart).getFigure(), locator);
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy() {
+
+ public Command getCommand(Request request) {
+ if (understandsRequest(request)) {
+ if (request instanceof CreateViewAndElementRequest) {
+ CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest) request).getViewAndElementDescriptor().getCreateElementRequestAdapter();
+ IElementType type = (IElementType) adapter.getAdapter(IElementType.class);
+ if (type == UMLElementTypes.Property_3002) {
+ EditPart compartmentEditPart = getChildBySemanticHint(UMLVisualIDRegistry.getType(ComponentAttributeCompartmentEditPart.VISUAL_ID));
+ return compartmentEditPart == null ? null : compartmentEditPart.getCommand(request);
+ }
+ if (type == UMLElementTypes.Operation_3003) {
+ EditPart compartmentEditPart = getChildBySemanticHint(UMLVisualIDRegistry.getType(ComponentOperationCompartmentEditPart.VISUAL_ID));
+ return compartmentEditPart == null ? null : compartmentEditPart.getCommand(request);
+ }
+ if (type == UMLElementTypes.Class_3004) {
+ EditPart compartmentEditPart = getChildBySemanticHint(UMLVisualIDRegistry.getType(ComponentNestedClassifierCompartmentEditPart.VISUAL_ID));
+ return compartmentEditPart == null ? null : compartmentEditPart.getCommand(request);
+ }
+ }
+ return super.getCommand(request);
+ }
+ return null;
+ }
+ });
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ComponentItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new ComponentCanonicalEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy());
+ installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy());
+
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+ LayoutEditPolicy lep = new LayoutEditPolicy() {
+
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ if (child instanceof IBorderItemEditPart) {
+ // return new BorderItemSelectionEditPolicy();
+ return new BorderItemResizableEditPolicy();
+ }
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ protected NodeFigure createMainFigure() {
+ NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ IFigure shape = createNodeShape();
+ figure.add(shape);
+ contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(40), getMapMode().DPtoLP(40));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ ClassifierDescriptor figure = new ClassifierDescriptor();
+ return primaryShape = figure;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+
+ if (editPart instanceof ComponentAttributeCompartmentEditPart) {
+ return getPrimaryShape().getAttributeCompartmentFigure();
+ }
+ if (editPart instanceof ComponentOperationCompartmentEditPart) {
+ return getPrimaryShape().getOperationCompartmentFigure();
+ }
+ if (editPart instanceof ComponentNestedClassifierCompartmentEditPart) {
+ return getPrimaryShape().getNestedClassifierFigure();
+ }
+ if (editPart instanceof RedefinableTemplateSignatureEditPart) {
+ return getBorderedFigure().getBorderItemContainer();
+ }
+ return super.getContentPaneFor(editPart);
+ }
+
+ /**
+ * @generated not
+ */
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(ComponentName2EditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ public ClassifierDescriptor getPrimaryShape() {
+ return (ClassifierDescriptor) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+
+ if (childEditPart instanceof ComponentAttributeCompartmentEditPart) {
+ IFigure pane = getPrimaryShape().getAttributeCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.remove(((ComponentAttributeCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof ComponentOperationCompartmentEditPart) {
+ IFigure pane = getPrimaryShape().getOperationCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.remove(((ComponentOperationCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof ComponentNestedClassifierCompartmentEditPart) {
+ IFigure pane = getPrimaryShape().getNestedClassifierFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.remove(((ComponentNestedClassifierCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof RedefinableTemplateSignatureEditPart) {
+ getBorderedFigure().getBorderItemContainer().remove(((RedefinableTemplateSignatureEditPart) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(getMapMode().DPtoLP(5));
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentName2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentName2EditPart.java
new file mode 100644
index 00000000000..3a74efd875e
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentName2EditPart.java
@@ -0,0 +1,554 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class ComponentName2EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5005;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ public ComponentName2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ EObject parserElement = getParserElement();
+ if (parserElement == null) {
+ return null;
+ }
+ return UMLElementTypes.getImage(parserElement.eClass());
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Component_2002, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated not
+ */
+ protected boolean isEditable() {
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentName3EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentName3EditPart.java
new file mode 100644
index 00000000000..7c19f6ddc41
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentName3EditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class ComponentName3EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5042;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public ComponentName3EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Component_3021, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentName4EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentName4EditPart.java
new file mode 100644
index 00000000000..40137bfcfca
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentName4EditPart.java
@@ -0,0 +1,554 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class ComponentName4EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5043;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public ComponentName4EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ EObject parserElement = getParserElement();
+ if (parserElement == null) {
+ return null;
+ }
+ return UMLElementTypes.getImage(parserElement.eClass());
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Component_3021, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentNameEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentNameEditPart.java
new file mode 100644
index 00000000000..f52c8d3b498
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentNameEditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class ComponentNameEditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5004;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public ComponentNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Component_2002, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentNestedClassifierCompartment2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentNestedClassifierCompartment2EditPart.java
new file mode 100644
index 00000000000..441707b906b
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentNestedClassifierCompartment2EditPart.java
@@ -0,0 +1,92 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.ComponentNestedClassifierCompartment2CanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.ComponentNestedClassifierCompartment2ItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.Messages;
+
+/**
+ * @generated
+ */
+public class ComponentNestedClassifierCompartment2EditPart extends ListCompartmentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 7025;
+
+ /**
+ * @generated
+ */
+ public ComponentNestedClassifierCompartment2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean hasModelChildrenChanged(Notification evt) {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public String getCompartmentName() {
+ return Messages.ComponentNestedClassifierCompartment2EditPart_title;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure createFigure() {
+ ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ComponentNestedClassifierCompartment2ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new ComponentNestedClassifierCompartment2CanonicalEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected void setRatio(Double ratio) {
+ if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentNestedClassifierCompartmentEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentNestedClassifierCompartmentEditPart.java
new file mode 100644
index 00000000000..434f0b77c0f
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentNestedClassifierCompartmentEditPart.java
@@ -0,0 +1,92 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.ComponentNestedClassifierCompartmentCanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.ComponentNestedClassifierCompartmentItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.Messages;
+
+/**
+ * @generated
+ */
+public class ComponentNestedClassifierCompartmentEditPart extends ListCompartmentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 7004;
+
+ /**
+ * @generated
+ */
+ public ComponentNestedClassifierCompartmentEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean hasModelChildrenChanged(Notification evt) {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public String getCompartmentName() {
+ return Messages.ComponentNestedClassifierCompartmentEditPart_title;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure createFigure() {
+ ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ComponentNestedClassifierCompartmentItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new ComponentNestedClassifierCompartmentCanonicalEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected void setRatio(Double ratio) {
+ if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentOperationCompartment2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentOperationCompartment2EditPart.java
new file mode 100644
index 00000000000..f4ffcc7cd0e
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentOperationCompartment2EditPart.java
@@ -0,0 +1,92 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.ComponentOperationCompartment2CanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.ComponentOperationCompartment2ItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.Messages;
+
+/**
+ * @generated
+ */
+public class ComponentOperationCompartment2EditPart extends ListCompartmentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 7024;
+
+ /**
+ * @generated
+ */
+ public ComponentOperationCompartment2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean hasModelChildrenChanged(Notification evt) {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public String getCompartmentName() {
+ return Messages.ComponentOperationCompartment2EditPart_title;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure createFigure() {
+ ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ComponentOperationCompartment2ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new ComponentOperationCompartment2CanonicalEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected void setRatio(Double ratio) {
+ if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentOperationCompartmentEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentOperationCompartmentEditPart.java
new file mode 100644
index 00000000000..caeb68e988d
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentOperationCompartmentEditPart.java
@@ -0,0 +1,92 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.ComponentOperationCompartmentCanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.ComponentOperationCompartmentItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.Messages;
+
+/**
+ * @generated
+ */
+public class ComponentOperationCompartmentEditPart extends ListCompartmentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 7003;
+
+ /**
+ * @generated
+ */
+ public ComponentOperationCompartmentEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean hasModelChildrenChanged(Notification evt) {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public String getCompartmentName() {
+ return Messages.ComponentOperationCompartmentEditPart_title;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure createFigure() {
+ ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ComponentOperationCompartmentItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new ComponentOperationCompartmentCanonicalEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected void setRatio(Double ratio) {
+ if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentQualifiedName2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentQualifiedName2EditPart.java
new file mode 100644
index 00000000000..e76bad3a39f
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentQualifiedName2EditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class ComponentQualifiedName2EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5044;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public ComponentQualifiedName2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Component_3021, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentQualifiedNameEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentQualifiedNameEditPart.java
new file mode 100644
index 00000000000..59a8d1712d2
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ComponentQualifiedNameEditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class ComponentQualifiedNameEditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5006;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public ComponentQualifiedNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Component_2002, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Constraint2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Constraint2EditPart.java
new file mode 100644
index 00000000000..fa8e412d587
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Constraint2EditPart.java
@@ -0,0 +1,298 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.Constraint2ItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.OpenDiagramEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.common.figure.node.CornerBentFigure;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @generated
+ */
+public class Constraint2EditPart extends ShapeNodeEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 3029;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public Constraint2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new Constraint2ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy());
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+ LayoutEditPolicy lep = new LayoutEditPolicy() {
+
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ CornerBentDescriptor figure = new CornerBentDescriptor();
+ return primaryShape = figure;
+ }
+
+ /**
+ * @generated
+ */
+ public CornerBentDescriptor getPrimaryShape() {
+ return (CornerBentDescriptor) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof ConstraintName2EditPart) {
+ ((ConstraintName2EditPart) childEditPart).setLabel(getPrimaryShape().getCornerBentContentLabel());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+
+ return super.getContentPaneFor(editPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(40), getMapMode().DPtoLP(40));
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ protected NodeFigure createNodeFigure() {
+ NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ IFigure shape = createNodeShape();
+ figure.add(shape);
+ contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(getMapMode().DPtoLP(5));
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(ConstraintName2EditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ public class CornerBentDescriptor extends CornerBentFigure {
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fCornerBentContentLabel;
+
+ /**
+ * @generated
+ */
+ public CornerBentDescriptor() {
+
+ this.setForegroundColor(ColorConstants.black);
+ this.setBackgroundColor(THIS_BACK);
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ fCornerBentContentLabel = new WrappingLabel();
+ fCornerBentContentLabel.setText("");
+
+ fCornerBentContentLabel.setFont(FCORNERBENTCONTENTLABEL_FONT);
+
+ this.add(fCornerBentContentLabel);
+
+ }
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getCornerBentContentLabel() {
+ return fCornerBentContentLabel;
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ static final Color THIS_BACK = new Color(null, 248, 249, 214);
+
+ /**
+ * @generated
+ */
+ static final Font FCORNERBENTCONTENTLABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.NORMAL);
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ConstraintConstrainedElementEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ConstraintConstrainedElementEditPart.java
new file mode 100644
index 00000000000..877096d4e64
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ConstraintConstrainedElementEditPart.java
@@ -0,0 +1,84 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.Connection;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.ConstraintConstrainedElementItemSemanticEditPolicy;
+
+/**
+ * @generated
+ */
+public class ConstraintConstrainedElementEditPart extends ConnectionNodeEditPart implements ITreeBranchEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 4014;
+
+ /**
+ * @generated
+ */
+ public ConstraintConstrainedElementEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ConstraintConstrainedElementItemSemanticEditPolicy());
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+
+ protected Connection createConnectionFigure() {
+ return new CommentLinkDescriptor();
+ }
+
+ /**
+ * @generated
+ */
+ public CommentLinkDescriptor getPrimaryShape() {
+ return (CommentLinkDescriptor) getFigure();
+ }
+
+ /**
+ * @generated
+ */
+ public class CommentLinkDescriptor extends PolylineConnectionEx {
+
+ /**
+ * @generated
+ */
+ public CommentLinkDescriptor() {
+ this.setLineStyle(Graphics.LINE_DASH);
+
+ }
+
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ConstraintEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ConstraintEditPart.java
new file mode 100644
index 00000000000..60bb42790d4
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ConstraintEditPart.java
@@ -0,0 +1,298 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.ConstraintItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.OpenDiagramEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.common.figure.node.CornerBentFigure;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @generated
+ */
+public class ConstraintEditPart extends ShapeNodeEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 2011;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public ConstraintEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ConstraintItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy());
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+ LayoutEditPolicy lep = new LayoutEditPolicy() {
+
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ CornerBentDescriptor figure = new CornerBentDescriptor();
+ return primaryShape = figure;
+ }
+
+ /**
+ * @generated
+ */
+ public CornerBentDescriptor getPrimaryShape() {
+ return (CornerBentDescriptor) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof ConstraintNameEditPart) {
+ ((ConstraintNameEditPart) childEditPart).setLabel(getPrimaryShape().getCornerBentContentLabel());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+
+ return super.getContentPaneFor(editPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(40), getMapMode().DPtoLP(40));
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ protected NodeFigure createNodeFigure() {
+ NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ IFigure shape = createNodeShape();
+ figure.add(shape);
+ contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(getMapMode().DPtoLP(5));
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(ConstraintNameEditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ public class CornerBentDescriptor extends CornerBentFigure {
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fCornerBentContentLabel;
+
+ /**
+ * @generated
+ */
+ public CornerBentDescriptor() {
+
+ this.setForegroundColor(ColorConstants.black);
+ this.setBackgroundColor(THIS_BACK);
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ fCornerBentContentLabel = new WrappingLabel();
+ fCornerBentContentLabel.setText("");
+
+ fCornerBentContentLabel.setFont(FCORNERBENTCONTENTLABEL_FONT);
+
+ this.add(fCornerBentContentLabel);
+
+ }
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getCornerBentContentLabel() {
+ return fCornerBentContentLabel;
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ static final Color THIS_BACK = new Color(null, 248, 249, 214);
+
+ /**
+ * @generated
+ */
+ static final Font FCORNERBENTCONTENTLABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.NORMAL);
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ConstraintName2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ConstraintName2EditPart.java
new file mode 100644
index 00000000000..bd5b04de5dd
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ConstraintName2EditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class ConstraintName2EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5064;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public ConstraintName2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Constraint_3029, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ConstraintNameEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ConstraintNameEditPart.java
new file mode 100644
index 00000000000..2c2df52d84e
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ConstraintNameEditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class ConstraintNameEditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5037;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public ConstraintNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Constraint_2011, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataType2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataType2EditPart.java
new file mode 100644
index 00000000000..5fa46fb1b77
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataType2EditPart.java
@@ -0,0 +1,498 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.DataType2CanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.DataType2ItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.OpenDiagramEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.common.editpolicies.BorderItemResizableEditPolicy;
+import org.eclipse.papyrus.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy;
+import org.eclipse.papyrus.diagram.common.figure.node.CClassifierFigure;
+import org.eclipse.papyrus.diagram.common.locator.TemplateClassifierBorderItemLocator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @generated
+ */
+public class DataType2EditPart extends AbstractBorderedShapeEditPart {
+
+ /**
+ * @generated
+ */
+ public class ClassifierDescriptor extends CClassifierFigure {
+
+ /**
+ * @generated
+ */
+ private RectangleFigure fAttributeCompartmentFigure;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fClassifierNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fClassifierQualifiedNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fClassifierStereotypeLabel;
+
+ /**
+ * @generated
+ */
+ private RectangleFigure fNestedClassifierFigure;
+
+ /**
+ * @generated
+ */
+ private RectangleFigure fOperationCompartmentFigure;
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ public ClassifierDescriptor() {
+
+ this.setForegroundColor(THIS_FORE);
+ this.setBackgroundColor(THIS_BACK);
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ fClassifierStereotypeLabel = new WrappingLabel();
+ fClassifierStereotypeLabel.setText("");
+
+ fClassifierStereotypeLabel.setFont(FCLASSIFIERSTEREOTYPELABEL_FONT);
+
+ this.add(fClassifierStereotypeLabel);
+
+ fClassifierNameLabel = new WrappingLabel();
+ fClassifierNameLabel.setText("");
+
+ fClassifierNameLabel.setFont(FCLASSIFIERNAMELABEL_FONT);
+
+ this.add(fClassifierNameLabel);
+
+ fClassifierQualifiedNameLabel = new WrappingLabel();
+ fClassifierQualifiedNameLabel.setText("");
+
+ fClassifierQualifiedNameLabel.setFont(FCLASSIFIERQUALIFIEDNAMELABEL_FONT);
+
+ this.add(fClassifierQualifiedNameLabel);
+
+ fAttributeCompartmentFigure = new RectangleFigure();
+ fAttributeCompartmentFigure.setFill(false);
+
+ this.add(fAttributeCompartmentFigure);
+ fAttributeCompartmentFigure.setLayoutManager(new StackLayout());
+
+ fOperationCompartmentFigure = new RectangleFigure();
+ fOperationCompartmentFigure.setFill(false);
+
+ this.add(fOperationCompartmentFigure);
+ fOperationCompartmentFigure.setLayoutManager(new StackLayout());
+
+ fNestedClassifierFigure = new RectangleFigure();
+ fNestedClassifierFigure.setFill(false);
+
+ this.add(fNestedClassifierFigure);
+ fNestedClassifierFigure.setLayoutManager(new StackLayout());
+
+ }
+
+ /**
+ * @generated
+ */
+ public RectangleFigure getAttributeCompartmentFigure() {
+ return fAttributeCompartmentFigure;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getClassifierNameLabel() {
+ return fClassifierNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getClassifierQualifiedNameLabel() {
+ return fClassifierQualifiedNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getClassifierStereotypeLabel() {
+ return fClassifierStereotypeLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public RectangleFigure getNestedClassifierFigure() {
+ return fNestedClassifierFigure;
+ }
+
+ /**
+ * @generated
+ */
+ public RectangleFigure getOperationCompartmentFigure() {
+ return fOperationCompartmentFigure;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ static final Font FCLASSIFIERNAMELABEL_FONT = new Font(Display.getCurrent(), "Arial", 10, SWT.BOLD);
+
+ /**
+ * @generated
+ */
+ static final Font FCLASSIFIERQUALIFIEDNAMELABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.ITALIC);
+
+ /**
+ * @generated
+ */
+ static final Font FCLASSIFIERSTEREOTYPELABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.NORMAL);
+
+ /**
+ * @generated
+ */
+ static final Color THIS_BACK = new Color(null, 235, 248, 255);
+
+ /**
+ * @generated
+ */
+ static final Color THIS_FORE = new Color(null, 177, 207, 229);
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 3027;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public DataType2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof DataTypeName3EditPart) {
+ ((DataTypeName3EditPart) childEditPart).setLabel(getPrimaryShape().getClassifierStereotypeLabel());
+ return true;
+ }
+ if (childEditPart instanceof DataTypeName4EditPart) {
+ ((DataTypeName4EditPart) childEditPart).setLabel(getPrimaryShape().getClassifierNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof DataTypeQualifiedName2EditPart) {
+ ((DataTypeQualifiedName2EditPart) childEditPart).setLabel(getPrimaryShape().getClassifierQualifiedNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof DataTypeAttributeCompartment2EditPart) {
+ IFigure pane = getPrimaryShape().getAttributeCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((DataTypeAttributeCompartment2EditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof DataTypeOperationCompartment2EditPart) {
+ IFigure pane = getPrimaryShape().getOperationCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((DataTypeOperationCompartment2EditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof RedefinableTemplateSignatureEditPart) {
+ // BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.NORTH);
+ BorderItemLocator locator = new TemplateClassifierBorderItemLocator(getMainFigure(), PositionConstants.NORTH);
+ getBorderedFigure().getBorderItemContainer().add(((RedefinableTemplateSignatureEditPart) childEditPart).getFigure(), locator);
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy() {
+
+ public Command getCommand(Request request) {
+ if (understandsRequest(request)) {
+ if (request instanceof CreateViewAndElementRequest) {
+ CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest) request).getViewAndElementDescriptor().getCreateElementRequestAdapter();
+ IElementType type = (IElementType) adapter.getAdapter(IElementType.class);
+ if (type == UMLElementTypes.Property_3018) {
+ EditPart compartmentEditPart = getChildBySemanticHint(UMLVisualIDRegistry.getType(DataTypeAttributeCompartment2EditPart.VISUAL_ID));
+ return compartmentEditPart == null ? null : compartmentEditPart.getCommand(request);
+ }
+ if (type == UMLElementTypes.Operation_3019) {
+ EditPart compartmentEditPart = getChildBySemanticHint(UMLVisualIDRegistry.getType(DataTypeOperationCompartment2EditPart.VISUAL_ID));
+ return compartmentEditPart == null ? null : compartmentEditPart.getCommand(request);
+ }
+ }
+ return super.getCommand(request);
+ }
+ return null;
+ }
+ });
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DataType2ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new DataType2CanonicalEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy());
+ installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy());
+
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+ LayoutEditPolicy lep = new LayoutEditPolicy() {
+
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ if (child instanceof IBorderItemEditPart) {
+ // return new BorderItemSelectionEditPolicy();
+ return new BorderItemResizableEditPolicy();
+ }
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ protected NodeFigure createMainFigure() {
+ NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ IFigure shape = createNodeShape();
+ figure.add(shape);
+ contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(40), getMapMode().DPtoLP(40));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ ClassifierDescriptor figure = new ClassifierDescriptor();
+ return primaryShape = figure;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+
+ if (editPart instanceof DataTypeAttributeCompartment2EditPart) {
+ return getPrimaryShape().getAttributeCompartmentFigure();
+ }
+ if (editPart instanceof DataTypeOperationCompartment2EditPart) {
+ return getPrimaryShape().getOperationCompartmentFigure();
+ }
+ if (editPart instanceof RedefinableTemplateSignatureEditPart) {
+ return getBorderedFigure().getBorderItemContainer();
+ }
+ return super.getContentPaneFor(editPart);
+ }
+
+ /**
+ * @generated
+ */
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(DataTypeName3EditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ public ClassifierDescriptor getPrimaryShape() {
+ return (ClassifierDescriptor) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+
+ if (childEditPart instanceof DataTypeAttributeCompartment2EditPart) {
+ IFigure pane = getPrimaryShape().getAttributeCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.remove(((DataTypeAttributeCompartment2EditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof DataTypeOperationCompartment2EditPart) {
+ IFigure pane = getPrimaryShape().getOperationCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.remove(((DataTypeOperationCompartment2EditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof RedefinableTemplateSignatureEditPart) {
+ getBorderedFigure().getBorderItemContainer().remove(((RedefinableTemplateSignatureEditPart) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(getMapMode().DPtoLP(5));
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataTypeAttributeCompartment2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataTypeAttributeCompartment2EditPart.java
new file mode 100644
index 00000000000..54b3193e017
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataTypeAttributeCompartment2EditPart.java
@@ -0,0 +1,92 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.DataTypeAttributeCompartment2CanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.DataTypeAttributeCompartment2ItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.Messages;
+
+/**
+ * @generated
+ */
+public class DataTypeAttributeCompartment2EditPart extends ListCompartmentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 7032;
+
+ /**
+ * @generated
+ */
+ public DataTypeAttributeCompartment2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean hasModelChildrenChanged(Notification evt) {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public String getCompartmentName() {
+ return Messages.DataTypeAttributeCompartment2EditPart_title;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure createFigure() {
+ ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DataTypeAttributeCompartment2ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new DataTypeAttributeCompartment2CanonicalEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected void setRatio(Double ratio) {
+ if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataTypeAttributeCompartmentEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataTypeAttributeCompartmentEditPart.java
new file mode 100644
index 00000000000..d0b1c28d5b8
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataTypeAttributeCompartmentEditPart.java
@@ -0,0 +1,92 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.DataTypeAttributeCompartmentCanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.DataTypeAttributeCompartmentItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.Messages;
+
+/**
+ * @generated
+ */
+public class DataTypeAttributeCompartmentEditPart extends ListCompartmentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 7020;
+
+ /**
+ * @generated
+ */
+ public DataTypeAttributeCompartmentEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean hasModelChildrenChanged(Notification evt) {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public String getCompartmentName() {
+ return Messages.DataTypeAttributeCompartmentEditPart_title;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure createFigure() {
+ ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DataTypeAttributeCompartmentItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new DataTypeAttributeCompartmentCanonicalEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected void setRatio(Double ratio) {
+ if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataTypeEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataTypeEditPart.java
new file mode 100644
index 00000000000..11b510f55c5
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataTypeEditPart.java
@@ -0,0 +1,505 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.DataTypeCanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.DataTypeItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.OpenDiagramEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.common.editpolicies.BorderItemResizableEditPolicy;
+import org.eclipse.papyrus.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy;
+import org.eclipse.papyrus.diagram.common.figure.node.CClassifierFigure;
+import org.eclipse.papyrus.diagram.common.locator.TemplateClassifierBorderItemLocator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @generated
+ */
+public class DataTypeEditPart extends AbstractBorderedShapeEditPart {
+
+ /**
+ * @generated
+ */
+ public class ClassifierDescriptor extends CClassifierFigure {
+
+ /**
+ * @generated
+ */
+ private RectangleFigure fAttributeCompartmentFigure;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fClassifierNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fClassifierQualifiedNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fClassifierStereotypeLabel;
+
+ /**
+ * @generated
+ */
+ private RectangleFigure fNestedClassifierFigure;
+
+ /**
+ * @generated
+ */
+ private RectangleFigure fOperationCompartmentFigure;
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ public ClassifierDescriptor() {
+
+ this.setForegroundColor(THIS_FORE);
+ this.setBackgroundColor(THIS_BACK);
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ fClassifierStereotypeLabel = new WrappingLabel();
+ fClassifierStereotypeLabel.setText("");
+
+ fClassifierStereotypeLabel.setFont(FCLASSIFIERSTEREOTYPELABEL_FONT);
+
+ this.add(fClassifierStereotypeLabel);
+
+ fClassifierNameLabel = new WrappingLabel();
+ fClassifierNameLabel.setText("");
+
+ fClassifierNameLabel.setFont(FCLASSIFIERNAMELABEL_FONT);
+
+ this.add(fClassifierNameLabel);
+
+ fClassifierQualifiedNameLabel = new WrappingLabel();
+ fClassifierQualifiedNameLabel.setText("");
+
+ fClassifierQualifiedNameLabel.setFont(FCLASSIFIERQUALIFIEDNAMELABEL_FONT);
+
+ this.add(fClassifierQualifiedNameLabel);
+
+ fAttributeCompartmentFigure = new RectangleFigure();
+ fAttributeCompartmentFigure.setFill(false);
+
+ this.add(fAttributeCompartmentFigure);
+ fAttributeCompartmentFigure.setLayoutManager(new StackLayout());
+
+ fOperationCompartmentFigure = new RectangleFigure();
+ fOperationCompartmentFigure.setFill(false);
+
+ this.add(fOperationCompartmentFigure);
+ fOperationCompartmentFigure.setLayoutManager(new StackLayout());
+
+ fNestedClassifierFigure = new RectangleFigure();
+ fNestedClassifierFigure.setFill(false);
+
+ this.add(fNestedClassifierFigure);
+ fNestedClassifierFigure.setLayoutManager(new StackLayout());
+
+ }
+
+ /**
+ * @generated
+ */
+ public RectangleFigure getAttributeCompartmentFigure() {
+ return fAttributeCompartmentFigure;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getClassifierNameLabel() {
+ return fClassifierNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getClassifierQualifiedNameLabel() {
+ return fClassifierQualifiedNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getClassifierStereotypeLabel() {
+ return fClassifierStereotypeLabel;
+ }
+
+ @Override
+ public Color getGradientColor() {
+ return THIS_GRADIENT;
+ }
+
+ /**
+ * @generated
+ */
+ public RectangleFigure getNestedClassifierFigure() {
+ return fNestedClassifierFigure;
+ }
+
+ /**
+ * @generated
+ */
+ public RectangleFigure getOperationCompartmentFigure() {
+ return fOperationCompartmentFigure;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ static final Font FCLASSIFIERNAMELABEL_FONT = new Font(Display.getCurrent(), "Arial", 10, SWT.BOLD);
+
+ /**
+ * @generated
+ */
+ static final Font FCLASSIFIERQUALIFIEDNAMELABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.ITALIC);
+
+ /**
+ * @generated
+ */
+ static final Font FCLASSIFIERSTEREOTYPELABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.NORMAL);
+
+ /**
+ * @generated
+ */
+ static final Color THIS_BACK = new Color(null, 235, 248, 255);
+
+ /**
+ * @generated
+ */
+ static final Color THIS_FORE = new Color(null, 177, 207, 229);
+
+ static final Color THIS_GRADIENT = new Color(null, 204, 204, 204);
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 2010;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public DataTypeEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof DataTypeNameEditPart) {
+ ((DataTypeNameEditPart) childEditPart).setLabel(getPrimaryShape().getClassifierStereotypeLabel());
+ return true;
+ }
+ if (childEditPart instanceof DataTypeName2EditPart) {
+ ((DataTypeName2EditPart) childEditPart).setLabel(getPrimaryShape().getClassifierNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof DataTypeQualifiedNameEditPart) {
+ ((DataTypeQualifiedNameEditPart) childEditPart).setLabel(getPrimaryShape().getClassifierQualifiedNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof DataTypeAttributeCompartmentEditPart) {
+ IFigure pane = getPrimaryShape().getAttributeCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((DataTypeAttributeCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof DataTypeOperationCompartmentEditPart) {
+ IFigure pane = getPrimaryShape().getOperationCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((DataTypeOperationCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof RedefinableTemplateSignatureEditPart) {
+ // BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.NORTH);
+ BorderItemLocator locator = new TemplateClassifierBorderItemLocator(getMainFigure(), PositionConstants.NORTH);
+ getBorderedFigure().getBorderItemContainer().add(((RedefinableTemplateSignatureEditPart) childEditPart).getFigure(), locator);
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy() {
+
+ public Command getCommand(Request request) {
+ if (understandsRequest(request)) {
+ if (request instanceof CreateViewAndElementRequest) {
+ CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest) request).getViewAndElementDescriptor().getCreateElementRequestAdapter();
+ IElementType type = (IElementType) adapter.getAdapter(IElementType.class);
+ if (type == UMLElementTypes.Property_3018) {
+ EditPart compartmentEditPart = getChildBySemanticHint(UMLVisualIDRegistry.getType(DataTypeAttributeCompartmentEditPart.VISUAL_ID));
+ return compartmentEditPart == null ? null : compartmentEditPart.getCommand(request);
+ }
+ if (type == UMLElementTypes.Operation_3019) {
+ EditPart compartmentEditPart = getChildBySemanticHint(UMLVisualIDRegistry.getType(DataTypeOperationCompartmentEditPart.VISUAL_ID));
+ return compartmentEditPart == null ? null : compartmentEditPart.getCommand(request);
+ }
+ }
+ return super.getCommand(request);
+ }
+ return null;
+ }
+ });
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DataTypeItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new DataTypeCanonicalEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy());
+ installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy());
+
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+ LayoutEditPolicy lep = new LayoutEditPolicy() {
+
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ if (child instanceof IBorderItemEditPart) {
+ // return new BorderItemSelectionEditPolicy();
+ return new BorderItemResizableEditPolicy();
+ }
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ protected NodeFigure createMainFigure() {
+ NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ IFigure shape = createNodeShape();
+ figure.add(shape);
+ contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(40), getMapMode().DPtoLP(40));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ ClassifierDescriptor figure = new ClassifierDescriptor();
+ return primaryShape = figure;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+
+ if (editPart instanceof DataTypeAttributeCompartmentEditPart) {
+ return getPrimaryShape().getAttributeCompartmentFigure();
+ }
+ if (editPart instanceof DataTypeOperationCompartmentEditPart) {
+ return getPrimaryShape().getOperationCompartmentFigure();
+ }
+ if (editPart instanceof RedefinableTemplateSignatureEditPart) {
+ return getBorderedFigure().getBorderItemContainer();
+ }
+ return super.getContentPaneFor(editPart);
+ }
+
+ /**
+ * @generated not
+ */
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(DataTypeName2EditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ public ClassifierDescriptor getPrimaryShape() {
+ return (ClassifierDescriptor) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+
+ if (childEditPart instanceof DataTypeAttributeCompartmentEditPart) {
+ IFigure pane = getPrimaryShape().getAttributeCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.remove(((DataTypeAttributeCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof DataTypeOperationCompartmentEditPart) {
+ IFigure pane = getPrimaryShape().getOperationCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.remove(((DataTypeOperationCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof RedefinableTemplateSignatureEditPart) {
+ getBorderedFigure().getBorderItemContainer().remove(((RedefinableTemplateSignatureEditPart) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(getMapMode().DPtoLP(5));
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataTypeName2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataTypeName2EditPart.java
new file mode 100644
index 00000000000..38c009721b3
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataTypeName2EditPart.java
@@ -0,0 +1,554 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class DataTypeName2EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5035;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ public DataTypeName2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ EObject parserElement = getParserElement();
+ if (parserElement == null) {
+ return null;
+ }
+ return UMLElementTypes.getImage(parserElement.eClass());
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.DataType_2010, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated not
+ */
+ protected boolean isEditable() {
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataTypeName3EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataTypeName3EditPart.java
new file mode 100644
index 00000000000..f20de113355
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataTypeName3EditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class DataTypeName3EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5060;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public DataTypeName3EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.DataType_3027, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataTypeName4EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataTypeName4EditPart.java
new file mode 100644
index 00000000000..c1eeec91ae9
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataTypeName4EditPart.java
@@ -0,0 +1,554 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class DataTypeName4EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5061;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public DataTypeName4EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ EObject parserElement = getParserElement();
+ if (parserElement == null) {
+ return null;
+ }
+ return UMLElementTypes.getImage(parserElement.eClass());
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.DataType_3027, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataTypeNameEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataTypeNameEditPart.java
new file mode 100644
index 00000000000..197e5dd93d3
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataTypeNameEditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class DataTypeNameEditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5034;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public DataTypeNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.DataType_2010, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataTypeOperationCompartment2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataTypeOperationCompartment2EditPart.java
new file mode 100644
index 00000000000..6100153a408
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataTypeOperationCompartment2EditPart.java
@@ -0,0 +1,92 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.DataTypeOperationCompartment2CanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.DataTypeOperationCompartment2ItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.Messages;
+
+/**
+ * @generated
+ */
+public class DataTypeOperationCompartment2EditPart extends ListCompartmentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 7033;
+
+ /**
+ * @generated
+ */
+ public DataTypeOperationCompartment2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean hasModelChildrenChanged(Notification evt) {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public String getCompartmentName() {
+ return Messages.DataTypeOperationCompartment2EditPart_title;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure createFigure() {
+ ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DataTypeOperationCompartment2ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new DataTypeOperationCompartment2CanonicalEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected void setRatio(Double ratio) {
+ if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataTypeOperationCompartmentEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataTypeOperationCompartmentEditPart.java
new file mode 100644
index 00000000000..60915fe82a4
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataTypeOperationCompartmentEditPart.java
@@ -0,0 +1,92 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.DataTypeOperationCompartmentCanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.DataTypeOperationCompartmentItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.Messages;
+
+/**
+ * @generated
+ */
+public class DataTypeOperationCompartmentEditPart extends ListCompartmentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 7021;
+
+ /**
+ * @generated
+ */
+ public DataTypeOperationCompartmentEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean hasModelChildrenChanged(Notification evt) {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public String getCompartmentName() {
+ return Messages.DataTypeOperationCompartmentEditPart_title;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure createFigure() {
+ ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DataTypeOperationCompartmentItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new DataTypeOperationCompartmentCanonicalEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected void setRatio(Double ratio) {
+ if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataTypeQualifiedName2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataTypeQualifiedName2EditPart.java
new file mode 100644
index 00000000000..c83a7487eed
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataTypeQualifiedName2EditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class DataTypeQualifiedName2EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5062;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public DataTypeQualifiedName2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.DataType_3027, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataTypeQualifiedNameEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataTypeQualifiedNameEditPart.java
new file mode 100644
index 00000000000..e39cfc66e92
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DataTypeQualifiedNameEditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class DataTypeQualifiedNameEditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5036;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public DataTypeQualifiedNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.DataType_2010, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Dependency2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Dependency2EditPart.java
new file mode 100644
index 00000000000..0df043a78c5
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Dependency2EditPart.java
@@ -0,0 +1,201 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Ellipse;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Shape;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.PointList;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.Dependency2ItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.OpenDiagramEditPolicy;
+
+/**
+ * @generated
+ */
+public class Dependency2EditPart extends ShapeNodeEditPart {
+
+ /**
+ * @generated
+ */
+ public class DependencyNodeDescriptor extends Ellipse {
+
+ /**
+ * @generated
+ */
+ public DependencyNodeDescriptor() {
+ this.setForegroundColor(ColorConstants.black);
+ this.setBackgroundColor(ColorConstants.black);
+ this.setMaximumSize(new Dimension(getMapMode().DPtoLP(10), getMapMode().DPtoLP(10)));
+ this.setMinimumSize(new Dimension(getMapMode().DPtoLP(10), getMapMode().DPtoLP(10)));
+ }
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 2014;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public Dependency2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new Dependency2ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy());
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+ LayoutEditPolicy lep = new LayoutEditPolicy() {
+
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ protected NodeFigure createNodeFigure() {
+ NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ IFigure shape = createNodeShape();
+ figure.add(shape);
+ contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(10), getMapMode().DPtoLP(10));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ DependencyNodeDescriptor figure = new DependencyNodeDescriptor();
+ return primaryShape = figure;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ public DependencyNodeDescriptor getPrimaryShape() {
+ return (DependencyNodeDescriptor) primaryShape;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Dependency3EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Dependency3EditPart.java
new file mode 100644
index 00000000000..43e8ce65f02
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Dependency3EditPart.java
@@ -0,0 +1,190 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Connection;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.Dependency3ItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.common.figure.edge.DashEdgeFigure;
+
+/**
+ * @generated
+ */
+public class Dependency3EditPart extends ConnectionNodeEditPart implements ITreeBranchEditPart {
+
+ /**
+ * @generated
+ */
+ public class DependencyDescriptor extends DashEdgeFigure {
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fAppliedStereotypeLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fDependencyNameLabel;
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ public DependencyDescriptor() {
+
+ this.setForegroundColor(ColorConstants.black);
+ this.setBackgroundColor(ColorConstants.black);
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ fDependencyNameLabel = new WrappingLabel();
+ fDependencyNameLabel.setText("");
+
+ this.add(fDependencyNameLabel);
+
+ fAppliedStereotypeLabel = new WrappingLabel();
+ fAppliedStereotypeLabel.setText("");
+
+ this.add(fAppliedStereotypeLabel);
+
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getAppliedStereotypeLabel() {
+ return fAppliedStereotypeLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getDependencyNameLabel() {
+ return fDependencyNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 4018;
+
+ /**
+ * @generated
+ */
+ public Dependency3EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof DependencyName3EditPart) {
+ ((DependencyName3EditPart) childEditPart).setLabel(getPrimaryShape().getDependencyNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof DependencyName4EditPart) {
+ ((DependencyName4EditPart) childEditPart).setLabel(getPrimaryShape().getAppliedStereotypeLabel());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+
+ protected Connection createConnectionFigure() {
+ return new DependencyDescriptor();
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new Dependency3ItemSemanticEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ public DependencyDescriptor getPrimaryShape() {
+ return (DependencyDescriptor) getFigure();
+ }
+
+ protected void refreshVisuals() {
+ String nodeDependencyVID = "" + Dependency2EditPart.VISUAL_ID;
+ if (this.getTarget() != null) {
+ String targetVID = ((View) this.getTarget().getModel()).getType();
+ if (targetVID.equals(nodeDependencyVID)) {
+ ((DashEdgeFigure) getFigure()).setArrow(false);
+ }
+ }
+ super.refreshVisuals();
+ }
+
+ public void setLayoutConstraint(EditPart child, IFigure childFigure, Object constraint) {
+ if (childFigure.getParent() != null) {
+ childFigure.getParent().setConstraint(childFigure, constraint);
+ }
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DependencyEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DependencyEditPart.java
new file mode 100644
index 00000000000..89fbc43bdf4
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DependencyEditPart.java
@@ -0,0 +1,173 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Connection;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.DependencyItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.common.figure.edge.DashEdgeFigure;
+
+/**
+ * @generated
+ */
+public class DependencyEditPart extends ConnectionNodeEditPart implements ITreeBranchEditPart {
+
+ /**
+ * @generated
+ */
+ public class DependencyDescriptor extends DashEdgeFigure {
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fAppliedStereotypeLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fDependencyNameLabel;
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ public DependencyDescriptor() {
+
+ this.setForegroundColor(ColorConstants.black);
+ this.setBackgroundColor(ColorConstants.black);
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ fDependencyNameLabel = new WrappingLabel();
+ fDependencyNameLabel.setText("");
+
+ this.add(fDependencyNameLabel);
+
+ fAppliedStereotypeLabel = new WrappingLabel();
+ fAppliedStereotypeLabel.setText("");
+
+ this.add(fAppliedStereotypeLabel);
+
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getAppliedStereotypeLabel() {
+ return fAppliedStereotypeLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getDependencyNameLabel() {
+ return fDependencyNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 4008;
+
+ /**
+ * @generated
+ */
+ public DependencyEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof DependencyNameEditPart) {
+ ((DependencyNameEditPart) childEditPart).setLabel(getPrimaryShape().getDependencyNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof DependencyName2EditPart) {
+ ((DependencyName2EditPart) childEditPart).setLabel(getPrimaryShape().getAppliedStereotypeLabel());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+
+ protected Connection createConnectionFigure() {
+ return new DependencyDescriptor();
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DependencyItemSemanticEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ public DependencyDescriptor getPrimaryShape() {
+ return (DependencyDescriptor) getFigure();
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DependencyName2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DependencyName2EditPart.java
new file mode 100644
index 00000000000..173a74dbd1d
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DependencyName2EditPart.java
@@ -0,0 +1,529 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class DependencyName2EditPart extends LabelEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 6027;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyName2EditPart.VISUAL_ID), new Point(0, 60));
+ }
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ public DependencyName2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ public int getKeyPoint() {
+ return ConnectionLocator.MIDDLE;
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Dependency_4008, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DependencyName3EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DependencyName3EditPart.java
new file mode 100644
index 00000000000..49cf32c1fb7
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DependencyName3EditPart.java
@@ -0,0 +1,516 @@
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class DependencyName3EditPart extends LabelEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 6028;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyName3EditPart.VISUAL_ID), new Point(0, 40));
+ }
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ public DependencyName3EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ public int getKeyPoint() {
+ return ConnectionLocator.MIDDLE;
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Dependency_4018, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DependencyName4EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DependencyName4EditPart.java
new file mode 100644
index 00000000000..82efcc8fdef
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DependencyName4EditPart.java
@@ -0,0 +1,529 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class DependencyName4EditPart extends LabelEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 6029;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyName4EditPart.VISUAL_ID), new Point(0, 60));
+ }
+
+ /**
+ * @generated
+ */
+ public DependencyName4EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ public int getKeyPoint() {
+ return ConnectionLocator.MIDDLE;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Dependency_4018, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DependencyNameEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DependencyNameEditPart.java
new file mode 100644
index 00000000000..daa56142c1d
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/DependencyNameEditPart.java
@@ -0,0 +1,529 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class DependencyNameEditPart extends LabelEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 6026;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyNameEditPart.VISUAL_ID), new Point(0, 40));
+ }
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ public DependencyNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ public int getKeyPoint() {
+ return ConnectionLocator.MIDDLE;
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Dependency_4008, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ElementImportAlias2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ElementImportAlias2EditPart.java
new file mode 100644
index 00000000000..88bc13e43fe
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ElementImportAlias2EditPart.java
@@ -0,0 +1,529 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class ElementImportAlias2EditPart extends LabelEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 6021;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportAlias2EditPart.VISUAL_ID), new Point(0, 60));
+ }
+
+ /**
+ * @generated
+ */
+ public ElementImportAlias2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ public int getKeyPoint() {
+ return ConnectionLocator.MIDDLE;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.ElementImport_4009, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ElementImportAliasEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ElementImportAliasEditPart.java
new file mode 100644
index 00000000000..8bdc607e700
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ElementImportAliasEditPart.java
@@ -0,0 +1,529 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class ElementImportAliasEditPart extends LabelEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 6020;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportAliasEditPart.VISUAL_ID), new Point(0, 40));
+ }
+
+ /**
+ * @generated
+ */
+ public ElementImportAliasEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ public int getKeyPoint() {
+ return ConnectionLocator.MIDDLE;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.ElementImport_4009, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ElementImportEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ElementImportEditPart.java
new file mode 100644
index 00000000000..88314eee901
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ElementImportEditPart.java
@@ -0,0 +1,173 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Connection;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.ElementImportItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.common.figure.edge.DashEdgeFigure;
+
+/**
+ * @generated
+ */
+public class ElementImportEditPart extends ConnectionNodeEditPart implements ITreeBranchEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 4009;
+
+ /**
+ * @generated
+ */
+ public ElementImportEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ElementImportItemSemanticEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof ElementImportAliasEditPart) {
+ ((ElementImportAliasEditPart) childEditPart).setLabel(getPrimaryShape().getDependencyNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof ElementImportAlias2EditPart) {
+ ((ElementImportAlias2EditPart) childEditPart).setLabel(getPrimaryShape().getAppliedStereotypeLabel());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+
+ protected Connection createConnectionFigure() {
+ return new DependencyDescriptor();
+ }
+
+ /**
+ * @generated
+ */
+ public DependencyDescriptor getPrimaryShape() {
+ return (DependencyDescriptor) getFigure();
+ }
+
+ /**
+ * @generated
+ */
+ public class DependencyDescriptor extends DashEdgeFigure {
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fDependencyNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fAppliedStereotypeLabel;
+
+ /**
+ * @generated
+ */
+ public DependencyDescriptor() {
+
+ this.setForegroundColor(ColorConstants.black);
+ this.setBackgroundColor(ColorConstants.black);
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ fDependencyNameLabel = new WrappingLabel();
+ fDependencyNameLabel.setText("");
+
+ this.add(fDependencyNameLabel);
+
+ fAppliedStereotypeLabel = new WrappingLabel();
+ fAppliedStereotypeLabel.setText("");
+
+ this.add(fAppliedStereotypeLabel);
+
+ }
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getDependencyNameLabel() {
+ return fDependencyNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getAppliedStereotypeLabel() {
+ return fAppliedStereotypeLabel;
+ }
+
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Enumeration2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Enumeration2EditPart.java
new file mode 100644
index 00000000000..e318f3e5b8f
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Enumeration2EditPart.java
@@ -0,0 +1,414 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.Enumeration2ItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.OpenDiagramEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.common.figure.node.CEnumeration;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @generated
+ */
+public class Enumeration2EditPart extends ShapeNodeEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 3025;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public Enumeration2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy() {
+
+ public Command getCommand(Request request) {
+ if (understandsRequest(request)) {
+ if (request instanceof CreateViewAndElementRequest) {
+ CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest) request).getViewAndElementDescriptor().getCreateElementRequestAdapter();
+ IElementType type = (IElementType) adapter.getAdapter(IElementType.class);
+ if (type == UMLElementTypes.EnumerationLiteral_3017) {
+ EditPart compartmentEditPart = getChildBySemanticHint(UMLVisualIDRegistry.getType(EnumerationEnumerationLiteralCompartment2EditPart.VISUAL_ID));
+ return compartmentEditPart == null ? null : compartmentEditPart.getCommand(request);
+ }
+ }
+ return super.getCommand(request);
+ }
+ return null;
+ }
+ });
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new Enumeration2ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy());
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+ LayoutEditPolicy lep = new LayoutEditPolicy() {
+
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ EnumerationDescriptor figure = new EnumerationDescriptor();
+ return primaryShape = figure;
+ }
+
+ /**
+ * @generated
+ */
+ public EnumerationDescriptor getPrimaryShape() {
+ return (EnumerationDescriptor) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof EnumerationName3EditPart) {
+ ((EnumerationName3EditPart) childEditPart).setLabel(getPrimaryShape().getEnumerationStereotypeLabel());
+ return true;
+ }
+ if (childEditPart instanceof EnumerationName4EditPart) {
+ ((EnumerationName4EditPart) childEditPart).setLabel(getPrimaryShape().getEnumerationNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof EnumerationQualifiedName2EditPart) {
+ ((EnumerationQualifiedName2EditPart) childEditPart).setLabel(getPrimaryShape().getEnumerationQualifiedNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof EnumerationEnumerationLiteralCompartment2EditPart) {
+ IFigure pane = getPrimaryShape().getEnumerationLiteralCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((EnumerationEnumerationLiteralCompartment2EditPart) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+
+ if (childEditPart instanceof EnumerationEnumerationLiteralCompartment2EditPart) {
+ IFigure pane = getPrimaryShape().getEnumerationLiteralCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.remove(((EnumerationEnumerationLiteralCompartment2EditPart) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+
+ if (editPart instanceof EnumerationEnumerationLiteralCompartment2EditPart) {
+ return getPrimaryShape().getEnumerationLiteralCompartmentFigure();
+ }
+ return super.getContentPaneFor(editPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(40), getMapMode().DPtoLP(40));
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ protected NodeFigure createNodeFigure() {
+ NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ IFigure shape = createNodeShape();
+ figure.add(shape);
+ contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(getMapMode().DPtoLP(5));
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(EnumerationName3EditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ public class EnumerationDescriptor extends CEnumeration {
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fEnumerationStereotypeLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fEnumerationNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fEnumerationQualifiedNameLabel;
+
+ /**
+ * @generated
+ */
+ private RectangleFigure fEnumerationLiteralCompartmentFigure;
+
+ /**
+ * @generated
+ */
+ public EnumerationDescriptor() {
+
+ this.setForegroundColor(THIS_FORE);
+ this.setBackgroundColor(THIS_BACK);
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ fEnumerationStereotypeLabel = new WrappingLabel();
+ fEnumerationStereotypeLabel.setText("");
+
+ fEnumerationStereotypeLabel.setFont(FENUMERATIONSTEREOTYPELABEL_FONT);
+
+ this.add(fEnumerationStereotypeLabel);
+
+ fEnumerationNameLabel = new WrappingLabel();
+ fEnumerationNameLabel.setText("");
+
+ fEnumerationNameLabel.setFont(FENUMERATIONNAMELABEL_FONT);
+
+ this.add(fEnumerationNameLabel);
+
+ fEnumerationQualifiedNameLabel = new WrappingLabel();
+ fEnumerationQualifiedNameLabel.setText("");
+
+ fEnumerationQualifiedNameLabel.setFont(FENUMERATIONQUALIFIEDNAMELABEL_FONT);
+
+ this.add(fEnumerationQualifiedNameLabel);
+
+ fEnumerationLiteralCompartmentFigure = new RectangleFigure();
+ fEnumerationLiteralCompartmentFigure.setFill(false);
+
+ this.add(fEnumerationLiteralCompartmentFigure);
+ fEnumerationLiteralCompartmentFigure.setLayoutManager(new StackLayout());
+
+ }
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getEnumerationStereotypeLabel() {
+ return fEnumerationStereotypeLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getEnumerationNameLabel() {
+ return fEnumerationNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getEnumerationQualifiedNameLabel() {
+ return fEnumerationQualifiedNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public RectangleFigure getEnumerationLiteralCompartmentFigure() {
+ return fEnumerationLiteralCompartmentFigure;
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ static final Color THIS_FORE = new Color(null, 204, 204, 204);
+
+ /**
+ * @generated
+ */
+ static final Color THIS_BACK = new Color(null, 242, 242, 242);
+
+ /**
+ * @generated
+ */
+ static final Font FENUMERATIONSTEREOTYPELABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.NORMAL);
+
+ /**
+ * @generated
+ */
+ static final Font FENUMERATIONNAMELABEL_FONT = new Font(Display.getCurrent(), "Arial", 10, SWT.BOLD);
+
+ /**
+ * @generated
+ */
+ static final Font FENUMERATIONQUALIFIEDNAMELABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.ITALIC);
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/EnumerationEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/EnumerationEditPart.java
new file mode 100644
index 00000000000..b4194cea171
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/EnumerationEditPart.java
@@ -0,0 +1,421 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.EnumerationItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.OpenDiagramEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.common.figure.node.CEnumeration;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @generated
+ */
+public class EnumerationEditPart extends ShapeNodeEditPart {
+
+ /**
+ * @generated
+ */
+ public class EnumerationDescriptor extends CEnumeration {
+
+ /**
+ * @generated
+ */
+ private RectangleFigure fEnumerationLiteralCompartmentFigure;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fEnumerationNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fEnumerationQualifiedNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fEnumerationStereotypeLabel;
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ public EnumerationDescriptor() {
+
+ this.setForegroundColor(THIS_FORE);
+ this.setBackgroundColor(THIS_BACK);
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ fEnumerationStereotypeLabel = new WrappingLabel();
+ fEnumerationStereotypeLabel.setText("");
+
+ fEnumerationStereotypeLabel.setFont(FENUMERATIONSTEREOTYPELABEL_FONT);
+
+ this.add(fEnumerationStereotypeLabel);
+
+ fEnumerationNameLabel = new WrappingLabel();
+ fEnumerationNameLabel.setText("");
+
+ fEnumerationNameLabel.setFont(FENUMERATIONNAMELABEL_FONT);
+
+ this.add(fEnumerationNameLabel);
+
+ fEnumerationQualifiedNameLabel = new WrappingLabel();
+ fEnumerationQualifiedNameLabel.setText("");
+
+ fEnumerationQualifiedNameLabel.setFont(FENUMERATIONQUALIFIEDNAMELABEL_FONT);
+
+ this.add(fEnumerationQualifiedNameLabel);
+
+ fEnumerationLiteralCompartmentFigure = new RectangleFigure();
+ fEnumerationLiteralCompartmentFigure.setFill(false);
+
+ this.add(fEnumerationLiteralCompartmentFigure);
+ fEnumerationLiteralCompartmentFigure.setLayoutManager(new StackLayout());
+
+ }
+
+ /**
+ * @generated
+ */
+ public RectangleFigure getEnumerationLiteralCompartmentFigure() {
+ return fEnumerationLiteralCompartmentFigure;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getEnumerationNameLabel() {
+ return fEnumerationNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getEnumerationQualifiedNameLabel() {
+ return fEnumerationQualifiedNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getEnumerationStereotypeLabel() {
+ return fEnumerationStereotypeLabel;
+ }
+
+ @Override
+ public Color getGradientColor() {
+ return THIS_GRADIENT;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ static final Font FENUMERATIONNAMELABEL_FONT = new Font(Display.getCurrent(), "Arial", 10, SWT.BOLD);
+
+ /**
+ * @generated
+ */
+ static final Font FENUMERATIONQUALIFIEDNAMELABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.ITALIC);
+
+ /**
+ * @generated
+ */
+ static final Font FENUMERATIONSTEREOTYPELABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.NORMAL);
+
+ /**
+ * @generated
+ */
+ static final Color THIS_BACK = new Color(null, 242, 242, 242);
+
+ /**
+ * @generated
+ */
+ static final Color THIS_FORE = new Color(null, 204, 204, 204);
+
+ static final Color THIS_GRADIENT = new Color(null, 204, 204, 204);
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 2006;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public EnumerationEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof EnumerationNameEditPart) {
+ ((EnumerationNameEditPart) childEditPart).setLabel(getPrimaryShape().getEnumerationStereotypeLabel());
+ return true;
+ }
+ if (childEditPart instanceof EnumerationName2EditPart) {
+ ((EnumerationName2EditPart) childEditPart).setLabel(getPrimaryShape().getEnumerationNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof EnumerationQualifiedNameEditPart) {
+ ((EnumerationQualifiedNameEditPart) childEditPart).setLabel(getPrimaryShape().getEnumerationQualifiedNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof EnumerationEnumerationLiteralCompartmentEditPart) {
+ IFigure pane = getPrimaryShape().getEnumerationLiteralCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((EnumerationEnumerationLiteralCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy() {
+
+ public Command getCommand(Request request) {
+ if (understandsRequest(request)) {
+ if (request instanceof CreateViewAndElementRequest) {
+ CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest) request).getViewAndElementDescriptor().getCreateElementRequestAdapter();
+ IElementType type = (IElementType) adapter.getAdapter(IElementType.class);
+ if (type == UMLElementTypes.EnumerationLiteral_3017) {
+ EditPart compartmentEditPart = getChildBySemanticHint(UMLVisualIDRegistry.getType(EnumerationEnumerationLiteralCompartmentEditPart.VISUAL_ID));
+ return compartmentEditPart == null ? null : compartmentEditPart.getCommand(request);
+ }
+ }
+ return super.getCommand(request);
+ }
+ return null;
+ }
+ });
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new EnumerationItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy());
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+ LayoutEditPolicy lep = new LayoutEditPolicy() {
+
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ protected NodeFigure createNodeFigure() {
+ NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ IFigure shape = createNodeShape();
+ figure.add(shape);
+ contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(40), getMapMode().DPtoLP(40));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ EnumerationDescriptor figure = new EnumerationDescriptor();
+ return primaryShape = figure;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+
+ if (editPart instanceof EnumerationEnumerationLiteralCompartmentEditPart) {
+ return getPrimaryShape().getEnumerationLiteralCompartmentFigure();
+ }
+ return super.getContentPaneFor(editPart);
+ }
+
+ /**
+ * @generated not
+ */
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(EnumerationName2EditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ public EnumerationDescriptor getPrimaryShape() {
+ return (EnumerationDescriptor) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+
+ if (childEditPart instanceof EnumerationEnumerationLiteralCompartmentEditPart) {
+ IFigure pane = getPrimaryShape().getEnumerationLiteralCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.remove(((EnumerationEnumerationLiteralCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(getMapMode().DPtoLP(5));
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/EnumerationEnumerationLiteralCompartment2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/EnumerationEnumerationLiteralCompartment2EditPart.java
new file mode 100644
index 00000000000..872677f449e
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/EnumerationEnumerationLiteralCompartment2EditPart.java
@@ -0,0 +1,92 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.EnumerationEnumerationLiteralCompartment2CanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.EnumerationEnumerationLiteralCompartment2ItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.Messages;
+
+/**
+ * @generated
+ */
+public class EnumerationEnumerationLiteralCompartment2EditPart extends ListCompartmentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 7031;
+
+ /**
+ * @generated
+ */
+ public EnumerationEnumerationLiteralCompartment2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean hasModelChildrenChanged(Notification evt) {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public String getCompartmentName() {
+ return Messages.EnumerationEnumerationLiteralCompartment2EditPart_title;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure createFigure() {
+ ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new EnumerationEnumerationLiteralCompartment2ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new EnumerationEnumerationLiteralCompartment2CanonicalEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected void setRatio(Double ratio) {
+ if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/EnumerationEnumerationLiteralCompartmentEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/EnumerationEnumerationLiteralCompartmentEditPart.java
new file mode 100644
index 00000000000..a9a2488d8d3
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/EnumerationEnumerationLiteralCompartmentEditPart.java
@@ -0,0 +1,92 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.EnumerationEnumerationLiteralCompartmentCanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.EnumerationEnumerationLiteralCompartmentItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.Messages;
+
+/**
+ * @generated
+ */
+public class EnumerationEnumerationLiteralCompartmentEditPart extends ListCompartmentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 7015;
+
+ /**
+ * @generated
+ */
+ public EnumerationEnumerationLiteralCompartmentEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean hasModelChildrenChanged(Notification evt) {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public String getCompartmentName() {
+ return Messages.EnumerationEnumerationLiteralCompartmentEditPart_title;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure createFigure() {
+ ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new EnumerationEnumerationLiteralCompartmentItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new EnumerationEnumerationLiteralCompartmentCanonicalEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected void setRatio(Double ratio) {
+ if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/EnumerationLiteralEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/EnumerationLiteralEditPart.java
new file mode 100644
index 00000000000..f6ef0a93e6c
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/EnumerationLiteralEditPart.java
@@ -0,0 +1,585 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.DragTracker;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.requests.SelectionRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ListItemComponentEditPolicy;
+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.DragEditPartsTrackerEx;
+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.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.EnumerationLiteralItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextNonResizableEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @generated
+ */
+public class EnumerationLiteralEditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public class LiteralEnumerationDescriptor extends WrappingLabel {
+
+ /**
+ * @generated
+ */
+ public LiteralEnumerationDescriptor() {
+ this.setText("");
+
+ this.setFont(THIS_FONT);
+
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ static final Font THIS_FONT = new Font(Display.getCurrent(), "Arial", 10, SWT.NORMAL);
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 3017;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ public EnumerationLiteralEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new EnumerationLiteralItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new UMLTextNonResizableEditPolicy());
+ installEditPolicy(EditPolicy.COMPONENT_ROLE, new ListItemComponentEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ IFigure label = createFigurePrim();
+ defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigurePrim() {
+ return new LiteralEnumerationDescriptor();
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public DragTracker getDragTracker(Request request) {
+ if (request instanceof SelectionRequest && ((SelectionRequest) request).getLastButtonPressed() == 3) {
+ return null;
+ }
+ return new DragEditPartsTrackerEx(this);
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ EObject parserElement = getParserElement();
+ if (parserElement == null) {
+ return null;
+ }
+ return UMLElementTypes.getImage(parserElement.eClass());
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.EnumerationLiteral_3017, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/EnumerationName2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/EnumerationName2EditPart.java
new file mode 100644
index 00000000000..d5345f99150
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/EnumerationName2EditPart.java
@@ -0,0 +1,554 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class EnumerationName2EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5023;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ public EnumerationName2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ EObject parserElement = getParserElement();
+ if (parserElement == null) {
+ return null;
+ }
+ return UMLElementTypes.getImage(parserElement.eClass());
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Enumeration_2006, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated not
+ */
+ protected boolean isEditable() {
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/EnumerationName3EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/EnumerationName3EditPart.java
new file mode 100644
index 00000000000..d684fbb896a
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/EnumerationName3EditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class EnumerationName3EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5054;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public EnumerationName3EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Enumeration_3025, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/EnumerationName4EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/EnumerationName4EditPart.java
new file mode 100644
index 00000000000..0c383aa88b0
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/EnumerationName4EditPart.java
@@ -0,0 +1,554 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class EnumerationName4EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5055;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public EnumerationName4EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ EObject parserElement = getParserElement();
+ if (parserElement == null) {
+ return null;
+ }
+ return UMLElementTypes.getImage(parserElement.eClass());
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Enumeration_3025, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/EnumerationNameEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/EnumerationNameEditPart.java
new file mode 100644
index 00000000000..4e0aea02fe0
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/EnumerationNameEditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class EnumerationNameEditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5022;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public EnumerationNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Enumeration_2006, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/EnumerationQualifiedName2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/EnumerationQualifiedName2EditPart.java
new file mode 100644
index 00000000000..ec8adab3709
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/EnumerationQualifiedName2EditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class EnumerationQualifiedName2EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5056;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public EnumerationQualifiedName2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Enumeration_3025, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/EnumerationQualifiedNameEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/EnumerationQualifiedNameEditPart.java
new file mode 100644
index 00000000000..a68464db7c7
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/EnumerationQualifiedNameEditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class EnumerationQualifiedNameEditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5024;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public EnumerationQualifiedNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Enumeration_2006, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/GeneralizationEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/GeneralizationEditPart.java
new file mode 100644
index 00000000000..5f898bcf9c6
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/GeneralizationEditPart.java
@@ -0,0 +1,152 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Connection;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.GeneralizationItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.common.figure.edge.CGeneralizationFigure;
+
+/**
+ * @generated
+ */
+public class GeneralizationEditPart extends ConnectionNodeEditPart implements ITreeBranchEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 4002;
+
+ /**
+ * @generated
+ */
+ public GeneralizationEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new GeneralizationItemSemanticEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof GeneralizationIsSubstitutableEditPart) {
+ ((GeneralizationIsSubstitutableEditPart) childEditPart).setLabel(getPrimaryShape().getAppliedStereotypeLabel());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+
+ protected Connection createConnectionFigure() {
+ return new GeneralizationDescriptor();
+ }
+
+ /**
+ * @generated
+ */
+ public GeneralizationDescriptor getPrimaryShape() {
+ return (GeneralizationDescriptor) getFigure();
+ }
+
+ /**
+ * @generated
+ */
+ public class GeneralizationDescriptor extends CGeneralizationFigure {
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fAppliedStereotypeLabel;
+
+ /**
+ * @generated
+ */
+ public GeneralizationDescriptor() {
+
+ this.setForegroundColor(ColorConstants.black);
+ this.setBackgroundColor(ColorConstants.black);
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ fAppliedStereotypeLabel = new WrappingLabel();
+ fAppliedStereotypeLabel.setText("");
+
+ this.add(fAppliedStereotypeLabel);
+
+ }
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getAppliedStereotypeLabel() {
+ return fAppliedStereotypeLabel;
+ }
+
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/GeneralizationIsSubstitutableEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/GeneralizationIsSubstitutableEditPart.java
new file mode 100644
index 00000000000..c6839a5c851
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/GeneralizationIsSubstitutableEditPart.java
@@ -0,0 +1,529 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class GeneralizationIsSubstitutableEditPart extends LabelEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 6007;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.clazz.edit.parts.GeneralizationIsSubstitutableEditPart.VISUAL_ID), new Point(0, 40));
+ }
+
+ /**
+ * @generated
+ */
+ public GeneralizationIsSubstitutableEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ public int getKeyPoint() {
+ return ConnectionLocator.MIDDLE;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Generalization_4002, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InstanceSpecification2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InstanceSpecification2EditPart.java
new file mode 100644
index 00000000000..44748ffc0c1
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InstanceSpecification2EditPart.java
@@ -0,0 +1,414 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.InstanceSpecification2ItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.OpenDiagramEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.common.figure.node.CEnumeration;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @generated
+ */
+public class InstanceSpecification2EditPart extends ShapeNodeEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 3020;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public InstanceSpecification2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy() {
+
+ public Command getCommand(Request request) {
+ if (understandsRequest(request)) {
+ if (request instanceof CreateViewAndElementRequest) {
+ CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest) request).getViewAndElementDescriptor().getCreateElementRequestAdapter();
+ IElementType type = (IElementType) adapter.getAdapter(IElementType.class);
+ if (type == UMLElementTypes.Slot_3001) {
+ EditPart compartmentEditPart = getChildBySemanticHint(UMLVisualIDRegistry.getType(InstanceSpecificationSlotCompartment2EditPart.VISUAL_ID));
+ return compartmentEditPart == null ? null : compartmentEditPart.getCommand(request);
+ }
+ }
+ return super.getCommand(request);
+ }
+ return null;
+ }
+ });
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new InstanceSpecification2ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy());
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+ LayoutEditPolicy lep = new LayoutEditPolicy() {
+
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ InstanceSpecificationDescriptor figure = new InstanceSpecificationDescriptor();
+ return primaryShape = figure;
+ }
+
+ /**
+ * @generated
+ */
+ public InstanceSpecificationDescriptor getPrimaryShape() {
+ return (InstanceSpecificationDescriptor) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof InstanceSpecificationName3EditPart) {
+ ((InstanceSpecificationName3EditPart) childEditPart).setLabel(getPrimaryShape().getInstanceSpecificationStereotypeLabel());
+ return true;
+ }
+ if (childEditPart instanceof InstanceSpecificationName4EditPart) {
+ ((InstanceSpecificationName4EditPart) childEditPart).setLabel(getPrimaryShape().getInstanceSpecificationNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof InstanceSpecificationQualifiedName2EditPart) {
+ ((InstanceSpecificationQualifiedName2EditPart) childEditPart).setLabel(getPrimaryShape().getInstanceSpecificationQualifiedNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof InstanceSpecificationSlotCompartment2EditPart) {
+ IFigure pane = getPrimaryShape().getSlotCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((InstanceSpecificationSlotCompartment2EditPart) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+
+ if (childEditPart instanceof InstanceSpecificationSlotCompartment2EditPart) {
+ IFigure pane = getPrimaryShape().getSlotCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.remove(((InstanceSpecificationSlotCompartment2EditPart) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+
+ if (editPart instanceof InstanceSpecificationSlotCompartment2EditPart) {
+ return getPrimaryShape().getSlotCompartmentFigure();
+ }
+ return super.getContentPaneFor(editPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(40), getMapMode().DPtoLP(40));
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ protected NodeFigure createNodeFigure() {
+ NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ IFigure shape = createNodeShape();
+ figure.add(shape);
+ contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(getMapMode().DPtoLP(5));
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(InstanceSpecificationName3EditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ public class InstanceSpecificationDescriptor extends CEnumeration {
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fInstanceSpecificationStereotypeLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fInstanceSpecificationNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fInstanceSpecificationQualifiedNameLabel;
+
+ /**
+ * @generated
+ */
+ private RectangleFigure fSlotCompartmentFigure;
+
+ /**
+ * @generated
+ */
+ public InstanceSpecificationDescriptor() {
+
+ this.setForegroundColor(THIS_FORE);
+ this.setBackgroundColor(THIS_BACK);
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ fInstanceSpecificationStereotypeLabel = new WrappingLabel();
+ fInstanceSpecificationStereotypeLabel.setText("");
+
+ fInstanceSpecificationStereotypeLabel.setFont(FINSTANCESPECIFICATIONSTEREOTYPELABEL_FONT);
+
+ this.add(fInstanceSpecificationStereotypeLabel);
+
+ fInstanceSpecificationNameLabel = new WrappingLabel();
+ fInstanceSpecificationNameLabel.setText("");
+
+ fInstanceSpecificationNameLabel.setFont(FINSTANCESPECIFICATIONNAMELABEL_FONT);
+
+ this.add(fInstanceSpecificationNameLabel);
+
+ fInstanceSpecificationQualifiedNameLabel = new WrappingLabel();
+ fInstanceSpecificationQualifiedNameLabel.setText("");
+
+ fInstanceSpecificationQualifiedNameLabel.setFont(FINSTANCESPECIFICATIONQUALIFIEDNAMELABEL_FONT);
+
+ this.add(fInstanceSpecificationQualifiedNameLabel);
+
+ fSlotCompartmentFigure = new RectangleFigure();
+ fSlotCompartmentFigure.setFill(false);
+
+ this.add(fSlotCompartmentFigure);
+ fSlotCompartmentFigure.setLayoutManager(new StackLayout());
+
+ }
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getInstanceSpecificationStereotypeLabel() {
+ return fInstanceSpecificationStereotypeLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getInstanceSpecificationNameLabel() {
+ return fInstanceSpecificationNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getInstanceSpecificationQualifiedNameLabel() {
+ return fInstanceSpecificationQualifiedNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public RectangleFigure getSlotCompartmentFigure() {
+ return fSlotCompartmentFigure;
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ static final Color THIS_FORE = new Color(null, 255, 180, 180);
+
+ /**
+ * @generated
+ */
+ static final Color THIS_BACK = new Color(null, 255, 219, 219);
+
+ /**
+ * @generated
+ */
+ static final Font FINSTANCESPECIFICATIONSTEREOTYPELABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.NORMAL);
+
+ /**
+ * @generated
+ */
+ static final Font FINSTANCESPECIFICATIONNAMELABEL_FONT = new Font(Display.getCurrent(), "Arial", 10, SWT.BOLD);
+
+ /**
+ * @generated
+ */
+ static final Font FINSTANCESPECIFICATIONQUALIFIEDNAMELABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.ITALIC);
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InstanceSpecificationEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InstanceSpecificationEditPart.java
new file mode 100644
index 00000000000..839001caff6
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InstanceSpecificationEditPart.java
@@ -0,0 +1,421 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.InstanceSpecificationItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.OpenDiagramEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.common.figure.node.CEnumeration;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @generated
+ */
+public class InstanceSpecificationEditPart extends ShapeNodeEditPart {
+
+ /**
+ * @generated
+ */
+ public class InstanceSpecificationDescriptor extends CEnumeration {
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fInstanceSpecificationNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fInstanceSpecificationQualifiedNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fInstanceSpecificationStereotypeLabel;
+
+ /**
+ * @generated
+ */
+ private RectangleFigure fSlotCompartmentFigure;
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ public InstanceSpecificationDescriptor() {
+
+ this.setForegroundColor(THIS_FORE);
+ this.setBackgroundColor(THIS_BACK);
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ fInstanceSpecificationStereotypeLabel = new WrappingLabel();
+ fInstanceSpecificationStereotypeLabel.setText("");
+
+ fInstanceSpecificationStereotypeLabel.setFont(FINSTANCESPECIFICATIONSTEREOTYPELABEL_FONT);
+
+ this.add(fInstanceSpecificationStereotypeLabel);
+
+ fInstanceSpecificationNameLabel = new WrappingLabel();
+ fInstanceSpecificationNameLabel.setText("");
+
+ fInstanceSpecificationNameLabel.setFont(FINSTANCESPECIFICATIONNAMELABEL_FONT);
+
+ this.add(fInstanceSpecificationNameLabel);
+
+ fInstanceSpecificationQualifiedNameLabel = new WrappingLabel();
+ fInstanceSpecificationQualifiedNameLabel.setText("");
+
+ fInstanceSpecificationQualifiedNameLabel.setFont(FINSTANCESPECIFICATIONQUALIFIEDNAMELABEL_FONT);
+
+ this.add(fInstanceSpecificationQualifiedNameLabel);
+
+ fSlotCompartmentFigure = new RectangleFigure();
+ fSlotCompartmentFigure.setFill(false);
+
+ this.add(fSlotCompartmentFigure);
+ fSlotCompartmentFigure.setLayoutManager(new StackLayout());
+
+ }
+
+ @Override
+ public Color getGradientColor() {
+ return THIS_GRADIENT;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getInstanceSpecificationNameLabel() {
+ return fInstanceSpecificationNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getInstanceSpecificationQualifiedNameLabel() {
+ return fInstanceSpecificationQualifiedNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getInstanceSpecificationStereotypeLabel() {
+ return fInstanceSpecificationStereotypeLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public RectangleFigure getSlotCompartmentFigure() {
+ return fSlotCompartmentFigure;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ static final Font FINSTANCESPECIFICATIONNAMELABEL_FONT = new Font(Display.getCurrent(), "Arial", 10, SWT.BOLD);
+
+ /**
+ * @generated
+ */
+ static final Font FINSTANCESPECIFICATIONQUALIFIEDNAMELABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.ITALIC);
+
+ /**
+ * @generated
+ */
+ static final Font FINSTANCESPECIFICATIONSTEREOTYPELABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.NORMAL);
+
+ /**
+ * @generated
+ */
+ static final Color THIS_BACK = new Color(null, 255, 219, 219);
+
+ /**
+ * @generated
+ */
+ static final Color THIS_FORE = new Color(null, 255, 180, 180);
+
+ static final Color THIS_GRADIENT = new Color(null, 255, 180, 180);
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 2001;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public InstanceSpecificationEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof InstanceSpecificationNameEditPart) {
+ ((InstanceSpecificationNameEditPart) childEditPart).setLabel(getPrimaryShape().getInstanceSpecificationStereotypeLabel());
+ return true;
+ }
+ if (childEditPart instanceof InstanceSpecificationName2EditPart) {
+ ((InstanceSpecificationName2EditPart) childEditPart).setLabel(getPrimaryShape().getInstanceSpecificationNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof InstanceSpecificationQualifiedNameEditPart) {
+ ((InstanceSpecificationQualifiedNameEditPart) childEditPart).setLabel(getPrimaryShape().getInstanceSpecificationQualifiedNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof InstanceSpecificationSlotCompartmentEditPart) {
+ IFigure pane = getPrimaryShape().getSlotCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((InstanceSpecificationSlotCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy() {
+
+ public Command getCommand(Request request) {
+ if (understandsRequest(request)) {
+ if (request instanceof CreateViewAndElementRequest) {
+ CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest) request).getViewAndElementDescriptor().getCreateElementRequestAdapter();
+ IElementType type = (IElementType) adapter.getAdapter(IElementType.class);
+ if (type == UMLElementTypes.Slot_3001) {
+ EditPart compartmentEditPart = getChildBySemanticHint(UMLVisualIDRegistry.getType(InstanceSpecificationSlotCompartmentEditPart.VISUAL_ID));
+ return compartmentEditPart == null ? null : compartmentEditPart.getCommand(request);
+ }
+ }
+ return super.getCommand(request);
+ }
+ return null;
+ }
+ });
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new InstanceSpecificationItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy());
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+ LayoutEditPolicy lep = new LayoutEditPolicy() {
+
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ protected NodeFigure createNodeFigure() {
+ NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ IFigure shape = createNodeShape();
+ figure.add(shape);
+ contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(40), getMapMode().DPtoLP(40));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ InstanceSpecificationDescriptor figure = new InstanceSpecificationDescriptor();
+ return primaryShape = figure;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+
+ if (editPart instanceof InstanceSpecificationSlotCompartmentEditPart) {
+ return getPrimaryShape().getSlotCompartmentFigure();
+ }
+ return super.getContentPaneFor(editPart);
+ }
+
+ /**
+ * @generated not
+ */
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(InstanceSpecificationName2EditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ public InstanceSpecificationDescriptor getPrimaryShape() {
+ return (InstanceSpecificationDescriptor) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+
+ if (childEditPart instanceof InstanceSpecificationSlotCompartmentEditPart) {
+ IFigure pane = getPrimaryShape().getSlotCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.remove(((InstanceSpecificationSlotCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(getMapMode().DPtoLP(5));
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InstanceSpecificationName2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InstanceSpecificationName2EditPart.java
new file mode 100644
index 00000000000..98136d3a6d3
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InstanceSpecificationName2EditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class InstanceSpecificationName2EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5002;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public InstanceSpecificationName2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.InstanceSpecification_2001, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InstanceSpecificationName3EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InstanceSpecificationName3EditPart.java
new file mode 100644
index 00000000000..cd0cd003eb7
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InstanceSpecificationName3EditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class InstanceSpecificationName3EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5039;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public InstanceSpecificationName3EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.InstanceSpecification_3020, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InstanceSpecificationName4EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InstanceSpecificationName4EditPart.java
new file mode 100644
index 00000000000..df7ff12940b
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InstanceSpecificationName4EditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class InstanceSpecificationName4EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5040;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public InstanceSpecificationName4EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.InstanceSpecification_3020, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InstanceSpecificationNameEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InstanceSpecificationNameEditPart.java
new file mode 100644
index 00000000000..0c75d70949c
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InstanceSpecificationNameEditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class InstanceSpecificationNameEditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5001;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public InstanceSpecificationNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.InstanceSpecification_2001, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InstanceSpecificationQualifiedName2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InstanceSpecificationQualifiedName2EditPart.java
new file mode 100644
index 00000000000..2e33453ad5f
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InstanceSpecificationQualifiedName2EditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class InstanceSpecificationQualifiedName2EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5041;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public InstanceSpecificationQualifiedName2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.InstanceSpecification_3020, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InstanceSpecificationQualifiedNameEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InstanceSpecificationQualifiedNameEditPart.java
new file mode 100644
index 00000000000..26342d66515
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InstanceSpecificationQualifiedNameEditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class InstanceSpecificationQualifiedNameEditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5003;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public InstanceSpecificationQualifiedNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.InstanceSpecification_2001, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InstanceSpecificationSlotCompartment2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InstanceSpecificationSlotCompartment2EditPart.java
new file mode 100644
index 00000000000..cfaf13c7209
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InstanceSpecificationSlotCompartment2EditPart.java
@@ -0,0 +1,92 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.InstanceSpecificationSlotCompartment2CanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.InstanceSpecificationSlotCompartment2ItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.Messages;
+
+/**
+ * @generated
+ */
+public class InstanceSpecificationSlotCompartment2EditPart extends ListCompartmentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 7022;
+
+ /**
+ * @generated
+ */
+ public InstanceSpecificationSlotCompartment2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean hasModelChildrenChanged(Notification evt) {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public String getCompartmentName() {
+ return Messages.InstanceSpecificationSlotCompartment2EditPart_title;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure createFigure() {
+ ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new InstanceSpecificationSlotCompartment2ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new InstanceSpecificationSlotCompartment2CanonicalEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected void setRatio(Double ratio) {
+ if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InstanceSpecificationSlotCompartmentEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InstanceSpecificationSlotCompartmentEditPart.java
new file mode 100644
index 00000000000..e288262ce5c
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InstanceSpecificationSlotCompartmentEditPart.java
@@ -0,0 +1,92 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.InstanceSpecificationSlotCompartmentCanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.InstanceSpecificationSlotCompartmentItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.Messages;
+
+/**
+ * @generated
+ */
+public class InstanceSpecificationSlotCompartmentEditPart extends ListCompartmentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 7001;
+
+ /**
+ * @generated
+ */
+ public InstanceSpecificationSlotCompartmentEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean hasModelChildrenChanged(Notification evt) {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public String getCompartmentName() {
+ return Messages.InstanceSpecificationSlotCompartmentEditPart_title;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure createFigure() {
+ ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new InstanceSpecificationSlotCompartmentItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new InstanceSpecificationSlotCompartmentCanonicalEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected void setRatio(Double ratio) {
+ if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Interface2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Interface2EditPart.java
new file mode 100644
index 00000000000..d6986a15c3f
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Interface2EditPart.java
@@ -0,0 +1,515 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.Interface2CanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.Interface2ItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.common.editpolicies.BorderItemResizableEditPolicy;
+import org.eclipse.papyrus.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy;
+import org.eclipse.papyrus.diagram.common.figure.node.CClassifierFigure;
+import org.eclipse.papyrus.diagram.common.locator.TemplateClassifierBorderItemLocator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @generated
+ */
+public class Interface2EditPart extends AbstractBorderedShapeEditPart {
+
+ /**
+ * @generated
+ */
+ public class ClassifierDescriptor extends CClassifierFigure {
+
+ /**
+ * @generated
+ */
+ private RectangleFigure fAttributeCompartmentFigure;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fClassifierNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fClassifierQualifiedNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fClassifierStereotypeLabel;
+
+ /**
+ * @generated
+ */
+ private RectangleFigure fNestedClassifierFigure;
+
+ /**
+ * @generated
+ */
+ private RectangleFigure fOperationCompartmentFigure;
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ public ClassifierDescriptor() {
+
+ this.setForegroundColor(THIS_FORE);
+ this.setBackgroundColor(THIS_BACK);
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ fClassifierStereotypeLabel = new WrappingLabel();
+ fClassifierStereotypeLabel.setText("");
+
+ fClassifierStereotypeLabel.setFont(FCLASSIFIERSTEREOTYPELABEL_FONT);
+
+ this.add(fClassifierStereotypeLabel);
+
+ fClassifierNameLabel = new WrappingLabel();
+ fClassifierNameLabel.setText("");
+
+ fClassifierNameLabel.setFont(FCLASSIFIERNAMELABEL_FONT);
+
+ this.add(fClassifierNameLabel);
+
+ fClassifierQualifiedNameLabel = new WrappingLabel();
+ fClassifierQualifiedNameLabel.setText("");
+
+ fClassifierQualifiedNameLabel.setFont(FCLASSIFIERQUALIFIEDNAMELABEL_FONT);
+
+ this.add(fClassifierQualifiedNameLabel);
+
+ fAttributeCompartmentFigure = new RectangleFigure();
+ fAttributeCompartmentFigure.setFill(false);
+
+ this.add(fAttributeCompartmentFigure);
+ fAttributeCompartmentFigure.setLayoutManager(new StackLayout());
+
+ fOperationCompartmentFigure = new RectangleFigure();
+ fOperationCompartmentFigure.setFill(false);
+
+ this.add(fOperationCompartmentFigure);
+ fOperationCompartmentFigure.setLayoutManager(new StackLayout());
+
+ fNestedClassifierFigure = new RectangleFigure();
+ fNestedClassifierFigure.setFill(false);
+
+ this.add(fNestedClassifierFigure);
+ fNestedClassifierFigure.setLayoutManager(new StackLayout());
+
+ }
+
+ /**
+ * @generated
+ */
+ public RectangleFigure getAttributeCompartmentFigure() {
+ return fAttributeCompartmentFigure;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getClassifierNameLabel() {
+ return fClassifierNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getClassifierQualifiedNameLabel() {
+ return fClassifierQualifiedNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getClassifierStereotypeLabel() {
+ return fClassifierStereotypeLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public RectangleFigure getNestedClassifierFigure() {
+ return fNestedClassifierFigure;
+ }
+
+ /**
+ * @generated
+ */
+ public RectangleFigure getOperationCompartmentFigure() {
+ return fOperationCompartmentFigure;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ static final Font FCLASSIFIERNAMELABEL_FONT = new Font(Display.getCurrent(), "Arial", 10, SWT.BOLD);
+
+ /**
+ * @generated
+ */
+ static final Font FCLASSIFIERQUALIFIEDNAMELABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.ITALIC);
+
+ /**
+ * @generated
+ */
+ static final Font FCLASSIFIERSTEREOTYPELABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.NORMAL);
+
+ /**
+ * @generated
+ */
+ static final Color THIS_BACK = new Color(null, 235, 248, 255);
+
+ /**
+ * @generated
+ */
+ static final Color THIS_FORE = new Color(null, 177, 207, 229);
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 3023;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public Interface2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof InterfaceName3EditPart) {
+ ((InterfaceName3EditPart) childEditPart).setLabel(getPrimaryShape().getClassifierStereotypeLabel());
+ return true;
+ }
+ if (childEditPart instanceof InterfaceName4EditPart) {
+ ((InterfaceName4EditPart) childEditPart).setLabel(getPrimaryShape().getClassifierNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof InterfaceQualifiedName2EditPart) {
+ ((InterfaceQualifiedName2EditPart) childEditPart).setLabel(getPrimaryShape().getClassifierQualifiedNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof InterfaceAttributeCompartment2EditPart) {
+ IFigure pane = getPrimaryShape().getAttributeCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((InterfaceAttributeCompartment2EditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof InterfaceOperationCompartment2EditPart) {
+ IFigure pane = getPrimaryShape().getOperationCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((InterfaceOperationCompartment2EditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof InterfaceNestedClassifierCompartment2EditPart) {
+ IFigure pane = getPrimaryShape().getNestedClassifierFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((InterfaceNestedClassifierCompartment2EditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof RedefinableTemplateSignatureEditPart) {
+ // BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.NORTH);
+ BorderItemLocator locator = new TemplateClassifierBorderItemLocator(getMainFigure(), PositionConstants.NORTH);
+ getBorderedFigure().getBorderItemContainer().add(((RedefinableTemplateSignatureEditPart) childEditPart).getFigure(), locator);
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy() {
+
+ public Command getCommand(Request request) {
+ if (understandsRequest(request)) {
+ if (request instanceof CreateViewAndElementRequest) {
+ CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest) request).getViewAndElementDescriptor().getCreateElementRequestAdapter();
+ IElementType type = (IElementType) adapter.getAdapter(IElementType.class);
+ if (type == UMLElementTypes.Property_3006) {
+ EditPart compartmentEditPart = getChildBySemanticHint(UMLVisualIDRegistry.getType(InterfaceAttributeCompartment2EditPart.VISUAL_ID));
+ return compartmentEditPart == null ? null : compartmentEditPart.getCommand(request);
+ }
+ if (type == UMLElementTypes.Operation_3007) {
+ EditPart compartmentEditPart = getChildBySemanticHint(UMLVisualIDRegistry.getType(InterfaceOperationCompartment2EditPart.VISUAL_ID));
+ return compartmentEditPart == null ? null : compartmentEditPart.getCommand(request);
+ }
+ if (type == UMLElementTypes.Class_3008) {
+ EditPart compartmentEditPart = getChildBySemanticHint(UMLVisualIDRegistry.getType(InterfaceNestedClassifierCompartment2EditPart.VISUAL_ID));
+ return compartmentEditPart == null ? null : compartmentEditPart.getCommand(request);
+ }
+ }
+ return super.getCommand(request);
+ }
+ return null;
+ }
+ });
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new Interface2ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new Interface2CanonicalEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy());
+
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+ LayoutEditPolicy lep = new LayoutEditPolicy() {
+
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ if (child instanceof IBorderItemEditPart) {
+ // return new BorderItemSelectionEditPolicy();
+ return new BorderItemResizableEditPolicy();
+ }
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ protected NodeFigure createMainFigure() {
+ NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ IFigure shape = createNodeShape();
+ figure.add(shape);
+ contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(40), getMapMode().DPtoLP(40));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ ClassifierDescriptor figure = new ClassifierDescriptor();
+ return primaryShape = figure;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+
+ if (editPart instanceof InterfaceAttributeCompartment2EditPart) {
+ return getPrimaryShape().getAttributeCompartmentFigure();
+ }
+ if (editPart instanceof InterfaceOperationCompartment2EditPart) {
+ return getPrimaryShape().getOperationCompartmentFigure();
+ }
+ if (editPart instanceof InterfaceNestedClassifierCompartment2EditPart) {
+ return getPrimaryShape().getNestedClassifierFigure();
+ }
+ if (editPart instanceof RedefinableTemplateSignatureEditPart) {
+ return getBorderedFigure().getBorderItemContainer();
+ }
+ return super.getContentPaneFor(editPart);
+ }
+
+ /**
+ * @generated
+ */
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(InterfaceName3EditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ public ClassifierDescriptor getPrimaryShape() {
+ return (ClassifierDescriptor) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+
+ if (childEditPart instanceof InterfaceAttributeCompartment2EditPart) {
+ IFigure pane = getPrimaryShape().getAttributeCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.remove(((InterfaceAttributeCompartment2EditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof InterfaceOperationCompartment2EditPart) {
+ IFigure pane = getPrimaryShape().getOperationCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.remove(((InterfaceOperationCompartment2EditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof InterfaceNestedClassifierCompartment2EditPart) {
+ IFigure pane = getPrimaryShape().getNestedClassifierFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.remove(((InterfaceNestedClassifierCompartment2EditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof RedefinableTemplateSignatureEditPart) {
+ getBorderedFigure().getBorderItemContainer().remove(((RedefinableTemplateSignatureEditPart) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(getMapMode().DPtoLP(5));
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceAttributeCompartment2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceAttributeCompartment2EditPart.java
new file mode 100644
index 00000000000..3278f164e2f
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceAttributeCompartment2EditPart.java
@@ -0,0 +1,92 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.InterfaceAttributeCompartment2CanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.InterfaceAttributeCompartment2ItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.Messages;
+
+/**
+ * @generated
+ */
+public class InterfaceAttributeCompartment2EditPart extends ListCompartmentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 7027;
+
+ /**
+ * @generated
+ */
+ public InterfaceAttributeCompartment2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean hasModelChildrenChanged(Notification evt) {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public String getCompartmentName() {
+ return Messages.InterfaceAttributeCompartment2EditPart_title;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure createFigure() {
+ ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new InterfaceAttributeCompartment2ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new InterfaceAttributeCompartment2CanonicalEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected void setRatio(Double ratio) {
+ if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceAttributeCompartmentEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceAttributeCompartmentEditPart.java
new file mode 100644
index 00000000000..012ac8c4281
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceAttributeCompartmentEditPart.java
@@ -0,0 +1,92 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.InterfaceAttributeCompartmentCanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.InterfaceAttributeCompartmentItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.Messages;
+
+/**
+ * @generated
+ */
+public class InterfaceAttributeCompartmentEditPart extends ListCompartmentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 7006;
+
+ /**
+ * @generated
+ */
+ public InterfaceAttributeCompartmentEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean hasModelChildrenChanged(Notification evt) {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public String getCompartmentName() {
+ return Messages.InterfaceAttributeCompartmentEditPart_title;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure createFigure() {
+ ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new InterfaceAttributeCompartmentItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new InterfaceAttributeCompartmentCanonicalEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected void setRatio(Double ratio) {
+ if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceEditPart.java
new file mode 100644
index 00000000000..6b871d9f93b
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceEditPart.java
@@ -0,0 +1,522 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.InterfaceCanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.InterfaceItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.common.editpolicies.BorderItemResizableEditPolicy;
+import org.eclipse.papyrus.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy;
+import org.eclipse.papyrus.diagram.common.figure.node.CClassifierFigure;
+import org.eclipse.papyrus.diagram.common.locator.TemplateClassifierBorderItemLocator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @generated
+ */
+public class InterfaceEditPart extends AbstractBorderedShapeEditPart {
+
+ /**
+ * @generated
+ */
+ public class ClassifierDescriptor extends CClassifierFigure {
+
+ /**
+ * @generated
+ */
+ private RectangleFigure fAttributeCompartmentFigure;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fClassifierNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fClassifierQualifiedNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fClassifierStereotypeLabel;
+
+ /**
+ * @generated
+ */
+ private RectangleFigure fNestedClassifierFigure;
+
+ /**
+ * @generated
+ */
+ private RectangleFigure fOperationCompartmentFigure;
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ public ClassifierDescriptor() {
+
+ this.setForegroundColor(THIS_FORE);
+ this.setBackgroundColor(THIS_BACK);
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ fClassifierStereotypeLabel = new WrappingLabel();
+ fClassifierStereotypeLabel.setText("");
+
+ fClassifierStereotypeLabel.setFont(FCLASSIFIERSTEREOTYPELABEL_FONT);
+
+ this.add(fClassifierStereotypeLabel);
+
+ fClassifierNameLabel = new WrappingLabel();
+ fClassifierNameLabel.setText("");
+
+ fClassifierNameLabel.setFont(FCLASSIFIERNAMELABEL_FONT);
+
+ this.add(fClassifierNameLabel);
+
+ fClassifierQualifiedNameLabel = new WrappingLabel();
+ fClassifierQualifiedNameLabel.setText("");
+
+ fClassifierQualifiedNameLabel.setFont(FCLASSIFIERQUALIFIEDNAMELABEL_FONT);
+
+ this.add(fClassifierQualifiedNameLabel);
+
+ fAttributeCompartmentFigure = new RectangleFigure();
+ fAttributeCompartmentFigure.setFill(false);
+
+ this.add(fAttributeCompartmentFigure);
+ fAttributeCompartmentFigure.setLayoutManager(new StackLayout());
+
+ fOperationCompartmentFigure = new RectangleFigure();
+ fOperationCompartmentFigure.setFill(false);
+
+ this.add(fOperationCompartmentFigure);
+ fOperationCompartmentFigure.setLayoutManager(new StackLayout());
+
+ fNestedClassifierFigure = new RectangleFigure();
+ fNestedClassifierFigure.setFill(false);
+
+ this.add(fNestedClassifierFigure);
+ fNestedClassifierFigure.setLayoutManager(new StackLayout());
+
+ }
+
+ /**
+ * @generated
+ */
+ public RectangleFigure getAttributeCompartmentFigure() {
+ return fAttributeCompartmentFigure;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getClassifierNameLabel() {
+ return fClassifierNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getClassifierQualifiedNameLabel() {
+ return fClassifierQualifiedNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getClassifierStereotypeLabel() {
+ return fClassifierStereotypeLabel;
+ }
+
+ @Override
+ public Color getGradientColor() {
+ return THIS_GRADIENT;
+ }
+
+ /**
+ * @generated
+ */
+ public RectangleFigure getNestedClassifierFigure() {
+ return fNestedClassifierFigure;
+ }
+
+ /**
+ * @generated
+ */
+ public RectangleFigure getOperationCompartmentFigure() {
+ return fOperationCompartmentFigure;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ static final Font FCLASSIFIERNAMELABEL_FONT = new Font(Display.getCurrent(), "Arial", 10, SWT.BOLD);
+
+ /**
+ * @generated
+ */
+ static final Font FCLASSIFIERQUALIFIEDNAMELABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.ITALIC);
+
+ /**
+ * @generated
+ */
+ static final Font FCLASSIFIERSTEREOTYPELABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.NORMAL);
+
+ /**
+ * @generated
+ */
+ static final Color THIS_BACK = new Color(null, 235, 248, 255);
+
+ /**
+ * @generated
+ */
+ static final Color THIS_FORE = new Color(null, 177, 207, 229);
+
+ static final Color THIS_GRADIENT = new Color(null, 177, 207, 229);
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 2004;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public InterfaceEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof InterfaceNameEditPart) {
+ ((InterfaceNameEditPart) childEditPart).setLabel(getPrimaryShape().getClassifierStereotypeLabel());
+ return true;
+ }
+ if (childEditPart instanceof InterfaceName2EditPart) {
+ ((InterfaceName2EditPart) childEditPart).setLabel(getPrimaryShape().getClassifierNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof InterfaceQualifiedNameEditPart) {
+ ((InterfaceQualifiedNameEditPart) childEditPart).setLabel(getPrimaryShape().getClassifierQualifiedNameLabel());
+ 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;
+ }
+ if (childEditPart instanceof InterfaceNestedClassifierCompartmentEditPart) {
+ IFigure pane = getPrimaryShape().getNestedClassifierFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((InterfaceNestedClassifierCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof RedefinableTemplateSignatureEditPart) {
+ // BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.NORTH);
+ BorderItemLocator locator = new TemplateClassifierBorderItemLocator(getMainFigure(), PositionConstants.NORTH);
+ getBorderedFigure().getBorderItemContainer().add(((RedefinableTemplateSignatureEditPart) childEditPart).getFigure(), locator);
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy() {
+
+ public Command getCommand(Request request) {
+ if (understandsRequest(request)) {
+ if (request instanceof CreateViewAndElementRequest) {
+ CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest) request).getViewAndElementDescriptor().getCreateElementRequestAdapter();
+ IElementType type = (IElementType) adapter.getAdapter(IElementType.class);
+ if (type == UMLElementTypes.Property_3006) {
+ EditPart compartmentEditPart = getChildBySemanticHint(UMLVisualIDRegistry.getType(InterfaceAttributeCompartmentEditPart.VISUAL_ID));
+ return compartmentEditPart == null ? null : compartmentEditPart.getCommand(request);
+ }
+ if (type == UMLElementTypes.Operation_3007) {
+ EditPart compartmentEditPart = getChildBySemanticHint(UMLVisualIDRegistry.getType(InterfaceOperationCompartmentEditPart.VISUAL_ID));
+ return compartmentEditPart == null ? null : compartmentEditPart.getCommand(request);
+ }
+ if (type == UMLElementTypes.Class_3008) {
+ EditPart compartmentEditPart = getChildBySemanticHint(UMLVisualIDRegistry.getType(InterfaceNestedClassifierCompartmentEditPart.VISUAL_ID));
+ return compartmentEditPart == null ? null : compartmentEditPart.getCommand(request);
+ }
+ }
+ return super.getCommand(request);
+ }
+ return null;
+ }
+ });
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new InterfaceItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new InterfaceCanonicalEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy());
+
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+ LayoutEditPolicy lep = new LayoutEditPolicy() {
+
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ if (child instanceof IBorderItemEditPart) {
+ // return new BorderItemSelectionEditPolicy();
+ return new BorderItemResizableEditPolicy();
+ }
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ protected NodeFigure createMainFigure() {
+ NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ IFigure shape = createNodeShape();
+ figure.add(shape);
+ contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(40), getMapMode().DPtoLP(40));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ ClassifierDescriptor figure = new ClassifierDescriptor();
+ return primaryShape = figure;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+
+ if (editPart instanceof InterfaceAttributeCompartmentEditPart) {
+ return getPrimaryShape().getAttributeCompartmentFigure();
+ }
+ if (editPart instanceof InterfaceOperationCompartmentEditPart) {
+ return getPrimaryShape().getOperationCompartmentFigure();
+ }
+ if (editPart instanceof InterfaceNestedClassifierCompartmentEditPart) {
+ return getPrimaryShape().getNestedClassifierFigure();
+ }
+ if (editPart instanceof RedefinableTemplateSignatureEditPart) {
+ return getBorderedFigure().getBorderItemContainer();
+ }
+ return super.getContentPaneFor(editPart);
+ }
+
+ /**
+ * @generated not
+ */
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(InterfaceName2EditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ public ClassifierDescriptor getPrimaryShape() {
+ return (ClassifierDescriptor) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+
+ if (childEditPart instanceof InterfaceAttributeCompartmentEditPart) {
+ IFigure pane = getPrimaryShape().getAttributeCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.remove(((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.remove(((InterfaceOperationCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof InterfaceNestedClassifierCompartmentEditPart) {
+ IFigure pane = getPrimaryShape().getNestedClassifierFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.remove(((InterfaceNestedClassifierCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof RedefinableTemplateSignatureEditPart) {
+ getBorderedFigure().getBorderItemContainer().remove(((RedefinableTemplateSignatureEditPart) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(getMapMode().DPtoLP(5));
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceName2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceName2EditPart.java
new file mode 100644
index 00000000000..3f25beda45d
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceName2EditPart.java
@@ -0,0 +1,554 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class InterfaceName2EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5011;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ public InterfaceName2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ EObject parserElement = getParserElement();
+ if (parserElement == null) {
+ return null;
+ }
+ return UMLElementTypes.getImage(parserElement.eClass());
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Interface_2004, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated not
+ */
+ protected boolean isEditable() {
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceName3EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceName3EditPart.java
new file mode 100644
index 00000000000..7fa6b7c28ac
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceName3EditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class InterfaceName3EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5048;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public InterfaceName3EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Interface_3023, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceName4EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceName4EditPart.java
new file mode 100644
index 00000000000..d9498352bf7
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceName4EditPart.java
@@ -0,0 +1,554 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class InterfaceName4EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5049;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public InterfaceName4EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ EObject parserElement = getParserElement();
+ if (parserElement == null) {
+ return null;
+ }
+ return UMLElementTypes.getImage(parserElement.eClass());
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Interface_3023, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceNameEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceNameEditPart.java
new file mode 100644
index 00000000000..13876cd8d4d
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceNameEditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class InterfaceNameEditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5010;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public InterfaceNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Interface_2004, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceNestedClassifierCompartment2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceNestedClassifierCompartment2EditPart.java
new file mode 100644
index 00000000000..b627009fb89
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceNestedClassifierCompartment2EditPart.java
@@ -0,0 +1,92 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.InterfaceNestedClassifierCompartment2CanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.InterfaceNestedClassifierCompartment2ItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.Messages;
+
+/**
+ * @generated
+ */
+public class InterfaceNestedClassifierCompartment2EditPart extends ListCompartmentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 7029;
+
+ /**
+ * @generated
+ */
+ public InterfaceNestedClassifierCompartment2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean hasModelChildrenChanged(Notification evt) {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public String getCompartmentName() {
+ return Messages.InterfaceNestedClassifierCompartment2EditPart_title;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure createFigure() {
+ ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new InterfaceNestedClassifierCompartment2ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new InterfaceNestedClassifierCompartment2CanonicalEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected void setRatio(Double ratio) {
+ if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceNestedClassifierCompartmentEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceNestedClassifierCompartmentEditPart.java
new file mode 100644
index 00000000000..afa92c3f6f6
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceNestedClassifierCompartmentEditPart.java
@@ -0,0 +1,92 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.InterfaceNestedClassifierCompartmentCanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.InterfaceNestedClassifierCompartmentItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.Messages;
+
+/**
+ * @generated
+ */
+public class InterfaceNestedClassifierCompartmentEditPart extends ListCompartmentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 7008;
+
+ /**
+ * @generated
+ */
+ public InterfaceNestedClassifierCompartmentEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean hasModelChildrenChanged(Notification evt) {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public String getCompartmentName() {
+ return Messages.InterfaceNestedClassifierCompartmentEditPart_title;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure createFigure() {
+ ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new InterfaceNestedClassifierCompartmentItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new InterfaceNestedClassifierCompartmentCanonicalEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected void setRatio(Double ratio) {
+ if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceOperationCompartment2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceOperationCompartment2EditPart.java
new file mode 100644
index 00000000000..648934633ef
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceOperationCompartment2EditPart.java
@@ -0,0 +1,92 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.InterfaceOperationCompartment2CanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.InterfaceOperationCompartment2ItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.Messages;
+
+/**
+ * @generated
+ */
+public class InterfaceOperationCompartment2EditPart extends ListCompartmentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 7028;
+
+ /**
+ * @generated
+ */
+ public InterfaceOperationCompartment2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean hasModelChildrenChanged(Notification evt) {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public String getCompartmentName() {
+ return Messages.InterfaceOperationCompartment2EditPart_title;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure createFigure() {
+ ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new InterfaceOperationCompartment2ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new InterfaceOperationCompartment2CanonicalEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected void setRatio(Double ratio) {
+ if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceOperationCompartmentEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceOperationCompartmentEditPart.java
new file mode 100644
index 00000000000..bf318fe2631
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceOperationCompartmentEditPart.java
@@ -0,0 +1,92 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.InterfaceOperationCompartmentCanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.InterfaceOperationCompartmentItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.Messages;
+
+/**
+ * @generated
+ */
+public class InterfaceOperationCompartmentEditPart extends ListCompartmentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 7007;
+
+ /**
+ * @generated
+ */
+ public InterfaceOperationCompartmentEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean hasModelChildrenChanged(Notification evt) {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public String getCompartmentName() {
+ return Messages.InterfaceOperationCompartmentEditPart_title;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure createFigure() {
+ ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new InterfaceOperationCompartmentItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new InterfaceOperationCompartmentCanonicalEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected void setRatio(Double ratio) {
+ if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceQualifiedName2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceQualifiedName2EditPart.java
new file mode 100644
index 00000000000..918a96def68
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceQualifiedName2EditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class InterfaceQualifiedName2EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5050;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public InterfaceQualifiedName2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Interface_3023, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceQualifiedNameEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceQualifiedNameEditPart.java
new file mode 100644
index 00000000000..1271dd86de4
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceQualifiedNameEditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class InterfaceQualifiedNameEditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5012;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public InterfaceQualifiedNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Interface_2004, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceRealizationEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceRealizationEditPart.java
new file mode 100644
index 00000000000..00f0e3d2b05
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceRealizationEditPart.java
@@ -0,0 +1,173 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Connection;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.InterfaceRealizationItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.common.figure.edge.CInterfaceRealizationFigure;
+
+/**
+ * @generated
+ */
+public class InterfaceRealizationEditPart extends ConnectionNodeEditPart implements ITreeBranchEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 4003;
+
+ /**
+ * @generated
+ */
+ public InterfaceRealizationEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new InterfaceRealizationItemSemanticEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof InterfaceRealizationNameEditPart) {
+ ((InterfaceRealizationNameEditPart) childEditPart).setLabel(getPrimaryShape().getAppliedStereotypeLabel());
+ return true;
+ }
+ if (childEditPart instanceof InterfaceRealizationName2EditPart) {
+ ((InterfaceRealizationName2EditPart) childEditPart).setLabel(getPrimaryShape().getInterfaceRealizationNameLabel());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+
+ protected Connection createConnectionFigure() {
+ return new InterfaceRealizationDescriptor();
+ }
+
+ /**
+ * @generated
+ */
+ public InterfaceRealizationDescriptor getPrimaryShape() {
+ return (InterfaceRealizationDescriptor) getFigure();
+ }
+
+ /**
+ * @generated
+ */
+ public class InterfaceRealizationDescriptor extends CInterfaceRealizationFigure {
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fInterfaceRealizationNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fAppliedStereotypeLabel;
+
+ /**
+ * @generated
+ */
+ public InterfaceRealizationDescriptor() {
+
+ this.setForegroundColor(ColorConstants.black);
+ this.setBackgroundColor(ColorConstants.black);
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ fInterfaceRealizationNameLabel = new WrappingLabel();
+ fInterfaceRealizationNameLabel.setText("");
+
+ this.add(fInterfaceRealizationNameLabel);
+
+ fAppliedStereotypeLabel = new WrappingLabel();
+ fAppliedStereotypeLabel.setText("");
+
+ this.add(fAppliedStereotypeLabel);
+
+ }
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getInterfaceRealizationNameLabel() {
+ return fInterfaceRealizationNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getAppliedStereotypeLabel() {
+ return fAppliedStereotypeLabel;
+ }
+
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceRealizationName2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceRealizationName2EditPart.java
new file mode 100644
index 00000000000..17d601a6431
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceRealizationName2EditPart.java
@@ -0,0 +1,529 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class InterfaceRealizationName2EditPart extends LabelEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 6009;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceRealizationName2EditPart.VISUAL_ID), new Point(0, 60));
+ }
+
+ /**
+ * @generated
+ */
+ public InterfaceRealizationName2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ public int getKeyPoint() {
+ return ConnectionLocator.MIDDLE;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.InterfaceRealization_4003, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceRealizationNameEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceRealizationNameEditPart.java
new file mode 100644
index 00000000000..67ef6345632
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/InterfaceRealizationNameEditPart.java
@@ -0,0 +1,529 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class InterfaceRealizationNameEditPart extends LabelEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 6008;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceRealizationNameEditPart.VISUAL_ID), new Point(0, 40));
+ }
+
+ /**
+ * @generated
+ */
+ public InterfaceRealizationNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ public int getKeyPoint() {
+ return ConnectionLocator.MIDDLE;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.InterfaceRealization_4003, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Model2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Model2EditPart.java
new file mode 100644
index 00000000000..8a7d33dcda3
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Model2EditPart.java
@@ -0,0 +1,426 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.custom.policies.RemoveOphanConnectionViewClazzPolicy;
+import org.eclipse.papyrus.diagram.clazz.custom.policies.RemoveOrphanNodeViewPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.Model2ItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.OpenDiagramEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.common.editpolicies.BorderItemResizableEditPolicy;
+import org.eclipse.papyrus.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy;
+import org.eclipse.papyrus.diagram.common.figure.node.CPackageFigure;
+import org.eclipse.papyrus.diagram.common.figure.node.PackageNodeFigure;
+import org.eclipse.papyrus.diagram.common.locator.TemplateBorderItemLocator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @generated
+ */
+public class Model2EditPart extends AbstractBorderedShapeEditPart {
+
+ /**
+ * @generated
+ */
+ public class PackageFigureDescriptor extends CPackageFigure {
+
+ /**
+ * @generated
+ */
+ private RectangleFigure fPackageableElementFigure;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fPackageNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fPackageQualifiedNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fStereotypesLabel;
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ public PackageFigureDescriptor() {
+
+ this.setForegroundColor(THIS_FORE);
+ this.setBackgroundColor(THIS_BACK);
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ fStereotypesLabel = new WrappingLabel();
+ fStereotypesLabel.setText("");
+
+ fStereotypesLabel.setFont(FSTEREOTYPESLABEL_FONT);
+
+ this.add(fStereotypesLabel);
+
+ fPackageNameLabel = new WrappingLabel();
+ fPackageNameLabel.setText("");
+
+ fPackageNameLabel.setFont(FPACKAGENAMELABEL_FONT);
+
+ this.add(fPackageNameLabel);
+
+ fPackageQualifiedNameLabel = new WrappingLabel();
+ fPackageQualifiedNameLabel.setText("");
+
+ fPackageQualifiedNameLabel.setFont(FPACKAGEQUALIFIEDNAMELABEL_FONT);
+
+ this.add(fPackageQualifiedNameLabel);
+
+ fPackageableElementFigure = new RectangleFigure();
+
+ this.add(fPackageableElementFigure);
+
+ }
+
+ /**
+ * @generated
+ */
+ public RectangleFigure getPackageableElementFigure() {
+ return fPackageableElementFigure;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getPackageNameLabel() {
+ return fPackageNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getPackageQualifiedNameLabel() {
+ return fPackageQualifiedNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getStereotypesLabel() {
+ return fStereotypesLabel;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ static final Font FPACKAGENAMELABEL_FONT = new Font(Display.getCurrent(), "Arial", 10, SWT.BOLD);
+
+ /**
+ * @generated
+ */
+ static final Font FPACKAGEQUALIFIEDNAMELABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.ITALIC);
+
+ /**
+ * @generated
+ */
+ static final Font FSTEREOTYPESLABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.NORMAL);
+
+ /**
+ * @generated
+ */
+ static final Color THIS_BACK = new Color(null, 255, 199, 143);
+
+ /**
+ * @generated
+ */
+ static final Color THIS_FORE = new Color(null, 233, 164, 96);
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 2005;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public Model2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof ModelNameEditPart) {
+ ((ModelNameEditPart) childEditPart).setLabel(getPrimaryShape().getStereotypesLabel());
+ return true;
+ }
+ if (childEditPart instanceof ModelName2EditPart) {
+ ((ModelName2EditPart) childEditPart).setLabel(getPrimaryShape().getPackageNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof ModelQualifiedNameEditPart) {
+ ((ModelQualifiedNameEditPart) childEditPart).setLabel(getPrimaryShape().getPackageQualifiedNameLabel());
+ 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;
+ }
+ if (childEditPart instanceof RedefinableTemplateSignatureEditPart) {
+ // BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.NORTH);
+ BorderItemLocator locator = new TemplateBorderItemLocator(getMainFigure(), PositionConstants.NORTH);
+
+ getBorderedFigure().getBorderItemContainer().add(((RedefinableTemplateSignatureEditPart) childEditPart).getFigure(), locator);
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new Model2ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new RemoveOrphanNodeViewPolicy());
+ installEditPolicy("canonicalConnection", new RemoveOphanConnectionViewClazzPolicy());
+
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy());
+ installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy());
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+ LayoutEditPolicy lep = new LayoutEditPolicy() {
+
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ if (child instanceof IBorderItemEditPart) {
+ // return new BorderItemSelectionEditPolicy();
+ return new BorderItemResizableEditPolicy();
+ }
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ protected NodeFigure createMainFigure() {
+ NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ IFigure shape = createNodeShape();
+ figure.add(shape);
+ contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * @generated-not
+ */
+ protected NodeFigure createNodePlate() {
+ DefaultSizeNodeFigure result = new PackageNodeFigure(getMapMode().DPtoLP(40), getMapMode().DPtoLP(40));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ PackageFigureDescriptor figure = new PackageFigureDescriptor();
+ return primaryShape = figure;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+
+ if (editPart instanceof ModelPackageableElementCompartmentEditPart) {
+ return getPrimaryShape().getPackageableElementFigure();
+ }
+ if (editPart instanceof RedefinableTemplateSignatureEditPart) {
+ return getBorderedFigure().getBorderItemContainer();
+ }
+ return super.getContentPaneFor(editPart);
+ }
+
+ /**
+ * @generated
+ */
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(ModelNameEditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ public PackageFigureDescriptor getPrimaryShape() {
+ return (PackageFigureDescriptor) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+
+ if (childEditPart instanceof ModelPackageableElementCompartmentEditPart) {
+ IFigure pane = getPrimaryShape().getPackageableElementFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.remove(((ModelPackageableElementCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof RedefinableTemplateSignatureEditPart) {
+ getBorderedFigure().getBorderItemContainer().remove(((RedefinableTemplateSignatureEditPart) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(getMapMode().DPtoLP(5));
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Model3EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Model3EditPart.java
new file mode 100644
index 00000000000..a3297a7279d
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Model3EditPart.java
@@ -0,0 +1,426 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.custom.policies.RemoveOphanConnectionViewClazzPolicy;
+import org.eclipse.papyrus.diagram.clazz.custom.policies.RemoveOrphanNodeViewPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.Model3ItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.OpenDiagramEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.common.editpolicies.BorderItemResizableEditPolicy;
+import org.eclipse.papyrus.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy;
+import org.eclipse.papyrus.diagram.common.figure.node.CPackageFigure;
+import org.eclipse.papyrus.diagram.common.figure.node.PackageNodeFigure;
+import org.eclipse.papyrus.diagram.common.locator.TemplateBorderItemLocator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @generated
+ */
+public class Model3EditPart extends AbstractBorderedShapeEditPart {
+
+ /**
+ * @generated
+ */
+ public class PackageFigureDescriptor extends CPackageFigure {
+
+ /**
+ * @generated
+ */
+ private RectangleFigure fPackageableElementFigure;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fPackageNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fPackageQualifiedNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fStereotypesLabel;
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ public PackageFigureDescriptor() {
+
+ this.setForegroundColor(THIS_FORE);
+ this.setBackgroundColor(THIS_BACK);
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ fStereotypesLabel = new WrappingLabel();
+ fStereotypesLabel.setText("");
+
+ fStereotypesLabel.setFont(FSTEREOTYPESLABEL_FONT);
+
+ this.add(fStereotypesLabel);
+
+ fPackageNameLabel = new WrappingLabel();
+ fPackageNameLabel.setText("");
+
+ fPackageNameLabel.setFont(FPACKAGENAMELABEL_FONT);
+
+ this.add(fPackageNameLabel);
+
+ fPackageQualifiedNameLabel = new WrappingLabel();
+ fPackageQualifiedNameLabel.setText("");
+
+ fPackageQualifiedNameLabel.setFont(FPACKAGEQUALIFIEDNAMELABEL_FONT);
+
+ this.add(fPackageQualifiedNameLabel);
+
+ fPackageableElementFigure = new RectangleFigure();
+
+ this.add(fPackageableElementFigure);
+
+ }
+
+ /**
+ * @generated
+ */
+ public RectangleFigure getPackageableElementFigure() {
+ return fPackageableElementFigure;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getPackageNameLabel() {
+ return fPackageNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getPackageQualifiedNameLabel() {
+ return fPackageQualifiedNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getStereotypesLabel() {
+ return fStereotypesLabel;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ static final Font FPACKAGENAMELABEL_FONT = new Font(Display.getCurrent(), "Arial", 10, SWT.BOLD);
+
+ /**
+ * @generated
+ */
+ static final Font FPACKAGEQUALIFIEDNAMELABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.ITALIC);
+
+ /**
+ * @generated
+ */
+ static final Font FSTEREOTYPESLABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.NORMAL);
+
+ /**
+ * @generated
+ */
+ static final Color THIS_BACK = new Color(null, 255, 199, 143);
+
+ /**
+ * @generated
+ */
+ static final Color THIS_FORE = new Color(null, 233, 164, 96);
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 3024;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public Model3EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof ModelName3EditPart) {
+ ((ModelName3EditPart) childEditPart).setLabel(getPrimaryShape().getStereotypesLabel());
+ return true;
+ }
+ if (childEditPart instanceof ModelName4EditPart) {
+ ((ModelName4EditPart) childEditPart).setLabel(getPrimaryShape().getPackageNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof ModelQualifiedName2EditPart) {
+ ((ModelQualifiedName2EditPart) childEditPart).setLabel(getPrimaryShape().getPackageQualifiedNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof ModelPackageableElementCompartment2EditPart) {
+ IFigure pane = getPrimaryShape().getPackageableElementFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((ModelPackageableElementCompartment2EditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof RedefinableTemplateSignatureEditPart) {
+ // BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.NORTH);
+ BorderItemLocator locator = new TemplateBorderItemLocator(getMainFigure(), PositionConstants.NORTH);
+
+ getBorderedFigure().getBorderItemContainer().add(((RedefinableTemplateSignatureEditPart) childEditPart).getFigure(), locator);
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new Model3ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new RemoveOrphanNodeViewPolicy());
+ installEditPolicy("canonicalConnection", new RemoveOphanConnectionViewClazzPolicy());
+
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy());
+ installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy());
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+ LayoutEditPolicy lep = new LayoutEditPolicy() {
+
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ if (child instanceof IBorderItemEditPart) {
+ // return new BorderItemSelectionEditPolicy();
+ return new BorderItemResizableEditPolicy();
+ }
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ protected NodeFigure createMainFigure() {
+ NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ IFigure shape = createNodeShape();
+ figure.add(shape);
+ contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ DefaultSizeNodeFigure result = new PackageNodeFigure(getMapMode().DPtoLP(40), getMapMode().DPtoLP(40));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ PackageFigureDescriptor figure = new PackageFigureDescriptor();
+ return primaryShape = figure;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+
+ if (editPart instanceof ModelPackageableElementCompartment2EditPart) {
+ return getPrimaryShape().getPackageableElementFigure();
+ }
+ if (editPart instanceof RedefinableTemplateSignatureEditPart) {
+ return getBorderedFigure().getBorderItemContainer();
+ }
+ return super.getContentPaneFor(editPart);
+ }
+
+ /**
+ * @generated
+ */
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(ModelName3EditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ public PackageFigureDescriptor getPrimaryShape() {
+ return (PackageFigureDescriptor) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+
+ if (childEditPart instanceof ModelPackageableElementCompartment2EditPart) {
+ IFigure pane = getPrimaryShape().getPackageableElementFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.remove(((ModelPackageableElementCompartment2EditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof RedefinableTemplateSignatureEditPart) {
+ getBorderedFigure().getBorderItemContainer().remove(((RedefinableTemplateSignatureEditPart) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(getMapMode().DPtoLP(5));
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ModelEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ModelEditPart.java
new file mode 100644
index 00000000000..c6e843f2a47
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ModelEditPart.java
@@ -0,0 +1,63 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.notation.View;
+
+import org.eclipse.papyrus.diagram.clazz.custom.policies.RemoveOphanConnectionViewClazzPolicy;
+import org.eclipse.papyrus.diagram.clazz.custom.policies.RemoveOrphanNodeViewPolicy;
+
+import org.eclipse.papyrus.diagram.clazz.custom.edit.policies.DiagramDragDropEditPolicy;
+
+import org.eclipse.papyrus.diagram.clazz.edit.policies.ModelItemSemanticEditPolicy;
+
+/**
+ * @generated
+ */
+public class ModelEditPart extends DiagramEditPart {
+
+ /**
+ * @generated
+ */
+ public final static String MODEL_ID = "PapyrusUMLClassDiagram"; //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 1000;
+
+ /**
+ * @generated
+ */
+ public ModelEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated-not
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ModelItemSemanticEditPolicy());
+ // remove canonical to avoid synchronization
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new RemoveOrphanNodeViewPolicy());
+ installEditPolicy("canonicalConnection", new RemoveOphanConnectionViewClazzPolicy());
+
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.POPUPBAR_ROLE);
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DiagramDragDropEditPolicy());
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ModelName2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ModelName2EditPart.java
new file mode 100644
index 00000000000..d84dcc32637
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ModelName2EditPart.java
@@ -0,0 +1,554 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class ModelName2EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5020;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public ModelName2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ EObject parserElement = getParserElement();
+ if (parserElement == null) {
+ return null;
+ }
+ return UMLElementTypes.getImage(parserElement.eClass());
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Model_2005, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ModelName3EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ModelName3EditPart.java
new file mode 100644
index 00000000000..d5f5bdb1398
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ModelName3EditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class ModelName3EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5051;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public ModelName3EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Model_3024, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ModelName4EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ModelName4EditPart.java
new file mode 100644
index 00000000000..3ac91083997
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ModelName4EditPart.java
@@ -0,0 +1,554 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class ModelName4EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5052;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public ModelName4EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ EObject parserElement = getParserElement();
+ if (parserElement == null) {
+ return null;
+ }
+ return UMLElementTypes.getImage(parserElement.eClass());
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Model_3024, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ModelNameEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ModelNameEditPart.java
new file mode 100644
index 00000000000..215005add17
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ModelNameEditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class ModelNameEditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5019;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public ModelNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Model_2005, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ModelPackageableElementCompartment2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ModelPackageableElementCompartment2EditPart.java
new file mode 100644
index 00000000000..d53634e418d
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ModelPackageableElementCompartment2EditPart.java
@@ -0,0 +1,81 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.ModelPackageableElementCompartment2CanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.ModelPackageableElementCompartment2ItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.Messages;
+
+/**
+ * @generated
+ */
+public class ModelPackageableElementCompartment2EditPart extends ShapeCompartmentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 7030;
+
+ /**
+ * @generated
+ */
+ public ModelPackageableElementCompartment2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ public String getCompartmentName() {
+ return Messages.ModelPackageableElementCompartment2EditPart_title;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure createFigure() {
+ ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ModelPackageableElementCompartment2ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new ModelPackageableElementCompartment2CanonicalEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected void setRatio(Double ratio) {
+ if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ModelPackageableElementCompartmentEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ModelPackageableElementCompartmentEditPart.java
new file mode 100644
index 00000000000..ee9d64a1479
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ModelPackageableElementCompartmentEditPart.java
@@ -0,0 +1,81 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.ModelPackageableElementCompartmentCanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.ModelPackageableElementCompartmentItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.Messages;
+
+/**
+ * @generated
+ */
+public class ModelPackageableElementCompartmentEditPart extends ShapeCompartmentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 7009;
+
+ /**
+ * @generated
+ */
+ public ModelPackageableElementCompartmentEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ public String getCompartmentName() {
+ return Messages.ModelPackageableElementCompartmentEditPart_title;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure createFigure() {
+ ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ModelPackageableElementCompartmentItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new ModelPackageableElementCompartmentCanonicalEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected void setRatio(Double ratio) {
+ if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ModelQualifiedName2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ModelQualifiedName2EditPart.java
new file mode 100644
index 00000000000..3205c1e301e
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ModelQualifiedName2EditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class ModelQualifiedName2EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5053;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public ModelQualifiedName2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Model_3024, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ModelQualifiedNameEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ModelQualifiedNameEditPart.java
new file mode 100644
index 00000000000..19f63d8eaf6
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ModelQualifiedNameEditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class ModelQualifiedNameEditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5021;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public ModelQualifiedNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Model_2005, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Operation2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Operation2EditPart.java
new file mode 100644
index 00000000000..7a710409168
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Operation2EditPart.java
@@ -0,0 +1,581 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.DragTracker;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.requests.SelectionRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ListItemComponentEditPolicy;
+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.DragEditPartsTrackerEx;
+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.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.Operation2ItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextNonResizableEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @generated
+ */
+public class Operation2EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 3007;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public Operation2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ public DragTracker getDragTracker(Request request) {
+ if (request instanceof SelectionRequest && ((SelectionRequest) request).getLastButtonPressed() == 3) {
+ return null;
+ }
+ return new DragEditPartsTrackerEx(this);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new Operation2ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new UMLTextNonResizableEditPolicy());
+ installEditPolicy(EditPolicy.COMPONENT_ROLE, new ListItemComponentEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Operation_3007, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ IFigure label = createFigurePrim();
+ defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigurePrim() {
+ return new OperationFigureDescriptor();
+ }
+
+ /**
+ * @generated
+ */
+ public class OperationFigureDescriptor extends WrappingLabel {
+
+ /**
+ * @generated
+ */
+ public OperationFigureDescriptor() {
+ this.setText("");
+
+ this.setFont(THIS_FONT);
+
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ static final Font THIS_FONT = new Font(Display.getCurrent(), "Arial", 10, SWT.NORMAL);
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Operation3EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Operation3EditPart.java
new file mode 100644
index 00000000000..7247c7baeaa
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Operation3EditPart.java
@@ -0,0 +1,581 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.DragTracker;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.requests.SelectionRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ListItemComponentEditPolicy;
+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.DragEditPartsTrackerEx;
+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.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.Operation3ItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextNonResizableEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @generated
+ */
+public class Operation3EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 3013;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public Operation3EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ public DragTracker getDragTracker(Request request) {
+ if (request instanceof SelectionRequest && ((SelectionRequest) request).getLastButtonPressed() == 3) {
+ return null;
+ }
+ return new DragEditPartsTrackerEx(this);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new Operation3ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new UMLTextNonResizableEditPolicy());
+ installEditPolicy(EditPolicy.COMPONENT_ROLE, new ListItemComponentEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Operation_3013, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ IFigure label = createFigurePrim();
+ defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigurePrim() {
+ return new OperationFigureDescriptor();
+ }
+
+ /**
+ * @generated
+ */
+ public class OperationFigureDescriptor extends WrappingLabel {
+
+ /**
+ * @generated
+ */
+ public OperationFigureDescriptor() {
+ this.setText("");
+
+ this.setFont(THIS_FONT);
+
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ static final Font THIS_FONT = new Font(Display.getCurrent(), "Arial", 10, SWT.NORMAL);
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Operation4EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Operation4EditPart.java
new file mode 100644
index 00000000000..c58022b30e3
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Operation4EditPart.java
@@ -0,0 +1,581 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.DragTracker;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.requests.SelectionRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ListItemComponentEditPolicy;
+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.DragEditPartsTrackerEx;
+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.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.Operation4ItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextNonResizableEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @generated
+ */
+public class Operation4EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 3019;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public Operation4EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ public DragTracker getDragTracker(Request request) {
+ if (request instanceof SelectionRequest && ((SelectionRequest) request).getLastButtonPressed() == 3) {
+ return null;
+ }
+ return new DragEditPartsTrackerEx(this);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new Operation4ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new UMLTextNonResizableEditPolicy());
+ installEditPolicy(EditPolicy.COMPONENT_ROLE, new ListItemComponentEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Operation_3019, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ IFigure label = createFigurePrim();
+ defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigurePrim() {
+ return new OperationFigureDescriptor();
+ }
+
+ /**
+ * @generated
+ */
+ public class OperationFigureDescriptor extends WrappingLabel {
+
+ /**
+ * @generated
+ */
+ public OperationFigureDescriptor() {
+ this.setText("");
+
+ this.setFont(THIS_FONT);
+
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ static final Font THIS_FONT = new Font(Display.getCurrent(), "Arial", 10, SWT.NORMAL);
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Operation5EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Operation5EditPart.java
new file mode 100644
index 00000000000..f4010f42a75
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Operation5EditPart.java
@@ -0,0 +1,581 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.DragTracker;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.requests.SelectionRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ListItemComponentEditPolicy;
+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.DragEditPartsTrackerEx;
+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.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.Operation5ItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextNonResizableEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @generated
+ */
+public class Operation5EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public class OperationFigureDescriptor extends WrappingLabel {
+
+ /**
+ * @generated
+ */
+ public OperationFigureDescriptor() {
+ this.setText("");
+
+ this.setFont(THIS_FONT);
+
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ static final Font THIS_FONT = new Font(Display.getCurrent(), "Arial", 10, SWT.NORMAL);
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 2018;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ public Operation5EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new Operation5ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new UMLTextNonResizableEditPolicy());
+ installEditPolicy(EditPolicy.COMPONENT_ROLE, new ListItemComponentEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ IFigure label = createFigurePrim();
+ defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigurePrim() {
+ return new OperationFigureDescriptor();
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public DragTracker getDragTracker(Request request) {
+ if (request instanceof SelectionRequest && ((SelectionRequest) request).getLastButtonPressed() == 3) {
+ return null;
+ }
+ return new DragEditPartsTrackerEx(this);
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Operation_3007, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/OperationEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/OperationEditPart.java
new file mode 100644
index 00000000000..620e6ce32bf
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/OperationEditPart.java
@@ -0,0 +1,581 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.DragTracker;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.requests.SelectionRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ListItemComponentEditPolicy;
+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.DragEditPartsTrackerEx;
+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.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.OperationItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextNonResizableEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @generated
+ */
+public class OperationEditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 3003;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public OperationEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ public DragTracker getDragTracker(Request request) {
+ if (request instanceof SelectionRequest && ((SelectionRequest) request).getLastButtonPressed() == 3) {
+ return null;
+ }
+ return new DragEditPartsTrackerEx(this);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new OperationItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new UMLTextNonResizableEditPolicy());
+ installEditPolicy(EditPolicy.COMPONENT_ROLE, new ListItemComponentEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Operation_3003, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ IFigure label = createFigurePrim();
+ defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigurePrim() {
+ return new OperationFigureDescriptor();
+ }
+
+ /**
+ * @generated
+ */
+ public class OperationFigureDescriptor extends WrappingLabel {
+
+ /**
+ * @generated
+ */
+ public OperationFigureDescriptor() {
+ this.setText("");
+
+ this.setFont(THIS_FONT);
+
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ static final Font THIS_FONT = new Font(Display.getCurrent(), "Arial", 10, SWT.NORMAL);
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Package2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Package2EditPart.java
new file mode 100644
index 00000000000..db2bb7b1439
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Package2EditPart.java
@@ -0,0 +1,421 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.OpenDiagramEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.Package2CanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.Package2ItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.common.editpolicies.BorderItemResizableEditPolicy;
+import org.eclipse.papyrus.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy;
+import org.eclipse.papyrus.diagram.common.figure.node.CPackageFigure;
+import org.eclipse.papyrus.diagram.common.locator.TemplateBorderItemLocator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @generated
+ */
+public class Package2EditPart extends AbstractBorderedShapeEditPart {
+
+ /**
+ * @generated
+ */
+ public class PackageFigureDescriptor extends CPackageFigure {
+
+ /**
+ * @generated
+ */
+ private RectangleFigure fPackageableElementFigure;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fPackageNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fPackageQualifiedNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fStereotypesLabel;
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ public PackageFigureDescriptor() {
+
+ this.setForegroundColor(THIS_FORE);
+ this.setBackgroundColor(THIS_BACK);
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ fStereotypesLabel = new WrappingLabel();
+ fStereotypesLabel.setText("");
+
+ fStereotypesLabel.setFont(FSTEREOTYPESLABEL_FONT);
+
+ this.add(fStereotypesLabel);
+
+ fPackageNameLabel = new WrappingLabel();
+ fPackageNameLabel.setText("");
+
+ fPackageNameLabel.setFont(FPACKAGENAMELABEL_FONT);
+
+ this.add(fPackageNameLabel);
+
+ fPackageQualifiedNameLabel = new WrappingLabel();
+ fPackageQualifiedNameLabel.setText("");
+
+ fPackageQualifiedNameLabel.setFont(FPACKAGEQUALIFIEDNAMELABEL_FONT);
+
+ this.add(fPackageQualifiedNameLabel);
+
+ fPackageableElementFigure = new RectangleFigure();
+
+ this.add(fPackageableElementFigure);
+
+ }
+
+ /**
+ * @generated
+ */
+ public RectangleFigure getPackageableElementFigure() {
+ return fPackageableElementFigure;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getPackageNameLabel() {
+ return fPackageNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getPackageQualifiedNameLabel() {
+ return fPackageQualifiedNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getStereotypesLabel() {
+ return fStereotypesLabel;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ static final Font FPACKAGENAMELABEL_FONT = new Font(Display.getCurrent(), "Arial", 10, SWT.BOLD);
+
+ /**
+ * @generated
+ */
+ static final Font FPACKAGEQUALIFIEDNAMELABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.ITALIC);
+
+ /**
+ * @generated
+ */
+ static final Font FSTEREOTYPESLABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.NORMAL);
+
+ /**
+ * @generated
+ */
+ static final Color THIS_BACK = new Color(null, 255, 199, 143);
+
+ /**
+ * @generated
+ */
+ static final Color THIS_FORE = new Color(null, 233, 164, 96);
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 3009;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public Package2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof PackageName3EditPart) {
+ ((PackageName3EditPart) childEditPart).setLabel(getPrimaryShape().getStereotypesLabel());
+ return true;
+ }
+ if (childEditPart instanceof PackageName4EditPart) {
+ ((PackageName4EditPart) childEditPart).setLabel(getPrimaryShape().getPackageNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof PackageQualifiedName2EditPart) {
+ ((PackageQualifiedName2EditPart) childEditPart).setLabel(getPrimaryShape().getPackageQualifiedNameLabel());
+ 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;
+ }
+ if (childEditPart instanceof RedefinableTemplateSignatureEditPart) {
+ // BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.NORTH);
+ BorderItemLocator locator = new TemplateBorderItemLocator(getMainFigure(), PositionConstants.NORTH);
+
+ getBorderedFigure().getBorderItemContainer().add(((RedefinableTemplateSignatureEditPart) childEditPart).getFigure(), locator);
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new Package2ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new Package2CanonicalEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy());
+ installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy());
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+ LayoutEditPolicy lep = new LayoutEditPolicy() {
+
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ if (child instanceof IBorderItemEditPart) {
+ // return new BorderItemSelectionEditPolicy();
+ return new BorderItemResizableEditPolicy();
+ }
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ protected NodeFigure createMainFigure() {
+ NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ IFigure shape = createNodeShape();
+ figure.add(shape);
+ contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(40), getMapMode().DPtoLP(40));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ PackageFigureDescriptor figure = new PackageFigureDescriptor();
+ return primaryShape = figure;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+
+ if (editPart instanceof PackagePackageableElementCompartmentEditPart) {
+ return getPrimaryShape().getPackageableElementFigure();
+ }
+ if (editPart instanceof RedefinableTemplateSignatureEditPart) {
+ return getBorderedFigure().getBorderItemContainer();
+ }
+ return super.getContentPaneFor(editPart);
+ }
+
+ /**
+ * @generated
+ */
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(PackageName3EditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ public PackageFigureDescriptor getPrimaryShape() {
+ return (PackageFigureDescriptor) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+
+ if (childEditPart instanceof PackagePackageableElementCompartmentEditPart) {
+ IFigure pane = getPrimaryShape().getPackageableElementFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.remove(((PackagePackageableElementCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof RedefinableTemplateSignatureEditPart) {
+ getBorderedFigure().getBorderItemContainer().remove(((RedefinableTemplateSignatureEditPart) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(getMapMode().DPtoLP(5));
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackageEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackageEditPart.java
new file mode 100644
index 00000000000..091d8fc2255
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackageEditPart.java
@@ -0,0 +1,422 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.OpenDiagramEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.PackageCanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.PackageItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.common.editpolicies.BorderItemResizableEditPolicy;
+import org.eclipse.papyrus.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy;
+import org.eclipse.papyrus.diagram.common.figure.node.CPackageFigure;
+import org.eclipse.papyrus.diagram.common.figure.node.PackageNodeFigure;
+import org.eclipse.papyrus.diagram.common.locator.TemplateBorderItemLocator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @generated
+ */
+public class PackageEditPart extends AbstractBorderedShapeEditPart {
+
+ /**
+ * @generated
+ */
+ public class PackageFigureDescriptor extends CPackageFigure {
+
+ /**
+ * @generated
+ */
+ private RectangleFigure fPackageableElementFigure;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fPackageNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fPackageQualifiedNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fStereotypesLabel;
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ public PackageFigureDescriptor() {
+
+ this.setForegroundColor(THIS_FORE);
+ this.setBackgroundColor(THIS_BACK);
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ fStereotypesLabel = new WrappingLabel();
+ fStereotypesLabel.setText("");
+
+ fStereotypesLabel.setFont(FSTEREOTYPESLABEL_FONT);
+
+ this.add(fStereotypesLabel);
+
+ fPackageNameLabel = new WrappingLabel();
+ fPackageNameLabel.setText("");
+
+ fPackageNameLabel.setFont(FPACKAGENAMELABEL_FONT);
+
+ this.add(fPackageNameLabel);
+
+ fPackageQualifiedNameLabel = new WrappingLabel();
+ fPackageQualifiedNameLabel.setText("");
+
+ fPackageQualifiedNameLabel.setFont(FPACKAGEQUALIFIEDNAMELABEL_FONT);
+
+ this.add(fPackageQualifiedNameLabel);
+
+ fPackageableElementFigure = new RectangleFigure();
+
+ this.add(fPackageableElementFigure);
+
+ }
+
+ /**
+ * @generated
+ */
+ public RectangleFigure getPackageableElementFigure() {
+ return fPackageableElementFigure;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getPackageNameLabel() {
+ return fPackageNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getPackageQualifiedNameLabel() {
+ return fPackageQualifiedNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getStereotypesLabel() {
+ return fStereotypesLabel;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ static final Font FPACKAGENAMELABEL_FONT = new Font(Display.getCurrent(), "Arial", 10, SWT.BOLD);
+
+ /**
+ * @generated
+ */
+ static final Font FPACKAGEQUALIFIEDNAMELABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.ITALIC);
+
+ /**
+ * @generated
+ */
+ static final Font FSTEREOTYPESLABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.NORMAL);
+
+ /**
+ * @generated
+ */
+ static final Color THIS_BACK = new Color(null, 255, 199, 143);
+
+ /**
+ * @generated
+ */
+ static final Color THIS_FORE = new Color(null, 233, 164, 96);
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 2007;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public PackageEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof PackageNameEditPart) {
+ ((PackageNameEditPart) childEditPart).setLabel(getPrimaryShape().getStereotypesLabel());
+ return true;
+ }
+ if (childEditPart instanceof PackageName2EditPart) {
+ ((PackageName2EditPart) childEditPart).setLabel(getPrimaryShape().getPackageNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof PackageQualifiedNameEditPart) {
+ ((PackageQualifiedNameEditPart) childEditPart).setLabel(getPrimaryShape().getPackageQualifiedNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof PackagePackageableElementCompartment2EditPart) {
+ IFigure pane = getPrimaryShape().getPackageableElementFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((PackagePackageableElementCompartment2EditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof RedefinableTemplateSignatureEditPart) {
+ // BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.NORTH);
+ BorderItemLocator locator = new TemplateBorderItemLocator(getMainFigure(), PositionConstants.NORTH);
+
+ getBorderedFigure().getBorderItemContainer().add(((RedefinableTemplateSignatureEditPart) childEditPart).getFigure(), locator);
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new PackageItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new PackageCanonicalEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy());
+ installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy());
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+ LayoutEditPolicy lep = new LayoutEditPolicy() {
+
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ if (child instanceof IBorderItemEditPart) {
+ // return new BorderItemSelectionEditPolicy();
+ return new BorderItemResizableEditPolicy();
+ }
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ protected NodeFigure createMainFigure() {
+ NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ IFigure shape = createNodeShape();
+ figure.add(shape);
+ contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * @generated-not
+ */
+ protected NodeFigure createNodePlate() {
+ DefaultSizeNodeFigure result = new PackageNodeFigure(getMapMode().DPtoLP(40), getMapMode().DPtoLP(40));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ PackageFigureDescriptor figure = new PackageFigureDescriptor();
+ return primaryShape = figure;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+
+ if (editPart instanceof PackagePackageableElementCompartment2EditPart) {
+ return getPrimaryShape().getPackageableElementFigure();
+ }
+ if (editPart instanceof RedefinableTemplateSignatureEditPart) {
+ return getBorderedFigure().getBorderItemContainer();
+ }
+ return super.getContentPaneFor(editPart);
+ }
+
+ /**
+ * @generated
+ */
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(PackageName2EditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ public PackageFigureDescriptor getPrimaryShape() {
+ return (PackageFigureDescriptor) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+
+ if (childEditPart instanceof PackagePackageableElementCompartment2EditPart) {
+ IFigure pane = getPrimaryShape().getPackageableElementFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.remove(((PackagePackageableElementCompartment2EditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof RedefinableTemplateSignatureEditPart) {
+ getBorderedFigure().getBorderItemContainer().remove(((RedefinableTemplateSignatureEditPart) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(getMapMode().DPtoLP(5));
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackageImportEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackageImportEditPart.java
new file mode 100644
index 00000000000..8aa5625795e
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackageImportEditPart.java
@@ -0,0 +1,169 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Connection;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.PackageImportItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.common.figure.edge.DashEdgeFigure;
+
+/**
+ * @generated
+ */
+public class PackageImportEditPart extends ConnectionNodeEditPart implements ITreeBranchEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 4010;
+
+ /**
+ * @generated
+ */
+ public PackageImportEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new PackageImportItemSemanticEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof PackageImportVisibilityEditPart) {
+ ((PackageImportVisibilityEditPart) childEditPart).setLabel(getPrimaryShape().getAppliedStereotypeLabel());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+
+ protected Connection createConnectionFigure() {
+ return new DependencyDescriptor();
+ }
+
+ /**
+ * @generated
+ */
+ public DependencyDescriptor getPrimaryShape() {
+ return (DependencyDescriptor) getFigure();
+ }
+
+ /**
+ * @generated
+ */
+ public class DependencyDescriptor extends DashEdgeFigure {
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fDependencyNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fAppliedStereotypeLabel;
+
+ /**
+ * @generated
+ */
+ public DependencyDescriptor() {
+
+ this.setForegroundColor(ColorConstants.black);
+ this.setBackgroundColor(ColorConstants.black);
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ fDependencyNameLabel = new WrappingLabel();
+ fDependencyNameLabel.setText("");
+
+ this.add(fDependencyNameLabel);
+
+ fAppliedStereotypeLabel = new WrappingLabel();
+ fAppliedStereotypeLabel.setText("");
+
+ this.add(fAppliedStereotypeLabel);
+
+ }
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getDependencyNameLabel() {
+ return fDependencyNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getAppliedStereotypeLabel() {
+ return fAppliedStereotypeLabel;
+ }
+
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackageImportVisibilityEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackageImportVisibilityEditPart.java
new file mode 100644
index 00000000000..4e31b990349
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackageImportVisibilityEditPart.java
@@ -0,0 +1,529 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class PackageImportVisibilityEditPart extends LabelEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 6022;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.clazz.edit.parts.PackageImportVisibilityEditPart.VISUAL_ID), new Point(0, 40));
+ }
+
+ /**
+ * @generated
+ */
+ public PackageImportVisibilityEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ public int getKeyPoint() {
+ return ConnectionLocator.MIDDLE;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.PackageImport_4010, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackageMergeEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackageMergeEditPart.java
new file mode 100644
index 00000000000..9d902c862b6
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackageMergeEditPart.java
@@ -0,0 +1,147 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Connection;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.PackageMergeItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.common.figure.edge.DashEdgeFigure;
+
+/**
+ * @generated
+ */
+public class PackageMergeEditPart extends ConnectionNodeEditPart implements ITreeBranchEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 4011;
+
+ /**
+ * @generated
+ */
+ public PackageMergeEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new PackageMergeItemSemanticEditPolicy());
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+
+ protected Connection createConnectionFigure() {
+ return new DependencyDescriptor();
+ }
+
+ /**
+ * @generated
+ */
+ public DependencyDescriptor getPrimaryShape() {
+ return (DependencyDescriptor) getFigure();
+ }
+
+ /**
+ * @generated
+ */
+ public class DependencyDescriptor extends DashEdgeFigure {
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fDependencyNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fAppliedStereotypeLabel;
+
+ /**
+ * @generated
+ */
+ public DependencyDescriptor() {
+
+ this.setForegroundColor(ColorConstants.black);
+ this.setBackgroundColor(ColorConstants.black);
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ fDependencyNameLabel = new WrappingLabel();
+ fDependencyNameLabel.setText("");
+
+ this.add(fDependencyNameLabel);
+
+ fAppliedStereotypeLabel = new WrappingLabel();
+ fAppliedStereotypeLabel.setText("");
+
+ this.add(fAppliedStereotypeLabel);
+
+ }
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getDependencyNameLabel() {
+ return fDependencyNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getAppliedStereotypeLabel() {
+ return fAppliedStereotypeLabel;
+ }
+
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackageName2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackageName2EditPart.java
new file mode 100644
index 00000000000..677bc197e83
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackageName2EditPart.java
@@ -0,0 +1,554 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class PackageName2EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5026;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public PackageName2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ EObject parserElement = getParserElement();
+ if (parserElement == null) {
+ return null;
+ }
+ return UMLElementTypes.getImage(parserElement.eClass());
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated not
+ */
+ protected boolean isEditable() {
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Package_2007, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackageName3EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackageName3EditPart.java
new file mode 100644
index 00000000000..2104a4c31f7
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackageName3EditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class PackageName3EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5016;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public PackageName3EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Package_3009, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackageName4EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackageName4EditPart.java
new file mode 100644
index 00000000000..4c23564d5ad
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackageName4EditPart.java
@@ -0,0 +1,554 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class PackageName4EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5017;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public PackageName4EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ EObject parserElement = getParserElement();
+ if (parserElement == null) {
+ return null;
+ }
+ return UMLElementTypes.getImage(parserElement.eClass());
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Package_3009, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackageNameEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackageNameEditPart.java
new file mode 100644
index 00000000000..43a991fd913
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackageNameEditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class PackageNameEditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5025;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public PackageNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Package_2007, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackagePackageableElementCompartment2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackagePackageableElementCompartment2EditPart.java
new file mode 100644
index 00000000000..36198a402f1
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackagePackageableElementCompartment2EditPart.java
@@ -0,0 +1,81 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.PackagePackageableElementCompartment2CanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.PackagePackageableElementCompartment2ItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.Messages;
+
+/**
+ * @generated
+ */
+public class PackagePackageableElementCompartment2EditPart extends ShapeCompartmentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 7016;
+
+ /**
+ * @generated
+ */
+ public PackagePackageableElementCompartment2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ public String getCompartmentName() {
+ return Messages.PackagePackageableElementCompartment2EditPart_title;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure createFigure() {
+ ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new PackagePackageableElementCompartment2ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new PackagePackageableElementCompartment2CanonicalEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected void setRatio(Double ratio) {
+ if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackagePackageableElementCompartmentEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackagePackageableElementCompartmentEditPart.java
new file mode 100644
index 00000000000..89d8f1f893d
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackagePackageableElementCompartmentEditPart.java
@@ -0,0 +1,81 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.PackagePackageableElementCompartmentCanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.PackagePackageableElementCompartmentItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.Messages;
+
+/**
+ * @generated
+ */
+public class PackagePackageableElementCompartmentEditPart extends ShapeCompartmentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 7010;
+
+ /**
+ * @generated
+ */
+ public PackagePackageableElementCompartmentEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ public String getCompartmentName() {
+ return Messages.PackagePackageableElementCompartmentEditPart_title;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure createFigure() {
+ ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new PackagePackageableElementCompartmentItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new PackagePackageableElementCompartmentCanonicalEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected void setRatio(Double ratio) {
+ if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackageQualifiedName2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackageQualifiedName2EditPart.java
new file mode 100644
index 00000000000..f8887604fa5
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackageQualifiedName2EditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class PackageQualifiedName2EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5018;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public PackageQualifiedName2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Package_3009, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackageQualifiedNameEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackageQualifiedNameEditPart.java
new file mode 100644
index 00000000000..7de78f299f6
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PackageQualifiedNameEditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class PackageQualifiedNameEditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5027;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public PackageQualifiedNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Package_2007, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PrimitiveType2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PrimitiveType2EditPart.java
new file mode 100644
index 00000000000..cf968426e38
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PrimitiveType2EditPart.java
@@ -0,0 +1,358 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.OpenDiagramEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.PrimitiveType2ItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.common.figure.node.CPrimitiveFigure;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @generated
+ */
+public class PrimitiveType2EditPart extends ShapeNodeEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 3026;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public PrimitiveType2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new PrimitiveType2ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy());
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+ LayoutEditPolicy lep = new LayoutEditPolicy() {
+
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ PrimitiveTypeDescriptor figure = new PrimitiveTypeDescriptor();
+ return primaryShape = figure;
+ }
+
+ /**
+ * @generated
+ */
+ public PrimitiveTypeDescriptor getPrimaryShape() {
+ return (PrimitiveTypeDescriptor) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof PrimitiveTypeName3EditPart) {
+ ((PrimitiveTypeName3EditPart) childEditPart).setLabel(getPrimaryShape().getStereotypesLabel());
+ return true;
+ }
+ if (childEditPart instanceof PrimitiveTypeName4EditPart) {
+ ((PrimitiveTypeName4EditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof PrimitiveTypeQualifiedName2EditPart) {
+ ((PrimitiveTypeQualifiedName2EditPart) childEditPart).setLabel(getPrimaryShape().getQualifiedNameLabel());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+
+ return super.getContentPaneFor(editPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(40), getMapMode().DPtoLP(40));
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ protected NodeFigure createNodeFigure() {
+ NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ IFigure shape = createNodeShape();
+ figure.add(shape);
+ contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(getMapMode().DPtoLP(5));
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(PrimitiveTypeName3EditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ public class PrimitiveTypeDescriptor extends CPrimitiveFigure {
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fStereotypesLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fQualifiedNameLabel;
+
+ /**
+ * @generated
+ */
+ public PrimitiveTypeDescriptor() {
+
+ this.setForegroundColor(THIS_FORE);
+ this.setBackgroundColor(THIS_BACK);
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ fStereotypesLabel = new WrappingLabel();
+ fStereotypesLabel.setText("");
+
+ fStereotypesLabel.setFont(FSTEREOTYPESLABEL_FONT);
+
+ this.add(fStereotypesLabel);
+
+ fNameLabel = new WrappingLabel();
+ fNameLabel.setText("");
+
+ fNameLabel.setFont(FNAMELABEL_FONT);
+
+ this.add(fNameLabel);
+
+ fQualifiedNameLabel = new WrappingLabel();
+ fQualifiedNameLabel.setText("");
+
+ fQualifiedNameLabel.setFont(FQUALIFIEDNAMELABEL_FONT);
+
+ this.add(fQualifiedNameLabel);
+
+ }
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getStereotypesLabel() {
+ return fStereotypesLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getNameLabel() {
+ return fNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getQualifiedNameLabel() {
+ return fQualifiedNameLabel;
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ static final Color THIS_FORE = new Color(null, 204, 204, 204);
+
+ /**
+ * @generated
+ */
+ static final Color THIS_BACK = new Color(null, 242, 242, 242);
+
+ /**
+ * @generated
+ */
+ static final Font FSTEREOTYPESLABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.NORMAL);
+
+ /**
+ * @generated
+ */
+ static final Font FNAMELABEL_FONT = new Font(Display.getCurrent(), "Arial", 10, SWT.BOLD);
+
+ /**
+ * @generated
+ */
+ static final Font FQUALIFIEDNAMELABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.ITALIC);
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PrimitiveTypeEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PrimitiveTypeEditPart.java
new file mode 100644
index 00000000000..b03c7a455ba
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PrimitiveTypeEditPart.java
@@ -0,0 +1,365 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.OpenDiagramEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.PrimitiveTypeItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.common.figure.node.CPrimitiveFigure;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @generated
+ */
+public class PrimitiveTypeEditPart extends ShapeNodeEditPart {
+
+ /**
+ * @generated
+ */
+ public class PrimitiveTypeDescriptor extends CPrimitiveFigure {
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fQualifiedNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fStereotypesLabel;
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ public PrimitiveTypeDescriptor() {
+
+ this.setForegroundColor(THIS_FORE);
+ this.setBackgroundColor(THIS_BACK);
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ fStereotypesLabel = new WrappingLabel();
+ fStereotypesLabel.setText("");
+
+ fStereotypesLabel.setFont(FSTEREOTYPESLABEL_FONT);
+
+ this.add(fStereotypesLabel);
+
+ fNameLabel = new WrappingLabel();
+ fNameLabel.setText("");
+
+ fNameLabel.setFont(FNAMELABEL_FONT);
+
+ this.add(fNameLabel);
+
+ fQualifiedNameLabel = new WrappingLabel();
+ fQualifiedNameLabel.setText("");
+
+ fQualifiedNameLabel.setFont(FQUALIFIEDNAMELABEL_FONT);
+
+ this.add(fQualifiedNameLabel);
+
+ }
+
+ @Override
+ public Color getGradientColor() {
+ return THIS_GRADIENT;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getNameLabel() {
+ return fNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getQualifiedNameLabel() {
+ return fQualifiedNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getStereotypesLabel() {
+ return fStereotypesLabel;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ static final Font FNAMELABEL_FONT = new Font(Display.getCurrent(), "Arial", 10, SWT.BOLD);
+
+ /**
+ * @generated
+ */
+ static final Font FQUALIFIEDNAMELABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.ITALIC);
+
+ /**
+ * @generated
+ */
+ static final Font FSTEREOTYPESLABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.NORMAL);
+
+ /**
+ * @generated
+ */
+ static final Color THIS_BACK = new Color(null, 242, 242, 242);
+
+ /**
+ * @generated
+ */
+ static final Color THIS_FORE = new Color(null, 204, 204, 204);
+
+ static final Color THIS_GRADIENT = new Color(null, 204, 204, 204);
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 2009;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public PrimitiveTypeEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof PrimitiveTypeNameEditPart) {
+ ((PrimitiveTypeNameEditPart) childEditPart).setLabel(getPrimaryShape().getStereotypesLabel());
+ return true;
+ }
+ if (childEditPart instanceof PrimitiveTypeName2EditPart) {
+ ((PrimitiveTypeName2EditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof PrimitiveTypeQualifiedNameEditPart) {
+ ((PrimitiveTypeQualifiedNameEditPart) childEditPart).setLabel(getPrimaryShape().getQualifiedNameLabel());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new PrimitiveTypeItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy());
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+ LayoutEditPolicy lep = new LayoutEditPolicy() {
+
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ protected NodeFigure createNodeFigure() {
+ NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ IFigure shape = createNodeShape();
+ figure.add(shape);
+ contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(40), getMapMode().DPtoLP(40));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ PrimitiveTypeDescriptor figure = new PrimitiveTypeDescriptor();
+ return primaryShape = figure;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+
+ return super.getContentPaneFor(editPart);
+ }
+
+ /**
+ * @generated not
+ */
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(PrimitiveTypeName2EditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ public PrimitiveTypeDescriptor getPrimaryShape() {
+ return (PrimitiveTypeDescriptor) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+
+ return false;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(getMapMode().DPtoLP(5));
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PrimitiveTypeName2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PrimitiveTypeName2EditPart.java
new file mode 100644
index 00000000000..b8f8ebd6fdf
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PrimitiveTypeName2EditPart.java
@@ -0,0 +1,554 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class PrimitiveTypeName2EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5032;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ public PrimitiveTypeName2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ EObject parserElement = getParserElement();
+ if (parserElement == null) {
+ return null;
+ }
+ return UMLElementTypes.getImage(parserElement.eClass());
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.PrimitiveType_2009, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated not
+ */
+ protected boolean isEditable() {
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PrimitiveTypeName3EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PrimitiveTypeName3EditPart.java
new file mode 100644
index 00000000000..d1a30dd06cf
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PrimitiveTypeName3EditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class PrimitiveTypeName3EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5057;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public PrimitiveTypeName3EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.PrimitiveType_3026, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PrimitiveTypeName4EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PrimitiveTypeName4EditPart.java
new file mode 100644
index 00000000000..42816046653
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PrimitiveTypeName4EditPart.java
@@ -0,0 +1,554 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class PrimitiveTypeName4EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5058;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public PrimitiveTypeName4EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ EObject parserElement = getParserElement();
+ if (parserElement == null) {
+ return null;
+ }
+ return UMLElementTypes.getImage(parserElement.eClass());
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.PrimitiveType_3026, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PrimitiveTypeNameEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PrimitiveTypeNameEditPart.java
new file mode 100644
index 00000000000..7e472ab5c82
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PrimitiveTypeNameEditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class PrimitiveTypeNameEditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5031;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public PrimitiveTypeNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.PrimitiveType_2009, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PrimitiveTypeQualifiedName2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PrimitiveTypeQualifiedName2EditPart.java
new file mode 100644
index 00000000000..dd61b2cf40c
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PrimitiveTypeQualifiedName2EditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class PrimitiveTypeQualifiedName2EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5059;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public PrimitiveTypeQualifiedName2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.PrimitiveType_3026, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PrimitiveTypeQualifiedNameEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PrimitiveTypeQualifiedNameEditPart.java
new file mode 100644
index 00000000000..4604ae71382
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PrimitiveTypeQualifiedNameEditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class PrimitiveTypeQualifiedNameEditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5033;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public PrimitiveTypeQualifiedNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.PrimitiveType_2009, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ProfileApplicationEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ProfileApplicationEditPart.java
new file mode 100644
index 00000000000..8f861947445
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ProfileApplicationEditPart.java
@@ -0,0 +1,147 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Connection;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.ProfileApplicationItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.common.figure.edge.DashEdgeFigure;
+
+/**
+ * @generated
+ */
+public class ProfileApplicationEditPart extends ConnectionNodeEditPart implements ITreeBranchEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 4012;
+
+ /**
+ * @generated
+ */
+ public ProfileApplicationEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ProfileApplicationItemSemanticEditPolicy());
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+
+ protected Connection createConnectionFigure() {
+ return new DependencyDescriptor();
+ }
+
+ /**
+ * @generated
+ */
+ public DependencyDescriptor getPrimaryShape() {
+ return (DependencyDescriptor) getFigure();
+ }
+
+ /**
+ * @generated
+ */
+ public class DependencyDescriptor extends DashEdgeFigure {
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fDependencyNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fAppliedStereotypeLabel;
+
+ /**
+ * @generated
+ */
+ public DependencyDescriptor() {
+
+ this.setForegroundColor(ColorConstants.black);
+ this.setBackgroundColor(ColorConstants.black);
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ fDependencyNameLabel = new WrappingLabel();
+ fDependencyNameLabel.setText("");
+
+ this.add(fDependencyNameLabel);
+
+ fAppliedStereotypeLabel = new WrappingLabel();
+ fAppliedStereotypeLabel.setText("");
+
+ this.add(fAppliedStereotypeLabel);
+
+ }
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getDependencyNameLabel() {
+ return fDependencyNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getAppliedStereotypeLabel() {
+ return fAppliedStereotypeLabel;
+ }
+
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Property2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Property2EditPart.java
new file mode 100644
index 00000000000..d09c94a354c
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Property2EditPart.java
@@ -0,0 +1,581 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.DragTracker;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.requests.SelectionRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ListItemComponentEditPolicy;
+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.DragEditPartsTrackerEx;
+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.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.Property2ItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextNonResizableEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @generated
+ */
+public class Property2EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 3005;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public Property2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ public DragTracker getDragTracker(Request request) {
+ if (request instanceof SelectionRequest && ((SelectionRequest) request).getLastButtonPressed() == 3) {
+ return null;
+ }
+ return new DragEditPartsTrackerEx(this);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new Property2ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new UMLTextNonResizableEditPolicy());
+ installEditPolicy(EditPolicy.COMPONENT_ROLE, new ListItemComponentEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Property_3005, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ IFigure label = createFigurePrim();
+ defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigurePrim() {
+ return new PropertyFigureDescriptor();
+ }
+
+ /**
+ * @generated
+ */
+ public class PropertyFigureDescriptor extends WrappingLabel {
+
+ /**
+ * @generated
+ */
+ public PropertyFigureDescriptor() {
+ this.setText("");
+
+ this.setFont(THIS_FONT);
+
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ static final Font THIS_FONT = new Font(Display.getCurrent(), "Arial", 10, SWT.NORMAL);
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Property3EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Property3EditPart.java
new file mode 100644
index 00000000000..97ac9702153
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Property3EditPart.java
@@ -0,0 +1,581 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.DragTracker;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.requests.SelectionRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ListItemComponentEditPolicy;
+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.DragEditPartsTrackerEx;
+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.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.Property3ItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextNonResizableEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @generated
+ */
+public class Property3EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 3006;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public Property3EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ public DragTracker getDragTracker(Request request) {
+ if (request instanceof SelectionRequest && ((SelectionRequest) request).getLastButtonPressed() == 3) {
+ return null;
+ }
+ return new DragEditPartsTrackerEx(this);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new Property3ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new UMLTextNonResizableEditPolicy());
+ installEditPolicy(EditPolicy.COMPONENT_ROLE, new ListItemComponentEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Property_3006, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ IFigure label = createFigurePrim();
+ defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigurePrim() {
+ return new PropertyFigureDescriptor();
+ }
+
+ /**
+ * @generated
+ */
+ public class PropertyFigureDescriptor extends WrappingLabel {
+
+ /**
+ * @generated
+ */
+ public PropertyFigureDescriptor() {
+ this.setText("");
+
+ this.setFont(THIS_FONT);
+
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ static final Font THIS_FONT = new Font(Display.getCurrent(), "Arial", 10, SWT.NORMAL);
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Property4EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Property4EditPart.java
new file mode 100644
index 00000000000..3abdf8355d3
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Property4EditPart.java
@@ -0,0 +1,581 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.DragTracker;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.requests.SelectionRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ListItemComponentEditPolicy;
+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.DragEditPartsTrackerEx;
+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.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.Property4ItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextNonResizableEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @generated
+ */
+public class Property4EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 3012;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public Property4EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ public DragTracker getDragTracker(Request request) {
+ if (request instanceof SelectionRequest && ((SelectionRequest) request).getLastButtonPressed() == 3) {
+ return null;
+ }
+ return new DragEditPartsTrackerEx(this);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new Property4ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new UMLTextNonResizableEditPolicy());
+ installEditPolicy(EditPolicy.COMPONENT_ROLE, new ListItemComponentEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Property_3012, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ IFigure label = createFigurePrim();
+ defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigurePrim() {
+ return new PropertyFigureDescriptor();
+ }
+
+ /**
+ * @generated
+ */
+ public class PropertyFigureDescriptor extends WrappingLabel {
+
+ /**
+ * @generated
+ */
+ public PropertyFigureDescriptor() {
+ this.setText("");
+
+ this.setFont(THIS_FONT);
+
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ static final Font THIS_FONT = new Font(Display.getCurrent(), "Arial", 10, SWT.NORMAL);
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Property5EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Property5EditPart.java
new file mode 100644
index 00000000000..3b9d021299e
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Property5EditPart.java
@@ -0,0 +1,581 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.DragTracker;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.requests.SelectionRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ListItemComponentEditPolicy;
+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.DragEditPartsTrackerEx;
+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.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.Property5ItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextNonResizableEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @generated
+ */
+public class Property5EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 3018;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public Property5EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ public DragTracker getDragTracker(Request request) {
+ if (request instanceof SelectionRequest && ((SelectionRequest) request).getLastButtonPressed() == 3) {
+ return null;
+ }
+ return new DragEditPartsTrackerEx(this);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new Property5ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new UMLTextNonResizableEditPolicy());
+ installEditPolicy(EditPolicy.COMPONENT_ROLE, new ListItemComponentEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Property_3018, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ IFigure label = createFigurePrim();
+ defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigurePrim() {
+ return new PropertyFigureDescriptor();
+ }
+
+ /**
+ * @generated
+ */
+ public class PropertyFigureDescriptor extends WrappingLabel {
+
+ /**
+ * @generated
+ */
+ public PropertyFigureDescriptor() {
+ this.setText("");
+
+ this.setFont(THIS_FONT);
+
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ static final Font THIS_FONT = new Font(Display.getCurrent(), "Arial", 10, SWT.NORMAL);
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PropertyEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PropertyEditPart.java
new file mode 100644
index 00000000000..b97aff10972
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/PropertyEditPart.java
@@ -0,0 +1,581 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.DragTracker;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.requests.SelectionRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ListItemComponentEditPolicy;
+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.DragEditPartsTrackerEx;
+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.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.PropertyItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextNonResizableEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @generated
+ */
+public class PropertyEditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 3002;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public PropertyEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ public DragTracker getDragTracker(Request request) {
+ if (request instanceof SelectionRequest && ((SelectionRequest) request).getLastButtonPressed() == 3) {
+ return null;
+ }
+ return new DragEditPartsTrackerEx(this);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new PropertyItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new UMLTextNonResizableEditPolicy());
+ installEditPolicy(EditPolicy.COMPONENT_ROLE, new ListItemComponentEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Property_3002, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ IFigure label = createFigurePrim();
+ defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigurePrim() {
+ return new PropertyFigureDescriptor();
+ }
+
+ /**
+ * @generated
+ */
+ public class PropertyFigureDescriptor extends WrappingLabel {
+
+ /**
+ * @generated
+ */
+ public PropertyFigureDescriptor() {
+ this.setText("");
+
+ this.setFont(THIS_FONT);
+
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ static final Font THIS_FONT = new Font(Display.getCurrent(), "Arial", 10, SWT.NORMAL);
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/RealizationEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/RealizationEditPart.java
new file mode 100644
index 00000000000..a92fb71427d
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/RealizationEditPart.java
@@ -0,0 +1,173 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Connection;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.RealizationItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.common.figure.edge.CInterfaceRealizationFigure;
+
+/**
+ * @generated
+ */
+public class RealizationEditPart extends ConnectionNodeEditPart implements ITreeBranchEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 4005;
+
+ /**
+ * @generated
+ */
+ public RealizationEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new RealizationItemSemanticEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof RealizationNameEditPart) {
+ ((RealizationNameEditPart) childEditPart).setLabel(getPrimaryShape().getAppliedStereotypeLabel());
+ return true;
+ }
+ if (childEditPart instanceof RealizationName2EditPart) {
+ ((RealizationName2EditPart) childEditPart).setLabel(getPrimaryShape().getInterfaceRealizationNameLabel());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+
+ protected Connection createConnectionFigure() {
+ return new InterfaceRealizationDescriptor();
+ }
+
+ /**
+ * @generated
+ */
+ public InterfaceRealizationDescriptor getPrimaryShape() {
+ return (InterfaceRealizationDescriptor) getFigure();
+ }
+
+ /**
+ * @generated
+ */
+ public class InterfaceRealizationDescriptor extends CInterfaceRealizationFigure {
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fInterfaceRealizationNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fAppliedStereotypeLabel;
+
+ /**
+ * @generated
+ */
+ public InterfaceRealizationDescriptor() {
+
+ this.setForegroundColor(ColorConstants.black);
+ this.setBackgroundColor(ColorConstants.black);
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ fInterfaceRealizationNameLabel = new WrappingLabel();
+ fInterfaceRealizationNameLabel.setText("");
+
+ this.add(fInterfaceRealizationNameLabel);
+
+ fAppliedStereotypeLabel = new WrappingLabel();
+ fAppliedStereotypeLabel.setText("");
+
+ this.add(fAppliedStereotypeLabel);
+
+ }
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getInterfaceRealizationNameLabel() {
+ return fInterfaceRealizationNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getAppliedStereotypeLabel() {
+ return fAppliedStereotypeLabel;
+ }
+
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/RealizationName2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/RealizationName2EditPart.java
new file mode 100644
index 00000000000..423c3367cbb
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/RealizationName2EditPart.java
@@ -0,0 +1,529 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class RealizationName2EditPart extends LabelEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 6013;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationName2EditPart.VISUAL_ID), new Point(0, 60));
+ }
+
+ /**
+ * @generated
+ */
+ public RealizationName2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ public int getKeyPoint() {
+ return ConnectionLocator.MIDDLE;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Realization_4005, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/RealizationNameEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/RealizationNameEditPart.java
new file mode 100644
index 00000000000..1b27e4d3b45
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/RealizationNameEditPart.java
@@ -0,0 +1,529 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class RealizationNameEditPart extends LabelEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 6012;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationNameEditPart.VISUAL_ID), new Point(0, 40));
+ }
+
+ /**
+ * @generated
+ */
+ public RealizationNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ public int getKeyPoint() {
+ return ConnectionLocator.MIDDLE;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Realization_4005, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ReceptionEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ReceptionEditPart.java
new file mode 100644
index 00000000000..e748515572e
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/ReceptionEditPart.java
@@ -0,0 +1,575 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.DragTracker;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.requests.SelectionRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ListItemComponentEditPolicy;
+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.DragEditPartsTrackerEx;
+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.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.ReceptionItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextNonResizableEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class ReceptionEditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 3011;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public ReceptionEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ public DragTracker getDragTracker(Request request) {
+ if (request instanceof SelectionRequest && ((SelectionRequest) request).getLastButtonPressed() == 3) {
+ return null;
+ }
+ return new DragEditPartsTrackerEx(this);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ReceptionItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new UMLTextNonResizableEditPolicy());
+ installEditPolicy(EditPolicy.COMPONENT_ROLE, new ListItemComponentEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ EObject parserElement = getParserElement();
+ if (parserElement == null) {
+ return null;
+ }
+ return UMLElementTypes.getImage(parserElement.eClass());
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Reception_3011, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ IFigure label = createFigurePrim();
+ defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigurePrim() {
+ return new ReceptionDescriptor();
+ }
+
+ /**
+ * @generated
+ */
+ public class ReceptionDescriptor extends WrappingLabel {
+
+ /**
+ * @generated
+ */
+ public ReceptionDescriptor() {
+ this.setText("");
+ }
+
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/RedefinableTemplateSignatureEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/RedefinableTemplateSignatureEditPart.java
new file mode 100644
index 00000000000..956fbc8ff77
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/RedefinableTemplateSignatureEditPart.java
@@ -0,0 +1,319 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.draw2d.ui.internal.figures.DelegatingLayout;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.OpenDiagramEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.RedefinableTemplateSignatureItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class RedefinableTemplateSignatureEditPart extends AbstractBorderItemEditPart {
+
+ /**
+ * @generated
+ */
+ public class TemplateSignatureDescriptor extends RectangleFigure {
+
+ /**
+ * @generated
+ */
+ private RectangleFigure fTemplateParameterRectangle;
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ public TemplateSignatureDescriptor() {
+ this.setSize(getMapMode().DPtoLP(100), getMapMode().DPtoLP(60));
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ fTemplateParameterRectangle = new RectangleFigure();
+
+ this.add(fTemplateParameterRectangle);
+ fTemplateParameterRectangle.setLayoutManager(new StackLayout());
+
+ }
+
+ /**
+ * @generated
+ */
+ public RectangleFigure getTemplateParameterRectangle() {
+ return fTemplateParameterRectangle;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 3015;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public RedefinableTemplateSignatureEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy() {
+
+ public Command getCommand(Request request) {
+ if (understandsRequest(request)) {
+ if (request instanceof CreateViewAndElementRequest) {
+ CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest) request).getViewAndElementDescriptor().getCreateElementRequestAdapter();
+ IElementType type = (IElementType) adapter.getAdapter(IElementType.class);
+ if (type == UMLElementTypes.TemplateParameter_3016) {
+ EditPart compartmentEditPart = getChildBySemanticHint(UMLVisualIDRegistry.getType(RedefinableTemplateSignatureTemplateParameterCompartmentEditPart.VISUAL_ID));
+ return compartmentEditPart == null ? null : compartmentEditPart.getCommand(request);
+ }
+ }
+ return super.getCommand(request);
+ }
+ return null;
+ }
+ });
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, getPrimaryDragEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new RedefinableTemplateSignatureItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy());
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+ LayoutEditPolicy lep = new LayoutEditPolicy() {
+
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ protected NodeFigure createNodeFigure() {
+ NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ IFigure shape = createNodeShape();
+ figure.add(shape);
+ contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(40), getMapMode().DPtoLP(40));
+
+ // FIXME: workaround for #154536
+ result.getBounds().setSize(result.getPreferredSize());
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ TemplateSignatureDescriptor figure = new TemplateSignatureDescriptor();
+ return primaryShape = figure;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ public TemplateSignatureDescriptor getPrimaryShape() {
+ return (TemplateSignatureDescriptor) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof RedefinableTemplateSignatureTemplateParameterCompartmentEditPart) {
+ IFigure pane = getPrimaryShape().getTemplateParameterRectangle();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((RedefinableTemplateSignatureTemplateParameterCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+
+ if (childEditPart instanceof RedefinableTemplateSignatureTemplateParameterCompartmentEditPart) {
+ IFigure pane = getPrimaryShape().getTemplateParameterRectangle();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.remove(((RedefinableTemplateSignatureTemplateParameterCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+
+ if (editPart instanceof RedefinableTemplateSignatureTemplateParameterCompartmentEditPart) {
+ return getPrimaryShape().getTemplateParameterRectangle();
+ }
+ return super.getContentPaneFor(editPart);
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ protected void refreshBounds() {
+ super.refreshBounds();
+ if (getBorderItemLocator() != null) {
+ getBorderItemLocator().relocate(getFigure());
+ }
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(getMapMode().DPtoLP(5));
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/RedefinableTemplateSignatureTemplateParameterCompartmentEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/RedefinableTemplateSignatureTemplateParameterCompartmentEditPart.java
new file mode 100644
index 00000000000..da708507c15
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/RedefinableTemplateSignatureTemplateParameterCompartmentEditPart.java
@@ -0,0 +1,89 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.RedefinableTemplateSignatureTemplateParameterCompartmentCanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.RedefinableTemplateSignatureTemplateParameterCompartmentItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.Messages;
+
+/**
+ * @generated
+ */
+public class RedefinableTemplateSignatureTemplateParameterCompartmentEditPart extends ListCompartmentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 7014;
+
+ /**
+ * @generated
+ */
+ public RedefinableTemplateSignatureTemplateParameterCompartmentEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean hasModelChildrenChanged(Notification evt) {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public String getCompartmentName() {
+ return Messages.RedefinableTemplateSignatureTemplateParameterCompartmentEditPart_title;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure createFigure() {
+ ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new RedefinableTemplateSignatureTemplateParameterCompartmentItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new RedefinableTemplateSignatureTemplateParameterCompartmentCanonicalEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected void setRatio(Double ratio) {
+ if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Signal2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Signal2EditPart.java
new file mode 100644
index 00000000000..e102d9dbc8c
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/Signal2EditPart.java
@@ -0,0 +1,479 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.OpenDiagramEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.Signal2CanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.Signal2ItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.common.editpolicies.BorderItemResizableEditPolicy;
+import org.eclipse.papyrus.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy;
+import org.eclipse.papyrus.diagram.common.figure.node.CClassifierFigure;
+import org.eclipse.papyrus.diagram.common.locator.TemplateClassifierBorderItemLocator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @generated
+ */
+public class Signal2EditPart extends AbstractBorderedShapeEditPart {
+
+ /**
+ * @generated
+ */
+ public class ClassifierDescriptor extends CClassifierFigure {
+
+ /**
+ * @generated
+ */
+ private RectangleFigure fAttributeCompartmentFigure;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fClassifierNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fClassifierQualifiedNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fClassifierStereotypeLabel;
+
+ /**
+ * @generated
+ */
+ private RectangleFigure fNestedClassifierFigure;
+
+ /**
+ * @generated
+ */
+ private RectangleFigure fOperationCompartmentFigure;
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ public ClassifierDescriptor() {
+
+ this.setForegroundColor(THIS_FORE);
+ this.setBackgroundColor(THIS_BACK);
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ fClassifierStereotypeLabel = new WrappingLabel();
+ fClassifierStereotypeLabel.setText("");
+
+ fClassifierStereotypeLabel.setFont(FCLASSIFIERSTEREOTYPELABEL_FONT);
+
+ this.add(fClassifierStereotypeLabel);
+
+ fClassifierNameLabel = new WrappingLabel();
+ fClassifierNameLabel.setText("");
+
+ fClassifierNameLabel.setFont(FCLASSIFIERNAMELABEL_FONT);
+
+ this.add(fClassifierNameLabel);
+
+ fClassifierQualifiedNameLabel = new WrappingLabel();
+ fClassifierQualifiedNameLabel.setText("");
+
+ fClassifierQualifiedNameLabel.setFont(FCLASSIFIERQUALIFIEDNAMELABEL_FONT);
+
+ this.add(fClassifierQualifiedNameLabel);
+
+ fAttributeCompartmentFigure = new RectangleFigure();
+ fAttributeCompartmentFigure.setFill(false);
+
+ this.add(fAttributeCompartmentFigure);
+ fAttributeCompartmentFigure.setLayoutManager(new StackLayout());
+
+ fOperationCompartmentFigure = new RectangleFigure();
+ fOperationCompartmentFigure.setFill(false);
+
+ this.add(fOperationCompartmentFigure);
+ fOperationCompartmentFigure.setLayoutManager(new StackLayout());
+
+ fNestedClassifierFigure = new RectangleFigure();
+ fNestedClassifierFigure.setFill(false);
+
+ this.add(fNestedClassifierFigure);
+ fNestedClassifierFigure.setLayoutManager(new StackLayout());
+
+ }
+
+ /**
+ * @generated
+ */
+ public RectangleFigure getAttributeCompartmentFigure() {
+ return fAttributeCompartmentFigure;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getClassifierNameLabel() {
+ return fClassifierNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getClassifierQualifiedNameLabel() {
+ return fClassifierQualifiedNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getClassifierStereotypeLabel() {
+ return fClassifierStereotypeLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public RectangleFigure getNestedClassifierFigure() {
+ return fNestedClassifierFigure;
+ }
+
+ /**
+ * @generated
+ */
+ public RectangleFigure getOperationCompartmentFigure() {
+ return fOperationCompartmentFigure;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ static final Font FCLASSIFIERNAMELABEL_FONT = new Font(Display.getCurrent(), "Arial", 10, SWT.BOLD);
+
+ /**
+ * @generated
+ */
+ static final Font FCLASSIFIERQUALIFIEDNAMELABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.ITALIC);
+
+ /**
+ * @generated
+ */
+ static final Font FCLASSIFIERSTEREOTYPELABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.NORMAL);
+
+ /**
+ * @generated
+ */
+ static final Color THIS_BACK = new Color(null, 235, 248, 255);
+
+ /**
+ * @generated
+ */
+ static final Color THIS_FORE = new Color(null, 177, 207, 229);
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 3022;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public Signal2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof SignalName3EditPart) {
+ ((SignalName3EditPart) childEditPart).setLabel(getPrimaryShape().getClassifierStereotypeLabel());
+ return true;
+ }
+ if (childEditPart instanceof SignalName4EditPart) {
+ ((SignalName4EditPart) childEditPart).setLabel(getPrimaryShape().getClassifierNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof SignalQualifiedName2EditPart) {
+ ((SignalQualifiedName2EditPart) childEditPart).setLabel(getPrimaryShape().getClassifierQualifiedNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof SignalAttributeCompartment2EditPart) {
+ IFigure pane = getPrimaryShape().getAttributeCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((SignalAttributeCompartment2EditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof RedefinableTemplateSignatureEditPart) {
+ // BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.NORTH);
+ BorderItemLocator locator = new TemplateClassifierBorderItemLocator(getMainFigure(), PositionConstants.NORTH);
+ getBorderedFigure().getBorderItemContainer().add(((RedefinableTemplateSignatureEditPart) childEditPart).getFigure(), locator);
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy() {
+
+ public Command getCommand(Request request) {
+ if (understandsRequest(request)) {
+ if (request instanceof CreateViewAndElementRequest) {
+ CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest) request).getViewAndElementDescriptor().getCreateElementRequestAdapter();
+ IElementType type = (IElementType) adapter.getAdapter(IElementType.class);
+ if (type == UMLElementTypes.Property_3005) {
+ EditPart compartmentEditPart = getChildBySemanticHint(UMLVisualIDRegistry.getType(SignalAttributeCompartment2EditPart.VISUAL_ID));
+ return compartmentEditPart == null ? null : compartmentEditPart.getCommand(request);
+ }
+ }
+ return super.getCommand(request);
+ }
+ return null;
+ }
+ });
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new Signal2ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new Signal2CanonicalEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy());
+
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+ LayoutEditPolicy lep = new LayoutEditPolicy() {
+
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ if (child instanceof IBorderItemEditPart) {
+ // return new BorderItemSelectionEditPolicy();
+ return new BorderItemResizableEditPolicy();
+ }
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ protected NodeFigure createMainFigure() {
+ NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ IFigure shape = createNodeShape();
+ figure.add(shape);
+ contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(40), getMapMode().DPtoLP(40));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ ClassifierDescriptor figure = new ClassifierDescriptor();
+ return primaryShape = figure;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+
+ if (editPart instanceof SignalAttributeCompartment2EditPart) {
+ return getPrimaryShape().getAttributeCompartmentFigure();
+ }
+ if (editPart instanceof RedefinableTemplateSignatureEditPart) {
+ return getBorderedFigure().getBorderItemContainer();
+ }
+ return super.getContentPaneFor(editPart);
+ }
+
+ /**
+ * @generated
+ */
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(SignalName3EditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ public ClassifierDescriptor getPrimaryShape() {
+ return (ClassifierDescriptor) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+
+ if (childEditPart instanceof SignalAttributeCompartment2EditPart) {
+ IFigure pane = getPrimaryShape().getAttributeCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.remove(((SignalAttributeCompartment2EditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof RedefinableTemplateSignatureEditPart) {
+ getBorderedFigure().getBorderItemContainer().remove(((RedefinableTemplateSignatureEditPart) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(getMapMode().DPtoLP(5));
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SignalAttributeCompartment2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SignalAttributeCompartment2EditPart.java
new file mode 100644
index 00000000000..3798511b014
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SignalAttributeCompartment2EditPart.java
@@ -0,0 +1,92 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.SignalAttributeCompartment2CanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.SignalAttributeCompartment2ItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.Messages;
+
+/**
+ * @generated
+ */
+public class SignalAttributeCompartment2EditPart extends ListCompartmentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 7026;
+
+ /**
+ * @generated
+ */
+ public SignalAttributeCompartment2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean hasModelChildrenChanged(Notification evt) {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public String getCompartmentName() {
+ return Messages.SignalAttributeCompartment2EditPart_title;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure createFigure() {
+ ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new SignalAttributeCompartment2ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new SignalAttributeCompartment2CanonicalEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected void setRatio(Double ratio) {
+ if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SignalAttributeCompartmentEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SignalAttributeCompartmentEditPart.java
new file mode 100644
index 00000000000..3c4093d54ef
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SignalAttributeCompartmentEditPart.java
@@ -0,0 +1,92 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.SignalAttributeCompartmentCanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.SignalAttributeCompartmentItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.Messages;
+
+/**
+ * @generated
+ */
+public class SignalAttributeCompartmentEditPart extends ListCompartmentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 7005;
+
+ /**
+ * @generated
+ */
+ public SignalAttributeCompartmentEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean hasModelChildrenChanged(Notification evt) {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public String getCompartmentName() {
+ return Messages.SignalAttributeCompartmentEditPart_title;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure createFigure() {
+ ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new SignalAttributeCompartmentItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new SignalAttributeCompartmentCanonicalEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected void setRatio(Double ratio) {
+ if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SignalEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SignalEditPart.java
new file mode 100644
index 00000000000..5da68c8de2b
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SignalEditPart.java
@@ -0,0 +1,484 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.SignalCanonicalEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.SignalItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.common.editpolicies.BorderItemResizableEditPolicy;
+import org.eclipse.papyrus.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy;
+import org.eclipse.papyrus.diagram.common.figure.node.CClassifierFigure;
+import org.eclipse.papyrus.diagram.common.locator.TemplateClassifierBorderItemLocator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @generated
+ */
+public class SignalEditPart extends AbstractBorderedShapeEditPart {
+
+ /**
+ * @generated
+ */
+ public class ClassifierDescriptor extends CClassifierFigure {
+
+ /**
+ * @generated
+ */
+ private RectangleFigure fAttributeCompartmentFigure;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fClassifierNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fClassifierQualifiedNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fClassifierStereotypeLabel;
+
+ /**
+ * @generated
+ */
+ private RectangleFigure fNestedClassifierFigure;
+
+ /**
+ * @generated
+ */
+ private RectangleFigure fOperationCompartmentFigure;
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ public ClassifierDescriptor() {
+
+ this.setForegroundColor(THIS_FORE);
+ this.setBackgroundColor(THIS_BACK);
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ fClassifierStereotypeLabel = new WrappingLabel();
+ fClassifierStereotypeLabel.setText("");
+
+ fClassifierStereotypeLabel.setFont(FCLASSIFIERSTEREOTYPELABEL_FONT);
+
+ this.add(fClassifierStereotypeLabel);
+
+ fClassifierNameLabel = new WrappingLabel();
+ fClassifierNameLabel.setText("");
+
+ fClassifierNameLabel.setFont(FCLASSIFIERNAMELABEL_FONT);
+
+ this.add(fClassifierNameLabel);
+
+ fClassifierQualifiedNameLabel = new WrappingLabel();
+ fClassifierQualifiedNameLabel.setText("");
+
+ fClassifierQualifiedNameLabel.setFont(FCLASSIFIERQUALIFIEDNAMELABEL_FONT);
+
+ this.add(fClassifierQualifiedNameLabel);
+
+ fAttributeCompartmentFigure = new RectangleFigure();
+ fAttributeCompartmentFigure.setFill(false);
+
+ this.add(fAttributeCompartmentFigure);
+ fAttributeCompartmentFigure.setLayoutManager(new StackLayout());
+
+ fOperationCompartmentFigure = new RectangleFigure();
+ fOperationCompartmentFigure.setFill(false);
+
+ this.add(fOperationCompartmentFigure);
+ fOperationCompartmentFigure.setLayoutManager(new StackLayout());
+
+ fNestedClassifierFigure = new RectangleFigure();
+ fNestedClassifierFigure.setFill(false);
+
+ this.add(fNestedClassifierFigure);
+ fNestedClassifierFigure.setLayoutManager(new StackLayout());
+
+ }
+
+ /**
+ * @generated
+ */
+ public RectangleFigure getAttributeCompartmentFigure() {
+ return fAttributeCompartmentFigure;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getClassifierNameLabel() {
+ return fClassifierNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getClassifierQualifiedNameLabel() {
+ return fClassifierQualifiedNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getClassifierStereotypeLabel() {
+ return fClassifierStereotypeLabel;
+ }
+
+ @Override
+ public Color getGradientColor() {
+ return THIS_GRADIENT;
+ }
+
+ /**
+ * @generated
+ */
+ public RectangleFigure getNestedClassifierFigure() {
+ return fNestedClassifierFigure;
+ }
+
+ /**
+ * @generated
+ */
+ public RectangleFigure getOperationCompartmentFigure() {
+ return fOperationCompartmentFigure;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ static final Font FCLASSIFIERNAMELABEL_FONT = new Font(Display.getCurrent(), "Arial", 10, SWT.BOLD);
+
+ /**
+ * @generated
+ */
+ static final Font FCLASSIFIERQUALIFIEDNAMELABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.ITALIC);
+
+ /**
+ * @generated
+ */
+ static final Font FCLASSIFIERSTEREOTYPELABEL_FONT = new Font(Display.getCurrent(), "Arial", 8, SWT.NORMAL);
+
+ /**
+ * @generated
+ */
+ static final Color THIS_BACK = new Color(null, 235, 248, 255);
+
+ /**
+ * @generated
+ */
+ static final Color THIS_FORE = new Color(null, 177, 207, 229);
+
+ static final Color THIS_GRADIENT = new Color(null, 177, 207, 229);
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 2003;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public SignalEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof SignalNameEditPart) {
+ ((SignalNameEditPart) childEditPart).setLabel(getPrimaryShape().getClassifierStereotypeLabel());
+ return true;
+ }
+ if (childEditPart instanceof SignalName2EditPart) {
+ ((SignalName2EditPart) childEditPart).setLabel(getPrimaryShape().getClassifierNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof SignalQualifiedNameEditPart) {
+ ((SignalQualifiedNameEditPart) childEditPart).setLabel(getPrimaryShape().getClassifierQualifiedNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof SignalAttributeCompartmentEditPart) {
+ IFigure pane = getPrimaryShape().getAttributeCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((SignalAttributeCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof RedefinableTemplateSignatureEditPart) {
+ // BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.NORTH);
+ BorderItemLocator locator = new TemplateClassifierBorderItemLocator(getMainFigure(), PositionConstants.NORTH);
+ getBorderedFigure().getBorderItemContainer().add(((RedefinableTemplateSignatureEditPart) childEditPart).getFigure(), locator);
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy() {
+
+ public Command getCommand(Request request) {
+ if (understandsRequest(request)) {
+ if (request instanceof CreateViewAndElementRequest) {
+ CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest) request).getViewAndElementDescriptor().getCreateElementRequestAdapter();
+ IElementType type = (IElementType) adapter.getAdapter(IElementType.class);
+ if (type == UMLElementTypes.Property_3005) {
+ EditPart compartmentEditPart = getChildBySemanticHint(UMLVisualIDRegistry.getType(SignalAttributeCompartmentEditPart.VISUAL_ID));
+ return compartmentEditPart == null ? null : compartmentEditPart.getCommand(request);
+ }
+ }
+ return super.getCommand(request);
+ }
+ return null;
+ }
+ });
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new SignalItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new SignalCanonicalEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy());
+
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+ LayoutEditPolicy lep = new LayoutEditPolicy() {
+
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ if (child instanceof IBorderItemEditPart) {
+ // return new BorderItemSelectionEditPolicy();
+ return new BorderItemResizableEditPolicy();
+ }
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ protected NodeFigure createMainFigure() {
+ NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ IFigure shape = createNodeShape();
+ figure.add(shape);
+ contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(40), getMapMode().DPtoLP(40));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ ClassifierDescriptor figure = new ClassifierDescriptor();
+ return primaryShape = figure;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+
+ if (editPart instanceof SignalAttributeCompartmentEditPart) {
+ return getPrimaryShape().getAttributeCompartmentFigure();
+ }
+ if (editPart instanceof RedefinableTemplateSignatureEditPart) {
+ return getBorderedFigure().getBorderItemContainer();
+ }
+ return super.getContentPaneFor(editPart);
+ }
+
+ /**
+ * @generated not
+ */
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(SignalName2EditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ public ClassifierDescriptor getPrimaryShape() {
+ return (ClassifierDescriptor) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+
+ if (childEditPart instanceof SignalAttributeCompartmentEditPart) {
+ IFigure pane = getPrimaryShape().getAttributeCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.remove(((SignalAttributeCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof RedefinableTemplateSignatureEditPart) {
+ getBorderedFigure().getBorderItemContainer().remove(((RedefinableTemplateSignatureEditPart) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(getMapMode().DPtoLP(5));
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SignalName2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SignalName2EditPart.java
new file mode 100644
index 00000000000..7420673c983
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SignalName2EditPart.java
@@ -0,0 +1,554 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class SignalName2EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5008;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ public SignalName2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ EObject parserElement = getParserElement();
+ if (parserElement == null) {
+ return null;
+ }
+ return UMLElementTypes.getImage(parserElement.eClass());
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Signal_2003, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated not
+ */
+ protected boolean isEditable() {
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SignalName3EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SignalName3EditPart.java
new file mode 100644
index 00000000000..3573a75bfac
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SignalName3EditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class SignalName3EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5045;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public SignalName3EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Signal_3022, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SignalName4EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SignalName4EditPart.java
new file mode 100644
index 00000000000..b71afd0c1ba
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SignalName4EditPart.java
@@ -0,0 +1,554 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class SignalName4EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5046;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public SignalName4EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ EObject parserElement = getParserElement();
+ if (parserElement == null) {
+ return null;
+ }
+ return UMLElementTypes.getImage(parserElement.eClass());
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Signal_3022, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SignalNameEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SignalNameEditPart.java
new file mode 100644
index 00000000000..e6de6d812fc
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SignalNameEditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class SignalNameEditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5007;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public SignalNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Signal_2003, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SignalQualifiedName2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SignalQualifiedName2EditPart.java
new file mode 100644
index 00000000000..982f8d5ebc8
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SignalQualifiedName2EditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class SignalQualifiedName2EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5047;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public SignalQualifiedName2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Signal_3022, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SignalQualifiedNameEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SignalQualifiedNameEditPart.java
new file mode 100644
index 00000000000..e91967c0228
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SignalQualifiedNameEditPart.java
@@ -0,0 +1,550 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class SignalQualifiedNameEditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5009;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public SignalQualifiedNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Signal_2003, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SlotEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SlotEditPart.java
new file mode 100644
index 00000000000..61c3833c21d
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SlotEditPart.java
@@ -0,0 +1,183 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.OpenDiagramEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.SlotItemSemanticEditPolicy;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @generated
+ */
+public class SlotEditPart extends ShapeNodeEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 3001;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public SlotEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new SlotItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy());
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+ LayoutEditPolicy lep = new LayoutEditPolicy() {
+
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ SlotDescriptor figure = new SlotDescriptor();
+ return primaryShape = figure;
+ }
+
+ /**
+ * @generated
+ */
+ public SlotDescriptor getPrimaryShape() {
+ return (SlotDescriptor) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(40), getMapMode().DPtoLP(40));
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ protected NodeFigure createNodeFigure() {
+ NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ IFigure shape = createNodeShape();
+ figure.add(shape);
+ contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ public class SlotDescriptor extends WrappingLabel {
+
+ /**
+ * @generated
+ */
+ public SlotDescriptor() {
+ this.setText("");
+
+ this.setFont(THIS_FONT);
+
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ static final Font THIS_FONT = new Font(Display.getCurrent(), "Arial", 10, SWT.NORMAL);
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SubstitutionEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SubstitutionEditPart.java
new file mode 100644
index 00000000000..7bcbd4c56ab
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SubstitutionEditPart.java
@@ -0,0 +1,173 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Connection;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.SubstitutionItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.common.figure.edge.DashEdgeFigure;
+
+/**
+ * @generated
+ */
+public class SubstitutionEditPart extends ConnectionNodeEditPart implements ITreeBranchEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 4004;
+
+ /**
+ * @generated
+ */
+ public SubstitutionEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new SubstitutionItemSemanticEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof SubstitutionNameEditPart) {
+ ((SubstitutionNameEditPart) childEditPart).setLabel(getPrimaryShape().getAppliedStereotypeLabel());
+ return true;
+ }
+ if (childEditPart instanceof SubstitutionName2EditPart) {
+ ((SubstitutionName2EditPart) childEditPart).setLabel(getPrimaryShape().getDependencyNameLabel());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+
+ protected Connection createConnectionFigure() {
+ return new DependencyDescriptor();
+ }
+
+ /**
+ * @generated
+ */
+ public DependencyDescriptor getPrimaryShape() {
+ return (DependencyDescriptor) getFigure();
+ }
+
+ /**
+ * @generated
+ */
+ public class DependencyDescriptor extends DashEdgeFigure {
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fDependencyNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fAppliedStereotypeLabel;
+
+ /**
+ * @generated
+ */
+ public DependencyDescriptor() {
+
+ this.setForegroundColor(ColorConstants.black);
+ this.setBackgroundColor(ColorConstants.black);
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ fDependencyNameLabel = new WrappingLabel();
+ fDependencyNameLabel.setText("");
+
+ this.add(fDependencyNameLabel);
+
+ fAppliedStereotypeLabel = new WrappingLabel();
+ fAppliedStereotypeLabel.setText("");
+
+ this.add(fAppliedStereotypeLabel);
+
+ }
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getDependencyNameLabel() {
+ return fDependencyNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getAppliedStereotypeLabel() {
+ return fAppliedStereotypeLabel;
+ }
+
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SubstitutionName2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SubstitutionName2EditPart.java
new file mode 100644
index 00000000000..06b7c3922e4
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SubstitutionName2EditPart.java
@@ -0,0 +1,529 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class SubstitutionName2EditPart extends LabelEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 6011;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.clazz.edit.parts.SubstitutionName2EditPart.VISUAL_ID), new Point(0, 60));
+ }
+
+ /**
+ * @generated
+ */
+ public SubstitutionName2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ public int getKeyPoint() {
+ return ConnectionLocator.MIDDLE;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Substitution_4004, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SubstitutionNameEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SubstitutionNameEditPart.java
new file mode 100644
index 00000000000..3cd55b03b69
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/SubstitutionNameEditPart.java
@@ -0,0 +1,529 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class SubstitutionNameEditPart extends LabelEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 6010;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.clazz.edit.parts.SubstitutionNameEditPart.VISUAL_ID), new Point(0, 40));
+ }
+
+ /**
+ * @generated
+ */
+ public SubstitutionNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ public int getKeyPoint() {
+ return ConnectionLocator.MIDDLE;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Substitution_4004, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/TemplateBindingEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/TemplateBindingEditPart.java
new file mode 100644
index 00000000000..15710d4c9a1
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/TemplateBindingEditPart.java
@@ -0,0 +1,169 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Connection;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.TemplateBindingItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.common.figure.edge.CInterfaceRealizationFigure;
+
+/**
+ * @generated
+ */
+public class TemplateBindingEditPart extends ConnectionNodeEditPart implements ITreeBranchEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 4015;
+
+ /**
+ * @generated
+ */
+ public TemplateBindingEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new TemplateBindingItemSemanticEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof WrappingLabelEditPart) {
+ ((WrappingLabelEditPart) childEditPart).setLabel(getPrimaryShape().getInterfaceRealizationNameLabel());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+
+ protected Connection createConnectionFigure() {
+ return new InterfaceRealizationDescriptor();
+ }
+
+ /**
+ * @generated
+ */
+ public InterfaceRealizationDescriptor getPrimaryShape() {
+ return (InterfaceRealizationDescriptor) getFigure();
+ }
+
+ /**
+ * @generated
+ */
+ public class InterfaceRealizationDescriptor extends CInterfaceRealizationFigure {
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fInterfaceRealizationNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fAppliedStereotypeLabel;
+
+ /**
+ * @generated
+ */
+ public InterfaceRealizationDescriptor() {
+
+ this.setForegroundColor(ColorConstants.black);
+ this.setBackgroundColor(ColorConstants.black);
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ fInterfaceRealizationNameLabel = new WrappingLabel();
+ fInterfaceRealizationNameLabel.setText("");
+
+ this.add(fInterfaceRealizationNameLabel);
+
+ fAppliedStereotypeLabel = new WrappingLabel();
+ fAppliedStereotypeLabel.setText("");
+
+ this.add(fAppliedStereotypeLabel);
+
+ }
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getInterfaceRealizationNameLabel() {
+ return fInterfaceRealizationNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getAppliedStereotypeLabel() {
+ return fAppliedStereotypeLabel;
+ }
+
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/TemplateParameterEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/TemplateParameterEditPart.java
new file mode 100644
index 00000000000..602acdc0b77
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/TemplateParameterEditPart.java
@@ -0,0 +1,573 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.DragTracker;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.requests.SelectionRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ListItemComponentEditPolicy;
+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.DragEditPartsTrackerEx;
+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.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.TemplateParameterItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextNonResizableEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class TemplateParameterEditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public class TemplateParameterDescriptor extends WrappingLabel {
+
+ /**
+ * @generated
+ */
+ public TemplateParameterDescriptor() {
+ this.setText("<UNDEFINED>");
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 3016;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ public TemplateParameterEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new TemplateParameterItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new UMLTextNonResizableEditPolicy());
+ installEditPolicy(EditPolicy.COMPONENT_ROLE, new ListItemComponentEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ IFigure label = createFigurePrim();
+ defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigurePrim() {
+ return new TemplateParameterDescriptor();
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public DragTracker getDragTracker(Request request) {
+ if (request instanceof SelectionRequest && ((SelectionRequest) request).getLastButtonPressed() == 3) {
+ return null;
+ }
+ return new DragEditPartsTrackerEx(this);
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.TemplateParameter_3016, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+
+ EObject element = resolveSemanticElement();
+ return element != null ? element : (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/UMLEditPartFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/UMLEditPartFactory.java
new file mode 100644
index 00000000000..da7d25b92a3
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/UMLEditPartFactory.java
@@ -0,0 +1,718 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.FigureUtilities;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartFactory;
+import org.eclipse.gef.tools.CellEditorLocator;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * @generated
+ */
+public class UMLEditPartFactory implements EditPartFactory {
+
+ /**
+ * @generated
+ */
+ public EditPart createEditPart(EditPart context, Object model) {
+ if (model instanceof View) {
+ View view = (View) model;
+ switch (UMLVisualIDRegistry.getVisualID(view)) {
+
+ case ModelEditPart.VISUAL_ID:
+ return new ModelEditPart(view);
+
+ case Dependency2EditPart.VISUAL_ID:
+ return new Dependency2EditPart(view);
+
+ case AssociationClassEditPart.VISUAL_ID:
+ return new AssociationClassEditPart(view);
+
+ case AssociationClassNameEditPart.VISUAL_ID:
+ return new AssociationClassNameEditPart(view);
+
+ case AssociationClassName2EditPart.VISUAL_ID:
+ return new AssociationClassName2EditPart(view);
+
+ case AssociationClassQualifiedNameEditPart.VISUAL_ID:
+ return new AssociationClassQualifiedNameEditPart(view);
+
+ case Association2EditPart.VISUAL_ID:
+ return new Association2EditPart(view);
+
+ case InstanceSpecificationEditPart.VISUAL_ID:
+ return new InstanceSpecificationEditPart(view);
+
+ case InstanceSpecificationNameEditPart.VISUAL_ID:
+ return new InstanceSpecificationNameEditPart(view);
+
+ case InstanceSpecificationName2EditPart.VISUAL_ID:
+ return new InstanceSpecificationName2EditPart(view);
+
+ case InstanceSpecificationQualifiedNameEditPart.VISUAL_ID:
+ return new InstanceSpecificationQualifiedNameEditPart(view);
+
+ case ComponentEditPart.VISUAL_ID:
+ return new ComponentEditPart(view);
+
+ case ComponentNameEditPart.VISUAL_ID:
+ return new ComponentNameEditPart(view);
+
+ case ComponentName2EditPart.VISUAL_ID:
+ return new ComponentName2EditPart(view);
+
+ case ComponentQualifiedNameEditPart.VISUAL_ID:
+ return new ComponentQualifiedNameEditPart(view);
+
+ case SignalEditPart.VISUAL_ID:
+ return new SignalEditPart(view);
+
+ case SignalNameEditPart.VISUAL_ID:
+ return new SignalNameEditPart(view);
+
+ case SignalName2EditPart.VISUAL_ID:
+ return new SignalName2EditPart(view);
+
+ case SignalQualifiedNameEditPart.VISUAL_ID:
+ return new SignalQualifiedNameEditPart(view);
+
+ case InterfaceEditPart.VISUAL_ID:
+ return new InterfaceEditPart(view);
+
+ case InterfaceNameEditPart.VISUAL_ID:
+ return new InterfaceNameEditPart(view);
+
+ case InterfaceName2EditPart.VISUAL_ID:
+ return new InterfaceName2EditPart(view);
+
+ case InterfaceQualifiedNameEditPart.VISUAL_ID:
+ return new InterfaceQualifiedNameEditPart(view);
+
+ case Model2EditPart.VISUAL_ID:
+ return new Model2EditPart(view);
+
+ case ModelNameEditPart.VISUAL_ID:
+ return new ModelNameEditPart(view);
+
+ case ModelName2EditPart.VISUAL_ID:
+ return new ModelName2EditPart(view);
+
+ case ModelQualifiedNameEditPart.VISUAL_ID:
+ return new ModelQualifiedNameEditPart(view);
+
+ case EnumerationEditPart.VISUAL_ID:
+ return new EnumerationEditPart(view);
+
+ case EnumerationNameEditPart.VISUAL_ID:
+ return new EnumerationNameEditPart(view);
+
+ case EnumerationName2EditPart.VISUAL_ID:
+ return new EnumerationName2EditPart(view);
+
+ case EnumerationQualifiedNameEditPart.VISUAL_ID:
+ return new EnumerationQualifiedNameEditPart(view);
+
+ case PackageEditPart.VISUAL_ID:
+ return new PackageEditPart(view);
+
+ case PackageNameEditPart.VISUAL_ID:
+ return new PackageNameEditPart(view);
+
+ case PackageName2EditPart.VISUAL_ID:
+ return new PackageName2EditPart(view);
+
+ case PackageQualifiedNameEditPart.VISUAL_ID:
+ return new PackageQualifiedNameEditPart(view);
+
+ case ClassEditPart.VISUAL_ID:
+ return new ClassEditPart(view);
+
+ case ClassNameEditPart.VISUAL_ID:
+ return new ClassNameEditPart(view);
+
+ case ClassName2EditPart.VISUAL_ID:
+ return new ClassName2EditPart(view);
+
+ case ClassQualifiedNameEditPart.VISUAL_ID:
+ return new ClassQualifiedNameEditPart(view);
+
+ case PrimitiveTypeEditPart.VISUAL_ID:
+ return new PrimitiveTypeEditPart(view);
+
+ case PrimitiveTypeNameEditPart.VISUAL_ID:
+ return new PrimitiveTypeNameEditPart(view);
+
+ case PrimitiveTypeName2EditPart.VISUAL_ID:
+ return new PrimitiveTypeName2EditPart(view);
+
+ case PrimitiveTypeQualifiedNameEditPart.VISUAL_ID:
+ return new PrimitiveTypeQualifiedNameEditPart(view);
+
+ case DataTypeEditPart.VISUAL_ID:
+ return new DataTypeEditPart(view);
+
+ case DataTypeNameEditPart.VISUAL_ID:
+ return new DataTypeNameEditPart(view);
+
+ case DataTypeName2EditPart.VISUAL_ID:
+ return new DataTypeName2EditPart(view);
+
+ case DataTypeQualifiedNameEditPart.VISUAL_ID:
+ return new DataTypeQualifiedNameEditPart(view);
+
+ case ConstraintEditPart.VISUAL_ID:
+ return new ConstraintEditPart(view);
+
+ case ConstraintNameEditPart.VISUAL_ID:
+ return new ConstraintNameEditPart(view);
+
+ case CommentEditPart.VISUAL_ID:
+ return new CommentEditPart(view);
+
+ case CommentBodyEditPart.VISUAL_ID:
+ return new CommentBodyEditPart(view);
+
+ case PropertyEditPart.VISUAL_ID:
+ return new PropertyEditPart(view);
+
+ case SlotEditPart.VISUAL_ID:
+ return new SlotEditPart(view);
+
+ case OperationEditPart.VISUAL_ID:
+ return new OperationEditPart(view);
+
+ case Class2EditPart.VISUAL_ID:
+ return new Class2EditPart(view);
+
+ case RedefinableTemplateSignatureEditPart.VISUAL_ID:
+ return new RedefinableTemplateSignatureEditPart(view);
+
+ case TemplateParameterEditPart.VISUAL_ID:
+ return new TemplateParameterEditPart(view);
+
+ case Property2EditPart.VISUAL_ID:
+ return new Property2EditPart(view);
+
+ case Property3EditPart.VISUAL_ID:
+ return new Property3EditPart(view);
+
+ case Operation2EditPart.VISUAL_ID:
+ return new Operation2EditPart(view);
+
+ case Class3EditPart.VISUAL_ID:
+ return new Class3EditPart(view);
+
+ case InstanceSpecification2EditPart.VISUAL_ID:
+ return new InstanceSpecification2EditPart(view);
+
+ case InstanceSpecificationName3EditPart.VISUAL_ID:
+ return new InstanceSpecificationName3EditPart(view);
+
+ case InstanceSpecificationName4EditPart.VISUAL_ID:
+ return new InstanceSpecificationName4EditPart(view);
+
+ case InstanceSpecificationQualifiedName2EditPart.VISUAL_ID:
+ return new InstanceSpecificationQualifiedName2EditPart(view);
+
+ case Component2EditPart.VISUAL_ID:
+ return new Component2EditPart(view);
+
+ case ComponentName3EditPart.VISUAL_ID:
+ return new ComponentName3EditPart(view);
+
+ case ComponentName4EditPart.VISUAL_ID:
+ return new ComponentName4EditPart(view);
+
+ case ComponentQualifiedName2EditPart.VISUAL_ID:
+ return new ComponentQualifiedName2EditPart(view);
+
+ case Signal2EditPart.VISUAL_ID:
+ return new Signal2EditPart(view);
+
+ case SignalName3EditPart.VISUAL_ID:
+ return new SignalName3EditPart(view);
+
+ case SignalName4EditPart.VISUAL_ID:
+ return new SignalName4EditPart(view);
+
+ case SignalQualifiedName2EditPart.VISUAL_ID:
+ return new SignalQualifiedName2EditPart(view);
+
+ case Interface2EditPart.VISUAL_ID:
+ return new Interface2EditPart(view);
+
+ case InterfaceName3EditPart.VISUAL_ID:
+ return new InterfaceName3EditPart(view);
+
+ case InterfaceName4EditPart.VISUAL_ID:
+ return new InterfaceName4EditPart(view);
+
+ case InterfaceQualifiedName2EditPart.VISUAL_ID:
+ return new InterfaceQualifiedName2EditPart(view);
+
+ case Model3EditPart.VISUAL_ID:
+ return new Model3EditPart(view);
+
+ case ModelName3EditPart.VISUAL_ID:
+ return new ModelName3EditPart(view);
+
+ case ModelName4EditPart.VISUAL_ID:
+ return new ModelName4EditPart(view);
+
+ case ModelQualifiedName2EditPart.VISUAL_ID:
+ return new ModelQualifiedName2EditPart(view);
+
+ case Enumeration2EditPart.VISUAL_ID:
+ return new Enumeration2EditPart(view);
+
+ case EnumerationName3EditPart.VISUAL_ID:
+ return new EnumerationName3EditPart(view);
+
+ case EnumerationName4EditPart.VISUAL_ID:
+ return new EnumerationName4EditPart(view);
+
+ case EnumerationQualifiedName2EditPart.VISUAL_ID:
+ return new EnumerationQualifiedName2EditPart(view);
+
+ case EnumerationLiteralEditPart.VISUAL_ID:
+ return new EnumerationLiteralEditPart(view);
+
+ case Package2EditPart.VISUAL_ID:
+ return new Package2EditPart(view);
+
+ case PackageName3EditPart.VISUAL_ID:
+ return new PackageName3EditPart(view);
+
+ case PackageName4EditPart.VISUAL_ID:
+ return new PackageName4EditPart(view);
+
+ case PackageQualifiedName2EditPart.VISUAL_ID:
+ return new PackageQualifiedName2EditPart(view);
+
+ case Class4EditPart.VISUAL_ID:
+ return new Class4EditPart(view);
+
+ case ClassName3EditPart.VISUAL_ID:
+ return new ClassName3EditPart(view);
+
+ case ClassName4EditPart.VISUAL_ID:
+ return new ClassName4EditPart(view);
+
+ case ClassQualifiedName2EditPart.VISUAL_ID:
+ return new ClassQualifiedName2EditPart(view);
+
+ case ReceptionEditPart.VISUAL_ID:
+ return new ReceptionEditPart(view);
+
+ case Property4EditPart.VISUAL_ID:
+ return new Property4EditPart(view);
+
+ case Operation3EditPart.VISUAL_ID:
+ return new Operation3EditPart(view);
+
+ case Class5EditPart.VISUAL_ID:
+ return new Class5EditPart(view);
+
+ case PrimitiveType2EditPart.VISUAL_ID:
+ return new PrimitiveType2EditPart(view);
+
+ case PrimitiveTypeName3EditPart.VISUAL_ID:
+ return new PrimitiveTypeName3EditPart(view);
+
+ case PrimitiveTypeName4EditPart.VISUAL_ID:
+ return new PrimitiveTypeName4EditPart(view);
+
+ case PrimitiveTypeQualifiedName2EditPart.VISUAL_ID:
+ return new PrimitiveTypeQualifiedName2EditPart(view);
+
+ case DataType2EditPart.VISUAL_ID:
+ return new DataType2EditPart(view);
+
+ case DataTypeName3EditPart.VISUAL_ID:
+ return new DataTypeName3EditPart(view);
+
+ case DataTypeName4EditPart.VISUAL_ID:
+ return new DataTypeName4EditPart(view);
+
+ case DataTypeQualifiedName2EditPart.VISUAL_ID:
+ return new DataTypeQualifiedName2EditPart(view);
+
+ case Property5EditPart.VISUAL_ID:
+ return new Property5EditPart(view);
+
+ case Operation4EditPart.VISUAL_ID:
+ return new Operation4EditPart(view);
+
+ case Comment2EditPart.VISUAL_ID:
+ return new Comment2EditPart(view);
+
+ case CommentBody2EditPart.VISUAL_ID:
+ return new CommentBody2EditPart(view);
+
+ case Constraint2EditPart.VISUAL_ID:
+ return new Constraint2EditPart(view);
+
+ case ConstraintName2EditPart.VISUAL_ID:
+ return new ConstraintName2EditPart(view);
+
+ case AssociationClassAttributeCompartmentEditPart.VISUAL_ID:
+ return new AssociationClassAttributeCompartmentEditPart(view);
+
+ case InstanceSpecificationSlotCompartmentEditPart.VISUAL_ID:
+ return new InstanceSpecificationSlotCompartmentEditPart(view);
+
+ case ComponentAttributeCompartmentEditPart.VISUAL_ID:
+ return new ComponentAttributeCompartmentEditPart(view);
+
+ case ComponentOperationCompartmentEditPart.VISUAL_ID:
+ return new ComponentOperationCompartmentEditPart(view);
+
+ case ComponentNestedClassifierCompartmentEditPart.VISUAL_ID:
+ return new ComponentNestedClassifierCompartmentEditPart(view);
+
+ case RedefinableTemplateSignatureTemplateParameterCompartmentEditPart.VISUAL_ID:
+ return new RedefinableTemplateSignatureTemplateParameterCompartmentEditPart(view);
+
+ case SignalAttributeCompartmentEditPart.VISUAL_ID:
+ return new SignalAttributeCompartmentEditPart(view);
+
+ case InterfaceAttributeCompartmentEditPart.VISUAL_ID:
+ return new InterfaceAttributeCompartmentEditPart(view);
+
+ case InterfaceOperationCompartmentEditPart.VISUAL_ID:
+ return new InterfaceOperationCompartmentEditPart(view);
+
+ case InterfaceNestedClassifierCompartmentEditPart.VISUAL_ID:
+ return new InterfaceNestedClassifierCompartmentEditPart(view);
+
+ case ModelPackageableElementCompartmentEditPart.VISUAL_ID:
+ return new ModelPackageableElementCompartmentEditPart(view);
+
+ case InstanceSpecificationSlotCompartment2EditPart.VISUAL_ID:
+ return new InstanceSpecificationSlotCompartment2EditPart(view);
+
+ case ComponentAttributeCompartment2EditPart.VISUAL_ID:
+ return new ComponentAttributeCompartment2EditPart(view);
+
+ case ComponentOperationCompartment2EditPart.VISUAL_ID:
+ return new ComponentOperationCompartment2EditPart(view);
+
+ case ComponentNestedClassifierCompartment2EditPart.VISUAL_ID:
+ return new ComponentNestedClassifierCompartment2EditPart(view);
+
+ case SignalAttributeCompartment2EditPart.VISUAL_ID:
+ return new SignalAttributeCompartment2EditPart(view);
+
+ case InterfaceAttributeCompartment2EditPart.VISUAL_ID:
+ return new InterfaceAttributeCompartment2EditPart(view);
+
+ case InterfaceOperationCompartment2EditPart.VISUAL_ID:
+ return new InterfaceOperationCompartment2EditPart(view);
+
+ case InterfaceNestedClassifierCompartment2EditPart.VISUAL_ID:
+ return new InterfaceNestedClassifierCompartment2EditPart(view);
+
+ case ModelPackageableElementCompartment2EditPart.VISUAL_ID:
+ return new ModelPackageableElementCompartment2EditPart(view);
+
+ case EnumerationEnumerationLiteralCompartment2EditPart.VISUAL_ID:
+ return new EnumerationEnumerationLiteralCompartment2EditPart(view);
+
+ case PackagePackageableElementCompartmentEditPart.VISUAL_ID:
+ return new PackagePackageableElementCompartmentEditPart(view);
+
+ case ClassAttributeCompartmentEditPart.VISUAL_ID:
+ return new ClassAttributeCompartmentEditPart(view);
+
+ case ClassOperationCompartmentEditPart.VISUAL_ID:
+ return new ClassOperationCompartmentEditPart(view);
+
+ case ClassNestedClassifierCompartmentEditPart.VISUAL_ID:
+ return new ClassNestedClassifierCompartmentEditPart(view);
+
+ case DataTypeAttributeCompartment2EditPart.VISUAL_ID:
+ return new DataTypeAttributeCompartment2EditPart(view);
+
+ case DataTypeOperationCompartment2EditPart.VISUAL_ID:
+ return new DataTypeOperationCompartment2EditPart(view);
+
+ case EnumerationEnumerationLiteralCompartmentEditPart.VISUAL_ID:
+ return new EnumerationEnumerationLiteralCompartmentEditPart(view);
+
+ case PackagePackageableElementCompartment2EditPart.VISUAL_ID:
+ return new PackagePackageableElementCompartment2EditPart(view);
+
+ case ClassAttributeCompartment2EditPart.VISUAL_ID:
+ return new ClassAttributeCompartment2EditPart(view);
+
+ case ClassOperationCompartment2EditPart.VISUAL_ID:
+ return new ClassOperationCompartment2EditPart(view);
+
+ case ClassNestedClassifierCompartment2EditPart.VISUAL_ID:
+ return new ClassNestedClassifierCompartment2EditPart(view);
+
+ case DataTypeAttributeCompartmentEditPart.VISUAL_ID:
+ return new DataTypeAttributeCompartmentEditPart(view);
+
+ case DataTypeOperationCompartmentEditPart.VISUAL_ID:
+ return new DataTypeOperationCompartmentEditPart(view);
+
+ case CommentLinkDescriptorEditPart.VISUAL_ID:
+ return new CommentLinkDescriptorEditPart(view);
+
+ case AssociationClass2EditPart.VISUAL_ID:
+ return new AssociationClass2EditPart(view);
+
+ case AssociationEditPart.VISUAL_ID:
+ return new AssociationEditPart(view);
+
+ case AssociationNameEditPart.VISUAL_ID:
+ return new AssociationNameEditPart(view);
+
+ case AssociationName2EditPart.VISUAL_ID:
+ return new AssociationName2EditPart(view);
+
+ case AssociationName3EditPart.VISUAL_ID:
+ return new AssociationName3EditPart(view);
+
+ case AssociationName4EditPart.VISUAL_ID:
+ return new AssociationName4EditPart(view);
+
+ case AssociationName5EditPart.VISUAL_ID:
+ return new AssociationName5EditPart(view);
+
+ case AssociationName6EditPart.VISUAL_ID:
+ return new AssociationName6EditPart(view);
+
+ case Association3EditPart.VISUAL_ID:
+ return new Association3EditPart(view);
+
+ case GeneralizationEditPart.VISUAL_ID:
+ return new GeneralizationEditPart(view);
+
+ case GeneralizationIsSubstitutableEditPart.VISUAL_ID:
+ return new GeneralizationIsSubstitutableEditPart(view);
+
+ case InterfaceRealizationEditPart.VISUAL_ID:
+ return new InterfaceRealizationEditPart(view);
+
+ case InterfaceRealizationNameEditPart.VISUAL_ID:
+ return new InterfaceRealizationNameEditPart(view);
+
+ case InterfaceRealizationName2EditPart.VISUAL_ID:
+ return new InterfaceRealizationName2EditPart(view);
+
+ case SubstitutionEditPart.VISUAL_ID:
+ return new SubstitutionEditPart(view);
+
+ case SubstitutionNameEditPart.VISUAL_ID:
+ return new SubstitutionNameEditPart(view);
+
+ case SubstitutionName2EditPart.VISUAL_ID:
+ return new SubstitutionName2EditPart(view);
+
+ case RealizationEditPart.VISUAL_ID:
+ return new RealizationEditPart(view);
+
+ case RealizationNameEditPart.VISUAL_ID:
+ return new RealizationNameEditPart(view);
+
+ case RealizationName2EditPart.VISUAL_ID:
+ return new RealizationName2EditPart(view);
+
+ case AbstractionEditPart.VISUAL_ID:
+ return new AbstractionEditPart(view);
+
+ case AbstractionNameEditPart.VISUAL_ID:
+ return new AbstractionNameEditPart(view);
+
+ case AbstractionName2EditPart.VISUAL_ID:
+ return new AbstractionName2EditPart(view);
+
+ case UsageEditPart.VISUAL_ID:
+ return new UsageEditPart(view);
+
+ case UsageNameEditPart.VISUAL_ID:
+ return new UsageNameEditPart(view);
+
+ case UsageName2EditPart.VISUAL_ID:
+ return new UsageName2EditPart(view);
+
+ case DependencyEditPart.VISUAL_ID:
+ return new DependencyEditPart(view);
+
+ case DependencyNameEditPart.VISUAL_ID:
+ return new DependencyNameEditPart(view);
+
+ case DependencyName2EditPart.VISUAL_ID:
+ return new DependencyName2EditPart(view);
+
+ case Dependency3EditPart.VISUAL_ID:
+ return new Dependency3EditPart(view);
+
+ case DependencyName3EditPart.VISUAL_ID:
+ return new DependencyName3EditPart(view);
+
+ case DependencyName4EditPart.VISUAL_ID:
+ return new DependencyName4EditPart(view);
+
+ case ElementImportEditPart.VISUAL_ID:
+ return new ElementImportEditPart(view);
+
+ case ElementImportAliasEditPart.VISUAL_ID:
+ return new ElementImportAliasEditPart(view);
+
+ case ElementImportAlias2EditPart.VISUAL_ID:
+ return new ElementImportAlias2EditPart(view);
+
+ case PackageImportEditPart.VISUAL_ID:
+ return new PackageImportEditPart(view);
+
+ case PackageImportVisibilityEditPart.VISUAL_ID:
+ return new PackageImportVisibilityEditPart(view);
+
+ case PackageMergeEditPart.VISUAL_ID:
+ return new PackageMergeEditPart(view);
+
+ case ProfileApplicationEditPart.VISUAL_ID:
+ return new ProfileApplicationEditPart(view);
+
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return new CommentAnnotatedElementEditPart(view);
+
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return new ConstraintConstrainedElementEditPart(view);
+
+ case TemplateBindingEditPart.VISUAL_ID:
+ return new TemplateBindingEditPart(view);
+
+ case WrappingLabelEditPart.VISUAL_ID:
+ return new WrappingLabelEditPart(view);
+ }
+ }
+ return createUnrecognizedEditPart(context, model);
+ }
+
+ /**
+ * @generated
+ */
+ private EditPart createUnrecognizedEditPart(EditPart context, Object model) {
+ // Handle creation of unrecognized child node EditParts here
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public static CellEditorLocator getTextCellEditorLocator(ITextAwareEditPart source) {
+ if (source.getFigure() instanceof WrappingLabel)
+ return new TextCellEditorLocator((WrappingLabel) source.getFigure());
+ else {
+ return new LabelCellEditorLocator((Label) source.getFigure());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ static private class TextCellEditorLocator implements CellEditorLocator {
+
+ /**
+ * @generated
+ */
+ private WrappingLabel wrapLabel;
+
+ /**
+ * @generated
+ */
+ public TextCellEditorLocator(WrappingLabel wrapLabel) {
+ this.wrapLabel = wrapLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getWrapLabel() {
+ return wrapLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public void relocate(CellEditor celleditor) {
+ Text text = (Text) celleditor.getControl();
+ Rectangle rect = getWrapLabel().getTextBounds().getCopy();
+ getWrapLabel().translateToAbsolute(rect);
+ if (getWrapLabel().isTextWrapOn() && getWrapLabel().getText().length() > 0) {
+ rect.setSize(new Dimension(text.computeSize(rect.width, SWT.DEFAULT)));
+ } else {
+ int avr = FigureUtilities.getFontMetrics(text.getFont()).getAverageCharWidth();
+ rect.setSize(new Dimension(text.computeSize(SWT.DEFAULT, SWT.DEFAULT)).expand(avr * 2, 0));
+ }
+ if (!rect.equals(new Rectangle(text.getBounds()))) {
+ text.setBounds(rect.x, rect.y, rect.width, rect.height);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private static class LabelCellEditorLocator implements CellEditorLocator {
+
+ /**
+ * @generated
+ */
+ private Label label;
+
+ /**
+ * @generated
+ */
+ public LabelCellEditorLocator(Label label) {
+ this.label = label;
+ }
+
+ /**
+ * @generated
+ */
+ public Label getLabel() {
+ return label;
+ }
+
+ /**
+ * @generated
+ */
+ public void relocate(CellEditor celleditor) {
+ Text text = (Text) celleditor.getControl();
+ Rectangle rect = getLabel().getTextBounds().getCopy();
+ getLabel().translateToAbsolute(rect);
+ int avr = FigureUtilities.getFontMetrics(text.getFont()).getAverageCharWidth();
+ rect.setSize(new Dimension(text.computeSize(SWT.DEFAULT, SWT.DEFAULT)).expand(avr * 2, 0));
+ if (!rect.equals(new Rectangle(text.getBounds()))) {
+ text.setBounds(rect.x, rect.y, rect.width, rect.height);
+ }
+ }
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/UsageEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/UsageEditPart.java
new file mode 100644
index 00000000000..3dc643abb70
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/UsageEditPart.java
@@ -0,0 +1,173 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Connection;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UsageItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.common.figure.edge.DashEdgeFigure;
+
+/**
+ * @generated
+ */
+public class UsageEditPart extends ConnectionNodeEditPart implements ITreeBranchEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 4007;
+
+ /**
+ * @generated
+ */
+ public UsageEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new UsageItemSemanticEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof UsageNameEditPart) {
+ ((UsageNameEditPart) childEditPart).setLabel(getPrimaryShape().getDependencyNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof UsageName2EditPart) {
+ ((UsageName2EditPart) childEditPart).setLabel(getPrimaryShape().getAppliedStereotypeLabel());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+
+ protected Connection createConnectionFigure() {
+ return new DependencyDescriptor();
+ }
+
+ /**
+ * @generated
+ */
+ public DependencyDescriptor getPrimaryShape() {
+ return (DependencyDescriptor) getFigure();
+ }
+
+ /**
+ * @generated
+ */
+ public class DependencyDescriptor extends DashEdgeFigure {
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fDependencyNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fAppliedStereotypeLabel;
+
+ /**
+ * @generated
+ */
+ public DependencyDescriptor() {
+
+ this.setForegroundColor(ColorConstants.black);
+ this.setBackgroundColor(ColorConstants.black);
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ fDependencyNameLabel = new WrappingLabel();
+ fDependencyNameLabel.setText("");
+
+ this.add(fDependencyNameLabel);
+
+ fAppliedStereotypeLabel = new WrappingLabel();
+ fAppliedStereotypeLabel.setText("");
+
+ this.add(fAppliedStereotypeLabel);
+
+ }
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getDependencyNameLabel() {
+ return fDependencyNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getAppliedStereotypeLabel() {
+ return fAppliedStereotypeLabel;
+ }
+
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/UsageName2EditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/UsageName2EditPart.java
new file mode 100644
index 00000000000..69716a91a80
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/UsageName2EditPart.java
@@ -0,0 +1,529 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class UsageName2EditPart extends LabelEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 6017;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.clazz.edit.parts.UsageName2EditPart.VISUAL_ID), new Point(0, 60));
+ }
+
+ /**
+ * @generated
+ */
+ public UsageName2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ public int getKeyPoint() {
+ return ConnectionLocator.MIDDLE;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Usage_4007, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/UsageNameEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/UsageNameEditPart.java
new file mode 100644
index 00000000000..e44456dbc3d
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/UsageNameEditPart.java
@@ -0,0 +1,529 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class UsageNameEditPart extends LabelEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 6016;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.clazz.edit.parts.UsageNameEditPart.VISUAL_ID), new Point(0, 40));
+ }
+
+ /**
+ * @generated
+ */
+ public UsageNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ public int getKeyPoint() {
+ return ConnectionLocator.MIDDLE;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Usage_4007, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/WrappingLabelEditPart.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/WrappingLabelEditPart.java
new file mode 100644
index 00000000000..216726e8ba2
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/parts/WrappingLabelEditPart.java
@@ -0,0 +1,531 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class WrappingLabelEditPart extends LabelEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 6023;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.clazz.edit.parts.WrappingLabelEditPart.VISUAL_ID), new Point(0, 40));
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabelEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ public int getKeyPoint() {
+ return ConnectionLocator.MIDDLE;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+
+ EObject element = resolveSemanticElement();
+ return element != null ? element : (View) getModel();
+ }
+
+ /**
+ * @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
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.TemplateBinding_4015, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/AbstractionItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/AbstractionItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..ee0a4bd1d48
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/AbstractionItemSemanticEditPolicy.java
@@ -0,0 +1,179 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class AbstractionItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ return getGEFWrapper(new DestroyElementCommand(req));
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case ElementImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new ElementImportReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Association2ItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Association2ItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..86a9068fe0e
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Association2ItemSemanticEditPolicy.java
@@ -0,0 +1,243 @@
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Association2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Association3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationClass2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationClassReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.GeneralizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.GeneralizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SubstitutionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SubstitutionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Association3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationClass2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.GeneralizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SubstitutionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class Association2ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyShortcutsCommand(cc);
+ View view = (View) getHost().getModel();
+ if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
+ req.setElementToDestroy(view);
+ }
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
+ return getGEFWrapper(new AssociationClass2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4001 == req.getElementType()) {
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4019 == req.getElementType()) {
+ return getGEFWrapper(new Association3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Generalization_4002 == req.getElementType()) {
+ return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Substitution_4004 == req.getElementType()) {
+ return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return getGEFWrapper(new PackageImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
+ return getGEFWrapper(new AssociationClass2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4001 == req.getElementType()) {
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4019 == req.getElementType()) {
+ return getGEFWrapper(new Association3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Generalization_4002 == req.getElementType()) {
+ return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Substitution_4004 == req.getElementType()) {
+ return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source
+ * should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case AssociationClass2EditPart.VISUAL_ID:
+ return getGEFWrapper(new AssociationClassReorientCommand(req));
+ case AssociationEditPart.VISUAL_ID:
+ return getGEFWrapper(new AssociationReorientCommand(req));
+ case Association3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Association2ReorientCommand(req));
+ case GeneralizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new GeneralizationReorientCommand(req));
+ case SubstitutionEditPart.VISUAL_ID:
+ return getGEFWrapper(new SubstitutionReorientCommand(req));
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case ElementImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new ElementImportReorientCommand(req));
+ case PackageImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new PackageImportReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source
+ * should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Association3ItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Association3ItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..66dde5b3bee
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Association3ItemSemanticEditPolicy.java
@@ -0,0 +1,234 @@
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Association2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Association3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationClass2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationClassReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.GeneralizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.GeneralizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SubstitutionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SubstitutionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Association3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationClass2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.GeneralizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SubstitutionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class Association3ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ return getGEFWrapper(new DestroyElementCommand(req));
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
+ return getGEFWrapper(new AssociationClass2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4001 == req.getElementType()) {
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4019 == req.getElementType()) {
+ return getGEFWrapper(new Association3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Generalization_4002 == req.getElementType()) {
+ return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Substitution_4004 == req.getElementType()) {
+ return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return getGEFWrapper(new PackageImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
+ return getGEFWrapper(new AssociationClass2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4001 == req.getElementType()) {
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4019 == req.getElementType()) {
+ return getGEFWrapper(new Association3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Generalization_4002 == req.getElementType()) {
+ return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Substitution_4004 == req.getElementType()) {
+ return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source
+ * should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case AssociationClass2EditPart.VISUAL_ID:
+ return getGEFWrapper(new AssociationClassReorientCommand(req));
+ case AssociationEditPart.VISUAL_ID:
+ return getGEFWrapper(new AssociationReorientCommand(req));
+ case Association3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Association2ReorientCommand(req));
+ case GeneralizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new GeneralizationReorientCommand(req));
+ case SubstitutionEditPart.VISUAL_ID:
+ return getGEFWrapper(new SubstitutionReorientCommand(req));
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case ElementImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new ElementImportReorientCommand(req));
+ case PackageImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new PackageImportReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source
+ * should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/AssociationClass2ItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/AssociationClass2ItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..b94b81da296
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/AssociationClass2ItemSemanticEditPolicy.java
@@ -0,0 +1,256 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Association2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Association3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationClass2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationClassReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.GeneralizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.GeneralizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.InterfaceRealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.InterfaceRealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SubstitutionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SubstitutionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Association3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationClass2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.GeneralizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceRealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SubstitutionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class AssociationClass2ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ return getGEFWrapper(new DestroyElementCommand(req));
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
+ return getGEFWrapper(new AssociationClass2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4001 == req.getElementType()) {
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4019 == req.getElementType()) {
+ return getGEFWrapper(new Association3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Generalization_4002 == req.getElementType()) {
+ return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.InterfaceRealization_4003 == req.getElementType()) {
+ return getGEFWrapper(new InterfaceRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Substitution_4004 == req.getElementType()) {
+ return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return getGEFWrapper(new PackageImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
+ return getGEFWrapper(new AssociationClass2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4001 == req.getElementType()) {
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4019 == req.getElementType()) {
+ return getGEFWrapper(new Association3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Generalization_4002 == req.getElementType()) {
+ return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.InterfaceRealization_4003 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.Substitution_4004 == req.getElementType()) {
+ return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case AssociationClass2EditPart.VISUAL_ID:
+ return getGEFWrapper(new AssociationClassReorientCommand(req));
+ case AssociationEditPart.VISUAL_ID:
+ return getGEFWrapper(new AssociationReorientCommand(req));
+ case Association3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Association2ReorientCommand(req));
+ case GeneralizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new GeneralizationReorientCommand(req));
+ case InterfaceRealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new InterfaceRealizationReorientCommand(req));
+ case SubstitutionEditPart.VISUAL_ID:
+ return getGEFWrapper(new SubstitutionReorientCommand(req));
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case ElementImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new ElementImportReorientCommand(req));
+ case PackageImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new PackageImportReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/AssociationClassAttributeCompartmentCanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/AssociationClassAttributeCompartmentCanonicalEditPolicy.java
new file mode 100644
index 00000000000..d5a2003d43c
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/AssociationClassAttributeCompartmentCanonicalEditPolicy.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PropertyEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class AssociationClassAttributeCompartmentCanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getAssociationClassAttributeCompartment_7034SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case PropertyEditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getStructuredClassifier_OwnedAttribute());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/AssociationClassAttributeCompartmentItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/AssociationClassAttributeCompartmentItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..e89fbcbb235
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/AssociationClassAttributeCompartmentItemSemanticEditPolicy.java
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PropertyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class AssociationClassAttributeCompartmentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.Property_3002 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getStructuredClassifier_OwnedAttribute());
+ }
+ return getGEFWrapper(new PropertyCreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/AssociationClassItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/AssociationClassItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..fbc683d02b2
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/AssociationClassItemSemanticEditPolicy.java
@@ -0,0 +1,299 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Association2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Association3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationClass2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationClassReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.GeneralizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.GeneralizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.InterfaceRealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.InterfaceRealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SubstitutionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SubstitutionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Association3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationClass2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationClassAttributeCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.GeneralizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceRealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PropertyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SubstitutionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class AssociationClassItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyChildNodesCommand(cc);
+ addDestroyShortcutsCommand(cc);
+ View view = (View) getHost().getModel();
+ if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
+ req.setElementToDestroy(view);
+ }
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addDestroyChildNodesCommand(CompoundCommand cmd) {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
+ if (annotation != null) {
+ return;
+ }
+ for (Iterator it = view.getChildren().iterator(); it.hasNext();) {
+ Node node = (Node) it.next();
+ switch (UMLVisualIDRegistry.getVisualID(node)) {
+ case AssociationClassAttributeCompartmentEditPart.VISUAL_ID:
+ for (Iterator cit = node.getChildren().iterator(); cit.hasNext();) {
+ Node cnode = (Node) cit.next();
+ switch (UMLVisualIDRegistry.getVisualID(cnode)) {
+ case PropertyEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
+ return getGEFWrapper(new AssociationClass2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4001 == req.getElementType()) {
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4019 == req.getElementType()) {
+ return getGEFWrapper(new Association3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Generalization_4002 == req.getElementType()) {
+ return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.InterfaceRealization_4003 == req.getElementType()) {
+ return getGEFWrapper(new InterfaceRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Substitution_4004 == req.getElementType()) {
+ return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return getGEFWrapper(new PackageImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
+ return getGEFWrapper(new AssociationClass2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4001 == req.getElementType()) {
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4019 == req.getElementType()) {
+ return getGEFWrapper(new Association3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Generalization_4002 == req.getElementType()) {
+ return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.InterfaceRealization_4003 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.Substitution_4004 == req.getElementType()) {
+ return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case AssociationClass2EditPart.VISUAL_ID:
+ return getGEFWrapper(new AssociationClassReorientCommand(req));
+ case AssociationEditPart.VISUAL_ID:
+ return getGEFWrapper(new AssociationReorientCommand(req));
+ case Association3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Association2ReorientCommand(req));
+ case GeneralizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new GeneralizationReorientCommand(req));
+ case InterfaceRealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new InterfaceRealizationReorientCommand(req));
+ case SubstitutionEditPart.VISUAL_ID:
+ return getGEFWrapper(new SubstitutionReorientCommand(req));
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case ElementImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new ElementImportReorientCommand(req));
+ case PackageImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new PackageImportReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/AssociationItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/AssociationItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..cbce6074d31
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/AssociationItemSemanticEditPolicy.java
@@ -0,0 +1,247 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.custom.command.DestroyAssociationCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Association2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Association3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationClass2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationClassReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.GeneralizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.GeneralizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SubstitutionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SubstitutionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Association3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationClass2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.GeneralizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SubstitutionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class AssociationItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
+ return getGEFWrapper(new AssociationClass2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4001 == req.getElementType()) {
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4019 == req.getElementType()) {
+ return getGEFWrapper(new Association3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Generalization_4002 == req.getElementType()) {
+ return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Substitution_4004 == req.getElementType()) {
+ return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated-not modified in order to take in charge the suppression of associated properties.
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ return getGEFWrapper(new DestroyAssociationCommand(req));
+ // return getGEFWrapper(new DestroyElementCommand(req));
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case AssociationClass2EditPart.VISUAL_ID:
+ return getGEFWrapper(new AssociationClassReorientCommand(req));
+ case AssociationEditPart.VISUAL_ID:
+ return getGEFWrapper(new AssociationReorientCommand(req));
+ case Association3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Association2ReorientCommand(req));
+ case GeneralizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new GeneralizationReorientCommand(req));
+ case SubstitutionEditPart.VISUAL_ID:
+ return getGEFWrapper(new SubstitutionReorientCommand(req));
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case ElementImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new ElementImportReorientCommand(req));
+ case PackageImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new PackageImportReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
+ return getGEFWrapper(new AssociationClass2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4001 == req.getElementType()) {
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4019 == req.getElementType()) {
+ return getGEFWrapper(new Association3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Generalization_4002 == req.getElementType()) {
+ return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Substitution_4004 == req.getElementType()) {
+ return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return getGEFWrapper(new PackageImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Class2ItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Class2ItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..6811e70de3c
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Class2ItemSemanticEditPolicy.java
@@ -0,0 +1,260 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Association2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Association3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationClass2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationClassReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.GeneralizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.GeneralizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.InterfaceRealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.InterfaceRealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SubstitutionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SubstitutionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Association3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationClass2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.GeneralizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceRealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SubstitutionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class Class2ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyShortcutsCommand(cc);
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
+ return getGEFWrapper(new AssociationClass2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4001 == req.getElementType()) {
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4019 == req.getElementType()) {
+ return getGEFWrapper(new Association3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Generalization_4002 == req.getElementType()) {
+ return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.InterfaceRealization_4003 == req.getElementType()) {
+ return getGEFWrapper(new InterfaceRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Substitution_4004 == req.getElementType()) {
+ return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return getGEFWrapper(new PackageImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
+ return getGEFWrapper(new AssociationClass2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4001 == req.getElementType()) {
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4019 == req.getElementType()) {
+ return getGEFWrapper(new Association3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Generalization_4002 == req.getElementType()) {
+ return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.InterfaceRealization_4003 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.Substitution_4004 == req.getElementType()) {
+ return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case AssociationClass2EditPart.VISUAL_ID:
+ return getGEFWrapper(new AssociationClassReorientCommand(req));
+ case AssociationEditPart.VISUAL_ID:
+ return getGEFWrapper(new AssociationReorientCommand(req));
+ case Association3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Association2ReorientCommand(req));
+ case GeneralizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new GeneralizationReorientCommand(req));
+ case InterfaceRealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new InterfaceRealizationReorientCommand(req));
+ case SubstitutionEditPart.VISUAL_ID:
+ return getGEFWrapper(new SubstitutionReorientCommand(req));
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case ElementImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new ElementImportReorientCommand(req));
+ case PackageImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new PackageImportReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Class3ItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Class3ItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..9ab2ab501aa
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Class3ItemSemanticEditPolicy.java
@@ -0,0 +1,260 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Association2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Association3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationClass2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationClassReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.GeneralizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.GeneralizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.InterfaceRealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.InterfaceRealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SubstitutionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SubstitutionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Association3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationClass2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.GeneralizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceRealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SubstitutionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class Class3ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyShortcutsCommand(cc);
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
+ return getGEFWrapper(new AssociationClass2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4001 == req.getElementType()) {
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4019 == req.getElementType()) {
+ return getGEFWrapper(new Association3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Generalization_4002 == req.getElementType()) {
+ return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.InterfaceRealization_4003 == req.getElementType()) {
+ return getGEFWrapper(new InterfaceRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Substitution_4004 == req.getElementType()) {
+ return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return getGEFWrapper(new PackageImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
+ return getGEFWrapper(new AssociationClass2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4001 == req.getElementType()) {
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4019 == req.getElementType()) {
+ return getGEFWrapper(new Association3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Generalization_4002 == req.getElementType()) {
+ return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.InterfaceRealization_4003 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.Substitution_4004 == req.getElementType()) {
+ return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case AssociationClass2EditPart.VISUAL_ID:
+ return getGEFWrapper(new AssociationClassReorientCommand(req));
+ case AssociationEditPart.VISUAL_ID:
+ return getGEFWrapper(new AssociationReorientCommand(req));
+ case Association3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Association2ReorientCommand(req));
+ case GeneralizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new GeneralizationReorientCommand(req));
+ case InterfaceRealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new InterfaceRealizationReorientCommand(req));
+ case SubstitutionEditPart.VISUAL_ID:
+ return getGEFWrapper(new SubstitutionReorientCommand(req));
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case ElementImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new ElementImportReorientCommand(req));
+ case PackageImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new PackageImportReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Class4CanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Class4CanonicalEditPolicy.java
new file mode 100644
index 00000000000..c19f5ad65d7
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Class4CanonicalEditPolicy.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RedefinableTemplateSignatureEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class Class4CanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getClass_3010SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case RedefinableTemplateSignatureEditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getTemplateableElement_OwnedTemplateSignature());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Class4ItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Class4ItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..8f5d72a30b6
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Class4ItemSemanticEditPolicy.java
@@ -0,0 +1,343 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Association2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Association3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationClass2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationClassReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.GeneralizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.GeneralizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.InterfaceRealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.InterfaceRealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RedefinableTemplateSignatureCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SubstitutionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SubstitutionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Association3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationClass2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Class5EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassAttributeCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassNestedClassifierCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassOperationCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.GeneralizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceRealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Operation3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Property4EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ReceptionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RedefinableTemplateSignatureEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SubstitutionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class Class4ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.RedefinableTemplateSignature_3015 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getTemplateableElement_OwnedTemplateSignature());
+ }
+ return getGEFWrapper(new RedefinableTemplateSignatureCreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyChildNodesCommand(cc);
+ addDestroyShortcutsCommand(cc);
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addDestroyChildNodesCommand(CompoundCommand cmd) {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
+ if (annotation != null) {
+ return;
+ }
+ for (Iterator it = view.getChildren().iterator(); it.hasNext();) {
+ Node node = (Node) it.next();
+ switch (UMLVisualIDRegistry.getVisualID(node)) {
+ case RedefinableTemplateSignatureEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(node));
+ break;
+ case ClassAttributeCompartmentEditPart.VISUAL_ID:
+ for (Iterator cit = node.getChildren().iterator(); cit.hasNext();) {
+ Node cnode = (Node) cit.next();
+ switch (UMLVisualIDRegistry.getVisualID(cnode)) {
+ case Property4EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ }
+ }
+ break;
+ case ClassOperationCompartmentEditPart.VISUAL_ID:
+ for (Iterator cit = node.getChildren().iterator(); cit.hasNext();) {
+ Node cnode = (Node) cit.next();
+ switch (UMLVisualIDRegistry.getVisualID(cnode)) {
+ case ReceptionEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case Operation3EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ }
+ }
+ break;
+ case ClassNestedClassifierCompartmentEditPart.VISUAL_ID:
+ for (Iterator cit = node.getChildren().iterator(); cit.hasNext();) {
+ Node cnode = (Node) cit.next();
+ switch (UMLVisualIDRegistry.getVisualID(cnode)) {
+ case Class5EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
+ return getGEFWrapper(new AssociationClass2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4001 == req.getElementType()) {
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4019 == req.getElementType()) {
+ return getGEFWrapper(new Association3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Generalization_4002 == req.getElementType()) {
+ return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.InterfaceRealization_4003 == req.getElementType()) {
+ return getGEFWrapper(new InterfaceRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Substitution_4004 == req.getElementType()) {
+ return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return getGEFWrapper(new PackageImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
+ return getGEFWrapper(new AssociationClass2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4001 == req.getElementType()) {
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4019 == req.getElementType()) {
+ return getGEFWrapper(new Association3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Generalization_4002 == req.getElementType()) {
+ return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.InterfaceRealization_4003 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.Substitution_4004 == req.getElementType()) {
+ return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case AssociationClass2EditPart.VISUAL_ID:
+ return getGEFWrapper(new AssociationClassReorientCommand(req));
+ case AssociationEditPart.VISUAL_ID:
+ return getGEFWrapper(new AssociationReorientCommand(req));
+ case Association3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Association2ReorientCommand(req));
+ case GeneralizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new GeneralizationReorientCommand(req));
+ case InterfaceRealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new InterfaceRealizationReorientCommand(req));
+ case SubstitutionEditPart.VISUAL_ID:
+ return getGEFWrapper(new SubstitutionReorientCommand(req));
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case ElementImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new ElementImportReorientCommand(req));
+ case PackageImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new PackageImportReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Class5ItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Class5ItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..1950baaebc3
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Class5ItemSemanticEditPolicy.java
@@ -0,0 +1,260 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Association2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Association3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationClass2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationClassReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.GeneralizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.GeneralizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.InterfaceRealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.InterfaceRealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SubstitutionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SubstitutionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Association3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationClass2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.GeneralizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceRealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SubstitutionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class Class5ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyShortcutsCommand(cc);
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
+ return getGEFWrapper(new AssociationClass2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4001 == req.getElementType()) {
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4019 == req.getElementType()) {
+ return getGEFWrapper(new Association3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Generalization_4002 == req.getElementType()) {
+ return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.InterfaceRealization_4003 == req.getElementType()) {
+ return getGEFWrapper(new InterfaceRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Substitution_4004 == req.getElementType()) {
+ return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return getGEFWrapper(new PackageImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
+ return getGEFWrapper(new AssociationClass2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4001 == req.getElementType()) {
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4019 == req.getElementType()) {
+ return getGEFWrapper(new Association3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Generalization_4002 == req.getElementType()) {
+ return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.InterfaceRealization_4003 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.Substitution_4004 == req.getElementType()) {
+ return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case AssociationClass2EditPart.VISUAL_ID:
+ return getGEFWrapper(new AssociationClassReorientCommand(req));
+ case AssociationEditPart.VISUAL_ID:
+ return getGEFWrapper(new AssociationReorientCommand(req));
+ case Association3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Association2ReorientCommand(req));
+ case GeneralizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new GeneralizationReorientCommand(req));
+ case InterfaceRealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new InterfaceRealizationReorientCommand(req));
+ case SubstitutionEditPart.VISUAL_ID:
+ return getGEFWrapper(new SubstitutionReorientCommand(req));
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case ElementImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new ElementImportReorientCommand(req));
+ case PackageImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new PackageImportReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassAttributeCompartment2CanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassAttributeCompartment2CanonicalEditPolicy.java
new file mode 100644
index 00000000000..a56bbe3b74b
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassAttributeCompartment2CanonicalEditPolicy.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Property4EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class ClassAttributeCompartment2CanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getClassAttributeCompartment_7017SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case Property4EditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getStructuredClassifier_OwnedAttribute());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassAttributeCompartment2ItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassAttributeCompartment2ItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..45feea122c1
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassAttributeCompartment2ItemSemanticEditPolicy.java
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Property4CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class ClassAttributeCompartment2ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.Property_3012 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getStructuredClassifier_OwnedAttribute());
+ }
+ return getGEFWrapper(new Property4CreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassAttributeCompartmentCanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassAttributeCompartmentCanonicalEditPolicy.java
new file mode 100644
index 00000000000..ccf075f0fd9
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassAttributeCompartmentCanonicalEditPolicy.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Property4EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class ClassAttributeCompartmentCanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getClassAttributeCompartment_7011SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case Property4EditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getStructuredClassifier_OwnedAttribute());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassAttributeCompartmentItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassAttributeCompartmentItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..1e0358666e4
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassAttributeCompartmentItemSemanticEditPolicy.java
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Property4CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class ClassAttributeCompartmentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.Property_3012 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getStructuredClassifier_OwnedAttribute());
+ }
+ return getGEFWrapper(new Property4CreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassCanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassCanonicalEditPolicy.java
new file mode 100644
index 00000000000..e003f3c3125
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassCanonicalEditPolicy.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RedefinableTemplateSignatureEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class ClassCanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getClass_2008SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case RedefinableTemplateSignatureEditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getTemplateableElement_OwnedTemplateSignature());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..e1189afe30f
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassItemSemanticEditPolicy.java
@@ -0,0 +1,347 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Association2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Association3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationClass2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationClassReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.GeneralizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.GeneralizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.InterfaceRealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.InterfaceRealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RedefinableTemplateSignatureCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SubstitutionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SubstitutionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Association3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationClass2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Class5EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassAttributeCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassNestedClassifierCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassOperationCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.GeneralizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceRealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Operation3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Property4EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ReceptionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RedefinableTemplateSignatureEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SubstitutionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class ClassItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.RedefinableTemplateSignature_3015 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getTemplateableElement_OwnedTemplateSignature());
+ }
+ return getGEFWrapper(new RedefinableTemplateSignatureCreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyChildNodesCommand(cc);
+ addDestroyShortcutsCommand(cc);
+ View view = (View) getHost().getModel();
+ if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
+ req.setElementToDestroy(view);
+ }
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addDestroyChildNodesCommand(CompoundCommand cmd) {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
+ if (annotation != null) {
+ return;
+ }
+ for (Iterator it = view.getChildren().iterator(); it.hasNext();) {
+ Node node = (Node) it.next();
+ switch (UMLVisualIDRegistry.getVisualID(node)) {
+ case RedefinableTemplateSignatureEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(node));
+ break;
+ case ClassAttributeCompartment2EditPart.VISUAL_ID:
+ for (Iterator cit = node.getChildren().iterator(); cit.hasNext();) {
+ Node cnode = (Node) cit.next();
+ switch (UMLVisualIDRegistry.getVisualID(cnode)) {
+ case Property4EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ }
+ }
+ break;
+ case ClassOperationCompartment2EditPart.VISUAL_ID:
+ for (Iterator cit = node.getChildren().iterator(); cit.hasNext();) {
+ Node cnode = (Node) cit.next();
+ switch (UMLVisualIDRegistry.getVisualID(cnode)) {
+ case ReceptionEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case Operation3EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ }
+ }
+ break;
+ case ClassNestedClassifierCompartment2EditPart.VISUAL_ID:
+ for (Iterator cit = node.getChildren().iterator(); cit.hasNext();) {
+ Node cnode = (Node) cit.next();
+ switch (UMLVisualIDRegistry.getVisualID(cnode)) {
+ case Class5EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
+ return getGEFWrapper(new AssociationClass2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4001 == req.getElementType()) {
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4019 == req.getElementType()) {
+ return getGEFWrapper(new Association3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Generalization_4002 == req.getElementType()) {
+ return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.InterfaceRealization_4003 == req.getElementType()) {
+ return getGEFWrapper(new InterfaceRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Substitution_4004 == req.getElementType()) {
+ return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return getGEFWrapper(new PackageImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
+ return getGEFWrapper(new AssociationClass2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4001 == req.getElementType()) {
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4019 == req.getElementType()) {
+ return getGEFWrapper(new Association3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Generalization_4002 == req.getElementType()) {
+ return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.InterfaceRealization_4003 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.Substitution_4004 == req.getElementType()) {
+ return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case AssociationClass2EditPart.VISUAL_ID:
+ return getGEFWrapper(new AssociationClassReorientCommand(req));
+ case AssociationEditPart.VISUAL_ID:
+ return getGEFWrapper(new AssociationReorientCommand(req));
+ case Association3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Association2ReorientCommand(req));
+ case GeneralizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new GeneralizationReorientCommand(req));
+ case InterfaceRealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new InterfaceRealizationReorientCommand(req));
+ case SubstitutionEditPart.VISUAL_ID:
+ return getGEFWrapper(new SubstitutionReorientCommand(req));
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case ElementImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new ElementImportReorientCommand(req));
+ case PackageImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new PackageImportReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassNestedClassifierCompartment2CanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassNestedClassifierCompartment2CanonicalEditPolicy.java
new file mode 100644
index 00000000000..47be8d8c93f
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassNestedClassifierCompartment2CanonicalEditPolicy.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Class5EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class ClassNestedClassifierCompartment2CanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getClassNestedClassifierCompartment_7019SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case Class5EditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getClass_NestedClassifier());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassNestedClassifierCompartment2ItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassNestedClassifierCompartment2ItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..714771353aa
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassNestedClassifierCompartment2ItemSemanticEditPolicy.java
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Class5CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class ClassNestedClassifierCompartment2ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.Class_3014 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getClass_NestedClassifier());
+ }
+ return getGEFWrapper(new Class5CreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassNestedClassifierCompartmentCanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassNestedClassifierCompartmentCanonicalEditPolicy.java
new file mode 100644
index 00000000000..ba15d084d26
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassNestedClassifierCompartmentCanonicalEditPolicy.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Class5EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class ClassNestedClassifierCompartmentCanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getClassNestedClassifierCompartment_7013SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case Class5EditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getClass_NestedClassifier());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassNestedClassifierCompartmentItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassNestedClassifierCompartmentItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..2b0226f8be2
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassNestedClassifierCompartmentItemSemanticEditPolicy.java
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Class5CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class ClassNestedClassifierCompartmentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.Class_3014 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getClass_NestedClassifier());
+ }
+ return getGEFWrapper(new Class5CreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassOperationCompartment2CanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassOperationCompartment2CanonicalEditPolicy.java
new file mode 100644
index 00000000000..1de90adf6a7
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassOperationCompartment2CanonicalEditPolicy.java
@@ -0,0 +1,88 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Operation3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ReceptionEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class ClassOperationCompartment2CanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getClassOperationCompartment_7018SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case ReceptionEditPart.VISUAL_ID:
+ case Operation3EditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getClass_OwnedReception());
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getClass_OwnedOperation());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassOperationCompartment2ItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassOperationCompartment2ItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..11a9f96c3a5
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassOperationCompartment2ItemSemanticEditPolicy.java
@@ -0,0 +1,47 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Operation3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ReceptionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class ClassOperationCompartment2ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.Reception_3011 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getClass_OwnedReception());
+ }
+ return getGEFWrapper(new ReceptionCreateCommand(req));
+ }
+ if (UMLElementTypes.Operation_3013 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getClass_OwnedOperation());
+ }
+ return getGEFWrapper(new Operation3CreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassOperationCompartmentCanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassOperationCompartmentCanonicalEditPolicy.java
new file mode 100644
index 00000000000..61f9ed255a0
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassOperationCompartmentCanonicalEditPolicy.java
@@ -0,0 +1,88 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Operation3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ReceptionEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class ClassOperationCompartmentCanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getClassOperationCompartment_7012SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case ReceptionEditPart.VISUAL_ID:
+ case Operation3EditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getClass_OwnedReception());
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getClass_OwnedOperation());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassOperationCompartmentItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassOperationCompartmentItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..68722fed1f5
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ClassOperationCompartmentItemSemanticEditPolicy.java
@@ -0,0 +1,47 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Operation3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ReceptionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class ClassOperationCompartmentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.Reception_3011 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getClass_OwnedReception());
+ }
+ return getGEFWrapper(new ReceptionCreateCommand(req));
+ }
+ if (UMLElementTypes.Operation_3013 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getClass_OwnedOperation());
+ }
+ return getGEFWrapper(new Operation3CreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Comment2ItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Comment2ItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..9bb56d8a470
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Comment2ItemSemanticEditPolicy.java
@@ -0,0 +1,117 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class Comment2ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyShortcutsCommand(cc);
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/CommentAnnotatedElementItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/CommentAnnotatedElementItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..4209b219205
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/CommentAnnotatedElementItemSemanticEditPolicy.java
@@ -0,0 +1,32 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyReferenceCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest;
+
+/**
+ * @generated
+ */
+public class CommentAnnotatedElementItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyReferenceCommand(DestroyReferenceRequest req) {
+ return getGEFWrapper(new DestroyReferenceCommand(req));
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/CommentItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/CommentItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..ff17b303ec5
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/CommentItemSemanticEditPolicy.java
@@ -0,0 +1,122 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class CommentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyShortcutsCommand(cc);
+ View view = (View) getHost().getModel();
+ if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
+ req.setElementToDestroy(view);
+ }
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Component2CanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Component2CanonicalEditPolicy.java
new file mode 100644
index 00000000000..2ea4e323458
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Component2CanonicalEditPolicy.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RedefinableTemplateSignatureEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class Component2CanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getComponent_3021SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case RedefinableTemplateSignatureEditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getTemplateableElement_OwnedTemplateSignature());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Component2ItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Component2ItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..af5d3c309ba
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Component2ItemSemanticEditPolicy.java
@@ -0,0 +1,339 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Association2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Association3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationClass2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationClassReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.GeneralizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.GeneralizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.InterfaceRealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.InterfaceRealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RedefinableTemplateSignatureCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SubstitutionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SubstitutionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Association3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationClass2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Class2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentAttributeCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentNestedClassifierCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentOperationCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.GeneralizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceRealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.OperationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PropertyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RedefinableTemplateSignatureEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SubstitutionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class Component2ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.RedefinableTemplateSignature_3015 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getTemplateableElement_OwnedTemplateSignature());
+ }
+ return getGEFWrapper(new RedefinableTemplateSignatureCreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyChildNodesCommand(cc);
+ addDestroyShortcutsCommand(cc);
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addDestroyChildNodesCommand(CompoundCommand cmd) {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
+ if (annotation != null) {
+ return;
+ }
+ for (Iterator it = view.getChildren().iterator(); it.hasNext();) {
+ Node node = (Node) it.next();
+ switch (UMLVisualIDRegistry.getVisualID(node)) {
+ case RedefinableTemplateSignatureEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(node));
+ break;
+ case ComponentAttributeCompartment2EditPart.VISUAL_ID:
+ for (Iterator cit = node.getChildren().iterator(); cit.hasNext();) {
+ Node cnode = (Node) cit.next();
+ switch (UMLVisualIDRegistry.getVisualID(cnode)) {
+ case PropertyEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ }
+ }
+ break;
+ case ComponentOperationCompartment2EditPart.VISUAL_ID:
+ for (Iterator cit = node.getChildren().iterator(); cit.hasNext();) {
+ Node cnode = (Node) cit.next();
+ switch (UMLVisualIDRegistry.getVisualID(cnode)) {
+ case OperationEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ }
+ }
+ break;
+ case ComponentNestedClassifierCompartment2EditPart.VISUAL_ID:
+ for (Iterator cit = node.getChildren().iterator(); cit.hasNext();) {
+ Node cnode = (Node) cit.next();
+ switch (UMLVisualIDRegistry.getVisualID(cnode)) {
+ case Class2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
+ return getGEFWrapper(new AssociationClass2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4001 == req.getElementType()) {
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4019 == req.getElementType()) {
+ return getGEFWrapper(new Association3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Generalization_4002 == req.getElementType()) {
+ return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.InterfaceRealization_4003 == req.getElementType()) {
+ return getGEFWrapper(new InterfaceRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Substitution_4004 == req.getElementType()) {
+ return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return getGEFWrapper(new PackageImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
+ return getGEFWrapper(new AssociationClass2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4001 == req.getElementType()) {
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4019 == req.getElementType()) {
+ return getGEFWrapper(new Association3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Generalization_4002 == req.getElementType()) {
+ return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.InterfaceRealization_4003 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.Substitution_4004 == req.getElementType()) {
+ return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case AssociationClass2EditPart.VISUAL_ID:
+ return getGEFWrapper(new AssociationClassReorientCommand(req));
+ case AssociationEditPart.VISUAL_ID:
+ return getGEFWrapper(new AssociationReorientCommand(req));
+ case Association3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Association2ReorientCommand(req));
+ case GeneralizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new GeneralizationReorientCommand(req));
+ case InterfaceRealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new InterfaceRealizationReorientCommand(req));
+ case SubstitutionEditPart.VISUAL_ID:
+ return getGEFWrapper(new SubstitutionReorientCommand(req));
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case ElementImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new ElementImportReorientCommand(req));
+ case PackageImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new PackageImportReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentAttributeCompartment2CanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentAttributeCompartment2CanonicalEditPolicy.java
new file mode 100644
index 00000000000..41fdb84a2ee
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentAttributeCompartment2CanonicalEditPolicy.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PropertyEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class ComponentAttributeCompartment2CanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getComponentAttributeCompartment_7023SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case PropertyEditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getStructuredClassifier_OwnedAttribute());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentAttributeCompartment2ItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentAttributeCompartment2ItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..562f520c757
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentAttributeCompartment2ItemSemanticEditPolicy.java
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PropertyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class ComponentAttributeCompartment2ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.Property_3002 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getStructuredClassifier_OwnedAttribute());
+ }
+ return getGEFWrapper(new PropertyCreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentAttributeCompartmentCanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentAttributeCompartmentCanonicalEditPolicy.java
new file mode 100644
index 00000000000..d278c2e4022
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentAttributeCompartmentCanonicalEditPolicy.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PropertyEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class ComponentAttributeCompartmentCanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getComponentAttributeCompartment_7002SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case PropertyEditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getStructuredClassifier_OwnedAttribute());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentAttributeCompartmentItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentAttributeCompartmentItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..f66f65123fa
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentAttributeCompartmentItemSemanticEditPolicy.java
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PropertyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class ComponentAttributeCompartmentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.Property_3002 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getStructuredClassifier_OwnedAttribute());
+ }
+ return getGEFWrapper(new PropertyCreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentCanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentCanonicalEditPolicy.java
new file mode 100644
index 00000000000..1bc778e2206
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentCanonicalEditPolicy.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RedefinableTemplateSignatureEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class ComponentCanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getComponent_2002SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case RedefinableTemplateSignatureEditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getTemplateableElement_OwnedTemplateSignature());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..62dcf5d4c21
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentItemSemanticEditPolicy.java
@@ -0,0 +1,343 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Association2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Association3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationClass2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationClassReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.GeneralizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.GeneralizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.InterfaceRealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.InterfaceRealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RedefinableTemplateSignatureCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SubstitutionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SubstitutionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Association3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationClass2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Class2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentAttributeCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentNestedClassifierCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentOperationCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.GeneralizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceRealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.OperationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PropertyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RedefinableTemplateSignatureEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SubstitutionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class ComponentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.RedefinableTemplateSignature_3015 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getTemplateableElement_OwnedTemplateSignature());
+ }
+ return getGEFWrapper(new RedefinableTemplateSignatureCreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyChildNodesCommand(cc);
+ addDestroyShortcutsCommand(cc);
+ View view = (View) getHost().getModel();
+ if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
+ req.setElementToDestroy(view);
+ }
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addDestroyChildNodesCommand(CompoundCommand cmd) {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
+ if (annotation != null) {
+ return;
+ }
+ for (Iterator it = view.getChildren().iterator(); it.hasNext();) {
+ Node node = (Node) it.next();
+ switch (UMLVisualIDRegistry.getVisualID(node)) {
+ case RedefinableTemplateSignatureEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(node));
+ break;
+ case ComponentAttributeCompartmentEditPart.VISUAL_ID:
+ for (Iterator cit = node.getChildren().iterator(); cit.hasNext();) {
+ Node cnode = (Node) cit.next();
+ switch (UMLVisualIDRegistry.getVisualID(cnode)) {
+ case PropertyEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ }
+ }
+ break;
+ case ComponentOperationCompartmentEditPart.VISUAL_ID:
+ for (Iterator cit = node.getChildren().iterator(); cit.hasNext();) {
+ Node cnode = (Node) cit.next();
+ switch (UMLVisualIDRegistry.getVisualID(cnode)) {
+ case OperationEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ }
+ }
+ break;
+ case ComponentNestedClassifierCompartmentEditPart.VISUAL_ID:
+ for (Iterator cit = node.getChildren().iterator(); cit.hasNext();) {
+ Node cnode = (Node) cit.next();
+ switch (UMLVisualIDRegistry.getVisualID(cnode)) {
+ case Class2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
+ return getGEFWrapper(new AssociationClass2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4001 == req.getElementType()) {
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4019 == req.getElementType()) {
+ return getGEFWrapper(new Association3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Generalization_4002 == req.getElementType()) {
+ return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.InterfaceRealization_4003 == req.getElementType()) {
+ return getGEFWrapper(new InterfaceRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Substitution_4004 == req.getElementType()) {
+ return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return getGEFWrapper(new PackageImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
+ return getGEFWrapper(new AssociationClass2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4001 == req.getElementType()) {
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4019 == req.getElementType()) {
+ return getGEFWrapper(new Association3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Generalization_4002 == req.getElementType()) {
+ return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.InterfaceRealization_4003 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.Substitution_4004 == req.getElementType()) {
+ return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case AssociationClass2EditPart.VISUAL_ID:
+ return getGEFWrapper(new AssociationClassReorientCommand(req));
+ case AssociationEditPart.VISUAL_ID:
+ return getGEFWrapper(new AssociationReorientCommand(req));
+ case Association3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Association2ReorientCommand(req));
+ case GeneralizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new GeneralizationReorientCommand(req));
+ case InterfaceRealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new InterfaceRealizationReorientCommand(req));
+ case SubstitutionEditPart.VISUAL_ID:
+ return getGEFWrapper(new SubstitutionReorientCommand(req));
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case ElementImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new ElementImportReorientCommand(req));
+ case PackageImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new PackageImportReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentNestedClassifierCompartment2CanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentNestedClassifierCompartment2CanonicalEditPolicy.java
new file mode 100644
index 00000000000..71960836dfa
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentNestedClassifierCompartment2CanonicalEditPolicy.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Class2EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class ComponentNestedClassifierCompartment2CanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getComponentNestedClassifierCompartment_7025SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case Class2EditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getClass_NestedClassifier());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentNestedClassifierCompartment2ItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentNestedClassifierCompartment2ItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..52fccb64cba
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentNestedClassifierCompartment2ItemSemanticEditPolicy.java
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Class2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class ComponentNestedClassifierCompartment2ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.Class_3004 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getClass_NestedClassifier());
+ }
+ return getGEFWrapper(new Class2CreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentNestedClassifierCompartmentCanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentNestedClassifierCompartmentCanonicalEditPolicy.java
new file mode 100644
index 00000000000..df7abf095c8
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentNestedClassifierCompartmentCanonicalEditPolicy.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Class2EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class ComponentNestedClassifierCompartmentCanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getComponentNestedClassifierCompartment_7004SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case Class2EditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getClass_NestedClassifier());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentNestedClassifierCompartmentItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentNestedClassifierCompartmentItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..00b368db57f
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentNestedClassifierCompartmentItemSemanticEditPolicy.java
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Class2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class ComponentNestedClassifierCompartmentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.Class_3004 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getClass_NestedClassifier());
+ }
+ return getGEFWrapper(new Class2CreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentOperationCompartment2CanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentOperationCompartment2CanonicalEditPolicy.java
new file mode 100644
index 00000000000..bd247c9cafd
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentOperationCompartment2CanonicalEditPolicy.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.OperationEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class ComponentOperationCompartment2CanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getComponentOperationCompartment_7024SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case OperationEditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getClass_OwnedOperation());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentOperationCompartment2ItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentOperationCompartment2ItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..a924a0a4442
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentOperationCompartment2ItemSemanticEditPolicy.java
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.OperationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class ComponentOperationCompartment2ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.Operation_3003 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getClass_OwnedOperation());
+ }
+ return getGEFWrapper(new OperationCreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentOperationCompartmentCanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentOperationCompartmentCanonicalEditPolicy.java
new file mode 100644
index 00000000000..1cc25fbb25a
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentOperationCompartmentCanonicalEditPolicy.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.OperationEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class ComponentOperationCompartmentCanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getComponentOperationCompartment_7003SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case OperationEditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getClass_OwnedOperation());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentOperationCompartmentItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentOperationCompartmentItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..88840e807f7
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ComponentOperationCompartmentItemSemanticEditPolicy.java
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.OperationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class ComponentOperationCompartmentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.Operation_3003 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getClass_OwnedOperation());
+ }
+ return getGEFWrapper(new OperationCreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Constraint2ItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Constraint2ItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..92f7b6dde11
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Constraint2ItemSemanticEditPolicy.java
@@ -0,0 +1,183 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class Constraint2ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyShortcutsCommand(cc);
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case ElementImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new ElementImportReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ConstraintConstrainedElementItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ConstraintConstrainedElementItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..cf68728286e
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ConstraintConstrainedElementItemSemanticEditPolicy.java
@@ -0,0 +1,32 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyReferenceCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest;
+
+/**
+ * @generated
+ */
+public class ConstraintConstrainedElementItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyReferenceCommand(DestroyReferenceRequest req) {
+ return getGEFWrapper(new DestroyReferenceCommand(req));
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ConstraintItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ConstraintItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..6dfcaff6dfd
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ConstraintItemSemanticEditPolicy.java
@@ -0,0 +1,188 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class ConstraintItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyShortcutsCommand(cc);
+ View view = (View) getHost().getModel();
+ if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
+ req.setElementToDestroy(view);
+ }
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case ElementImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new ElementImportReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataType2CanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataType2CanonicalEditPolicy.java
new file mode 100644
index 00000000000..305fb8cf43f
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataType2CanonicalEditPolicy.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RedefinableTemplateSignatureEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class DataType2CanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getDataType_3027SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case RedefinableTemplateSignatureEditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getTemplateableElement_OwnedTemplateSignature());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataType2ItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataType2ItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..1900bb42b75
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataType2ItemSemanticEditPolicy.java
@@ -0,0 +1,316 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Association2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Association3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationClass2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationClassReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.GeneralizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.GeneralizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RedefinableTemplateSignatureCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SubstitutionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SubstitutionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Association3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationClass2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataTypeAttributeCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataTypeOperationCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.GeneralizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Operation4EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Property5EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RedefinableTemplateSignatureEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SubstitutionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class DataType2ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.RedefinableTemplateSignature_3015 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getTemplateableElement_OwnedTemplateSignature());
+ }
+ return getGEFWrapper(new RedefinableTemplateSignatureCreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyChildNodesCommand(cc);
+ addDestroyShortcutsCommand(cc);
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addDestroyChildNodesCommand(CompoundCommand cmd) {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
+ if (annotation != null) {
+ return;
+ }
+ for (Iterator it = view.getChildren().iterator(); it.hasNext();) {
+ Node node = (Node) it.next();
+ switch (UMLVisualIDRegistry.getVisualID(node)) {
+ case RedefinableTemplateSignatureEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(node));
+ break;
+ case DataTypeAttributeCompartment2EditPart.VISUAL_ID:
+ for (Iterator cit = node.getChildren().iterator(); cit.hasNext();) {
+ Node cnode = (Node) cit.next();
+ switch (UMLVisualIDRegistry.getVisualID(cnode)) {
+ case Property5EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ }
+ }
+ break;
+ case DataTypeOperationCompartment2EditPart.VISUAL_ID:
+ for (Iterator cit = node.getChildren().iterator(); cit.hasNext();) {
+ Node cnode = (Node) cit.next();
+ switch (UMLVisualIDRegistry.getVisualID(cnode)) {
+ case Operation4EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
+ return getGEFWrapper(new AssociationClass2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4001 == req.getElementType()) {
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4019 == req.getElementType()) {
+ return getGEFWrapper(new Association3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Generalization_4002 == req.getElementType()) {
+ return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Substitution_4004 == req.getElementType()) {
+ return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return getGEFWrapper(new PackageImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
+ return getGEFWrapper(new AssociationClass2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4001 == req.getElementType()) {
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4019 == req.getElementType()) {
+ return getGEFWrapper(new Association3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Generalization_4002 == req.getElementType()) {
+ return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Substitution_4004 == req.getElementType()) {
+ return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case AssociationClass2EditPart.VISUAL_ID:
+ return getGEFWrapper(new AssociationClassReorientCommand(req));
+ case AssociationEditPart.VISUAL_ID:
+ return getGEFWrapper(new AssociationReorientCommand(req));
+ case Association3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Association2ReorientCommand(req));
+ case GeneralizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new GeneralizationReorientCommand(req));
+ case SubstitutionEditPart.VISUAL_ID:
+ return getGEFWrapper(new SubstitutionReorientCommand(req));
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case ElementImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new ElementImportReorientCommand(req));
+ case PackageImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new PackageImportReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataTypeAttributeCompartment2CanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataTypeAttributeCompartment2CanonicalEditPolicy.java
new file mode 100644
index 00000000000..9dd1c566528
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataTypeAttributeCompartment2CanonicalEditPolicy.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Property5EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class DataTypeAttributeCompartment2CanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getDataTypeAttributeCompartment_7032SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case Property5EditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getDataType_OwnedAttribute());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataTypeAttributeCompartment2ItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataTypeAttributeCompartment2ItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..00aabfa509e
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataTypeAttributeCompartment2ItemSemanticEditPolicy.java
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Property5CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class DataTypeAttributeCompartment2ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.Property_3018 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getDataType_OwnedAttribute());
+ }
+ return getGEFWrapper(new Property5CreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataTypeAttributeCompartmentCanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataTypeAttributeCompartmentCanonicalEditPolicy.java
new file mode 100644
index 00000000000..826afe10180
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataTypeAttributeCompartmentCanonicalEditPolicy.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Property5EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class DataTypeAttributeCompartmentCanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getDataTypeAttributeCompartment_7020SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case Property5EditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getDataType_OwnedAttribute());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataTypeAttributeCompartmentItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataTypeAttributeCompartmentItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..e115ff0f6c8
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataTypeAttributeCompartmentItemSemanticEditPolicy.java
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Property5CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class DataTypeAttributeCompartmentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.Property_3018 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getDataType_OwnedAttribute());
+ }
+ return getGEFWrapper(new Property5CreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataTypeCanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataTypeCanonicalEditPolicy.java
new file mode 100644
index 00000000000..0e9d9f6bcc9
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataTypeCanonicalEditPolicy.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RedefinableTemplateSignatureEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class DataTypeCanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getDataType_2010SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case RedefinableTemplateSignatureEditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getTemplateableElement_OwnedTemplateSignature());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataTypeItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataTypeItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..9595ab382b9
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataTypeItemSemanticEditPolicy.java
@@ -0,0 +1,320 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Association2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Association3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationClass2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationClassReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.GeneralizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.GeneralizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RedefinableTemplateSignatureCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SubstitutionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SubstitutionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Association3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationClass2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataTypeAttributeCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataTypeOperationCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.GeneralizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Operation4EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Property5EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RedefinableTemplateSignatureEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SubstitutionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class DataTypeItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.RedefinableTemplateSignature_3015 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getTemplateableElement_OwnedTemplateSignature());
+ }
+ return getGEFWrapper(new RedefinableTemplateSignatureCreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyChildNodesCommand(cc);
+ addDestroyShortcutsCommand(cc);
+ View view = (View) getHost().getModel();
+ if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
+ req.setElementToDestroy(view);
+ }
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addDestroyChildNodesCommand(CompoundCommand cmd) {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
+ if (annotation != null) {
+ return;
+ }
+ for (Iterator it = view.getChildren().iterator(); it.hasNext();) {
+ Node node = (Node) it.next();
+ switch (UMLVisualIDRegistry.getVisualID(node)) {
+ case RedefinableTemplateSignatureEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(node));
+ break;
+ case DataTypeAttributeCompartmentEditPart.VISUAL_ID:
+ for (Iterator cit = node.getChildren().iterator(); cit.hasNext();) {
+ Node cnode = (Node) cit.next();
+ switch (UMLVisualIDRegistry.getVisualID(cnode)) {
+ case Property5EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ }
+ }
+ break;
+ case DataTypeOperationCompartmentEditPart.VISUAL_ID:
+ for (Iterator cit = node.getChildren().iterator(); cit.hasNext();) {
+ Node cnode = (Node) cit.next();
+ switch (UMLVisualIDRegistry.getVisualID(cnode)) {
+ case Operation4EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
+ return getGEFWrapper(new AssociationClass2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4001 == req.getElementType()) {
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4019 == req.getElementType()) {
+ return getGEFWrapper(new Association3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Generalization_4002 == req.getElementType()) {
+ return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Substitution_4004 == req.getElementType()) {
+ return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return getGEFWrapper(new PackageImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
+ return getGEFWrapper(new AssociationClass2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4001 == req.getElementType()) {
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4019 == req.getElementType()) {
+ return getGEFWrapper(new Association3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Generalization_4002 == req.getElementType()) {
+ return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Substitution_4004 == req.getElementType()) {
+ return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case AssociationClass2EditPart.VISUAL_ID:
+ return getGEFWrapper(new AssociationClassReorientCommand(req));
+ case AssociationEditPart.VISUAL_ID:
+ return getGEFWrapper(new AssociationReorientCommand(req));
+ case Association3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Association2ReorientCommand(req));
+ case GeneralizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new GeneralizationReorientCommand(req));
+ case SubstitutionEditPart.VISUAL_ID:
+ return getGEFWrapper(new SubstitutionReorientCommand(req));
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case ElementImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new ElementImportReorientCommand(req));
+ case PackageImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new PackageImportReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataTypeOperationCompartment2CanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataTypeOperationCompartment2CanonicalEditPolicy.java
new file mode 100644
index 00000000000..3f2b91e836a
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataTypeOperationCompartment2CanonicalEditPolicy.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Operation4EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class DataTypeOperationCompartment2CanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getDataTypeOperationCompartment_7033SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case Operation4EditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getDataType_OwnedOperation());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataTypeOperationCompartment2ItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataTypeOperationCompartment2ItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..ce48e23142c
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataTypeOperationCompartment2ItemSemanticEditPolicy.java
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Operation4CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class DataTypeOperationCompartment2ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.Operation_3019 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getDataType_OwnedOperation());
+ }
+ return getGEFWrapper(new Operation4CreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataTypeOperationCompartmentCanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataTypeOperationCompartmentCanonicalEditPolicy.java
new file mode 100644
index 00000000000..2118bf19b19
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataTypeOperationCompartmentCanonicalEditPolicy.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Operation4EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class DataTypeOperationCompartmentCanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getDataTypeOperationCompartment_7021SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case Operation4EditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getDataType_OwnedOperation());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataTypeOperationCompartmentItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataTypeOperationCompartmentItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..c606ad1c55b
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DataTypeOperationCompartmentItemSemanticEditPolicy.java
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Operation4CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class DataTypeOperationCompartmentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.Operation_3019 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getDataType_OwnedOperation());
+ }
+ return getGEFWrapper(new Operation4CreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Dependency2ItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Dependency2ItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..2a7c7219cd9
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Dependency2ItemSemanticEditPolicy.java
@@ -0,0 +1,190 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class Dependency2ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyShortcutsCommand(cc);
+ View view = (View) getHost().getModel();
+ if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
+ req.setElementToDestroy(view);
+ }
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source
+ * should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case ElementImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new ElementImportReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source
+ * should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Dependency3ItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Dependency3ItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..955525b14b4
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Dependency3ItemSemanticEditPolicy.java
@@ -0,0 +1,168 @@
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class Dependency3ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ return getGEFWrapper(new DestroyElementCommand(req));
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source
+ * should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case ElementImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new ElementImportReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source
+ * should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DependencyItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DependencyItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..cbb6f00ee7b
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/DependencyItemSemanticEditPolicy.java
@@ -0,0 +1,179 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class DependencyItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ return getGEFWrapper(new DestroyElementCommand(req));
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case ElementImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new ElementImportReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ElementImportItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ElementImportItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..d6a64e5ac46
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ElementImportItemSemanticEditPolicy.java
@@ -0,0 +1,113 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class ElementImportItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ return getGEFWrapper(new DestroyElementCommand(req));
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Enumeration2ItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Enumeration2ItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..b3b3d570e3a
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Enumeration2ItemSemanticEditPolicy.java
@@ -0,0 +1,284 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Association2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Association3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationClass2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationClassReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.GeneralizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.GeneralizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SubstitutionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SubstitutionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Association3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationClass2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.EnumerationEnumerationLiteralCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.EnumerationLiteralEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.GeneralizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SubstitutionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class Enumeration2ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyChildNodesCommand(cc);
+ addDestroyShortcutsCommand(cc);
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addDestroyChildNodesCommand(CompoundCommand cmd) {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
+ if (annotation != null) {
+ return;
+ }
+ for (Iterator it = view.getChildren().iterator(); it.hasNext();) {
+ Node node = (Node) it.next();
+ switch (UMLVisualIDRegistry.getVisualID(node)) {
+ case EnumerationEnumerationLiteralCompartment2EditPart.VISUAL_ID:
+ for (Iterator cit = node.getChildren().iterator(); cit.hasNext();) {
+ Node cnode = (Node) cit.next();
+ switch (UMLVisualIDRegistry.getVisualID(cnode)) {
+ case EnumerationLiteralEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
+ return getGEFWrapper(new AssociationClass2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4001 == req.getElementType()) {
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4019 == req.getElementType()) {
+ return getGEFWrapper(new Association3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Generalization_4002 == req.getElementType()) {
+ return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Substitution_4004 == req.getElementType()) {
+ return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return getGEFWrapper(new PackageImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
+ return getGEFWrapper(new AssociationClass2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4001 == req.getElementType()) {
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4019 == req.getElementType()) {
+ return getGEFWrapper(new Association3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Generalization_4002 == req.getElementType()) {
+ return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Substitution_4004 == req.getElementType()) {
+ return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case AssociationClass2EditPart.VISUAL_ID:
+ return getGEFWrapper(new AssociationClassReorientCommand(req));
+ case AssociationEditPart.VISUAL_ID:
+ return getGEFWrapper(new AssociationReorientCommand(req));
+ case Association3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Association2ReorientCommand(req));
+ case GeneralizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new GeneralizationReorientCommand(req));
+ case SubstitutionEditPart.VISUAL_ID:
+ return getGEFWrapper(new SubstitutionReorientCommand(req));
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case ElementImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new ElementImportReorientCommand(req));
+ case PackageImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new PackageImportReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/EnumerationEnumerationLiteralCompartment2CanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/EnumerationEnumerationLiteralCompartment2CanonicalEditPolicy.java
new file mode 100644
index 00000000000..b587549bb14
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/EnumerationEnumerationLiteralCompartment2CanonicalEditPolicy.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.EnumerationLiteralEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class EnumerationEnumerationLiteralCompartment2CanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getEnumerationEnumerationLiteralCompartment_7031SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case EnumerationLiteralEditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getEnumeration_OwnedLiteral());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/EnumerationEnumerationLiteralCompartment2ItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/EnumerationEnumerationLiteralCompartment2ItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..e2d66d151fd
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/EnumerationEnumerationLiteralCompartment2ItemSemanticEditPolicy.java
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.EnumerationLiteralCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class EnumerationEnumerationLiteralCompartment2ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.EnumerationLiteral_3017 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getEnumeration_OwnedLiteral());
+ }
+ return getGEFWrapper(new EnumerationLiteralCreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/EnumerationEnumerationLiteralCompartmentCanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/EnumerationEnumerationLiteralCompartmentCanonicalEditPolicy.java
new file mode 100644
index 00000000000..0deb56335f7
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/EnumerationEnumerationLiteralCompartmentCanonicalEditPolicy.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.EnumerationLiteralEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class EnumerationEnumerationLiteralCompartmentCanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getEnumerationEnumerationLiteralCompartment_7015SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case EnumerationLiteralEditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getEnumeration_OwnedLiteral());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/EnumerationEnumerationLiteralCompartmentItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/EnumerationEnumerationLiteralCompartmentItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..5c62aeb6547
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/EnumerationEnumerationLiteralCompartmentItemSemanticEditPolicy.java
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.EnumerationLiteralCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class EnumerationEnumerationLiteralCompartmentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.EnumerationLiteral_3017 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getEnumeration_OwnedLiteral());
+ }
+ return getGEFWrapper(new EnumerationLiteralCreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/EnumerationItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/EnumerationItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..8edc0f6028e
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/EnumerationItemSemanticEditPolicy.java
@@ -0,0 +1,288 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Association2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Association3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationClass2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationClassReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.GeneralizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.GeneralizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SubstitutionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SubstitutionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Association3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationClass2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.EnumerationEnumerationLiteralCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.EnumerationLiteralEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.GeneralizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SubstitutionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class EnumerationItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyChildNodesCommand(cc);
+ addDestroyShortcutsCommand(cc);
+ View view = (View) getHost().getModel();
+ if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
+ req.setElementToDestroy(view);
+ }
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addDestroyChildNodesCommand(CompoundCommand cmd) {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
+ if (annotation != null) {
+ return;
+ }
+ for (Iterator it = view.getChildren().iterator(); it.hasNext();) {
+ Node node = (Node) it.next();
+ switch (UMLVisualIDRegistry.getVisualID(node)) {
+ case EnumerationEnumerationLiteralCompartmentEditPart.VISUAL_ID:
+ for (Iterator cit = node.getChildren().iterator(); cit.hasNext();) {
+ Node cnode = (Node) cit.next();
+ switch (UMLVisualIDRegistry.getVisualID(cnode)) {
+ case EnumerationLiteralEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
+ return getGEFWrapper(new AssociationClass2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4001 == req.getElementType()) {
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4019 == req.getElementType()) {
+ return getGEFWrapper(new Association3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Generalization_4002 == req.getElementType()) {
+ return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Substitution_4004 == req.getElementType()) {
+ return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return getGEFWrapper(new PackageImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
+ return getGEFWrapper(new AssociationClass2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4001 == req.getElementType()) {
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4019 == req.getElementType()) {
+ return getGEFWrapper(new Association3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Generalization_4002 == req.getElementType()) {
+ return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Substitution_4004 == req.getElementType()) {
+ return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case AssociationClass2EditPart.VISUAL_ID:
+ return getGEFWrapper(new AssociationClassReorientCommand(req));
+ case AssociationEditPart.VISUAL_ID:
+ return getGEFWrapper(new AssociationReorientCommand(req));
+ case Association3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Association2ReorientCommand(req));
+ case GeneralizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new GeneralizationReorientCommand(req));
+ case SubstitutionEditPart.VISUAL_ID:
+ return getGEFWrapper(new SubstitutionReorientCommand(req));
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case ElementImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new ElementImportReorientCommand(req));
+ case PackageImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new PackageImportReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/EnumerationLiteralItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/EnumerationLiteralItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..1e9b5315e22
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/EnumerationLiteralItemSemanticEditPolicy.java
@@ -0,0 +1,183 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class EnumerationLiteralItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyShortcutsCommand(cc);
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case ElementImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new ElementImportReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/GeneralizationItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/GeneralizationItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..640b296aa61
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/GeneralizationItemSemanticEditPolicy.java
@@ -0,0 +1,113 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class GeneralizationItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ return getGEFWrapper(new DestroyElementCommand(req));
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InstanceSpecification2ItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InstanceSpecification2ItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..fc3c2566205
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InstanceSpecification2ItemSemanticEditPolicy.java
@@ -0,0 +1,218 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InstanceSpecificationSlotCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SlotEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class InstanceSpecification2ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyChildNodesCommand(cc);
+ addDestroyShortcutsCommand(cc);
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addDestroyChildNodesCommand(CompoundCommand cmd) {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
+ if (annotation != null) {
+ return;
+ }
+ for (Iterator it = view.getChildren().iterator(); it.hasNext();) {
+ Node node = (Node) it.next();
+ switch (UMLVisualIDRegistry.getVisualID(node)) {
+ case InstanceSpecificationSlotCompartment2EditPart.VISUAL_ID:
+ for (Iterator cit = node.getChildren().iterator(); cit.hasNext();) {
+ Node cnode = (Node) cit.next();
+ switch (UMLVisualIDRegistry.getVisualID(cnode)) {
+ case SlotEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case ElementImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new ElementImportReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InstanceSpecificationItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InstanceSpecificationItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..dec94ddf281
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InstanceSpecificationItemSemanticEditPolicy.java
@@ -0,0 +1,222 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InstanceSpecificationSlotCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SlotEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class InstanceSpecificationItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyChildNodesCommand(cc);
+ addDestroyShortcutsCommand(cc);
+ View view = (View) getHost().getModel();
+ if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
+ req.setElementToDestroy(view);
+ }
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addDestroyChildNodesCommand(CompoundCommand cmd) {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
+ if (annotation != null) {
+ return;
+ }
+ for (Iterator it = view.getChildren().iterator(); it.hasNext();) {
+ Node node = (Node) it.next();
+ switch (UMLVisualIDRegistry.getVisualID(node)) {
+ case InstanceSpecificationSlotCompartmentEditPart.VISUAL_ID:
+ for (Iterator cit = node.getChildren().iterator(); cit.hasNext();) {
+ Node cnode = (Node) cit.next();
+ switch (UMLVisualIDRegistry.getVisualID(cnode)) {
+ case SlotEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case ElementImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new ElementImportReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InstanceSpecificationSlotCompartment2CanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InstanceSpecificationSlotCompartment2CanonicalEditPolicy.java
new file mode 100644
index 00000000000..8cdba5dbc54
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InstanceSpecificationSlotCompartment2CanonicalEditPolicy.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SlotEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class InstanceSpecificationSlotCompartment2CanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getInstanceSpecificationSlotCompartment_7022SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case SlotEditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getInstanceSpecification_Slot());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InstanceSpecificationSlotCompartment2ItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InstanceSpecificationSlotCompartment2ItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..1b711d9217b
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InstanceSpecificationSlotCompartment2ItemSemanticEditPolicy.java
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SlotCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class InstanceSpecificationSlotCompartment2ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.Slot_3001 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getInstanceSpecification_Slot());
+ }
+ return getGEFWrapper(new SlotCreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InstanceSpecificationSlotCompartmentCanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InstanceSpecificationSlotCompartmentCanonicalEditPolicy.java
new file mode 100644
index 00000000000..cb3d0cf9658
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InstanceSpecificationSlotCompartmentCanonicalEditPolicy.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SlotEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class InstanceSpecificationSlotCompartmentCanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getInstanceSpecificationSlotCompartment_7001SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case SlotEditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getInstanceSpecification_Slot());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InstanceSpecificationSlotCompartmentItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InstanceSpecificationSlotCompartmentItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..98697ecfd49
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InstanceSpecificationSlotCompartmentItemSemanticEditPolicy.java
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SlotCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class InstanceSpecificationSlotCompartmentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.Slot_3001 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getInstanceSpecification_Slot());
+ }
+ return getGEFWrapper(new SlotCreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Interface2CanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Interface2CanonicalEditPolicy.java
new file mode 100644
index 00000000000..977b1dfa96e
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Interface2CanonicalEditPolicy.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RedefinableTemplateSignatureEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class Interface2CanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getInterface_3023SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case RedefinableTemplateSignatureEditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getTemplateableElement_OwnedTemplateSignature());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Interface2ItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Interface2ItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..b5af21cf6de
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Interface2ItemSemanticEditPolicy.java
@@ -0,0 +1,339 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Association2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Association3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationClass2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationClassReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.GeneralizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.GeneralizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.InterfaceRealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.InterfaceRealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RedefinableTemplateSignatureCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SubstitutionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SubstitutionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Association3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationClass2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Class3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.GeneralizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceAttributeCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceNestedClassifierCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceOperationCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceRealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Operation2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Property3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RedefinableTemplateSignatureEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SubstitutionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class Interface2ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.RedefinableTemplateSignature_3015 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getTemplateableElement_OwnedTemplateSignature());
+ }
+ return getGEFWrapper(new RedefinableTemplateSignatureCreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyChildNodesCommand(cc);
+ addDestroyShortcutsCommand(cc);
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addDestroyChildNodesCommand(CompoundCommand cmd) {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
+ if (annotation != null) {
+ return;
+ }
+ for (Iterator it = view.getChildren().iterator(); it.hasNext();) {
+ Node node = (Node) it.next();
+ switch (UMLVisualIDRegistry.getVisualID(node)) {
+ case RedefinableTemplateSignatureEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(node));
+ break;
+ case InterfaceAttributeCompartment2EditPart.VISUAL_ID:
+ for (Iterator cit = node.getChildren().iterator(); cit.hasNext();) {
+ Node cnode = (Node) cit.next();
+ switch (UMLVisualIDRegistry.getVisualID(cnode)) {
+ case Property3EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ }
+ }
+ break;
+ case InterfaceOperationCompartment2EditPart.VISUAL_ID:
+ for (Iterator cit = node.getChildren().iterator(); cit.hasNext();) {
+ Node cnode = (Node) cit.next();
+ switch (UMLVisualIDRegistry.getVisualID(cnode)) {
+ case Operation2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ }
+ }
+ break;
+ case InterfaceNestedClassifierCompartment2EditPart.VISUAL_ID:
+ for (Iterator cit = node.getChildren().iterator(); cit.hasNext();) {
+ Node cnode = (Node) cit.next();
+ switch (UMLVisualIDRegistry.getVisualID(cnode)) {
+ case Class3EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
+ return getGEFWrapper(new AssociationClass2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4001 == req.getElementType()) {
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4019 == req.getElementType()) {
+ return getGEFWrapper(new Association3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Generalization_4002 == req.getElementType()) {
+ return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.InterfaceRealization_4003 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.Substitution_4004 == req.getElementType()) {
+ return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return getGEFWrapper(new PackageImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
+ return getGEFWrapper(new AssociationClass2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4001 == req.getElementType()) {
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4019 == req.getElementType()) {
+ return getGEFWrapper(new Association3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Generalization_4002 == req.getElementType()) {
+ return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.InterfaceRealization_4003 == req.getElementType()) {
+ return getGEFWrapper(new InterfaceRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Substitution_4004 == req.getElementType()) {
+ return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case AssociationClass2EditPart.VISUAL_ID:
+ return getGEFWrapper(new AssociationClassReorientCommand(req));
+ case AssociationEditPart.VISUAL_ID:
+ return getGEFWrapper(new AssociationReorientCommand(req));
+ case Association3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Association2ReorientCommand(req));
+ case GeneralizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new GeneralizationReorientCommand(req));
+ case InterfaceRealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new InterfaceRealizationReorientCommand(req));
+ case SubstitutionEditPart.VISUAL_ID:
+ return getGEFWrapper(new SubstitutionReorientCommand(req));
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case ElementImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new ElementImportReorientCommand(req));
+ case PackageImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new PackageImportReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceAttributeCompartment2CanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceAttributeCompartment2CanonicalEditPolicy.java
new file mode 100644
index 00000000000..2b9432c6d1c
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceAttributeCompartment2CanonicalEditPolicy.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Property3EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class InterfaceAttributeCompartment2CanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getInterfaceAttributeCompartment_7027SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case Property3EditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getInterface_OwnedAttribute());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceAttributeCompartment2ItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceAttributeCompartment2ItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..79da0ade433
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceAttributeCompartment2ItemSemanticEditPolicy.java
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Property3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class InterfaceAttributeCompartment2ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.Property_3006 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getInterface_OwnedAttribute());
+ }
+ return getGEFWrapper(new Property3CreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceAttributeCompartmentCanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceAttributeCompartmentCanonicalEditPolicy.java
new file mode 100644
index 00000000000..761acba9399
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceAttributeCompartmentCanonicalEditPolicy.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Property3EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class InterfaceAttributeCompartmentCanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getInterfaceAttributeCompartment_7006SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case Property3EditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getInterface_OwnedAttribute());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceAttributeCompartmentItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceAttributeCompartmentItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..a5f89899d68
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceAttributeCompartmentItemSemanticEditPolicy.java
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Property3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class InterfaceAttributeCompartmentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.Property_3006 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getInterface_OwnedAttribute());
+ }
+ return getGEFWrapper(new Property3CreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceCanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceCanonicalEditPolicy.java
new file mode 100644
index 00000000000..3295fe7e4c9
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceCanonicalEditPolicy.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RedefinableTemplateSignatureEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class InterfaceCanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getInterface_2004SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case RedefinableTemplateSignatureEditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getTemplateableElement_OwnedTemplateSignature());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..e336bfd8be8
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceItemSemanticEditPolicy.java
@@ -0,0 +1,343 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Association2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Association3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationClass2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationClassReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.GeneralizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.GeneralizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.InterfaceRealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.InterfaceRealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RedefinableTemplateSignatureCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SubstitutionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SubstitutionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Association3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationClass2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Class3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.GeneralizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceAttributeCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceNestedClassifierCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceOperationCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceRealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Operation2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Property3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RedefinableTemplateSignatureEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SubstitutionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class InterfaceItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.RedefinableTemplateSignature_3015 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getTemplateableElement_OwnedTemplateSignature());
+ }
+ return getGEFWrapper(new RedefinableTemplateSignatureCreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyChildNodesCommand(cc);
+ addDestroyShortcutsCommand(cc);
+ View view = (View) getHost().getModel();
+ if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
+ req.setElementToDestroy(view);
+ }
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addDestroyChildNodesCommand(CompoundCommand cmd) {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
+ if (annotation != null) {
+ return;
+ }
+ for (Iterator it = view.getChildren().iterator(); it.hasNext();) {
+ Node node = (Node) it.next();
+ switch (UMLVisualIDRegistry.getVisualID(node)) {
+ case RedefinableTemplateSignatureEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(node));
+ break;
+ case InterfaceAttributeCompartmentEditPart.VISUAL_ID:
+ for (Iterator cit = node.getChildren().iterator(); cit.hasNext();) {
+ Node cnode = (Node) cit.next();
+ switch (UMLVisualIDRegistry.getVisualID(cnode)) {
+ case Property3EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ }
+ }
+ break;
+ case InterfaceOperationCompartmentEditPart.VISUAL_ID:
+ for (Iterator cit = node.getChildren().iterator(); cit.hasNext();) {
+ Node cnode = (Node) cit.next();
+ switch (UMLVisualIDRegistry.getVisualID(cnode)) {
+ case Operation2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ }
+ }
+ break;
+ case InterfaceNestedClassifierCompartmentEditPart.VISUAL_ID:
+ for (Iterator cit = node.getChildren().iterator(); cit.hasNext();) {
+ Node cnode = (Node) cit.next();
+ switch (UMLVisualIDRegistry.getVisualID(cnode)) {
+ case Class3EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
+ return getGEFWrapper(new AssociationClass2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4001 == req.getElementType()) {
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4019 == req.getElementType()) {
+ return getGEFWrapper(new Association3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Generalization_4002 == req.getElementType()) {
+ return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.InterfaceRealization_4003 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.Substitution_4004 == req.getElementType()) {
+ return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return getGEFWrapper(new PackageImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
+ return getGEFWrapper(new AssociationClass2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4001 == req.getElementType()) {
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4019 == req.getElementType()) {
+ return getGEFWrapper(new Association3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Generalization_4002 == req.getElementType()) {
+ return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.InterfaceRealization_4003 == req.getElementType()) {
+ return getGEFWrapper(new InterfaceRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Substitution_4004 == req.getElementType()) {
+ return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case AssociationClass2EditPart.VISUAL_ID:
+ return getGEFWrapper(new AssociationClassReorientCommand(req));
+ case AssociationEditPart.VISUAL_ID:
+ return getGEFWrapper(new AssociationReorientCommand(req));
+ case Association3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Association2ReorientCommand(req));
+ case GeneralizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new GeneralizationReorientCommand(req));
+ case InterfaceRealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new InterfaceRealizationReorientCommand(req));
+ case SubstitutionEditPart.VISUAL_ID:
+ return getGEFWrapper(new SubstitutionReorientCommand(req));
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case ElementImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new ElementImportReorientCommand(req));
+ case PackageImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new PackageImportReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceNestedClassifierCompartment2CanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceNestedClassifierCompartment2CanonicalEditPolicy.java
new file mode 100644
index 00000000000..d7ac410e8e5
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceNestedClassifierCompartment2CanonicalEditPolicy.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Class3EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class InterfaceNestedClassifierCompartment2CanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getInterfaceNestedClassifierCompartment_7029SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case Class3EditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getInterface_NestedClassifier());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceNestedClassifierCompartment2ItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceNestedClassifierCompartment2ItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..509b7ea93a2
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceNestedClassifierCompartment2ItemSemanticEditPolicy.java
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Class3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class InterfaceNestedClassifierCompartment2ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.Class_3008 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getInterface_NestedClassifier());
+ }
+ return getGEFWrapper(new Class3CreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceNestedClassifierCompartmentCanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceNestedClassifierCompartmentCanonicalEditPolicy.java
new file mode 100644
index 00000000000..5e88c30efa9
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceNestedClassifierCompartmentCanonicalEditPolicy.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Class3EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class InterfaceNestedClassifierCompartmentCanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getInterfaceNestedClassifierCompartment_7008SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case Class3EditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getInterface_NestedClassifier());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceNestedClassifierCompartmentItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceNestedClassifierCompartmentItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..70505aa27e1
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceNestedClassifierCompartmentItemSemanticEditPolicy.java
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Class3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class InterfaceNestedClassifierCompartmentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.Class_3008 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getInterface_NestedClassifier());
+ }
+ return getGEFWrapper(new Class3CreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceOperationCompartment2CanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceOperationCompartment2CanonicalEditPolicy.java
new file mode 100644
index 00000000000..86e9814bdc1
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceOperationCompartment2CanonicalEditPolicy.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Operation2EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class InterfaceOperationCompartment2CanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getInterfaceOperationCompartment_7028SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case Operation2EditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getInterface_OwnedOperation());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceOperationCompartment2ItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceOperationCompartment2ItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..51a8262d4c9
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceOperationCompartment2ItemSemanticEditPolicy.java
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Operation2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class InterfaceOperationCompartment2ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.Operation_3007 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getInterface_OwnedOperation());
+ }
+ return getGEFWrapper(new Operation2CreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceOperationCompartmentCanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceOperationCompartmentCanonicalEditPolicy.java
new file mode 100644
index 00000000000..4da176bc6e7
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceOperationCompartmentCanonicalEditPolicy.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Operation2EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class InterfaceOperationCompartmentCanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getInterfaceOperationCompartment_7007SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case Operation2EditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getInterface_OwnedOperation());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceOperationCompartmentItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceOperationCompartmentItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..2fd77a4665b
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceOperationCompartmentItemSemanticEditPolicy.java
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Operation2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class InterfaceOperationCompartmentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.Operation_3007 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getInterface_OwnedOperation());
+ }
+ return getGEFWrapper(new Operation2CreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceRealizationItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceRealizationItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..a40a5d9c40a
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/InterfaceRealizationItemSemanticEditPolicy.java
@@ -0,0 +1,179 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class InterfaceRealizationItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ return getGEFWrapper(new DestroyElementCommand(req));
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case ElementImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new ElementImportReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Model2CanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Model2CanonicalEditPolicy.java
new file mode 100644
index 00000000000..b2a885cf389
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Model2CanonicalEditPolicy.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RedefinableTemplateSignatureEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class Model2CanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getModel_2005SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case RedefinableTemplateSignatureEditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getTemplateableElement_OwnedTemplateSignature());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Model2ItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Model2ItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..bc2437b5c5a
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Model2ItemSemanticEditPolicy.java
@@ -0,0 +1,319 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageMergeCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageMergeReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ProfileApplicationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ProfileApplicationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RedefinableTemplateSignatureCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Class4EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Comment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Component2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Constraint2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataType2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Enumeration2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InstanceSpecification2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Interface2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Model3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelPackageableElementCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Package2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageMergeEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PrimitiveType2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ProfileApplicationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RedefinableTemplateSignatureEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Signal2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class Model2ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.RedefinableTemplateSignature_3015 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getTemplateableElement_OwnedTemplateSignature());
+ }
+ return getGEFWrapper(new RedefinableTemplateSignatureCreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyChildNodesCommand(cc);
+ addDestroyShortcutsCommand(cc);
+ View view = (View) getHost().getModel();
+ if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
+ req.setElementToDestroy(view);
+ }
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addDestroyChildNodesCommand(CompoundCommand cmd) {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
+ if (annotation != null) {
+ return;
+ }
+ for (Iterator it = view.getChildren().iterator(); it.hasNext();) {
+ Node node = (Node) it.next();
+ switch (UMLVisualIDRegistry.getVisualID(node)) {
+ case RedefinableTemplateSignatureEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(node));
+ break;
+ case ModelPackageableElementCompartmentEditPart.VISUAL_ID:
+ for (Iterator cit = node.getChildren().iterator(); cit.hasNext();) {
+ Node cnode = (Node) cit.next();
+ switch (UMLVisualIDRegistry.getVisualID(cnode)) {
+ case InstanceSpecification2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case Component2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case Signal2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case Interface2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case Model3EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case Enumeration2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case Package2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case Class4EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case PrimitiveType2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case DataType2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case Comment2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case Constraint2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return getGEFWrapper(new PackageImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageMerge_4011 == req.getElementType()) {
+ return getGEFWrapper(new PackageMergeCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ProfileApplication_4012 == req.getElementType()) {
+ return getGEFWrapper(new ProfileApplicationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return getGEFWrapper(new PackageImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageMerge_4011 == req.getElementType()) {
+ return getGEFWrapper(new PackageMergeCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ProfileApplication_4012 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case ElementImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new ElementImportReorientCommand(req));
+ case PackageImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new PackageImportReorientCommand(req));
+ case PackageMergeEditPart.VISUAL_ID:
+ return getGEFWrapper(new PackageMergeReorientCommand(req));
+ case ProfileApplicationEditPart.VISUAL_ID:
+ return getGEFWrapper(new ProfileApplicationReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Model3CanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Model3CanonicalEditPolicy.java
new file mode 100644
index 00000000000..fe0d0f25179
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Model3CanonicalEditPolicy.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RedefinableTemplateSignatureEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class Model3CanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getModel_3024SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case RedefinableTemplateSignatureEditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getTemplateableElement_OwnedTemplateSignature());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Model3ItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Model3ItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..386dd4d58f3
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Model3ItemSemanticEditPolicy.java
@@ -0,0 +1,315 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageMergeCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageMergeReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ProfileApplicationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ProfileApplicationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RedefinableTemplateSignatureCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Class4EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Comment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Component2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Constraint2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataType2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Enumeration2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InstanceSpecification2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Interface2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Model3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelPackageableElementCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Package2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageMergeEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PrimitiveType2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ProfileApplicationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RedefinableTemplateSignatureEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Signal2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class Model3ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.RedefinableTemplateSignature_3015 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getTemplateableElement_OwnedTemplateSignature());
+ }
+ return getGEFWrapper(new RedefinableTemplateSignatureCreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyChildNodesCommand(cc);
+ addDestroyShortcutsCommand(cc);
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addDestroyChildNodesCommand(CompoundCommand cmd) {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
+ if (annotation != null) {
+ return;
+ }
+ for (Iterator it = view.getChildren().iterator(); it.hasNext();) {
+ Node node = (Node) it.next();
+ switch (UMLVisualIDRegistry.getVisualID(node)) {
+ case RedefinableTemplateSignatureEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(node));
+ break;
+ case ModelPackageableElementCompartment2EditPart.VISUAL_ID:
+ for (Iterator cit = node.getChildren().iterator(); cit.hasNext();) {
+ Node cnode = (Node) cit.next();
+ switch (UMLVisualIDRegistry.getVisualID(cnode)) {
+ case InstanceSpecification2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case Component2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case Signal2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case Interface2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case Model3EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case Enumeration2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case Package2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case Class4EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case PrimitiveType2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case DataType2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case Comment2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case Constraint2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return getGEFWrapper(new PackageImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageMerge_4011 == req.getElementType()) {
+ return getGEFWrapper(new PackageMergeCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ProfileApplication_4012 == req.getElementType()) {
+ return getGEFWrapper(new ProfileApplicationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return getGEFWrapper(new PackageImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageMerge_4011 == req.getElementType()) {
+ return getGEFWrapper(new PackageMergeCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ProfileApplication_4012 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case ElementImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new ElementImportReorientCommand(req));
+ case PackageImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new PackageImportReorientCommand(req));
+ case PackageMergeEditPart.VISUAL_ID:
+ return getGEFWrapper(new PackageMergeReorientCommand(req));
+ case ProfileApplicationEditPart.VISUAL_ID:
+ return getGEFWrapper(new ProfileApplicationReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ModelCanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ModelCanonicalEditPolicy.java
new file mode 100644
index 00000000000..fed83adb34d
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ModelCanonicalEditPolicy.java
@@ -0,0 +1,742 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.commands.DeferredLayoutCommand;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalConnectionEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Association2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Association3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationClass2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationClassEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Class4EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Comment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Component2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Constraint2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataType2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataTypeEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Enumeration2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.EnumerationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.GeneralizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InstanceSpecification2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InstanceSpecificationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Interface2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceRealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Model2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Model3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Package2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageMergeEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PrimitiveType2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PrimitiveTypeEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ProfileApplicationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RedefinableTemplateSignatureEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Signal2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SignalEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SlotEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SubstitutionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLLinkDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class ModelCanonicalEditPolicy extends CanonicalConnectionEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ private Collection collectAllLinks(View view, Map domain2NotationMap) {
+ if (!ModelEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(view))) {
+ return Collections.EMPTY_LIST;
+ }
+ Collection result = new LinkedList();
+ switch (UMLVisualIDRegistry.getVisualID(view)) {
+ case ModelEditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getPackage_1000ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ case Dependency2EditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getDependency_2014ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ case AssociationClassEditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getAssociationClass_2013ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ case Association2EditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getAssociation_2015ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ case InstanceSpecificationEditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getInstanceSpecification_2001ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ case ComponentEditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getComponent_2002ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ case SignalEditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getSignal_2003ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ case InterfaceEditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getInterface_2004ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ case Model2EditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getModel_2005ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ case EnumerationEditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getEnumeration_2006ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ case PackageEditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getPackage_2007ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ case ClassEditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getClass_2008ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ case PrimitiveTypeEditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getPrimitiveType_2009ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ case DataTypeEditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getDataType_2010ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ case ConstraintEditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getConstraint_2011ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ case CommentEditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getComment_2012ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ case SlotEditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getSlot_3001ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ case RedefinableTemplateSignatureEditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getRedefinableTemplateSignature_3015ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ case InstanceSpecification2EditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getInstanceSpecification_3020ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ case Component2EditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getComponent_3021ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ case Signal2EditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getSignal_3022ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ case Interface2EditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getInterface_3023ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ case Model3EditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getModel_3024ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ case Enumeration2EditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getEnumeration_3025ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ case Package2EditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getPackage_3009ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ case Class4EditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getClass_3010ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ case PrimitiveType2EditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getPrimitiveType_3026ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ case DataType2EditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getDataType_3027ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ case Comment2EditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getComment_3028ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ case Constraint2EditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getConstraint_3029ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ case AssociationClass2EditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getAssociationClass_4017ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ case AssociationEditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getAssociation_4001ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ case Association3EditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getAssociation_4019ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ case GeneralizationEditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getGeneralization_4002ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ case InterfaceRealizationEditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getInterfaceRealization_4003ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ case SubstitutionEditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getSubstitution_4004ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ case RealizationEditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getRealization_4005ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ case AbstractionEditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getAbstraction_4006ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ case UsageEditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getUsage_4007ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ case DependencyEditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getDependency_4008ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ case Dependency3EditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getDependency_4018ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ case ElementImportEditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getElementImport_4009ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ case PackageImportEditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getPackageImport_4010ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ case PackageMergeEditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getPackageMerge_4011ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ case ProfileApplicationEditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getProfileApplication_4012ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ case TemplateBindingEditPart.VISUAL_ID: {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+ result.addAll(UMLDiagramUpdater.getTemplateBinding_4015ContainedLinks(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+ }
+ }
+ for (Iterator children = view.getChildren().iterator(); children.hasNext();) {
+ result.addAll(collectAllLinks((View) children.next(), domain2NotationMap));
+ }
+ for (Iterator edges = view.getSourceEdges().iterator(); edges.hasNext();) {
+ result.addAll(collectAllLinks((View) edges.next(), domain2NotationMap));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private Collection createConnections(Collection linkDescriptors, Map domain2NotationMap) {
+ List adapters = new LinkedList();
+ for (Iterator linkDescriptorsIterator = linkDescriptors.iterator(); linkDescriptorsIterator.hasNext();) {
+ final UMLLinkDescriptor nextLinkDescriptor = (UMLLinkDescriptor) linkDescriptorsIterator.next();
+ EditPart sourceEditPart = getEditPart(nextLinkDescriptor.getSource(), domain2NotationMap);
+ EditPart targetEditPart = getEditPart(nextLinkDescriptor.getDestination(), domain2NotationMap);
+ if (sourceEditPart == null || targetEditPart == null) {
+ continue;
+ }
+ CreateConnectionViewRequest.ConnectionViewDescriptor descriptor = new CreateConnectionViewRequest.ConnectionViewDescriptor(nextLinkDescriptor.getSemanticAdapter(), null, ViewUtil.APPEND,
+ false, ((IGraphicalEditPart) getHost()).getDiagramPreferencesHint());
+ CreateConnectionViewRequest ccr = new CreateConnectionViewRequest(descriptor);
+ ccr.setType(RequestConstants.REQ_CONNECTION_START);
+ ccr.setSourceEditPart(sourceEditPart);
+ sourceEditPart.getCommand(ccr);
+ ccr.setTargetEditPart(targetEditPart);
+ ccr.setType(RequestConstants.REQ_CONNECTION_END);
+ Command cmd = targetEditPart.getCommand(ccr);
+ if (cmd != null && cmd.canExecute()) {
+ executeCommand(cmd);
+ IAdaptable viewAdapter = (IAdaptable) ccr.getNewObject();
+ if (viewAdapter != null) {
+ adapters.add(viewAdapter);
+ }
+ }
+ }
+ return adapters;
+ }
+
+ /**
+ * not-gnerated used to call getAlllink by sub classes without change code generation
+ *
+ * @param view
+ * the view container
+ * @param domain2NotationMap
+ * @return the list of all links
+ */
+ protected Collection getAllLinks(View view, Map domain2NotationMap) {
+ return collectAllLinks(view, domain2NotationMap);
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ private Diagram getDiagram() {
+ return ((View) getHost().getModel()).getDiagram();
+ }
+
+ /**
+ * @generated
+ */
+ private EditPart getEditPart(EObject domainModelElement, Map domain2NotationMap) {
+ View view = (View) domain2NotationMap.get(domainModelElement);
+ if (view != null) {
+ return (EditPart) getHost().getViewer().getEditPartRegistry().get(view);
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getElement_OwnedComment());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getPackage_1000SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected List getSemanticConnectionsList() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getSourceElement(EObject relationship) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getTargetElement(EObject relationship) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case Dependency2EditPart.VISUAL_ID:
+ case AssociationClassEditPart.VISUAL_ID:
+ case Association2EditPart.VISUAL_ID:
+ case InstanceSpecificationEditPart.VISUAL_ID:
+ case ComponentEditPart.VISUAL_ID:
+ case SignalEditPart.VISUAL_ID:
+ case InterfaceEditPart.VISUAL_ID:
+ case Model2EditPart.VISUAL_ID:
+ case EnumerationEditPart.VISUAL_ID:
+ case PackageEditPart.VISUAL_ID:
+ case ClassEditPart.VISUAL_ID:
+ case PrimitiveTypeEditPart.VISUAL_ID:
+ case DataTypeEditPart.VISUAL_ID:
+ case ConstraintEditPart.VISUAL_ID:
+ case CommentEditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ private Collection refreshConnections() {
+ Map domain2NotationMap = new HashMap();
+ Collection linkDescriptors = collectAllLinks(getDiagram(), domain2NotationMap);
+ Collection existingLinks = new LinkedList(getDiagram().getEdges());
+ for (Iterator linksIterator = existingLinks.iterator(); linksIterator.hasNext();) {
+ Edge nextDiagramLink = (Edge) linksIterator.next();
+ int diagramLinkVisualID = UMLVisualIDRegistry.getVisualID(nextDiagramLink);
+ if (diagramLinkVisualID == -1) {
+ if (nextDiagramLink.getSource() != null && nextDiagramLink.getTarget() != null) {
+ linksIterator.remove();
+ }
+ continue;
+ }
+ EObject diagramLinkObject = nextDiagramLink.getElement();
+ EObject diagramLinkSrc = nextDiagramLink.getSource().getElement();
+ EObject diagramLinkDst = nextDiagramLink.getTarget().getElement();
+ for (Iterator LinkDescriptorsIterator = linkDescriptors.iterator(); LinkDescriptorsIterator.hasNext();) {
+ UMLLinkDescriptor nextLinkDescriptor = (UMLLinkDescriptor) LinkDescriptorsIterator.next();
+ if (diagramLinkObject == nextLinkDescriptor.getModelElement() && diagramLinkSrc == nextLinkDescriptor.getSource() && diagramLinkDst == nextLinkDescriptor.getDestination()
+ && diagramLinkVisualID == nextLinkDescriptor.getVisualID()) {
+ linksIterator.remove();
+ LinkDescriptorsIterator.remove();
+ }
+ }
+ }
+ deleteViews(existingLinks.iterator());
+ return createConnections(linkDescriptors, domain2NotationMap);
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshSemantic() {
+ List createdViews = new LinkedList();
+ createdViews.addAll(refreshSemanticChildren());
+ List createdConnectionViews = new LinkedList();
+ createdConnectionViews.addAll(refreshSemanticConnections());
+ createdConnectionViews.addAll(refreshConnections());
+
+ if (createdViews.size() > 1) {
+ // perform a layout of the container
+ DeferredLayoutCommand layoutCmd = new DeferredLayoutCommand(host().getEditingDomain(), createdViews, host());
+ executeCommand(new ICommandProxy(layoutCmd));
+ }
+
+ createdViews.addAll(createdConnectionViews);
+ makeViewsImmutable(createdViews);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean shouldDeleteView(View view) {
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean shouldIncludeConnection(Edge connector, Collection children) {
+ return false;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ModelItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ModelItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..d372704df3f
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ModelItemSemanticEditPolicy.java
@@ -0,0 +1,164 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.emf.commands.core.commands.DuplicateEObjectsCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Association2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationClassCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ClassCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ComponentCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DataTypeCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.EnumerationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.InstanceSpecificationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.InterfaceCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ModelCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PrimitiveTypeCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SignalCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class ModelItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.Dependency_2014 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new Dependency2CreateCommand(req));
+ }
+ if (UMLElementTypes.AssociationClass_2013 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new AssociationClassCreateCommand(req));
+ }
+ if (UMLElementTypes.Association_2015 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new Association2CreateCommand(req));
+ }
+ if (UMLElementTypes.InstanceSpecification_2001 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new InstanceSpecificationCreateCommand(req));
+ }
+ if (UMLElementTypes.Component_2002 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new ComponentCreateCommand(req));
+ }
+ if (UMLElementTypes.Signal_2003 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new SignalCreateCommand(req));
+ }
+ if (UMLElementTypes.Interface_2004 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new InterfaceCreateCommand(req));
+ }
+ if (UMLElementTypes.Model_2005 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new ModelCreateCommand(req));
+ }
+ if (UMLElementTypes.Enumeration_2006 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new EnumerationCreateCommand(req));
+ }
+ if (UMLElementTypes.Package_2007 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new PackageCreateCommand(req));
+ }
+ if (UMLElementTypes.Class_2008 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new ClassCreateCommand(req));
+ }
+ if (UMLElementTypes.PrimitiveType_2009 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new PrimitiveTypeCreateCommand(req));
+ }
+ if (UMLElementTypes.DataType_2010 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new DataTypeCreateCommand(req));
+ }
+ if (UMLElementTypes.Constraint_2011 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new ConstraintCreateCommand(req));
+ }
+ if (UMLElementTypes.Comment_2012 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getElement_OwnedComment());
+ }
+ return getGEFWrapper(new CommentCreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getDuplicateCommand(DuplicateElementsRequest req) {
+ TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
+ return getGEFWrapper(new DuplicateAnythingCommand(editingDomain, req));
+ }
+
+ /**
+ * @generated
+ */
+ private static class DuplicateAnythingCommand extends DuplicateEObjectsCommand {
+
+ /**
+ * @generated
+ */
+ public DuplicateAnythingCommand(TransactionalEditingDomain editingDomain, DuplicateElementsRequest req) {
+ super(editingDomain, req.getLabel(), req.getElementsToBeDuplicated(), req.getAllDuplicatedElementsMap());
+ }
+
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ModelPackageableElementCompartment2CanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ModelPackageableElementCompartment2CanonicalEditPolicy.java
new file mode 100644
index 00000000000..b50894e605c
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ModelPackageableElementCompartment2CanonicalEditPolicy.java
@@ -0,0 +1,108 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Class4EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Comment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Component2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Constraint2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataType2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Enumeration2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InstanceSpecification2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Interface2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Model3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Package2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PrimitiveType2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Signal2EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class ModelPackageableElementCompartment2CanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getModelPackageableElementCompartment_7030SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case InstanceSpecification2EditPart.VISUAL_ID:
+ case Component2EditPart.VISUAL_ID:
+ case Signal2EditPart.VISUAL_ID:
+ case Interface2EditPart.VISUAL_ID:
+ case Model3EditPart.VISUAL_ID:
+ case Enumeration2EditPart.VISUAL_ID:
+ case Package2EditPart.VISUAL_ID:
+ case Class4EditPart.VISUAL_ID:
+ case PrimitiveType2EditPart.VISUAL_ID:
+ case DataType2EditPart.VISUAL_ID:
+ case Comment2EditPart.VISUAL_ID:
+ case Constraint2EditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getElement_OwnedComment());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ModelPackageableElementCompartment2ItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ModelPackageableElementCompartment2ItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..aa1ef1ddd50
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ModelPackageableElementCompartment2ItemSemanticEditPolicy.java
@@ -0,0 +1,117 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Class4CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Comment2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Component2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Constraint2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DataType2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Enumeration2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.InstanceSpecification2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Interface2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Model2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Package2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PrimitiveType2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Signal2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class ModelPackageableElementCompartment2ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.InstanceSpecification_3020 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new InstanceSpecification2CreateCommand(req));
+ }
+ if (UMLElementTypes.Component_3021 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new Component2CreateCommand(req));
+ }
+ if (UMLElementTypes.Signal_3022 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new Signal2CreateCommand(req));
+ }
+ if (UMLElementTypes.Interface_3023 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new Interface2CreateCommand(req));
+ }
+ if (UMLElementTypes.Model_3024 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new Model2CreateCommand(req));
+ }
+ if (UMLElementTypes.Enumeration_3025 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new Enumeration2CreateCommand(req));
+ }
+ if (UMLElementTypes.Package_3009 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new Package2CreateCommand(req));
+ }
+ if (UMLElementTypes.Class_3010 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new Class4CreateCommand(req));
+ }
+ if (UMLElementTypes.PrimitiveType_3026 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new PrimitiveType2CreateCommand(req));
+ }
+ if (UMLElementTypes.DataType_3027 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new DataType2CreateCommand(req));
+ }
+ if (UMLElementTypes.Comment_3028 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getElement_OwnedComment());
+ }
+ return getGEFWrapper(new Comment2CreateCommand(req));
+ }
+ if (UMLElementTypes.Constraint_3029 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new Constraint2CreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ModelPackageableElementCompartmentCanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ModelPackageableElementCompartmentCanonicalEditPolicy.java
new file mode 100644
index 00000000000..cdda0cf76b6
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ModelPackageableElementCompartmentCanonicalEditPolicy.java
@@ -0,0 +1,108 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Class4EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Comment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Component2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Constraint2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataType2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Enumeration2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InstanceSpecification2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Interface2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Model3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Package2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PrimitiveType2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Signal2EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class ModelPackageableElementCompartmentCanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getModelPackageableElementCompartment_7009SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case InstanceSpecification2EditPart.VISUAL_ID:
+ case Component2EditPart.VISUAL_ID:
+ case Signal2EditPart.VISUAL_ID:
+ case Interface2EditPart.VISUAL_ID:
+ case Model3EditPart.VISUAL_ID:
+ case Enumeration2EditPart.VISUAL_ID:
+ case Package2EditPart.VISUAL_ID:
+ case Class4EditPart.VISUAL_ID:
+ case PrimitiveType2EditPart.VISUAL_ID:
+ case DataType2EditPart.VISUAL_ID:
+ case Comment2EditPart.VISUAL_ID:
+ case Constraint2EditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getElement_OwnedComment());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..a6a99b2e5ce
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicy.java
@@ -0,0 +1,117 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Class4CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Comment2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Component2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Constraint2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DataType2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Enumeration2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.InstanceSpecification2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Interface2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Model2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Package2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PrimitiveType2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Signal2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class ModelPackageableElementCompartmentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.InstanceSpecification_3020 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new InstanceSpecification2CreateCommand(req));
+ }
+ if (UMLElementTypes.Component_3021 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new Component2CreateCommand(req));
+ }
+ if (UMLElementTypes.Signal_3022 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new Signal2CreateCommand(req));
+ }
+ if (UMLElementTypes.Interface_3023 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new Interface2CreateCommand(req));
+ }
+ if (UMLElementTypes.Model_3024 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new Model2CreateCommand(req));
+ }
+ if (UMLElementTypes.Enumeration_3025 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new Enumeration2CreateCommand(req));
+ }
+ if (UMLElementTypes.Package_3009 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new Package2CreateCommand(req));
+ }
+ if (UMLElementTypes.Class_3010 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new Class4CreateCommand(req));
+ }
+ if (UMLElementTypes.PrimitiveType_3026 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new PrimitiveType2CreateCommand(req));
+ }
+ if (UMLElementTypes.DataType_3027 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new DataType2CreateCommand(req));
+ }
+ if (UMLElementTypes.Comment_3028 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getElement_OwnedComment());
+ }
+ return getGEFWrapper(new Comment2CreateCommand(req));
+ }
+ if (UMLElementTypes.Constraint_3029 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new Constraint2CreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/OpenDiagramEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/OpenDiagramEditPolicy.java
new file mode 100644
index 00000000000..7717bf324a9
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/OpenDiagramEditPolicy.java
@@ -0,0 +1,195 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Iterator;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.common.ui.URIEditorInput;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.core.services.ViewService;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.OpenEditPolicy;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.Style;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.Messages;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorUtil;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.WorkspaceModifyOperation;
+
+/**
+ * @generated
+ */
+public class OpenDiagramEditPolicy extends OpenEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getOpenCommand(Request request) {
+ EditPart targetEditPart = getTargetEditPart(request);
+ if (false == targetEditPart.getModel() instanceof View) {
+ return null;
+ }
+ View view = (View) targetEditPart.getModel();
+ Style link = view.getStyle(NotationPackage.eINSTANCE.getHintedDiagramLinkStyle());
+ if (false == link instanceof HintedDiagramLinkStyle) {
+ return null;
+ }
+ return new ICommandProxy(new OpenDiagramCommand((HintedDiagramLinkStyle) link));
+ }
+
+ /**
+ * @generated
+ */
+ private static class OpenDiagramCommand extends AbstractTransactionalCommand {
+
+ /**
+ * @generated
+ */
+ private final HintedDiagramLinkStyle diagramFacet;
+
+ /**
+ * @generated
+ */
+ OpenDiagramCommand(HintedDiagramLinkStyle linkStyle) {
+ // editing domain is taken for original diagram,
+ // if we open diagram from another file, we should use another editing domain
+ super(TransactionUtil.getEditingDomain(linkStyle), Messages.CommandName_OpenDiagram, null);
+ diagramFacet = linkStyle;
+ }
+
+ // FIXME canExecute if !(readOnly && getDiagramToOpen == null), i.e. open works on ro diagrams only when there's associated diagram already
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ try {
+ Diagram diagram = getDiagramToOpen();
+ if (diagram == null) {
+ diagram = intializeNewDiagram();
+ }
+ URI uri = EcoreUtil.getURI(diagram);
+ String editorName = uri.lastSegment() + "#" + diagram.eResource().getContents().indexOf(diagram); //$NON-NLS-1$
+ IEditorInput editorInput = new URIEditorInput(uri, editorName);
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ page.openEditor(editorInput, getEditorID());
+ return CommandResult.newOKCommandResult();
+ } catch (Exception ex) {
+ throw new ExecutionException("Can't open diagram", ex);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Diagram getDiagramToOpen() {
+ return diagramFacet.getDiagramLink();
+ }
+
+ /**
+ * @generated
+ */
+ protected Diagram intializeNewDiagram() throws ExecutionException {
+ Diagram d = ViewService.createDiagram(getDiagramDomainElement(), getDiagramKind(), getPreferencesHint());
+ if (d == null) {
+ throw new ExecutionException("Can't create diagram of '" + getDiagramKind() + "' kind");
+ }
+ diagramFacet.setDiagramLink(d);
+ assert diagramFacet.eResource() != null;
+ diagramFacet.eResource().getContents().add(d);
+ EObject container = diagramFacet.eContainer();
+ while (container instanceof View) {
+ ((View) container).persist();
+ container = container.eContainer();
+ }
+ try {
+ new WorkspaceModifyOperation() {
+
+ protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
+ try {
+ for (Iterator it = diagramFacet.eResource().getResourceSet().getResources().iterator(); it.hasNext();) {
+ Resource nextResource = (Resource) it.next();
+ if (nextResource.isLoaded() && !getEditingDomain().isReadOnly(nextResource)) {
+ nextResource.save(UMLDiagramEditorUtil.getSaveOptions());
+ }
+ }
+ } catch (IOException ex) {
+ throw new InvocationTargetException(ex, "Save operation failed");
+ }
+ }
+ }.run(null);
+ } catch (InvocationTargetException e) {
+ throw new ExecutionException("Can't create diagram of '" + getDiagramKind() + "' kind", e);
+ } catch (InterruptedException e) {
+ throw new ExecutionException("Can't create diagram of '" + getDiagramKind() + "' kind", e);
+ }
+ return d;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getDiagramDomainElement() {
+ // use same element as associated with EP
+ return ((View) diagramFacet.eContainer()).getElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected PreferencesHint getPreferencesHint() {
+ // XXX prefhint from target diagram's editor?
+ return UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDiagramKind() {
+ return ModelEditPart.MODEL_ID;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getEditorID() {
+ return UMLDiagramEditor.ID;
+ }
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Operation2ItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Operation2ItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..6b1c9de0950
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Operation2ItemSemanticEditPolicy.java
@@ -0,0 +1,194 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class Operation2ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyShortcutsCommand(cc);
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return getGEFWrapper(new PackageImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case ElementImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new ElementImportReorientCommand(req));
+ case PackageImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new PackageImportReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Operation3ItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Operation3ItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..50acda14d25
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Operation3ItemSemanticEditPolicy.java
@@ -0,0 +1,194 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class Operation3ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyShortcutsCommand(cc);
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return getGEFWrapper(new PackageImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case ElementImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new ElementImportReorientCommand(req));
+ case PackageImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new PackageImportReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Operation4ItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Operation4ItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..735f3d60a5b
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Operation4ItemSemanticEditPolicy.java
@@ -0,0 +1,194 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class Operation4ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyShortcutsCommand(cc);
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return getGEFWrapper(new PackageImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case ElementImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new ElementImportReorientCommand(req));
+ case PackageImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new PackageImportReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Operation5ItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Operation5ItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..15ea5670562
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Operation5ItemSemanticEditPolicy.java
@@ -0,0 +1,172 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class Operation5ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyShortcutsCommand(cc);
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case ElementImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new ElementImportReorientCommand(req));
+ case PackageImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new PackageImportReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return getGEFWrapper(new PackageImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/OperationItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/OperationItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..bd470e692a7
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/OperationItemSemanticEditPolicy.java
@@ -0,0 +1,194 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class OperationItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyShortcutsCommand(cc);
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return getGEFWrapper(new PackageImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case ElementImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new ElementImportReorientCommand(req));
+ case PackageImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new PackageImportReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Package2CanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Package2CanonicalEditPolicy.java
new file mode 100644
index 00000000000..7d2ede2be56
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Package2CanonicalEditPolicy.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RedefinableTemplateSignatureEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class Package2CanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getPackage_3009SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case RedefinableTemplateSignatureEditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getTemplateableElement_OwnedTemplateSignature());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Package2ItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Package2ItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..78a8d204a11
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Package2ItemSemanticEditPolicy.java
@@ -0,0 +1,315 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageMergeCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageMergeReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ProfileApplicationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ProfileApplicationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RedefinableTemplateSignatureCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Class4EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Comment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Component2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Constraint2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataType2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Enumeration2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InstanceSpecification2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Interface2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Model3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Package2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageMergeEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackagePackageableElementCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PrimitiveType2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ProfileApplicationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RedefinableTemplateSignatureEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Signal2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class Package2ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.RedefinableTemplateSignature_3015 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getTemplateableElement_OwnedTemplateSignature());
+ }
+ return getGEFWrapper(new RedefinableTemplateSignatureCreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyChildNodesCommand(cc);
+ addDestroyShortcutsCommand(cc);
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addDestroyChildNodesCommand(CompoundCommand cmd) {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
+ if (annotation != null) {
+ return;
+ }
+ for (Iterator it = view.getChildren().iterator(); it.hasNext();) {
+ Node node = (Node) it.next();
+ switch (UMLVisualIDRegistry.getVisualID(node)) {
+ case RedefinableTemplateSignatureEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(node));
+ break;
+ case PackagePackageableElementCompartmentEditPart.VISUAL_ID:
+ for (Iterator cit = node.getChildren().iterator(); cit.hasNext();) {
+ Node cnode = (Node) cit.next();
+ switch (UMLVisualIDRegistry.getVisualID(cnode)) {
+ case InstanceSpecification2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case Component2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case Signal2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case Interface2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case Model3EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case Enumeration2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case Package2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case Class4EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case PrimitiveType2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case DataType2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case Comment2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case Constraint2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return getGEFWrapper(new PackageImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageMerge_4011 == req.getElementType()) {
+ return getGEFWrapper(new PackageMergeCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ProfileApplication_4012 == req.getElementType()) {
+ return getGEFWrapper(new ProfileApplicationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return getGEFWrapper(new PackageImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageMerge_4011 == req.getElementType()) {
+ return getGEFWrapper(new PackageMergeCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ProfileApplication_4012 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case ElementImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new ElementImportReorientCommand(req));
+ case PackageImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new PackageImportReorientCommand(req));
+ case PackageMergeEditPart.VISUAL_ID:
+ return getGEFWrapper(new PackageMergeReorientCommand(req));
+ case ProfileApplicationEditPart.VISUAL_ID:
+ return getGEFWrapper(new ProfileApplicationReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/PackageCanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/PackageCanonicalEditPolicy.java
new file mode 100644
index 00000000000..d992d023a0c
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/PackageCanonicalEditPolicy.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RedefinableTemplateSignatureEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class PackageCanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getPackage_2007SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case RedefinableTemplateSignatureEditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getTemplateableElement_OwnedTemplateSignature());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/PackageImportItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/PackageImportItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..9f44a60df94
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/PackageImportItemSemanticEditPolicy.java
@@ -0,0 +1,113 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class PackageImportItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ return getGEFWrapper(new DestroyElementCommand(req));
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/PackageItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/PackageItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..7ae9a561a4b
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/PackageItemSemanticEditPolicy.java
@@ -0,0 +1,319 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageMergeCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageMergeReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ProfileApplicationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ProfileApplicationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RedefinableTemplateSignatureCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Class4EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Comment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Component2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Constraint2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataType2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Enumeration2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InstanceSpecification2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Interface2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Model3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Package2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageMergeEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackagePackageableElementCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PrimitiveType2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ProfileApplicationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RedefinableTemplateSignatureEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Signal2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class PackageItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.RedefinableTemplateSignature_3015 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getTemplateableElement_OwnedTemplateSignature());
+ }
+ return getGEFWrapper(new RedefinableTemplateSignatureCreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyChildNodesCommand(cc);
+ addDestroyShortcutsCommand(cc);
+ View view = (View) getHost().getModel();
+ if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
+ req.setElementToDestroy(view);
+ }
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addDestroyChildNodesCommand(CompoundCommand cmd) {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
+ if (annotation != null) {
+ return;
+ }
+ for (Iterator it = view.getChildren().iterator(); it.hasNext();) {
+ Node node = (Node) it.next();
+ switch (UMLVisualIDRegistry.getVisualID(node)) {
+ case RedefinableTemplateSignatureEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(node));
+ break;
+ case PackagePackageableElementCompartment2EditPart.VISUAL_ID:
+ for (Iterator cit = node.getChildren().iterator(); cit.hasNext();) {
+ Node cnode = (Node) cit.next();
+ switch (UMLVisualIDRegistry.getVisualID(cnode)) {
+ case InstanceSpecification2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case Component2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case Signal2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case Interface2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case Model3EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case Enumeration2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case Package2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case Class4EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case PrimitiveType2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case DataType2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case Comment2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case Constraint2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return getGEFWrapper(new PackageImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageMerge_4011 == req.getElementType()) {
+ return getGEFWrapper(new PackageMergeCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ProfileApplication_4012 == req.getElementType()) {
+ return getGEFWrapper(new ProfileApplicationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return getGEFWrapper(new PackageImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageMerge_4011 == req.getElementType()) {
+ return getGEFWrapper(new PackageMergeCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ProfileApplication_4012 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case ElementImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new ElementImportReorientCommand(req));
+ case PackageImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new PackageImportReorientCommand(req));
+ case PackageMergeEditPart.VISUAL_ID:
+ return getGEFWrapper(new PackageMergeReorientCommand(req));
+ case ProfileApplicationEditPart.VISUAL_ID:
+ return getGEFWrapper(new ProfileApplicationReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/PackageMergeItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/PackageMergeItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..f0c2e39b4c4
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/PackageMergeItemSemanticEditPolicy.java
@@ -0,0 +1,113 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class PackageMergeItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ return getGEFWrapper(new DestroyElementCommand(req));
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/PackagePackageableElementCompartment2CanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/PackagePackageableElementCompartment2CanonicalEditPolicy.java
new file mode 100644
index 00000000000..2cd0adcfbe3
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/PackagePackageableElementCompartment2CanonicalEditPolicy.java
@@ -0,0 +1,108 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Class4EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Comment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Component2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Constraint2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataType2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Enumeration2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InstanceSpecification2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Interface2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Model3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Package2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PrimitiveType2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Signal2EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class PackagePackageableElementCompartment2CanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getPackagePackageableElementCompartment_7016SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case InstanceSpecification2EditPart.VISUAL_ID:
+ case Component2EditPart.VISUAL_ID:
+ case Signal2EditPart.VISUAL_ID:
+ case Interface2EditPart.VISUAL_ID:
+ case Model3EditPart.VISUAL_ID:
+ case Enumeration2EditPart.VISUAL_ID:
+ case Package2EditPart.VISUAL_ID:
+ case Class4EditPart.VISUAL_ID:
+ case PrimitiveType2EditPart.VISUAL_ID:
+ case DataType2EditPart.VISUAL_ID:
+ case Comment2EditPart.VISUAL_ID:
+ case Constraint2EditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getElement_OwnedComment());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/PackagePackageableElementCompartment2ItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/PackagePackageableElementCompartment2ItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..fa66b4486c1
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/PackagePackageableElementCompartment2ItemSemanticEditPolicy.java
@@ -0,0 +1,117 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Class4CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Comment2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Component2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Constraint2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DataType2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Enumeration2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.InstanceSpecification2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Interface2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Model2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Package2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PrimitiveType2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Signal2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class PackagePackageableElementCompartment2ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.InstanceSpecification_3020 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new InstanceSpecification2CreateCommand(req));
+ }
+ if (UMLElementTypes.Component_3021 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new Component2CreateCommand(req));
+ }
+ if (UMLElementTypes.Signal_3022 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new Signal2CreateCommand(req));
+ }
+ if (UMLElementTypes.Interface_3023 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new Interface2CreateCommand(req));
+ }
+ if (UMLElementTypes.Model_3024 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new Model2CreateCommand(req));
+ }
+ if (UMLElementTypes.Enumeration_3025 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new Enumeration2CreateCommand(req));
+ }
+ if (UMLElementTypes.Package_3009 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new Package2CreateCommand(req));
+ }
+ if (UMLElementTypes.Class_3010 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new Class4CreateCommand(req));
+ }
+ if (UMLElementTypes.PrimitiveType_3026 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new PrimitiveType2CreateCommand(req));
+ }
+ if (UMLElementTypes.DataType_3027 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new DataType2CreateCommand(req));
+ }
+ if (UMLElementTypes.Comment_3028 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getElement_OwnedComment());
+ }
+ return getGEFWrapper(new Comment2CreateCommand(req));
+ }
+ if (UMLElementTypes.Constraint_3029 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new Constraint2CreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/PackagePackageableElementCompartmentCanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/PackagePackageableElementCompartmentCanonicalEditPolicy.java
new file mode 100644
index 00000000000..0596ae82658
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/PackagePackageableElementCompartmentCanonicalEditPolicy.java
@@ -0,0 +1,108 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Class4EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Comment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Component2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Constraint2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataType2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Enumeration2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InstanceSpecification2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Interface2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Model3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Package2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PrimitiveType2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Signal2EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class PackagePackageableElementCompartmentCanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getPackagePackageableElementCompartment_7010SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case InstanceSpecification2EditPart.VISUAL_ID:
+ case Component2EditPart.VISUAL_ID:
+ case Signal2EditPart.VISUAL_ID:
+ case Interface2EditPart.VISUAL_ID:
+ case Model3EditPart.VISUAL_ID:
+ case Enumeration2EditPart.VISUAL_ID:
+ case Package2EditPart.VISUAL_ID:
+ case Class4EditPart.VISUAL_ID:
+ case PrimitiveType2EditPart.VISUAL_ID:
+ case DataType2EditPart.VISUAL_ID:
+ case Comment2EditPart.VISUAL_ID:
+ case Constraint2EditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getElement_OwnedComment());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..f8970c97221
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicy.java
@@ -0,0 +1,117 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Class4CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Comment2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Component2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Constraint2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DataType2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Enumeration2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.InstanceSpecification2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Interface2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Model2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Package2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PrimitiveType2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Signal2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class PackagePackageableElementCompartmentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.InstanceSpecification_3020 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new InstanceSpecification2CreateCommand(req));
+ }
+ if (UMLElementTypes.Component_3021 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new Component2CreateCommand(req));
+ }
+ if (UMLElementTypes.Signal_3022 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new Signal2CreateCommand(req));
+ }
+ if (UMLElementTypes.Interface_3023 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new Interface2CreateCommand(req));
+ }
+ if (UMLElementTypes.Model_3024 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new Model2CreateCommand(req));
+ }
+ if (UMLElementTypes.Enumeration_3025 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new Enumeration2CreateCommand(req));
+ }
+ if (UMLElementTypes.Package_3009 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new Package2CreateCommand(req));
+ }
+ if (UMLElementTypes.Class_3010 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new Class4CreateCommand(req));
+ }
+ if (UMLElementTypes.PrimitiveType_3026 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new PrimitiveType2CreateCommand(req));
+ }
+ if (UMLElementTypes.DataType_3027 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new DataType2CreateCommand(req));
+ }
+ if (UMLElementTypes.Comment_3028 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getElement_OwnedComment());
+ }
+ return getGEFWrapper(new Comment2CreateCommand(req));
+ }
+ if (UMLElementTypes.Constraint_3029 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getPackage_PackagedElement());
+ }
+ return getGEFWrapper(new Constraint2CreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/PrimitiveType2ItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/PrimitiveType2ItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..8d6a49ed1ef
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/PrimitiveType2ItemSemanticEditPolicy.java
@@ -0,0 +1,249 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Association2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Association3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationClass2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationClassReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.GeneralizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.GeneralizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SubstitutionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SubstitutionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Association3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationClass2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.GeneralizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SubstitutionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class PrimitiveType2ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyShortcutsCommand(cc);
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
+ return getGEFWrapper(new AssociationClass2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4001 == req.getElementType()) {
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4019 == req.getElementType()) {
+ return getGEFWrapper(new Association3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Generalization_4002 == req.getElementType()) {
+ return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Substitution_4004 == req.getElementType()) {
+ return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return getGEFWrapper(new PackageImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
+ return getGEFWrapper(new AssociationClass2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4001 == req.getElementType()) {
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4019 == req.getElementType()) {
+ return getGEFWrapper(new Association3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Generalization_4002 == req.getElementType()) {
+ return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Substitution_4004 == req.getElementType()) {
+ return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case AssociationClass2EditPart.VISUAL_ID:
+ return getGEFWrapper(new AssociationClassReorientCommand(req));
+ case AssociationEditPart.VISUAL_ID:
+ return getGEFWrapper(new AssociationReorientCommand(req));
+ case Association3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Association2ReorientCommand(req));
+ case GeneralizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new GeneralizationReorientCommand(req));
+ case SubstitutionEditPart.VISUAL_ID:
+ return getGEFWrapper(new SubstitutionReorientCommand(req));
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case ElementImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new ElementImportReorientCommand(req));
+ case PackageImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new PackageImportReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/PrimitiveTypeItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/PrimitiveTypeItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..52de485fe7d
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/PrimitiveTypeItemSemanticEditPolicy.java
@@ -0,0 +1,254 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Association2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Association3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationClass2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationClassReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.GeneralizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.GeneralizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SubstitutionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SubstitutionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Association3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationClass2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.GeneralizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SubstitutionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class PrimitiveTypeItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyShortcutsCommand(cc);
+ View view = (View) getHost().getModel();
+ if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
+ req.setElementToDestroy(view);
+ }
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
+ return getGEFWrapper(new AssociationClass2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4001 == req.getElementType()) {
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4019 == req.getElementType()) {
+ return getGEFWrapper(new Association3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Generalization_4002 == req.getElementType()) {
+ return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Substitution_4004 == req.getElementType()) {
+ return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return getGEFWrapper(new PackageImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
+ return getGEFWrapper(new AssociationClass2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4001 == req.getElementType()) {
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4019 == req.getElementType()) {
+ return getGEFWrapper(new Association3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Generalization_4002 == req.getElementType()) {
+ return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Substitution_4004 == req.getElementType()) {
+ return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case AssociationClass2EditPart.VISUAL_ID:
+ return getGEFWrapper(new AssociationClassReorientCommand(req));
+ case AssociationEditPart.VISUAL_ID:
+ return getGEFWrapper(new AssociationReorientCommand(req));
+ case Association3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Association2ReorientCommand(req));
+ case GeneralizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new GeneralizationReorientCommand(req));
+ case SubstitutionEditPart.VISUAL_ID:
+ return getGEFWrapper(new SubstitutionReorientCommand(req));
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case ElementImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new ElementImportReorientCommand(req));
+ case PackageImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new PackageImportReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ProfileApplicationItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ProfileApplicationItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..265016617aa
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ProfileApplicationItemSemanticEditPolicy.java
@@ -0,0 +1,113 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class ProfileApplicationItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ return getGEFWrapper(new DestroyElementCommand(req));
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Property2ItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Property2ItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..0f96e616f9f
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Property2ItemSemanticEditPolicy.java
@@ -0,0 +1,172 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class Property2ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyShortcutsCommand(cc);
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Property3ItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Property3ItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..a7861e33047
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Property3ItemSemanticEditPolicy.java
@@ -0,0 +1,172 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class Property3ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyShortcutsCommand(cc);
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Property4ItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Property4ItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..fdc68916fdf
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Property4ItemSemanticEditPolicy.java
@@ -0,0 +1,172 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class Property4ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyShortcutsCommand(cc);
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Property5ItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Property5ItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..ca2629a2d65
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Property5ItemSemanticEditPolicy.java
@@ -0,0 +1,172 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class Property5ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyShortcutsCommand(cc);
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/PropertyItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/PropertyItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..b484f80cc17
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/PropertyItemSemanticEditPolicy.java
@@ -0,0 +1,172 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class PropertyItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyShortcutsCommand(cc);
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/RealizationItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/RealizationItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..cc8a0093389
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/RealizationItemSemanticEditPolicy.java
@@ -0,0 +1,179 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class RealizationItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ return getGEFWrapper(new DestroyElementCommand(req));
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case ElementImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new ElementImportReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ReceptionItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ReceptionItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..ce2f9da6716
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/ReceptionItemSemanticEditPolicy.java
@@ -0,0 +1,194 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class ReceptionItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyShortcutsCommand(cc);
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return getGEFWrapper(new PackageImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case ElementImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new ElementImportReorientCommand(req));
+ case PackageImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new PackageImportReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/RedefinableTemplateSignatureItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/RedefinableTemplateSignatureItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..2b12f3a25c6
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/RedefinableTemplateSignatureItemSemanticEditPolicy.java
@@ -0,0 +1,207 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RedefinableTemplateSignatureTemplateParameterCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateParameterEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class RedefinableTemplateSignatureItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyChildNodesCommand(cc);
+ addDestroyShortcutsCommand(cc);
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addDestroyChildNodesCommand(CompoundCommand cmd) {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
+ if (annotation != null) {
+ return;
+ }
+ for (Iterator it = view.getChildren().iterator(); it.hasNext();) {
+ Node node = (Node) it.next();
+ switch (UMLVisualIDRegistry.getVisualID(node)) {
+ case RedefinableTemplateSignatureTemplateParameterCompartmentEditPart.VISUAL_ID:
+ for (Iterator cit = node.getChildren().iterator(); cit.hasNext();) {
+ Node cnode = (Node) cit.next();
+ switch (UMLVisualIDRegistry.getVisualID(cnode)) {
+ case TemplateParameterEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/RedefinableTemplateSignatureTemplateParameterCompartmentCanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/RedefinableTemplateSignatureTemplateParameterCompartmentCanonicalEditPolicy.java
new file mode 100644
index 00000000000..9c62f90e398
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/RedefinableTemplateSignatureTemplateParameterCompartmentCanonicalEditPolicy.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateParameterEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class RedefinableTemplateSignatureTemplateParameterCompartmentCanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getRedefinableTemplateSignatureTemplateParameterCompartment_7014SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case TemplateParameterEditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getTemplateSignature_OwnedParameter());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/RedefinableTemplateSignatureTemplateParameterCompartmentItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/RedefinableTemplateSignatureTemplateParameterCompartmentItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..93ef21c2200
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/RedefinableTemplateSignatureTemplateParameterCompartmentItemSemanticEditPolicy.java
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateParameterCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class RedefinableTemplateSignatureTemplateParameterCompartmentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.TemplateParameter_3016 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getTemplateSignature_OwnedParameter());
+ }
+ return getGEFWrapper(new TemplateParameterCreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Signal2CanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Signal2CanonicalEditPolicy.java
new file mode 100644
index 00000000000..20175c57d80
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Signal2CanonicalEditPolicy.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RedefinableTemplateSignatureEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class Signal2CanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getSignal_3022SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case RedefinableTemplateSignatureEditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getTemplateableElement_OwnedTemplateSignature());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Signal2ItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Signal2ItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..94cd4a24de9
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/Signal2ItemSemanticEditPolicy.java
@@ -0,0 +1,304 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Association2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Association3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationClass2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationClassReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.GeneralizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.GeneralizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RedefinableTemplateSignatureCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SubstitutionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SubstitutionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Association3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationClass2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.GeneralizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Property2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RedefinableTemplateSignatureEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SignalAttributeCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SubstitutionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class Signal2ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.RedefinableTemplateSignature_3015 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getTemplateableElement_OwnedTemplateSignature());
+ }
+ return getGEFWrapper(new RedefinableTemplateSignatureCreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyChildNodesCommand(cc);
+ addDestroyShortcutsCommand(cc);
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addDestroyChildNodesCommand(CompoundCommand cmd) {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
+ if (annotation != null) {
+ return;
+ }
+ for (Iterator it = view.getChildren().iterator(); it.hasNext();) {
+ Node node = (Node) it.next();
+ switch (UMLVisualIDRegistry.getVisualID(node)) {
+ case RedefinableTemplateSignatureEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(node));
+ break;
+ case SignalAttributeCompartment2EditPart.VISUAL_ID:
+ for (Iterator cit = node.getChildren().iterator(); cit.hasNext();) {
+ Node cnode = (Node) cit.next();
+ switch (UMLVisualIDRegistry.getVisualID(cnode)) {
+ case Property2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
+ return getGEFWrapper(new AssociationClass2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4001 == req.getElementType()) {
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4019 == req.getElementType()) {
+ return getGEFWrapper(new Association3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Generalization_4002 == req.getElementType()) {
+ return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Substitution_4004 == req.getElementType()) {
+ return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return getGEFWrapper(new PackageImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
+ return getGEFWrapper(new AssociationClass2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4001 == req.getElementType()) {
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4019 == req.getElementType()) {
+ return getGEFWrapper(new Association3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Generalization_4002 == req.getElementType()) {
+ return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Substitution_4004 == req.getElementType()) {
+ return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case AssociationClass2EditPart.VISUAL_ID:
+ return getGEFWrapper(new AssociationClassReorientCommand(req));
+ case AssociationEditPart.VISUAL_ID:
+ return getGEFWrapper(new AssociationReorientCommand(req));
+ case Association3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Association2ReorientCommand(req));
+ case GeneralizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new GeneralizationReorientCommand(req));
+ case SubstitutionEditPart.VISUAL_ID:
+ return getGEFWrapper(new SubstitutionReorientCommand(req));
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case ElementImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new ElementImportReorientCommand(req));
+ case PackageImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new PackageImportReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/SignalAttributeCompartment2CanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/SignalAttributeCompartment2CanonicalEditPolicy.java
new file mode 100644
index 00000000000..71a2814b4b9
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/SignalAttributeCompartment2CanonicalEditPolicy.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Property2EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class SignalAttributeCompartment2CanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getSignalAttributeCompartment_7026SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case Property2EditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getSignal_OwnedAttribute());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/SignalAttributeCompartment2ItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/SignalAttributeCompartment2ItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..44dc4b137d0
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/SignalAttributeCompartment2ItemSemanticEditPolicy.java
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Property2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class SignalAttributeCompartment2ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.Property_3005 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getSignal_OwnedAttribute());
+ }
+ return getGEFWrapper(new Property2CreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/SignalAttributeCompartmentCanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/SignalAttributeCompartmentCanonicalEditPolicy.java
new file mode 100644
index 00000000000..b9d8ba9cdf5
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/SignalAttributeCompartmentCanonicalEditPolicy.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Property2EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class SignalAttributeCompartmentCanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getSignalAttributeCompartment_7005SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case Property2EditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getSignal_OwnedAttribute());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/SignalAttributeCompartmentItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/SignalAttributeCompartmentItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..a29f6a8ff51
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/SignalAttributeCompartmentItemSemanticEditPolicy.java
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Property2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class SignalAttributeCompartmentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.Property_3005 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getSignal_OwnedAttribute());
+ }
+ return getGEFWrapper(new Property2CreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/SignalCanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/SignalCanonicalEditPolicy.java
new file mode 100644
index 00000000000..469d279a3f6
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/SignalCanonicalEditPolicy.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RedefinableTemplateSignatureEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.clazz.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class SignalCanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getSignal_2003SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((UMLNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = UMLVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case RedefinableTemplateSignatureEditPart.VISUAL_ID:
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getTemplateableElement_OwnedTemplateSignature());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/SignalItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/SignalItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..af57707ebe0
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/SignalItemSemanticEditPolicy.java
@@ -0,0 +1,308 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Association2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Association3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationClass2CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationClassReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AssociationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.GeneralizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.GeneralizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.PackageImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RedefinableTemplateSignatureCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SubstitutionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.SubstitutionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Association3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationClass2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.GeneralizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Property2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RedefinableTemplateSignatureEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SignalAttributeCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SubstitutionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class SignalItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.RedefinableTemplateSignature_3015 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(UMLPackage.eINSTANCE.getTemplateableElement_OwnedTemplateSignature());
+ }
+ return getGEFWrapper(new RedefinableTemplateSignatureCreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyChildNodesCommand(cc);
+ addDestroyShortcutsCommand(cc);
+ View view = (View) getHost().getModel();
+ if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
+ req.setElementToDestroy(view);
+ }
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addDestroyChildNodesCommand(CompoundCommand cmd) {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
+ if (annotation != null) {
+ return;
+ }
+ for (Iterator it = view.getChildren().iterator(); it.hasNext();) {
+ Node node = (Node) it.next();
+ switch (UMLVisualIDRegistry.getVisualID(node)) {
+ case RedefinableTemplateSignatureEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(node));
+ break;
+ case SignalAttributeCompartmentEditPart.VISUAL_ID:
+ for (Iterator cit = node.getChildren().iterator(); cit.hasNext();) {
+ Node cnode = (Node) cit.next();
+ switch (UMLVisualIDRegistry.getVisualID(cnode)) {
+ case Property2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
+ return getGEFWrapper(new AssociationClass2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4001 == req.getElementType()) {
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4019 == req.getElementType()) {
+ return getGEFWrapper(new Association3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Generalization_4002 == req.getElementType()) {
+ return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Substitution_4004 == req.getElementType()) {
+ return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return getGEFWrapper(new PackageImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
+ return getGEFWrapper(new AssociationClass2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4001 == req.getElementType()) {
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Association_4019 == req.getElementType()) {
+ return getGEFWrapper(new Association3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Generalization_4002 == req.getElementType()) {
+ return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Substitution_4004 == req.getElementType()) {
+ return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.PackageImport_4010 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case AssociationClass2EditPart.VISUAL_ID:
+ return getGEFWrapper(new AssociationClassReorientCommand(req));
+ case AssociationEditPart.VISUAL_ID:
+ return getGEFWrapper(new AssociationReorientCommand(req));
+ case Association3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Association2ReorientCommand(req));
+ case GeneralizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new GeneralizationReorientCommand(req));
+ case SubstitutionEditPart.VISUAL_ID:
+ return getGEFWrapper(new SubstitutionReorientCommand(req));
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case ElementImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new ElementImportReorientCommand(req));
+ case PackageImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new PackageImportReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/SlotItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/SlotItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..c26fab07cc2
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/SlotItemSemanticEditPolicy.java
@@ -0,0 +1,117 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class SlotItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyShortcutsCommand(cc);
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/SubstitutionItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/SubstitutionItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..661d611fe87
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/SubstitutionItemSemanticEditPolicy.java
@@ -0,0 +1,179 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class SubstitutionItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ return getGEFWrapper(new DestroyElementCommand(req));
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case ElementImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new ElementImportReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/TemplateBindingItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/TemplateBindingItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..e291eb2a515
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/TemplateBindingItemSemanticEditPolicy.java
@@ -0,0 +1,113 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class TemplateBindingItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ return getGEFWrapper(new DestroyElementCommand(req));
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/TemplateParameterItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/TemplateParameterItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..7beeb71c6ef
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/TemplateParameterItemSemanticEditPolicy.java
@@ -0,0 +1,117 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class TemplateParameterItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyShortcutsCommand(cc);
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/UMLBaseItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/UMLBaseItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..b6a24312c04
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/UMLBaseItemSemanticEditPolicy.java
@@ -0,0 +1,646 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collections;
+import java.util.Iterator;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gef.requests.ReconnectRequest;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.SemanticEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandRequestWrapper;
+import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
+import org.eclipse.gmf.runtime.emf.type.core.IEditHelperContext;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.GetEditContextRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.helpers.UMLBaseEditHelper;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.BehavioredClassifier;
+import org.eclipse.uml2.uml.Classifier;
+import org.eclipse.uml2.uml.Comment;
+import org.eclipse.uml2.uml.Constraint;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Interface;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.Namespace;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.PackageableElement;
+import org.eclipse.uml2.uml.Profile;
+import org.eclipse.uml2.uml.TemplateableElement;
+import org.eclipse.uml2.uml.Type;
+
+/**
+ * @generated
+ */
+public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy {
+
+ /**
+ * Extended request data key to hold editpart visual id.
+ *
+ * @generated
+ */
+ public static final String VISUAL_ID_KEY = "visual_id"; //$NON-NLS-1$
+
+ /**
+ * Extended request data key to hold editpart visual id. Add visual id of edited editpart to extended data of the request so command switch can decide what kind of diagram element is being edited.
+ * It is done in those cases when it's not possible to deduce diagram element kind from domain element.
+ *
+ * @generated
+ */
+ public Command getCommand(Request request) {
+ if (request instanceof ReconnectRequest) {
+ Object view = ((ReconnectRequest) request).getConnectionEditPart().getModel();
+ if (view instanceof View) {
+ Integer id = new Integer(UMLVisualIDRegistry.getVisualID((View) view));
+ request.getExtendedData().put(VISUAL_ID_KEY, id);
+ }
+ }
+ return super.getCommand(request);
+ }
+
+ /**
+ * Returns visual id from request parameters.
+ *
+ * @generated
+ */
+ protected int getVisualID(IEditCommandRequest request) {
+ Object id = request.getParameter(VISUAL_ID_KEY);
+ return id instanceof Integer ? ((Integer) id).intValue() : -1;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getSemanticCommand(IEditCommandRequest request) {
+ IEditCommandRequest completedRequest = completeRequest(request);
+ Object editHelperContext = completedRequest.getEditHelperContext();
+ if (editHelperContext instanceof View || (editHelperContext instanceof IEditHelperContext && ((IEditHelperContext) editHelperContext).getEObject() instanceof View)) {
+ // no semantic commands are provided for pure design elements
+ return null;
+ }
+ if (editHelperContext == null) {
+ editHelperContext = ViewUtil.resolveSemanticElement((View) getHost().getModel());
+ }
+ IElementType elementType = ElementTypeRegistry.getInstance().getElementType(editHelperContext);
+ if (elementType == ElementTypeRegistry.getInstance().getType("org.eclipse.gmf.runtime.emf.type.core.default")) { //$NON-NLS-1$
+ elementType = null;
+ }
+ Command semanticCommand = getSemanticCommandSwitch(completedRequest);
+ if (elementType != null) {
+ if (semanticCommand != null) {
+ ICommand command = semanticCommand instanceof ICommandProxy ? ((ICommandProxy) semanticCommand).getICommand() : new CommandProxy(semanticCommand);
+ completedRequest.setParameter(UMLBaseEditHelper.EDIT_POLICY_COMMAND, command);
+ }
+ ICommand command = elementType.getEditCommand(completedRequest);
+ if (command != null) {
+ if (!(command instanceof CompositeTransactionalCommand)) {
+ TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
+ command = new CompositeTransactionalCommand(editingDomain, command.getLabel()).compose(command);
+ }
+ semanticCommand = new ICommandProxy(command);
+ }
+ }
+ boolean shouldProceed = true;
+ if (completedRequest instanceof DestroyRequest) {
+ shouldProceed = shouldProceed((DestroyRequest) completedRequest);
+ }
+ if (shouldProceed) {
+ if (completedRequest instanceof DestroyRequest) {
+ TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
+ Command deleteViewCommand = new ICommandProxy(new DeleteCommand(editingDomain, (View) getHost().getModel()));
+ semanticCommand = semanticCommand == null ? deleteViewCommand : semanticCommand.chain(deleteViewCommand);
+ }
+ return semanticCommand;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getSemanticCommandSwitch(IEditCommandRequest req) {
+ if (req instanceof CreateRelationshipRequest) {
+ return getCreateRelationshipCommand((CreateRelationshipRequest) req);
+ } else if (req instanceof CreateElementRequest) {
+ return getCreateCommand((CreateElementRequest) req);
+ } else if (req instanceof ConfigureRequest) {
+ return getConfigureCommand((ConfigureRequest) req);
+ } else if (req instanceof DestroyElementRequest) {
+ return getDestroyElementCommand((DestroyElementRequest) req);
+ } else if (req instanceof DestroyReferenceRequest) {
+ return getDestroyReferenceCommand((DestroyReferenceRequest) req);
+ } else if (req instanceof DuplicateElementsRequest) {
+ return getDuplicateCommand((DuplicateElementsRequest) req);
+ } else if (req instanceof GetEditContextRequest) {
+ return getEditContextCommand((GetEditContextRequest) req);
+ } else if (req instanceof MoveRequest) {
+ return getMoveCommand((MoveRequest) req);
+ } else if (req instanceof ReorientReferenceRelationshipRequest) {
+ return getReorientReferenceRelationshipCommand((ReorientReferenceRelationshipRequest) req);
+ } else if (req instanceof ReorientRelationshipRequest) {
+ return getReorientRelationshipCommand((ReorientRelationshipRequest) req);
+ } else if (req instanceof SetRequest) {
+ return getSetCommand((SetRequest) req);
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getConfigureCommand(ConfigureRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getSetCommand(SetRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getEditContextCommand(GetEditContextRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyReferenceCommand(DestroyReferenceRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getDuplicateCommand(DuplicateElementsRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getMoveCommand(MoveRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * @generated
+ */
+ protected final Command getGEFWrapper(ICommand cmd) {
+ return new ICommandProxy(cmd);
+ }
+
+ /**
+ * @deprecated use getGEFWrapper() instead
+ * @generated
+ */
+ protected final Command getMSLWrapper(ICommand cmd) {
+ // XXX deprecated: use getGEFWrapper() instead
+ return getGEFWrapper(cmd);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getSemanticElement() {
+ return ViewUtil.resolveSemanticElement((View) getHost().getModel());
+ }
+
+ /**
+ * Returns editing domain from the host edit part.
+ *
+ * @generated
+ */
+ protected TransactionalEditingDomain getEditingDomain() {
+ return ((IGraphicalEditPart) getHost()).getEditingDomain();
+ }
+
+ /**
+ * Creates command to destroy the link.
+ *
+ * @generated
+ */
+ protected Command getDestroyElementCommand(View view) {
+ EditPart editPart = (EditPart) getHost().getViewer().getEditPartRegistry().get(view);
+ DestroyElementRequest request = new DestroyElementRequest(getEditingDomain(), false);
+ return editPart.getCommand(new EditCommandRequestWrapper(request, Collections.EMPTY_MAP));
+ }
+
+ /**
+ * Creates commands to destroy all host incoming and outgoing links.
+ *
+ * @generated
+ */
+ protected CompoundCommand getDestroyEdgesCommand() {
+ CompoundCommand cmd = new CompoundCommand();
+ View view = (View) getHost().getModel();
+ for (Iterator it = view.getSourceEdges().iterator(); it.hasNext();) {
+ cmd.add(getDestroyElementCommand((Edge) it.next()));
+ }
+ for (Iterator it = view.getTargetEdges().iterator(); it.hasNext();) {
+ cmd.add(getDestroyElementCommand((Edge) it.next()));
+ }
+ return cmd;
+ }
+
+ /**
+ * @generated
+ */
+ protected void addDestroyShortcutsCommand(CompoundCommand command) {
+ View view = (View) getHost().getModel();
+ if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
+ return;
+ }
+ for (Iterator it = view.getDiagram().getChildren().iterator(); it.hasNext();) {
+ View nextView = (View) it.next();
+ if (nextView.getEAnnotation("Shortcut") == null || !nextView.isSetElement() || nextView.getElement() != view.getElement()) { //$NON-NLS-1$
+ continue;
+ }
+ command.add(getDestroyElementCommand(nextView));
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static class LinkConstraints {
+
+ /**
+ * @generated
+ */
+ private static final String OPPOSITE_END_VAR = "oppositeEnd"; //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static boolean canCreateLink_4016() {
+ return canExistLink_4016();
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canCreateAssociationClass_4017(Package container, Type source, Type target) {
+ return canExistAssociationClass_4017(container, source, target);
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canCreateAssociation_4001(Package container, Type source, Type target) {
+ return canExistAssociation_4001(container, source, target);
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canCreateAssociation_4019(Package container, Type source, Type target) {
+ return canExistAssociation_4019(container, source, target);
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canCreateGeneralization_4002(Classifier source, Classifier target) {
+ return canExistGeneralization_4002(source, target);
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canCreateInterfaceRealization_4003(BehavioredClassifier source, Interface target) {
+ return canExistInterfaceRealization_4003(source, target);
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canCreateSubstitution_4004(Classifier container, Classifier source, Classifier target) {
+ return canExistSubstitution_4004(container, source, target);
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canCreateRealization_4005(Package container, NamedElement source, NamedElement target) {
+ return canExistRealization_4005(container, source, target);
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canCreateAbstraction_4006(Package container, NamedElement source, NamedElement target) {
+ return canExistAbstraction_4006(container, source, target);
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canCreateUsage_4007(Package container, NamedElement source, NamedElement target) {
+ return canExistUsage_4007(container, source, target);
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canCreateDependency_4008(Package container, NamedElement source, NamedElement target) {
+ return canExistDependency_4008(container, source, target);
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canCreateDependency_4018(Package container, NamedElement source, NamedElement target) {
+ return canExistDependency_4018(container, source, target);
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canCreateElementImport_4009(Namespace source, PackageableElement target) {
+ return canExistElementImport_4009(source, target);
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canCreatePackageImport_4010(Namespace source, Package target) {
+ return canExistPackageImport_4010(source, target);
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canCreatePackageMerge_4011(Package container, Package source, Package target) {
+ return canExistPackageMerge_4011(container, source, target);
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canCreateProfileApplication_4012(Package source, Profile target) {
+ return canExistProfileApplication_4012(source, target);
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canCreateCommentAnnotatedElement_4013(Comment source, Element target) {
+ if (source != null) {
+ if (source.getAnnotatedElements().contains(target)) {
+ return false;
+ }
+ }
+ return canExistCommentAnnotatedElement_4013(source, target);
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canCreateConstraintConstrainedElement_4014(Constraint source, Element target) {
+ if (source != null) {
+ if (source.getConstrainedElements().contains(target)) {
+ return false;
+ }
+ }
+ return canExistConstraintConstrainedElement_4014(source, target);
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canCreateTemplateBinding_4015(TemplateableElement container, TemplateableElement source, Element target) {
+ return canExistTemplateBinding_4015(container, source, target);
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canExistLink_4016() {
+
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canExistAssociationClass_4017(Package container, Type source, Type target) {
+
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canExistAssociation_4001(Package container, Type source, Type target) {
+
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canExistAssociation_4019(Package container, Type source, Type target) {
+
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canExistGeneralization_4002(Classifier source, Classifier target) {
+
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canExistInterfaceRealization_4003(BehavioredClassifier source, Interface target) {
+
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canExistSubstitution_4004(Classifier container, Classifier source, Classifier target) {
+
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canExistRealization_4005(Package container, NamedElement source, NamedElement target) {
+
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canExistAbstraction_4006(Package container, NamedElement source, NamedElement target) {
+
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canExistUsage_4007(Package container, NamedElement source, NamedElement target) {
+
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canExistDependency_4008(Package container, NamedElement source, NamedElement target) {
+
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canExistDependency_4018(Package container, NamedElement source, NamedElement target) {
+
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canExistElementImport_4009(Namespace source, PackageableElement target) {
+
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canExistPackageImport_4010(Namespace source, Package target) {
+
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canExistPackageMerge_4011(Package container, Package source, Package target) {
+
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canExistProfileApplication_4012(Package source, Profile target) {
+
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canExistCommentAnnotatedElement_4013(Comment source, Element target) {
+
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canExistConstraintConstrainedElement_4014(Constraint source, Element target) {
+
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canExistTemplateBinding_4015(TemplateableElement container, TemplateableElement source, Element target) {
+
+ return true;
+ }
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/UMLTextNonResizableEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/UMLTextNonResizableEditPolicy.java
new file mode 100644
index 00000000000..6042aee3142
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/UMLTextNonResizableEditPolicy.java
@@ -0,0 +1,213 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.handles.MoveHandle;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.NonResizableEditPolicyEx;
+import org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+
+/**
+ * @generated
+ */
+public class UMLTextNonResizableEditPolicy extends NonResizableEditPolicyEx {
+
+ /**
+ * @generated
+ */
+ private IFigure selectionFeedbackFigure;
+
+ /**
+ * @generated
+ */
+ private IFigure focusFeedbackFigure;
+
+ /**
+ * @generated
+ */
+ protected void showPrimarySelection() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setSelected(true);
+ ((WrappingLabel) getHostFigure()).setFocus(true);
+ } else {
+ showSelection();
+ showFocus();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void showSelection() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setSelected(true);
+ ((WrappingLabel) getHostFigure()).setFocus(false);
+ } else {
+ hideSelection();
+ addFeedback(selectionFeedbackFigure = createSelectionFeedbackFigure());
+ refreshSelectionFeedback();
+ hideFocus();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void hideSelection() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setSelected(false);
+ ((WrappingLabel) getHostFigure()).setFocus(false);
+ } else {
+ if (selectionFeedbackFigure != null) {
+ removeFeedback(selectionFeedbackFigure);
+ selectionFeedbackFigure = null;
+ }
+ hideFocus();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void showFocus() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setFocus(true);
+ } else {
+ hideFocus();
+ addFeedback(focusFeedbackFigure = createFocusFeedbackFigure());
+ refreshFocusFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void hideFocus() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setFocus(false);
+ } else {
+ if (focusFeedbackFigure != null) {
+ removeFeedback(focusFeedbackFigure);
+ focusFeedbackFigure = null;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Rectangle getFeedbackBounds() {
+ Rectangle bounds;
+ if (getHostFigure() instanceof Label) {
+ bounds = ((Label) getHostFigure()).getTextBounds();
+ bounds.intersect(getHostFigure().getBounds());
+ } else {
+ bounds = getHostFigure().getBounds().getCopy();
+ }
+ getHostFigure().getParent().translateToAbsolute(bounds);
+ getFeedbackLayer().translateToRelative(bounds);
+ return bounds;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createSelectionFeedbackFigure() {
+ if (getHostFigure() instanceof Label) {
+ Label feedbackFigure = new Label();
+ feedbackFigure.setOpaque(true);
+ feedbackFigure.setBackgroundColor(ColorConstants.menuBackgroundSelected);
+ feedbackFigure.setForegroundColor(ColorConstants.menuForegroundSelected);
+ return feedbackFigure;
+ } else {
+ RectangleFigure feedbackFigure = new RectangleFigure();
+ feedbackFigure.setFill(false);
+ return feedbackFigure;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFocusFeedbackFigure() {
+ return new Figure() {
+
+ protected void paintFigure(Graphics graphics) {
+ graphics.drawFocus(getBounds().getResized(-1, -1));
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ protected void updateLabel(Label target) {
+ Label source = (Label) getHostFigure();
+ target.setText(source.getText());
+ target.setTextAlignment(source.getTextAlignment());
+ target.setFont(source.getFont());
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshSelectionFeedback() {
+ if (selectionFeedbackFigure != null) {
+ if (selectionFeedbackFigure instanceof Label) {
+ updateLabel((Label) selectionFeedbackFigure);
+ selectionFeedbackFigure.setBounds(getFeedbackBounds());
+ } else {
+ selectionFeedbackFigure.setBounds(getFeedbackBounds().expand(5, 5));
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFocusFeedback() {
+ if (focusFeedbackFigure != null) {
+ focusFeedbackFigure.setBounds(getFeedbackBounds());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void refreshFeedback() {
+ refreshSelectionFeedback();
+ refreshFocusFeedback();
+ }
+
+ /**
+ * @generated
+ */
+ protected List createSelectionHandles() {
+ MoveHandle moveHandle = new MoveHandle((GraphicalEditPart) getHost());
+ moveHandle.setBorder(null);
+ moveHandle.setDragTracker(new DragEditPartsTrackerEx(getHost()));
+ return Collections.singletonList(moveHandle);
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/UMLTextSelectionEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/UMLTextSelectionEditPolicy.java
new file mode 100644
index 00000000000..04fbd079928
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/UMLTextSelectionEditPolicy.java
@@ -0,0 +1,197 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.editpolicies.SelectionEditPolicy;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+
+/**
+ * @generated
+ */
+public class UMLTextSelectionEditPolicy extends SelectionEditPolicy {
+
+ /**
+ * @generated
+ */
+ private IFigure selectionFeedbackFigure;
+
+ /**
+ * @generated
+ */
+ private IFigure focusFeedbackFigure;
+
+ /**
+ * @generated
+ */
+ protected void showPrimarySelection() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setSelected(true);
+ ((WrappingLabel) getHostFigure()).setFocus(true);
+ } else {
+ showSelection();
+ showFocus();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void showSelection() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setSelected(true);
+ ((WrappingLabel) getHostFigure()).setFocus(false);
+ } else {
+ hideSelection();
+ addFeedback(selectionFeedbackFigure = createSelectionFeedbackFigure());
+ refreshSelectionFeedback();
+ hideFocus();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void hideSelection() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setSelected(false);
+ ((WrappingLabel) getHostFigure()).setFocus(false);
+ } else {
+ if (selectionFeedbackFigure != null) {
+ removeFeedback(selectionFeedbackFigure);
+ selectionFeedbackFigure = null;
+ }
+ hideFocus();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void showFocus() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setFocus(true);
+ } else {
+ hideFocus();
+ addFeedback(focusFeedbackFigure = createFocusFeedbackFigure());
+ refreshFocusFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void hideFocus() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setFocus(false);
+ } else {
+ if (focusFeedbackFigure != null) {
+ removeFeedback(focusFeedbackFigure);
+ focusFeedbackFigure = null;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Rectangle getFeedbackBounds() {
+ Rectangle bounds;
+ if (getHostFigure() instanceof Label) {
+ bounds = ((Label) getHostFigure()).getTextBounds();
+ bounds.intersect(getHostFigure().getBounds());
+ } else {
+ bounds = getHostFigure().getBounds().getCopy();
+ }
+ getHostFigure().getParent().translateToAbsolute(bounds);
+ getFeedbackLayer().translateToRelative(bounds);
+ return bounds;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createSelectionFeedbackFigure() {
+ if (getHostFigure() instanceof Label) {
+ Label feedbackFigure = new Label();
+ feedbackFigure.setOpaque(true);
+ feedbackFigure.setBackgroundColor(ColorConstants.menuBackgroundSelected);
+ feedbackFigure.setForegroundColor(ColorConstants.menuForegroundSelected);
+ return feedbackFigure;
+ } else {
+ RectangleFigure feedbackFigure = new RectangleFigure();
+ feedbackFigure.setFill(false);
+ return feedbackFigure;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFocusFeedbackFigure() {
+ return new Figure() {
+
+ protected void paintFigure(Graphics graphics) {
+ graphics.drawFocus(getBounds().getResized(-1, -1));
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ protected void updateLabel(Label target) {
+ Label source = (Label) getHostFigure();
+ target.setText(source.getText());
+ target.setTextAlignment(source.getTextAlignment());
+ target.setFont(source.getFont());
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshSelectionFeedback() {
+ if (selectionFeedbackFigure != null) {
+ if (selectionFeedbackFigure instanceof Label) {
+ updateLabel((Label) selectionFeedbackFigure);
+ selectionFeedbackFigure.setBounds(getFeedbackBounds());
+ } else {
+ selectionFeedbackFigure.setBounds(getFeedbackBounds().expand(5, 5));
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFocusFeedback() {
+ if (focusFeedbackFigure != null) {
+ focusFeedbackFigure.setBounds(getFeedbackBounds());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void refreshFeedback() {
+ refreshSelectionFeedback();
+ refreshFocusFeedback();
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/UsageItemSemanticEditPolicy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/UsageItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..33c2230de88
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/policies/UsageItemSemanticEditPolicy.java
@@ -0,0 +1,179 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.AbstractionReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency2ReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.Dependency3CreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.DependencyReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.ElementImportReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.RealizationReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.TemplateBindingReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.commands.UsageReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class UsageItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ return getGEFWrapper(new DestroyElementCommand(req));
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return null;
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (UMLElementTypes.Realization_4005 == req.getElementType()) {
+ return getGEFWrapper(new RealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Abstraction_4006 == req.getElementType()) {
+ return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Usage_4007 == req.getElementType()) {
+ return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4008 == req.getElementType()) {
+ return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Dependency_4018 == req.getElementType()) {
+ return getGEFWrapper(new Dependency3CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ElementImport_4009 == req.getElementType()) {
+ return getGEFWrapper(new ElementImportCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.CommentAnnotatedElement_4013 == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.ConstraintConstrainedElement_4014 == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
+ return getGEFWrapper(new TemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case RealizationEditPart.VISUAL_ID:
+ return getGEFWrapper(new RealizationReorientCommand(req));
+ case AbstractionEditPart.VISUAL_ID:
+ return getGEFWrapper(new AbstractionReorientCommand(req));
+ case UsageEditPart.VISUAL_ID:
+ return getGEFWrapper(new UsageReorientCommand(req));
+ case DependencyEditPart.VISUAL_ID:
+ return getGEFWrapper(new DependencyReorientCommand(req));
+ case Dependency3EditPart.VISUAL_ID:
+ return getGEFWrapper(new Dependency2ReorientCommand(req));
+ case ElementImportEditPart.VISUAL_ID:
+ return getGEFWrapper(new ElementImportReorientCommand(req));
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getGEFWrapper(new TemplateBindingReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/expressions/UMLAbstractExpression.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/expressions/UMLAbstractExpression.java
new file mode 100644
index 00000000000..f1d6f5220d0
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/expressions/UMLAbstractExpression.java
@@ -0,0 +1,162 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.expressions;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.Collections;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EEnum;
+import org.eclipse.emf.ecore.EEnumLiteral;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+public abstract class UMLAbstractExpression {
+
+ /**
+ * @generated
+ */
+ private IStatus status = Status.OK_STATUS;
+
+ /**
+ * @generated
+ */
+ protected void setStatus(int severity, String message, Throwable throwable) {
+ String pluginID = UMLDiagramEditorPlugin.ID;
+ this.status = new Status(severity, pluginID, -1, (message != null) ? message : "", throwable); //$NON-NLS-1$
+ if (!this.status.isOK()) {
+ UMLDiagramEditorPlugin.getInstance().logError("Expression problem:" + message + "body:" + body(), throwable); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public IStatus getStatus() {
+ return status;
+ }
+
+ /**
+ * @generated
+ */
+ private final String myBody;
+
+ /**
+ * @generated
+ */
+ public String body() {
+ return myBody;
+ }
+
+ /**
+ * @generated
+ */
+ private final EClassifier myContext;
+
+ /**
+ * @generated
+ */
+ public EClassifier context() {
+ return myContext;
+ }
+
+ /**
+ * @generated
+ */
+ protected UMLAbstractExpression(String body, EClassifier context) {
+ myBody = body;
+ myContext = context;
+ }
+
+ /**
+ * @generated
+ */
+ protected abstract Object doEvaluate(Object context, Map env);
+
+ /**
+ * @generated
+ */
+ public Object evaluate(Object context) {
+ return evaluate(context, Collections.EMPTY_MAP);
+ }
+
+ /**
+ * @generated
+ */
+ public Object evaluate(Object context, Map env) {
+ if (context().isInstance(context)) {
+ try {
+ return doEvaluate(context, env);
+ } catch (Exception e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Expression evaluation failure: " + body(), e);//$NON-NLS-1$
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Expression may return number value which is not directly compatible with feature type (e.g. Double when Integer is expected), or EEnumLiteral meta-object when literal instance is expected
+ *
+ * @generated
+ */
+ public static Object performCast(Object value, EDataType targetType) {
+ if (targetType instanceof EEnum) {
+ if (value instanceof EEnumLiteral) {
+ EEnumLiteral literal = (EEnumLiteral) value;
+ return (literal.getInstance() != null) ? literal.getInstance() : literal;
+ }
+ }
+ if (false == value instanceof Number || targetType == null || targetType.getInstanceClass() == null) {
+ return value;
+ }
+ Class targetClass = targetType.getInstanceClass();
+ Number num = (Number) value;
+ Class valClass = value.getClass();
+ Class targetWrapperClass = targetClass;
+ if (targetClass.isPrimitive()) {
+ targetWrapperClass = EcoreUtil.wrapperClassFor(targetClass);
+ }
+ if (valClass.equals(targetWrapperClass)) {
+ return value;
+ }
+ if (Number.class.isAssignableFrom(targetWrapperClass)) {
+ if (targetWrapperClass.equals(Byte.class))
+ return new Byte(num.byteValue());
+ if (targetWrapperClass.equals(Integer.class))
+ return new Integer(num.intValue());
+ if (targetWrapperClass.equals(Short.class))
+ return new Short(num.shortValue());
+ if (targetWrapperClass.equals(Long.class))
+ return new Long(num.longValue());
+ if (targetWrapperClass.equals(BigInteger.class))
+ return BigInteger.valueOf(num.longValue());
+ if (targetWrapperClass.equals(Float.class))
+ return new Float(num.floatValue());
+ if (targetWrapperClass.equals(Double.class))
+ return new Double(num.doubleValue());
+ if (targetWrapperClass.equals(BigDecimal.class))
+ return new BigDecimal(num.doubleValue());
+ }
+ return value;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/expressions/UMLOCLFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/expressions/UMLOCLFactory.java
new file mode 100644
index 00000000000..fdc39d63a16
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/expressions/UMLOCLFactory.java
@@ -0,0 +1,181 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.expressions;
+
+import java.lang.ref.WeakReference;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.ocl.Environment;
+import org.eclipse.ocl.EvaluationEnvironment;
+import org.eclipse.ocl.ParserException;
+import org.eclipse.ocl.Query;
+import org.eclipse.ocl.ecore.EcoreFactory;
+import org.eclipse.ocl.expressions.OCLExpression;
+import org.eclipse.ocl.expressions.OperationCallExp;
+import org.eclipse.ocl.expressions.Variable;
+import org.eclipse.ocl.helper.OCLHelper;
+import org.eclipse.ocl.utilities.AbstractVisitor;
+import org.eclipse.ocl.utilities.PredefinedType;
+
+/**
+ * @generated
+ */
+public class UMLOCLFactory {
+
+ /**
+ * @generated
+ */
+ private UMLOCLFactory() {
+ }
+
+ /**
+ * @generated
+ */
+ public static UMLAbstractExpression getExpression(String body, EClassifier context, Map environment) {
+ return new Expression(body, context, environment);
+ }
+
+ /**
+ * @generated
+ */
+ public static UMLAbstractExpression getExpression(String body, EClassifier context) {
+ return getExpression(body, context, Collections.EMPTY_MAP);
+ }
+
+ /**
+ * @generated
+ */
+ private static class Expression extends UMLAbstractExpression {
+
+ /**
+ * @generated
+ */
+ private WeakReference queryRef;
+
+ /**
+ * @generated
+ */
+ private final org.eclipse.ocl.ecore.OCL oclInstance;
+
+ /**
+ * @generated
+ */
+ public Expression(String body, EClassifier context, Map environment) {
+ super(body, context);
+ oclInstance = org.eclipse.ocl.ecore.OCL.newInstance();
+ initCustomEnv(oclInstance.getEnvironment(), environment);
+ }
+
+ /**
+ * @generated
+ */
+ protected Query getQuery() {
+ Query oclQuery = null;
+ if (this.queryRef != null) {
+ oclQuery = (Query) this.queryRef.get();
+ }
+ if (oclQuery == null) {
+ OCLHelper oclHelper = oclInstance.createOCLHelper();
+ oclHelper.setContext(context());
+ try {
+ OCLExpression oclExpression = oclHelper.createQuery(body());
+ oclQuery = oclInstance.createQuery(oclExpression);
+ this.queryRef = new WeakReference(oclQuery);
+ setStatus(IStatus.OK, null, null);
+ } catch (ParserException e) {
+ setStatus(IStatus.ERROR, e.getMessage(), e);
+ }
+ }
+ return oclQuery;
+ }
+
+ /**
+ * @generated
+ */
+ protected Object doEvaluate(Object context, Map env) {
+ Query oclQuery = getQuery();
+ if (oclQuery == null) {
+ return null;
+ }
+ EvaluationEnvironment evalEnv = oclQuery.getEvaluationEnvironment();
+ // init environment
+ for (Iterator it = env.entrySet().iterator(); it.hasNext();) {
+ Map.Entry nextEntry = (Map.Entry) it.next();
+ evalEnv.replace((String) nextEntry.getKey(), nextEntry.getValue());
+ }
+ try {
+ initExtentMap(context);
+ Object result = oclQuery.evaluate(context);
+ return (result != oclInstance.getEnvironment().getOCLStandardLibrary().getOclInvalid()) ? result : null;
+ } finally {
+ evalEnv.clear();
+ oclQuery.getExtentMap().clear();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void initExtentMap(Object context) {
+ if (!getStatus().isOK() || context == null) {
+ return;
+ }
+ final Query queryToInit = getQuery();
+ final Object extentContext = context;
+ queryToInit.getExtentMap().clear();
+ if (queryToInit.queryText() != null && queryToInit.queryText().indexOf(PredefinedType.ALL_INSTANCES_NAME) >= 0) {
+ AbstractVisitor visitior = new AbstractVisitor() {
+
+ private boolean usesAllInstances = false;
+
+ public Object visitOperationCallExp(OperationCallExp oc) {
+ if (!usesAllInstances) {
+ usesAllInstances = PredefinedType.ALL_INSTANCES == oc.getOperationCode();
+ if (usesAllInstances) {
+ queryToInit.getExtentMap().putAll(oclInstance.getEvaluationEnvironment().createExtentMap(extentContext));
+ }
+ }
+ return super.visitOperationCallExp(oc);
+ }
+ };
+ queryToInit.getExpression().accept(visitior);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private static void initCustomEnv(Environment ecoreEnv, Map environment) {
+ for (Iterator it = environment.keySet().iterator(); it.hasNext();) {
+ String varName = (String) it.next();
+ EClassifier varType = (EClassifier) environment.get(varName);
+ ecoreEnv.addElement(varName, createVar(ecoreEnv, varName, varType), false);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private static Variable createVar(Environment ecoreEnv, String name, EClassifier type) {
+ Variable var = EcoreFactory.eINSTANCE.createVariable();
+ var.setName(name);
+ var.setType(ecoreEnv.getUMLReflection().getOCLType(type));
+ return var;
+ }
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/navigator/UMLAbstractNavigatorItem.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/navigator/UMLAbstractNavigatorItem.java
new file mode 100644
index 00000000000..e91e74519f5
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/navigator/UMLAbstractNavigatorItem.java
@@ -0,0 +1,71 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.navigator;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor;
+
+/**
+ * @generated
+ */
+public abstract class UMLAbstractNavigatorItem extends PlatformObject {
+
+ /**
+ * @generated
+ */
+ static {
+ final Class[] supportedTypes = new Class[] { ITabbedPropertySheetPageContributor.class };
+ final ITabbedPropertySheetPageContributor propertySheetPageContributor = new ITabbedPropertySheetPageContributor() {
+
+ public String getContributorId() {
+ return "org.eclipse.papyrus.diagram.clazz"; //$NON-NLS-1$
+ }
+ };
+ Platform.getAdapterManager().registerAdapters(new IAdapterFactory() {
+
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (adaptableObject instanceof org.eclipse.papyrus.diagram.clazz.navigator.UMLAbstractNavigatorItem && adapterType == ITabbedPropertySheetPageContributor.class) {
+ return propertySheetPageContributor;
+ }
+ return null;
+ }
+
+ public Class[] getAdapterList() {
+ return supportedTypes;
+ }
+ }, org.eclipse.papyrus.diagram.clazz.navigator.UMLAbstractNavigatorItem.class);
+ }
+
+ /**
+ * @generated
+ */
+ private Object myParent;
+
+ /**
+ * @generated
+ */
+ protected UMLAbstractNavigatorItem(Object parent) {
+ myParent = parent;
+ }
+
+ /**
+ * @generated
+ */
+ public Object getParent() {
+ return myParent;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/navigator/UMLDomainNavigatorContentProvider.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/navigator/UMLDomainNavigatorContentProvider.java
new file mode 100644
index 00000000000..003c3aaf18b
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/navigator/UMLDomainNavigatorContentProvider.java
@@ -0,0 +1,230 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.navigator;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
+import org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.navigator.ICommonContentExtensionSite;
+import org.eclipse.ui.navigator.ICommonContentProvider;
+
+/**
+ * @generated
+ */
+public class UMLDomainNavigatorContentProvider implements ICommonContentProvider {
+
+ /**
+ * @generated
+ */
+ private AdapterFactoryContentProvider myAdapterFctoryContentProvier;
+
+ /**
+ * @generated
+ */
+ private static final Object[] EMPTY_ARRAY = new Object[0];
+
+ /**
+ * @generated
+ */
+ private Viewer myViewer;
+
+ /**
+ * @generated
+ */
+ private AdapterFactoryEditingDomain myEditingDomain;
+
+ /**
+ * @generated
+ */
+ private WorkspaceSynchronizer myWorkspaceSynchronizer;
+
+ /**
+ * @generated
+ */
+ private Runnable myViewerRefreshRunnable;
+
+ /**
+ * @generated
+ */
+ public UMLDomainNavigatorContentProvider() {
+ myAdapterFctoryContentProvier = new AdapterFactoryContentProvider(UMLDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory());
+ TransactionalEditingDomain editingDomain = GMFEditingDomainFactory.INSTANCE.createEditingDomain();
+ myEditingDomain = (AdapterFactoryEditingDomain) editingDomain;
+ myEditingDomain.setResourceToReadOnlyMap(new HashMap() {
+
+ public Object get(Object key) {
+ if (!containsKey(key)) {
+ put(key, Boolean.TRUE);
+ }
+ return super.get(key);
+ }
+ });
+ myViewerRefreshRunnable = new Runnable() {
+
+ public void run() {
+ if (myViewer != null) {
+ myViewer.refresh();
+ }
+ }
+ };
+ myWorkspaceSynchronizer = new WorkspaceSynchronizer(editingDomain, new WorkspaceSynchronizer.Delegate() {
+
+ public void dispose() {
+ }
+
+ public boolean handleResourceChanged(final Resource resource) {
+ for (Iterator it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) {
+ Resource nextResource = (Resource) it.next();
+ nextResource.unload();
+ }
+ if (myViewer != null) {
+ myViewer.getControl().getDisplay().asyncExec(myViewerRefreshRunnable);
+ }
+ return true;
+ }
+
+ public boolean handleResourceDeleted(Resource resource) {
+ for (Iterator it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) {
+ Resource nextResource = (Resource) it.next();
+ nextResource.unload();
+ }
+ if (myViewer != null) {
+ myViewer.getControl().getDisplay().asyncExec(myViewerRefreshRunnable);
+ }
+ return true;
+ }
+
+ public boolean handleResourceMoved(Resource resource, final URI newURI) {
+ for (Iterator it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) {
+ Resource nextResource = (Resource) it.next();
+ nextResource.unload();
+ }
+ if (myViewer != null) {
+ myViewer.getControl().getDisplay().asyncExec(myViewerRefreshRunnable);
+ }
+ return true;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ public void dispose() {
+ myWorkspaceSynchronizer.dispose();
+ myWorkspaceSynchronizer = null;
+ myViewerRefreshRunnable = null;
+ for (Iterator it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) {
+ Resource resource = (Resource) it.next();
+ resource.unload();
+ }
+ ((TransactionalEditingDomain) myEditingDomain).dispose();
+ myEditingDomain = null;
+ }
+
+ /**
+ * @generated
+ */
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ myViewer = viewer;
+ }
+
+ /**
+ * @generated
+ */
+ public Object[] getElements(Object inputElement) {
+ return getChildren(inputElement);
+ }
+
+ /**
+ * @generated
+ */
+ public void restoreState(IMemento aMemento) {
+ }
+
+ /**
+ * @generated
+ */
+ public void saveState(IMemento aMemento) {
+ }
+
+ /**
+ * @generated
+ */
+ public void init(ICommonContentExtensionSite aConfig) {
+ }
+
+ /**
+ * @generated
+ */
+ public Object[] getChildren(Object parentElement) {
+ if (parentElement instanceof IFile) {
+ IFile file = (IFile) parentElement;
+ URI fileURI = URI.createPlatformResourceURI(file.getFullPath().toString(), true);
+ Resource resource = myEditingDomain.getResourceSet().getResource(fileURI, true);
+ return wrapEObjects(myAdapterFctoryContentProvier.getChildren(resource), parentElement);
+ }
+
+ if (parentElement instanceof UMLDomainNavigatorItem) {
+ return wrapEObjects(myAdapterFctoryContentProvier.getChildren(((UMLDomainNavigatorItem) parentElement).getEObject()), parentElement);
+ }
+ return EMPTY_ARRAY;
+ }
+
+ /**
+ * @generated
+ */
+ public Object[] wrapEObjects(Object[] objects, Object parentElement) {
+ Collection result = new ArrayList();
+ for (int i = 0; i < objects.length; i++) {
+ if (objects[i] instanceof EObject) {
+ result.add(new UMLDomainNavigatorItem((EObject) objects[i], parentElement, myAdapterFctoryContentProvier));
+ }
+ }
+ return result.toArray();
+ }
+
+ /**
+ * @generated
+ */
+ public Object getParent(Object element) {
+ if (element instanceof UMLAbstractNavigatorItem) {
+ UMLAbstractNavigatorItem abstractNavigatorItem = (UMLAbstractNavigatorItem) element;
+ return abstractNavigatorItem.getParent();
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean hasChildren(Object element) {
+ return element instanceof IFile || getChildren(element).length > 0;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/navigator/UMLDomainNavigatorItem.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/navigator/UMLDomainNavigatorItem.java
new file mode 100644
index 00000000000..2b262e33db0
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/navigator/UMLDomainNavigatorItem.java
@@ -0,0 +1,119 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.navigator;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.eclipse.ui.views.properties.IPropertySourceProvider;
+
+/**
+ * @generated
+ */
+public class UMLDomainNavigatorItem extends PlatformObject {
+
+ /**
+ * @generated
+ */
+ static {
+ final Class[] supportedTypes = new Class[] { EObject.class, IPropertySource.class };
+ Platform.getAdapterManager().registerAdapters(new IAdapterFactory() {
+
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (adaptableObject instanceof org.eclipse.papyrus.diagram.clazz.navigator.UMLDomainNavigatorItem) {
+ org.eclipse.papyrus.diagram.clazz.navigator.UMLDomainNavigatorItem domainNavigatorItem = (org.eclipse.papyrus.diagram.clazz.navigator.UMLDomainNavigatorItem) adaptableObject;
+ EObject eObject = domainNavigatorItem.getEObject();
+ if (adapterType == EObject.class) {
+ return eObject;
+ }
+ if (adapterType == IPropertySource.class) {
+ return domainNavigatorItem.getPropertySourceProvider().getPropertySource(eObject);
+ }
+ }
+
+ return null;
+ }
+
+ public Class[] getAdapterList() {
+ return supportedTypes;
+ }
+ }, org.eclipse.papyrus.diagram.clazz.navigator.UMLDomainNavigatorItem.class);
+ }
+
+ /**
+ * @generated
+ */
+ private Object myParent;
+
+ /**
+ * @generated
+ */
+ private EObject myEObject;
+
+ /**
+ * @generated
+ */
+ private IPropertySourceProvider myPropertySourceProvider;
+
+ /**
+ * @generated
+ */
+ public UMLDomainNavigatorItem(EObject eObject, Object parent, IPropertySourceProvider propertySourceProvider) {
+ myParent = parent;
+ myEObject = eObject;
+ myPropertySourceProvider = propertySourceProvider;
+ }
+
+ /**
+ * @generated
+ */
+ public Object getParent() {
+ return myParent;
+ }
+
+ /**
+ * @generated
+ */
+ public EObject getEObject() {
+ return myEObject;
+ }
+
+ /**
+ * @generated
+ */
+ public IPropertySourceProvider getPropertySourceProvider() {
+ return myPropertySourceProvider;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean equals(Object obj) {
+ if (obj instanceof org.eclipse.papyrus.diagram.clazz.navigator.UMLDomainNavigatorItem) {
+ return EcoreUtil.getURI(getEObject()).equals(EcoreUtil.getURI(((org.eclipse.papyrus.diagram.clazz.navigator.UMLDomainNavigatorItem) obj).getEObject()));
+ }
+ return super.equals(obj);
+ }
+
+ /**
+ * @generated
+ */
+ public int hashCode() {
+ return EcoreUtil.getURI(getEObject()).hashCode();
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/navigator/UMLDomainNavigatorLabelProvider.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/navigator/UMLDomainNavigatorLabelProvider.java
new file mode 100644
index 00000000000..3b436350f1c
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/navigator/UMLDomainNavigatorLabelProvider.java
@@ -0,0 +1,107 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.navigator;
+
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.navigator.ICommonContentExtensionSite;
+import org.eclipse.ui.navigator.ICommonLabelProvider;
+
+/**
+ * @generated
+ */
+public class UMLDomainNavigatorLabelProvider implements ICommonLabelProvider {
+
+ /**
+ * @generated
+ */
+ private AdapterFactoryLabelProvider myAdapterFactoryLabelProvider = new AdapterFactoryLabelProvider(UMLDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory());
+
+ /**
+ * @generated
+ */
+ public void init(ICommonContentExtensionSite aConfig) {
+ }
+
+ /**
+ * @generated
+ */
+ public Image getImage(Object element) {
+ if (element instanceof UMLDomainNavigatorItem) {
+ return myAdapterFactoryLabelProvider.getImage(((UMLDomainNavigatorItem) element).getEObject());
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public String getText(Object element) {
+ if (element instanceof UMLDomainNavigatorItem) {
+ return myAdapterFactoryLabelProvider.getText(((UMLDomainNavigatorItem) element).getEObject());
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public void addListener(ILabelProviderListener listener) {
+ myAdapterFactoryLabelProvider.addListener(listener);
+ }
+
+ /**
+ * @generated
+ */
+ public void dispose() {
+ myAdapterFactoryLabelProvider.dispose();
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isLabelProperty(Object element, String property) {
+ return myAdapterFactoryLabelProvider.isLabelProperty(element, property);
+ }
+
+ /**
+ * @generated
+ */
+ public void removeListener(ILabelProviderListener listener) {
+ myAdapterFactoryLabelProvider.removeListener(listener);
+ }
+
+ /**
+ * @generated
+ */
+ public void restoreState(IMemento aMemento) {
+ }
+
+ /**
+ * @generated
+ */
+ public void saveState(IMemento aMemento) {
+ }
+
+ /**
+ * @generated
+ */
+ public String getDescription(Object anElement) {
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/navigator/UMLNavigatorActionProvider.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/navigator/UMLNavigatorActionProvider.java
new file mode 100644
index 00000000000..b681015db34
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/navigator/UMLNavigatorActionProvider.java
@@ -0,0 +1,182 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.navigator;
+
+import java.util.Iterator;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.common.ui.URIEditorInput;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.Messages;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditor;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.navigator.CommonActionProvider;
+import org.eclipse.ui.navigator.ICommonActionConstants;
+import org.eclipse.ui.navigator.ICommonActionExtensionSite;
+import org.eclipse.ui.navigator.ICommonViewerWorkbenchSite;
+import org.eclipse.ui.part.FileEditorInput;
+
+/**
+ * @generated
+ */
+public class UMLNavigatorActionProvider extends CommonActionProvider {
+
+ /**
+ * @generated
+ */
+ private boolean myContribute;
+
+ /**
+ * @generated
+ */
+ private OpenDiagramAction myOpenDiagramAction;
+
+ /**
+ * @generated
+ */
+ public void init(ICommonActionExtensionSite aSite) {
+ super.init(aSite);
+ if (aSite.getViewSite() instanceof ICommonViewerWorkbenchSite) {
+ myContribute = true;
+ makeActions((ICommonViewerWorkbenchSite) aSite.getViewSite());
+ } else {
+ myContribute = false;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void makeActions(ICommonViewerWorkbenchSite viewerSite) {
+ myOpenDiagramAction = new OpenDiagramAction(viewerSite);
+ }
+
+ /**
+ * @generated
+ */
+ public void fillActionBars(IActionBars actionBars) {
+ if (!myContribute) {
+ return;
+ }
+ IStructuredSelection selection = (IStructuredSelection) getContext().getSelection();
+ myOpenDiagramAction.selectionChanged(selection);
+ if (myOpenDiagramAction.isEnabled()) {
+ actionBars.setGlobalActionHandler(ICommonActionConstants.OPEN, myOpenDiagramAction);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void fillContextMenu(IMenuManager menu) {
+ }
+
+ /**
+ * @generated
+ */
+ private class OpenDiagramAction extends Action {
+
+ /**
+ * @generated
+ */
+ private Diagram myDiagram;
+
+ /**
+ * @generated
+ */
+ private ICommonViewerWorkbenchSite myViewerSite;
+
+ /**
+ * @generated
+ */
+ public OpenDiagramAction(ICommonViewerWorkbenchSite viewerSite) {
+ super(Messages.NavigatorActionProvider_OpenDiagramActionName);
+ myViewerSite = viewerSite;
+ }
+
+ /**
+ * @generated
+ */
+ public final void selectionChanged(IStructuredSelection selection) {
+ myDiagram = null;
+ if (selection.size() == 1) {
+ Object selectedElement = selection.getFirstElement();
+ if (selectedElement instanceof UMLNavigatorItem) {
+ selectedElement = ((UMLNavigatorItem) selectedElement).getView();
+ } else if (selectedElement instanceof IAdaptable) {
+ selectedElement = ((IAdaptable) selectedElement).getAdapter(View.class);
+ }
+ if (selectedElement instanceof Diagram) {
+ Diagram diagram = (Diagram) selectedElement;
+ if (ModelEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(diagram))) {
+ myDiagram = diagram;
+ }
+ }
+ }
+ setEnabled(myDiagram != null);
+ }
+
+ /**
+ * @generated
+ */
+ public void run() {
+ if (myDiagram == null || myDiagram.eResource() == null) {
+ return;
+ }
+
+ IEditorInput editorInput = getEditorInput();
+ IWorkbenchPage page = myViewerSite.getPage();
+ try {
+ page.openEditor(editorInput, UMLDiagramEditor.ID);
+ } catch (PartInitException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Exception while openning diagram", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private IEditorInput getEditorInput() {
+ for (Iterator it = myDiagram.eResource().getContents().iterator(); it.hasNext();) {
+ EObject nextEObject = (EObject) it.next();
+ if (nextEObject == myDiagram) {
+ return new FileEditorInput(WorkspaceSynchronizer.getFile(myDiagram.eResource()));
+ }
+ if (nextEObject instanceof Diagram) {
+ break;
+ }
+ }
+ URI uri = EcoreUtil.getURI(myDiagram);
+ String editorName = uri.lastSegment() + "#" + myDiagram.eResource().getContents().indexOf(myDiagram); //$NON-NLS-1$
+ IEditorInput editorInput = new URIEditorInput(uri, editorName);
+ return editorInput;
+ }
+
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/navigator/UMLNavigatorContentProvider.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/navigator/UMLNavigatorContentProvider.java
new file mode 100644
index 00000000000..d0f87ae0bc7
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/navigator/UMLNavigatorContentProvider.java
@@ -0,0 +1,5450 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.navigator;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
+import org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Association2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Association3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationClass2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationClassAttributeCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationClassEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Class2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Class3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Class4EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Class5EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassAttributeCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassAttributeCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassNestedClassifierCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassNestedClassifierCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassOperationCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassOperationCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Comment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentLinkDescriptorEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Component2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentAttributeCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentAttributeCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentNestedClassifierCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentNestedClassifierCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentOperationCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentOperationCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Constraint2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataType2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataTypeAttributeCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataTypeAttributeCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataTypeEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataTypeOperationCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataTypeOperationCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Enumeration2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.EnumerationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.EnumerationEnumerationLiteralCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.EnumerationEnumerationLiteralCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.EnumerationLiteralEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.GeneralizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InstanceSpecification2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InstanceSpecificationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InstanceSpecificationSlotCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InstanceSpecificationSlotCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Interface2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceAttributeCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceAttributeCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceNestedClassifierCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceNestedClassifierCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceOperationCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceOperationCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceRealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Model2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Model3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelPackageableElementCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelPackageableElementCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Operation2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Operation3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Operation4EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.OperationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Package2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageMergeEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackagePackageableElementCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackagePackageableElementCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PrimitiveType2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PrimitiveTypeEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ProfileApplicationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Property2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Property3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Property4EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Property5EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PropertyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ReceptionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RedefinableTemplateSignatureEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RedefinableTemplateSignatureTemplateParameterCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Signal2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SignalAttributeCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SignalAttributeCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SignalEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SlotEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SubstitutionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateParameterEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.Messages;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.navigator.ICommonContentExtensionSite;
+import org.eclipse.ui.navigator.ICommonContentProvider;
+
+/**
+ * @generated
+ */
+public class UMLNavigatorContentProvider implements ICommonContentProvider {
+
+ /**
+ * @generated
+ */
+ private static final Object[] EMPTY_ARRAY = new Object[0];
+
+ /**
+ * @generated
+ */
+ private AdapterFactoryEditingDomain myEditingDomain;
+
+ /**
+ * @generated
+ */
+ private Viewer myViewer;
+
+ /**
+ * @generated
+ */
+ private Runnable myViewerRefreshRunnable;
+
+ /**
+ * @generated
+ */
+ private WorkspaceSynchronizer myWorkspaceSynchronizer;
+
+ /**
+ * @generated
+ */
+ public UMLNavigatorContentProvider() {
+ TransactionalEditingDomain editingDomain = GMFEditingDomainFactory.INSTANCE.createEditingDomain();
+ myEditingDomain = (AdapterFactoryEditingDomain) editingDomain;
+ myEditingDomain.setResourceToReadOnlyMap(new HashMap() {
+
+ public Object get(Object key) {
+ if (!containsKey(key)) {
+ put(key, Boolean.TRUE);
+ }
+ return super.get(key);
+ }
+ });
+ myViewerRefreshRunnable = new Runnable() {
+
+ public void run() {
+ if (myViewer != null) {
+ myViewer.refresh();
+ }
+ }
+ };
+ myWorkspaceSynchronizer = new WorkspaceSynchronizer(editingDomain, new WorkspaceSynchronizer.Delegate() {
+
+ public void dispose() {
+ }
+
+ public boolean handleResourceChanged(final Resource resource) {
+ for (Iterator it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) {
+ Resource nextResource = (Resource) it.next();
+ nextResource.unload();
+ }
+ if (myViewer != null) {
+ myViewer.getControl().getDisplay().asyncExec(myViewerRefreshRunnable);
+ }
+ return true;
+ }
+
+ public boolean handleResourceDeleted(Resource resource) {
+ for (Iterator it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) {
+ Resource nextResource = (Resource) it.next();
+ nextResource.unload();
+ }
+ if (myViewer != null) {
+ myViewer.getControl().getDisplay().asyncExec(myViewerRefreshRunnable);
+ }
+ return true;
+ }
+
+ public boolean handleResourceMoved(Resource resource, final URI newURI) {
+ for (Iterator it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) {
+ Resource nextResource = (Resource) it.next();
+ nextResource.unload();
+ }
+ if (myViewer != null) {
+ myViewer.getControl().getDisplay().asyncExec(myViewerRefreshRunnable);
+ }
+ return true;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ private Collection createNavigatorItems(Collection views, Object parent, boolean isLeafs) {
+ Collection result = new ArrayList();
+ for (Iterator it = views.iterator(); it.hasNext();) {
+ result.add(new UMLNavigatorItem((View) it.next(), parent, isLeafs));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public void dispose() {
+ myWorkspaceSynchronizer.dispose();
+ myWorkspaceSynchronizer = null;
+ myViewerRefreshRunnable = null;
+ for (Iterator it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) {
+ Resource resource = (Resource) it.next();
+ resource.unload();
+ }
+ ((TransactionalEditingDomain) myEditingDomain).dispose();
+ myEditingDomain = null;
+ }
+
+ /**
+ * @generated
+ */
+ public Object[] getChildren(Object parentElement) {
+ if (parentElement instanceof IFile) {
+ IFile file = (IFile) parentElement;
+ URI fileURI = URI.createPlatformResourceURI(file.getFullPath().toString(), true);
+ Resource resource = myEditingDomain.getResourceSet().getResource(fileURI, true);
+ Collection result = new ArrayList();
+ result.addAll(createNavigatorItems(selectViewsByType(resource.getContents(), ModelEditPart.MODEL_ID), file, false));
+ return result.toArray();
+ }
+
+ if (parentElement instanceof UMLNavigatorGroup) {
+ UMLNavigatorGroup group = (UMLNavigatorGroup) parentElement;
+ return group.getChildren();
+ }
+
+ if (parentElement instanceof UMLNavigatorItem) {
+ UMLNavigatorItem navigatorItem = (UMLNavigatorItem) parentElement;
+ if (navigatorItem.isLeaf() || !isOwnView(navigatorItem.getView())) {
+ return EMPTY_ARRAY;
+ }
+ return getViewChildren(navigatorItem.getView(), parentElement);
+ }
+
+ return EMPTY_ARRAY;
+ }
+
+ /**
+ * @generated
+ */
+ private Collection getChildrenByType(Collection nodes, int visualID) {
+ Collection result = new ArrayList();
+ String type = UMLVisualIDRegistry.getType(visualID);
+ for (Iterator it = nodes.iterator(); it.hasNext();) {
+ View nextNode = (View) it.next();
+ result.addAll(selectViewsByType(nextNode.getChildren(), type));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private Collection getDiagramLinksByType(Collection diagrams, int visualID) {
+ Collection result = new ArrayList();
+ String type = UMLVisualIDRegistry.getType(visualID);
+ for (Iterator it = diagrams.iterator(); it.hasNext();) {
+ Diagram nextDiagram = (Diagram) it.next();
+ result.addAll(selectViewsByType(nextDiagram.getEdges(), type));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public Object[] getElements(Object inputElement) {
+ return getChildren(inputElement);
+ }
+
+ /**
+ * @generated
+ */
+ private Collection getIncomingLinksByType(Collection nodes, int visualID) {
+ Collection result = new ArrayList();
+ String type = UMLVisualIDRegistry.getType(visualID);
+ for (Iterator it = nodes.iterator(); it.hasNext();) {
+ View nextNode = (View) it.next();
+ result.addAll(selectViewsByType(nextNode.getTargetEdges(), type));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private Collection getLinksSourceByType(Collection edges, int visualID) {
+ Collection result = new ArrayList();
+ String type = UMLVisualIDRegistry.getType(visualID);
+ for (Iterator it = edges.iterator(); it.hasNext();) {
+ Edge nextEdge = (Edge) it.next();
+ View nextEdgeSource = nextEdge.getSource();
+ if (type.equals(nextEdgeSource.getType()) && isOwnView(nextEdgeSource)) {
+ result.add(nextEdgeSource);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private Collection getLinksTargetByType(Collection edges, int visualID) {
+ Collection result = new ArrayList();
+ String type = UMLVisualIDRegistry.getType(visualID);
+ for (Iterator it = edges.iterator(); it.hasNext();) {
+ Edge nextEdge = (Edge) it.next();
+ View nextEdgeTarget = nextEdge.getTarget();
+ if (type.equals(nextEdgeTarget.getType()) && isOwnView(nextEdgeTarget)) {
+ result.add(nextEdgeTarget);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private Collection getOutgoingLinksByType(Collection nodes, int visualID) {
+ Collection result = new ArrayList();
+ String type = UMLVisualIDRegistry.getType(visualID);
+ for (Iterator it = nodes.iterator(); it.hasNext();) {
+ View nextNode = (View) it.next();
+ result.addAll(selectViewsByType(nextNode.getSourceEdges(), type));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public Object getParent(Object element) {
+ if (element instanceof UMLAbstractNavigatorItem) {
+ UMLAbstractNavigatorItem abstractNavigatorItem = (UMLAbstractNavigatorItem) element;
+ return abstractNavigatorItem.getParent();
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ private Object[] getViewChildren(View view, Object parentElement) {
+ switch (UMLVisualIDRegistry.getVisualID(view)) {
+
+ case ModelEditPart.VISUAL_ID: {
+ return getViewChildrenForModel(view, parentElement);
+ }
+
+ case Dependency2EditPart.VISUAL_ID: {
+ return getViewChildrenForDependency2EditPart(view, parentElement);
+ }
+
+ case AssociationClassEditPart.VISUAL_ID: {
+ return getViewChildrenForAssociationClassEditPart(view, parentElement);
+ }
+
+ case Association2EditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup incominglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Association_2015_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Association_2015_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AssociationClass2EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AssociationClass2EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AssociationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AssociationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Association3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Association3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), GeneralizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), GeneralizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), SubstitutionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), SubstitutionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), PackageImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ case InstanceSpecificationEditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup incominglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_InstanceSpecification_2001_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_InstanceSpecification_2001_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getChildrenByType(Collections.singleton(view), InstanceSpecificationSlotCompartmentEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, SlotEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ case ComponentEditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup incominglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Component_2002_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Component_2002_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getChildrenByType(Collections.singleton(view), ComponentAttributeCompartmentEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, PropertyEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), ComponentOperationCompartmentEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, OperationEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), ComponentNestedClassifierCompartmentEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Class2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), RedefinableTemplateSignatureEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AssociationClass2EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AssociationClass2EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AssociationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AssociationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Association3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Association3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), GeneralizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), GeneralizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), InterfaceRealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), SubstitutionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), SubstitutionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), PackageImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ case SignalEditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup incominglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Signal_2003_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Signal_2003_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getChildrenByType(Collections.singleton(view), SignalAttributeCompartmentEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Property2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), RedefinableTemplateSignatureEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AssociationClass2EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AssociationClass2EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AssociationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AssociationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Association3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Association3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), GeneralizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), GeneralizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), SubstitutionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), SubstitutionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), PackageImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ case InterfaceEditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup incominglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Interface_2004_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Interface_2004_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getChildrenByType(Collections.singleton(view), InterfaceAttributeCompartmentEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Property3EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), InterfaceOperationCompartmentEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Operation2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), InterfaceNestedClassifierCompartmentEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Class3EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), RedefinableTemplateSignatureEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AssociationClass2EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AssociationClass2EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AssociationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AssociationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Association3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Association3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), GeneralizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), GeneralizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), InterfaceRealizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), SubstitutionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), SubstitutionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), PackageImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ case Model2EditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup incominglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Model_2005_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Model_2005_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getChildrenByType(Collections.singleton(view), ModelPackageableElementCompartmentEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, InstanceSpecification2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), ModelPackageableElementCompartmentEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Component2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), ModelPackageableElementCompartmentEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Signal2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), ModelPackageableElementCompartmentEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Interface2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), ModelPackageableElementCompartmentEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Model3EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), ModelPackageableElementCompartmentEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Enumeration2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), ModelPackageableElementCompartmentEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Package2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), ModelPackageableElementCompartmentEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Class4EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), ModelPackageableElementCompartmentEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, PrimitiveType2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), ModelPackageableElementCompartmentEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, DataType2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), ModelPackageableElementCompartmentEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Comment2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), ModelPackageableElementCompartmentEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Constraint2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), RedefinableTemplateSignatureEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), PackageImportEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), PackageImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), PackageMergeEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), PackageMergeEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), ProfileApplicationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ case EnumerationEditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup incominglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Enumeration_2006_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Enumeration_2006_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getChildrenByType(Collections.singleton(view), EnumerationEnumerationLiteralCompartmentEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, EnumerationLiteralEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AssociationClass2EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AssociationClass2EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AssociationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AssociationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Association3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Association3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), GeneralizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), GeneralizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), SubstitutionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), SubstitutionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), PackageImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ case PackageEditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup incominglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Package_2007_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Package_2007_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getChildrenByType(Collections.singleton(view), PackagePackageableElementCompartment2EditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, InstanceSpecification2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), PackagePackageableElementCompartment2EditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Component2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), PackagePackageableElementCompartment2EditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Signal2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), PackagePackageableElementCompartment2EditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Interface2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), PackagePackageableElementCompartment2EditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Model3EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), PackagePackageableElementCompartment2EditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Enumeration2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), PackagePackageableElementCompartment2EditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Package2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), PackagePackageableElementCompartment2EditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Class4EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), PackagePackageableElementCompartment2EditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, PrimitiveType2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), PackagePackageableElementCompartment2EditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, DataType2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), PackagePackageableElementCompartment2EditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Comment2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), PackagePackageableElementCompartment2EditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Constraint2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), RedefinableTemplateSignatureEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), PackageImportEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), PackageImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), PackageMergeEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), PackageMergeEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), ProfileApplicationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ case ClassEditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup incominglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Class_2008_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Class_2008_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getChildrenByType(Collections.singleton(view), ClassOperationCompartment2EditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, ReceptionEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), ClassAttributeCompartment2EditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Property4EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), ClassOperationCompartment2EditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Operation3EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), ClassNestedClassifierCompartment2EditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Class5EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), RedefinableTemplateSignatureEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AssociationClass2EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AssociationClass2EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AssociationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AssociationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Association3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Association3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), GeneralizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), GeneralizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), InterfaceRealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), SubstitutionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), SubstitutionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), PackageImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ case PrimitiveTypeEditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup incominglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_PrimitiveType_2009_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_PrimitiveType_2009_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AssociationClass2EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AssociationClass2EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AssociationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AssociationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Association3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Association3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), GeneralizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), GeneralizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), SubstitutionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), SubstitutionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), PackageImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ case DataTypeEditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup incominglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_DataType_2010_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_DataType_2010_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getChildrenByType(Collections.singleton(view), DataTypeAttributeCompartmentEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Property5EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), DataTypeOperationCompartmentEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Operation4EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), RedefinableTemplateSignatureEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AssociationClass2EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AssociationClass2EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AssociationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AssociationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Association3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Association3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), GeneralizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), GeneralizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), SubstitutionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), SubstitutionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), PackageImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ case ConstraintEditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup incominglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Constraint_2011_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Constraint_2011_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ case CommentEditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup incominglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Comment_2012_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Comment_2012_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ case PropertyEditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup incominglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Property_3002_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Property_3002_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ case SlotEditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup incominglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Slot_3001_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Slot_3001_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ case OperationEditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup incominglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Operation_3003_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Operation_3003_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), PackageImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ case Class2EditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup incominglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Class_3004_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Class_3004_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AssociationClass2EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AssociationClass2EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AssociationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AssociationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Association3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Association3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), GeneralizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), GeneralizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), InterfaceRealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), SubstitutionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), SubstitutionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), PackageImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ case RedefinableTemplateSignatureEditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup incominglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_RedefinableTemplateSignature_3015_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_RedefinableTemplateSignature_3015_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getChildrenByType(Collections.singleton(view), RedefinableTemplateSignatureTemplateParameterCompartmentEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, TemplateParameterEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ case TemplateParameterEditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup incominglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_TemplateParameter_3016_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_TemplateParameter_3016_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ case Property2EditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup incominglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Property_3005_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Property_3005_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ case Property3EditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup incominglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Property_3006_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Property_3006_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ case Operation2EditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup incominglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Operation_3007_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Operation_3007_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), PackageImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ case Class3EditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup incominglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Class_3008_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Class_3008_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AssociationClass2EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AssociationClass2EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AssociationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AssociationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Association3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Association3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), GeneralizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), GeneralizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), InterfaceRealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), SubstitutionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), SubstitutionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), PackageImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ case InstanceSpecification2EditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup incominglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_InstanceSpecification_3020_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_InstanceSpecification_3020_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getChildrenByType(Collections.singleton(view), InstanceSpecificationSlotCompartment2EditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, SlotEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ case Component2EditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup incominglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Component_3021_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Component_3021_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getChildrenByType(Collections.singleton(view), ComponentAttributeCompartment2EditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, PropertyEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), ComponentOperationCompartment2EditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, OperationEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), ComponentNestedClassifierCompartment2EditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Class2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), RedefinableTemplateSignatureEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AssociationClass2EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AssociationClass2EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AssociationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AssociationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Association3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Association3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), GeneralizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), GeneralizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), InterfaceRealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), SubstitutionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), SubstitutionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), PackageImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ case Signal2EditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup incominglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Signal_3022_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Signal_3022_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getChildrenByType(Collections.singleton(view), SignalAttributeCompartment2EditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Property2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), RedefinableTemplateSignatureEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AssociationClass2EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AssociationClass2EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AssociationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AssociationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Association3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Association3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), GeneralizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), GeneralizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), SubstitutionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), SubstitutionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), PackageImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ case Interface2EditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup incominglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Interface_3023_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Interface_3023_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getChildrenByType(Collections.singleton(view), InterfaceAttributeCompartment2EditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Property3EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), InterfaceOperationCompartment2EditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Operation2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), InterfaceNestedClassifierCompartment2EditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Class3EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), RedefinableTemplateSignatureEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AssociationClass2EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AssociationClass2EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AssociationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AssociationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Association3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Association3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), GeneralizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), GeneralizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), InterfaceRealizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), SubstitutionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), SubstitutionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), PackageImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ case Model3EditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup incominglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Model_3024_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Model_3024_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getChildrenByType(Collections.singleton(view), ModelPackageableElementCompartment2EditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, InstanceSpecification2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), ModelPackageableElementCompartment2EditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Component2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), ModelPackageableElementCompartment2EditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Signal2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), ModelPackageableElementCompartment2EditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Interface2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), ModelPackageableElementCompartment2EditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Model3EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), ModelPackageableElementCompartment2EditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Enumeration2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), ModelPackageableElementCompartment2EditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Package2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), ModelPackageableElementCompartment2EditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Class4EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), ModelPackageableElementCompartment2EditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, PrimitiveType2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), ModelPackageableElementCompartment2EditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, DataType2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), ModelPackageableElementCompartment2EditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Comment2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), ModelPackageableElementCompartment2EditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Constraint2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), RedefinableTemplateSignatureEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), PackageImportEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), PackageImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), PackageMergeEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), PackageMergeEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), ProfileApplicationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ case Enumeration2EditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup incominglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Enumeration_3025_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Enumeration_3025_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getChildrenByType(Collections.singleton(view), EnumerationEnumerationLiteralCompartment2EditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, EnumerationLiteralEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AssociationClass2EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AssociationClass2EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AssociationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AssociationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Association3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Association3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), GeneralizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), GeneralizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), SubstitutionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), SubstitutionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), PackageImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ case EnumerationLiteralEditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup incominglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_EnumerationLiteral_3017_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_EnumerationLiteral_3017_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ case Package2EditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup incominglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Package_3009_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Package_3009_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getChildrenByType(Collections.singleton(view), PackagePackageableElementCompartmentEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, InstanceSpecification2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), PackagePackageableElementCompartmentEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Component2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), PackagePackageableElementCompartmentEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Signal2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), PackagePackageableElementCompartmentEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Interface2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), PackagePackageableElementCompartmentEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Model3EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), PackagePackageableElementCompartmentEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Enumeration2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), PackagePackageableElementCompartmentEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Package2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), PackagePackageableElementCompartmentEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Class4EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), PackagePackageableElementCompartmentEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, PrimitiveType2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), PackagePackageableElementCompartmentEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, DataType2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), PackagePackageableElementCompartmentEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Comment2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), PackagePackageableElementCompartmentEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Constraint2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), RedefinableTemplateSignatureEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), PackageImportEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), PackageImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), PackageMergeEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), PackageMergeEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), ProfileApplicationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ case Class4EditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup incominglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Class_3010_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Class_3010_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getChildrenByType(Collections.singleton(view), ClassOperationCompartmentEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, ReceptionEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), ClassAttributeCompartmentEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Property4EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), ClassOperationCompartmentEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Operation3EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), ClassNestedClassifierCompartmentEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Class5EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), RedefinableTemplateSignatureEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AssociationClass2EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AssociationClass2EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AssociationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AssociationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Association3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Association3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), GeneralizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), GeneralizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), InterfaceRealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), SubstitutionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), SubstitutionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), PackageImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ case ReceptionEditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup incominglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Reception_3011_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Reception_3011_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), PackageImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ case Property4EditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup incominglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Property_3012_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Property_3012_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ case Operation3EditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup incominglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Operation_3013_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Operation_3013_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), PackageImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ case Class5EditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup incominglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Class_3014_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Class_3014_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AssociationClass2EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AssociationClass2EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AssociationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AssociationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Association3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Association3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), GeneralizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), GeneralizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), InterfaceRealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), SubstitutionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), SubstitutionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), PackageImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ case PrimitiveType2EditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup incominglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_PrimitiveType_3026_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_PrimitiveType_3026_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AssociationClass2EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AssociationClass2EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AssociationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AssociationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Association3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Association3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), GeneralizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), GeneralizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), SubstitutionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), SubstitutionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), PackageImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ case DataType2EditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup incominglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_DataType_3027_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_DataType_3027_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getChildrenByType(Collections.singleton(view), DataTypeAttributeCompartment2EditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Property5EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), DataTypeOperationCompartment2EditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, Operation4EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), RedefinableTemplateSignatureEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AssociationClass2EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AssociationClass2EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AssociationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AssociationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Association3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Association3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), GeneralizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), GeneralizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), SubstitutionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), SubstitutionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), PackageImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ case Property5EditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup incominglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Property_3018_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Property_3018_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ case Operation4EditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup incominglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Operation_3019_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Operation_3019_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), PackageImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ case Comment2EditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup incominglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Comment_3028_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Comment_3028_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ case Constraint2EditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup incominglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Constraint_3029_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Constraint_3029_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ case CommentLinkDescriptorEditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup target = new UMLNavigatorGroup(Messages.NavigatorGroupName_Link_4016_target, "icons/linkTargetNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup source = new UMLNavigatorGroup(Messages.NavigatorGroupName_Link_4016_source, "icons/linkSourceNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getLinksTargetByType(Collections.singleton(view), Dependency2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), AssociationClassEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Association2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), InstanceSpecificationEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ComponentEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), SignalEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), InterfaceEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Model2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), EnumerationEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PackageEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ClassEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PrimitiveTypeEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), DataTypeEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ConstraintEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), CommentEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PropertyEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), SlotEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), OperationEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), RedefinableTemplateSignatureEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), TemplateParameterEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Property2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Property3EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Operation2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class3EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), InstanceSpecification2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Component2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Signal2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Interface2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Model3EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Enumeration2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), EnumerationLiteralEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Package2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class4EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ReceptionEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Property4EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Operation3EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class5EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PrimitiveType2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), DataType2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Property5EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Operation4EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Comment2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Constraint2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Dependency2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), AssociationClassEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Association2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), InstanceSpecificationEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), ComponentEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), SignalEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), InterfaceEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Model2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), EnumerationEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PackageEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), ClassEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PrimitiveTypeEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), DataTypeEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), ConstraintEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), CommentEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PropertyEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), SlotEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), OperationEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), RedefinableTemplateSignatureEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), TemplateParameterEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Property2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Property3EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Operation2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class3EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), InstanceSpecification2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Component2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Signal2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Interface2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Model3EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Enumeration2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), EnumerationLiteralEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Package2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class4EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), ReceptionEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Property4EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Operation3EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class5EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PrimitiveType2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), DataType2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Property5EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Operation4EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Comment2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Constraint2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ if (!target.isEmpty()) {
+ result.add(target);
+ }
+ if (!source.isEmpty()) {
+ result.add(source);
+ }
+ return result.toArray();
+ }
+
+ case AssociationClass2EditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup target = new UMLNavigatorGroup(Messages.NavigatorGroupName_AssociationClass_4017_target, "icons/linkTargetNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup source = new UMLNavigatorGroup(Messages.NavigatorGroupName_AssociationClass_4017_source, "icons/linkSourceNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getLinksTargetByType(Collections.singleton(view), AssociationClassEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Association2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ComponentEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), SignalEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), InterfaceEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), EnumerationEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ClassEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PrimitiveTypeEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), DataTypeEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class3EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Component2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Signal2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Interface2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Enumeration2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class4EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class5EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PrimitiveType2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), DataType2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), AssociationClassEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Association2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), ComponentEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), SignalEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), InterfaceEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), EnumerationEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), ClassEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PrimitiveTypeEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), DataTypeEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class3EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Component2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Signal2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Interface2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Enumeration2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class4EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class5EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PrimitiveType2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), DataType2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ if (!target.isEmpty()) {
+ result.add(target);
+ }
+ if (!source.isEmpty()) {
+ result.add(source);
+ }
+ return result.toArray();
+ }
+
+ case AssociationEditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup target = new UMLNavigatorGroup(Messages.NavigatorGroupName_Association_4001_target, "icons/linkTargetNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup source = new UMLNavigatorGroup(Messages.NavigatorGroupName_Association_4001_source, "icons/linkSourceNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getLinksTargetByType(Collections.singleton(view), AssociationClassEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Association2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ComponentEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), SignalEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), InterfaceEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), EnumerationEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ClassEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PrimitiveTypeEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), DataTypeEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class3EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Component2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Signal2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Interface2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Enumeration2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class4EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class5EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PrimitiveType2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), DataType2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), AssociationClassEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Association2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), ComponentEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), SignalEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), InterfaceEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), EnumerationEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), ClassEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PrimitiveTypeEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), DataTypeEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class3EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Component2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Signal2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Interface2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Enumeration2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class4EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class5EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PrimitiveType2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), DataType2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ if (!target.isEmpty()) {
+ result.add(target);
+ }
+ if (!source.isEmpty()) {
+ result.add(source);
+ }
+ return result.toArray();
+ }
+
+ case Association3EditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup target = new UMLNavigatorGroup(Messages.NavigatorGroupName_Association_4019_target, "icons/linkTargetNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup source = new UMLNavigatorGroup(Messages.NavigatorGroupName_Association_4019_source, "icons/linkSourceNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getLinksTargetByType(Collections.singleton(view), AssociationClassEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Association2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ComponentEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), SignalEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), InterfaceEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), EnumerationEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ClassEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PrimitiveTypeEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), DataTypeEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class3EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Component2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Signal2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Interface2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Enumeration2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class4EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class5EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PrimitiveType2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), DataType2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), AssociationClassEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Association2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), ComponentEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), SignalEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), InterfaceEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), EnumerationEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), ClassEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PrimitiveTypeEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), DataTypeEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class3EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Component2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Signal2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Interface2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Enumeration2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class4EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class5EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PrimitiveType2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), DataType2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ if (!target.isEmpty()) {
+ result.add(target);
+ }
+ if (!source.isEmpty()) {
+ result.add(source);
+ }
+ return result.toArray();
+ }
+
+ case GeneralizationEditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup target = new UMLNavigatorGroup(Messages.NavigatorGroupName_Generalization_4002_target, "icons/linkTargetNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup source = new UMLNavigatorGroup(Messages.NavigatorGroupName_Generalization_4002_source, "icons/linkSourceNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getLinksTargetByType(Collections.singleton(view), AssociationClassEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Association2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ComponentEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), SignalEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), InterfaceEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), EnumerationEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ClassEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PrimitiveTypeEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), DataTypeEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class3EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Component2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Signal2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Interface2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Enumeration2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class4EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class5EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PrimitiveType2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), DataType2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), AssociationClassEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Association2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), ComponentEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), SignalEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), InterfaceEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), EnumerationEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), ClassEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PrimitiveTypeEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), DataTypeEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class3EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Component2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Signal2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Interface2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Enumeration2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class4EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class5EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PrimitiveType2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), DataType2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ if (!target.isEmpty()) {
+ result.add(target);
+ }
+ if (!source.isEmpty()) {
+ result.add(source);
+ }
+ return result.toArray();
+ }
+
+ case InterfaceRealizationEditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup target = new UMLNavigatorGroup(Messages.NavigatorGroupName_InterfaceRealization_4003_target, "icons/linkTargetNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup source = new UMLNavigatorGroup(Messages.NavigatorGroupName_InterfaceRealization_4003_source, "icons/linkSourceNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getLinksTargetByType(Collections.singleton(view), InterfaceEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Interface2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), AssociationClassEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), ComponentEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), ClassEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class3EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Component2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class4EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class5EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ if (!target.isEmpty()) {
+ result.add(target);
+ }
+ if (!source.isEmpty()) {
+ result.add(source);
+ }
+ return result.toArray();
+ }
+
+ case SubstitutionEditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup target = new UMLNavigatorGroup(Messages.NavigatorGroupName_Substitution_4004_target, "icons/linkTargetNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup source = new UMLNavigatorGroup(Messages.NavigatorGroupName_Substitution_4004_source, "icons/linkSourceNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getLinksTargetByType(Collections.singleton(view), AssociationClassEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Association2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ComponentEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), SignalEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), InterfaceEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), EnumerationEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ClassEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PrimitiveTypeEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), DataTypeEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class3EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Component2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Signal2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Interface2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Enumeration2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class4EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class5EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PrimitiveType2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), DataType2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), AssociationClassEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Association2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), ComponentEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), SignalEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), InterfaceEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), EnumerationEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), ClassEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PrimitiveTypeEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), DataTypeEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class3EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Component2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Signal2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Interface2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Enumeration2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class4EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class5EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PrimitiveType2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), DataType2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ if (!target.isEmpty()) {
+ result.add(target);
+ }
+ if (!source.isEmpty()) {
+ result.add(source);
+ }
+ return result.toArray();
+ }
+
+ case RealizationEditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup target = new UMLNavigatorGroup(Messages.NavigatorGroupName_Realization_4005_target, "icons/linkTargetNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup source = new UMLNavigatorGroup(Messages.NavigatorGroupName_Realization_4005_source, "icons/linkSourceNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getLinksTargetByType(Collections.singleton(view), Dependency2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), AssociationClassEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Association2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), InstanceSpecificationEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ComponentEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), SignalEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), InterfaceEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Model2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), EnumerationEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PackageEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ClassEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PrimitiveTypeEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), DataTypeEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ConstraintEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PropertyEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), OperationEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), RedefinableTemplateSignatureEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Property2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Property3EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Operation2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class3EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), InstanceSpecification2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Component2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Signal2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Interface2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Model3EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Enumeration2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), EnumerationLiteralEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Package2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class4EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ReceptionEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Property4EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Operation3EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class5EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PrimitiveType2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), DataType2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Property5EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Operation4EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Constraint2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Dependency2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), AssociationClassEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Association2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), InstanceSpecificationEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), ComponentEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), SignalEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), InterfaceEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Model2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), EnumerationEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PackageEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), ClassEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PrimitiveTypeEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), DataTypeEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), ConstraintEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PropertyEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), OperationEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), RedefinableTemplateSignatureEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Property2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Property3EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Operation2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class3EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), InstanceSpecification2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Component2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Signal2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Interface2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Model3EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Enumeration2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), EnumerationLiteralEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Package2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class4EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), ReceptionEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Property4EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Operation3EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class5EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PrimitiveType2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), DataType2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Property5EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Operation4EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Constraint2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ if (!target.isEmpty()) {
+ result.add(target);
+ }
+ if (!source.isEmpty()) {
+ result.add(source);
+ }
+ return result.toArray();
+ }
+
+ case AbstractionEditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup target = new UMLNavigatorGroup(Messages.NavigatorGroupName_Abstraction_4006_target, "icons/linkTargetNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup source = new UMLNavigatorGroup(Messages.NavigatorGroupName_Abstraction_4006_source, "icons/linkSourceNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getLinksTargetByType(Collections.singleton(view), Dependency2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), AssociationClassEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Association2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), InstanceSpecificationEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ComponentEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), SignalEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), InterfaceEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Model2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), EnumerationEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PackageEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ClassEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PrimitiveTypeEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), DataTypeEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ConstraintEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PropertyEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), OperationEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), RedefinableTemplateSignatureEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Property2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Property3EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Operation2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class3EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), InstanceSpecification2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Component2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Signal2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Interface2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Model3EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Enumeration2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), EnumerationLiteralEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Package2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class4EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ReceptionEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Property4EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Operation3EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class5EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PrimitiveType2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), DataType2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Property5EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Operation4EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Constraint2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Dependency2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), AssociationClassEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Association2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), InstanceSpecificationEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), ComponentEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), SignalEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), InterfaceEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Model2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), EnumerationEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PackageEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), ClassEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PrimitiveTypeEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), DataTypeEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), ConstraintEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PropertyEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), OperationEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), RedefinableTemplateSignatureEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Property2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Property3EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Operation2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class3EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), InstanceSpecification2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Component2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Signal2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Interface2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Model3EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Enumeration2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), EnumerationLiteralEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Package2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class4EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), ReceptionEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Property4EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Operation3EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class5EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PrimitiveType2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), DataType2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Property5EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Operation4EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Constraint2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ if (!target.isEmpty()) {
+ result.add(target);
+ }
+ if (!source.isEmpty()) {
+ result.add(source);
+ }
+ return result.toArray();
+ }
+
+ case UsageEditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup target = new UMLNavigatorGroup(Messages.NavigatorGroupName_Usage_4007_target, "icons/linkTargetNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup source = new UMLNavigatorGroup(Messages.NavigatorGroupName_Usage_4007_source, "icons/linkSourceNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getLinksTargetByType(Collections.singleton(view), Dependency2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), AssociationClassEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Association2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), InstanceSpecificationEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ComponentEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), SignalEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), InterfaceEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Model2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), EnumerationEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PackageEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ClassEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PrimitiveTypeEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), DataTypeEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ConstraintEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PropertyEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), OperationEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), RedefinableTemplateSignatureEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Property2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Property3EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Operation2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class3EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), InstanceSpecification2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Component2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Signal2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Interface2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Model3EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Enumeration2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), EnumerationLiteralEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Package2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class4EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ReceptionEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Property4EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Operation3EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class5EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PrimitiveType2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), DataType2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Property5EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Operation4EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Constraint2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Dependency2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), AssociationClassEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Association2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), InstanceSpecificationEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), ComponentEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), SignalEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), InterfaceEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Model2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), EnumerationEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PackageEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), ClassEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PrimitiveTypeEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), DataTypeEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), ConstraintEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PropertyEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), OperationEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), RedefinableTemplateSignatureEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Property2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Property3EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Operation2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class3EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), InstanceSpecification2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Component2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Signal2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Interface2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Model3EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Enumeration2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), EnumerationLiteralEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Package2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class4EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), ReceptionEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Property4EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Operation3EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class5EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PrimitiveType2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), DataType2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Property5EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Operation4EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Constraint2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ if (!target.isEmpty()) {
+ result.add(target);
+ }
+ if (!source.isEmpty()) {
+ result.add(source);
+ }
+ return result.toArray();
+ }
+
+ case DependencyEditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup target = new UMLNavigatorGroup(Messages.NavigatorGroupName_Dependency_4008_target, "icons/linkTargetNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup source = new UMLNavigatorGroup(Messages.NavigatorGroupName_Dependency_4008_source, "icons/linkSourceNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getLinksTargetByType(Collections.singleton(view), Dependency2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), AssociationClassEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Association2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), InstanceSpecificationEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ComponentEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), SignalEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), InterfaceEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Model2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), EnumerationEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PackageEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ClassEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PrimitiveTypeEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), DataTypeEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ConstraintEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PropertyEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), OperationEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), RedefinableTemplateSignatureEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Property2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Property3EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Operation2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class3EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), InstanceSpecification2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Component2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Signal2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Interface2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Model3EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Enumeration2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), EnumerationLiteralEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Package2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class4EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ReceptionEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Property4EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Operation3EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class5EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PrimitiveType2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), DataType2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Property5EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Operation4EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Constraint2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Dependency2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), AssociationClassEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Association2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), InstanceSpecificationEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), ComponentEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), SignalEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), InterfaceEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Model2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), EnumerationEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PackageEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), ClassEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PrimitiveTypeEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), DataTypeEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), ConstraintEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PropertyEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), OperationEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), RedefinableTemplateSignatureEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Property2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Property3EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Operation2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class3EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), InstanceSpecification2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Component2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Signal2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Interface2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Model3EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Enumeration2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), EnumerationLiteralEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Package2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class4EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), ReceptionEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Property4EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Operation3EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class5EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PrimitiveType2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), DataType2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Property5EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Operation4EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Constraint2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ if (!target.isEmpty()) {
+ result.add(target);
+ }
+ if (!source.isEmpty()) {
+ result.add(source);
+ }
+ return result.toArray();
+ }
+
+ case Dependency3EditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup target = new UMLNavigatorGroup(Messages.NavigatorGroupName_Dependency_4018_target, "icons/linkTargetNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup source = new UMLNavigatorGroup(Messages.NavigatorGroupName_Dependency_4018_source, "icons/linkSourceNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getLinksTargetByType(Collections.singleton(view), Dependency2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), AssociationClassEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Association2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), InstanceSpecificationEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ComponentEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), SignalEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), InterfaceEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Model2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), EnumerationEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PackageEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ClassEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PrimitiveTypeEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), DataTypeEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ConstraintEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PropertyEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), OperationEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), RedefinableTemplateSignatureEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Property2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Property3EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Operation2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class3EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), InstanceSpecification2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Component2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Signal2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Interface2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Model3EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Enumeration2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), EnumerationLiteralEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Package2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class4EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ReceptionEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Property4EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Operation3EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class5EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PrimitiveType2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), DataType2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Property5EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Operation4EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Constraint2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Dependency2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), AssociationClassEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Association2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), InstanceSpecificationEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), ComponentEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), SignalEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), InterfaceEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Model2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), EnumerationEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PackageEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), ClassEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PrimitiveTypeEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), DataTypeEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), ConstraintEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PropertyEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), OperationEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), RedefinableTemplateSignatureEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Property2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Property3EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Operation2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class3EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), InstanceSpecification2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Component2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Signal2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Interface2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Model3EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Enumeration2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), EnumerationLiteralEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Package2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class4EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), ReceptionEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Property4EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Operation3EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class5EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PrimitiveType2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), DataType2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Property5EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Operation4EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Constraint2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ if (!target.isEmpty()) {
+ result.add(target);
+ }
+ if (!source.isEmpty()) {
+ result.add(source);
+ }
+ return result.toArray();
+ }
+
+ case ElementImportEditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup target = new UMLNavigatorGroup(Messages.NavigatorGroupName_ElementImport_4009_target, "icons/linkTargetNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup source = new UMLNavigatorGroup(Messages.NavigatorGroupName_ElementImport_4009_source, "icons/linkSourceNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getLinksTargetByType(Collections.singleton(view), Dependency2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), AssociationClassEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Association2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), InstanceSpecificationEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ComponentEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), SignalEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), InterfaceEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Model2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), EnumerationEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PackageEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ClassEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PrimitiveTypeEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), DataTypeEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ConstraintEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class3EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), InstanceSpecification2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Component2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Signal2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Interface2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Model3EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Enumeration2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), EnumerationLiteralEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Package2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class4EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class5EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PrimitiveType2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), DataType2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Constraint2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), AssociationClassEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Association2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), ComponentEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), SignalEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), InterfaceEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Model2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), EnumerationEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PackageEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), ClassEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PrimitiveTypeEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), DataTypeEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), OperationEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Operation2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class3EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Component2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Signal2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Interface2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Model3EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Enumeration2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Package2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class4EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), ReceptionEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Operation3EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class5EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PrimitiveType2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), DataType2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Operation4EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ if (!target.isEmpty()) {
+ result.add(target);
+ }
+ if (!source.isEmpty()) {
+ result.add(source);
+ }
+ return result.toArray();
+ }
+
+ case PackageImportEditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup target = new UMLNavigatorGroup(Messages.NavigatorGroupName_PackageImport_4010_target, "icons/linkTargetNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup source = new UMLNavigatorGroup(Messages.NavigatorGroupName_PackageImport_4010_source, "icons/linkSourceNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getLinksTargetByType(Collections.singleton(view), Model2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PackageEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Model3EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Package2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), AssociationClassEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Association2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), ComponentEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), SignalEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), InterfaceEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Model2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), EnumerationEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PackageEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), ClassEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PrimitiveTypeEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), DataTypeEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), OperationEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Operation2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class3EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Component2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Signal2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Interface2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Model3EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Enumeration2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Package2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class4EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), ReceptionEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Operation3EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class5EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PrimitiveType2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), DataType2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Operation4EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ if (!target.isEmpty()) {
+ result.add(target);
+ }
+ if (!source.isEmpty()) {
+ result.add(source);
+ }
+ return result.toArray();
+ }
+
+ case PackageMergeEditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup target = new UMLNavigatorGroup(Messages.NavigatorGroupName_PackageMerge_4011_target, "icons/linkTargetNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup source = new UMLNavigatorGroup(Messages.NavigatorGroupName_PackageMerge_4011_source, "icons/linkSourceNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getLinksTargetByType(Collections.singleton(view), Model2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PackageEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Model3EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Package2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Model2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PackageEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Model3EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Package2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ if (!target.isEmpty()) {
+ result.add(target);
+ }
+ if (!source.isEmpty()) {
+ result.add(source);
+ }
+ return result.toArray();
+ }
+
+ case ProfileApplicationEditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup source = new UMLNavigatorGroup(Messages.NavigatorGroupName_ProfileApplication_4012_source, "icons/linkSourceNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getLinksSourceByType(Collections.singleton(view), Model2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PackageEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Model3EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Package2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ if (!source.isEmpty()) {
+ result.add(source);
+ }
+ return result.toArray();
+ }
+
+ case CommentAnnotatedElementEditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup target = new UMLNavigatorGroup(Messages.NavigatorGroupName_CommentAnnotatedElement_4013_target, "icons/linkTargetNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup source = new UMLNavigatorGroup(Messages.NavigatorGroupName_CommentAnnotatedElement_4013_source, "icons/linkSourceNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getLinksTargetByType(Collections.singleton(view), Dependency2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), AssociationClassEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Association2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), InstanceSpecificationEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ComponentEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), SignalEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), InterfaceEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Model2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), EnumerationEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PackageEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ClassEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PrimitiveTypeEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), DataTypeEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ConstraintEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), CommentEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PropertyEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), SlotEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), OperationEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), RedefinableTemplateSignatureEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), TemplateParameterEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Property2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Property3EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Operation2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class3EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), InstanceSpecification2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Component2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Signal2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Interface2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Model3EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Enumeration2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), EnumerationLiteralEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Package2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class4EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ReceptionEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Property4EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Operation3EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class5EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PrimitiveType2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), DataType2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Property5EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Operation4EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Comment2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Constraint2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), CommentEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Comment2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ if (!target.isEmpty()) {
+ result.add(target);
+ }
+ if (!source.isEmpty()) {
+ result.add(source);
+ }
+ return result.toArray();
+ }
+
+ case ConstraintConstrainedElementEditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup target = new UMLNavigatorGroup(Messages.NavigatorGroupName_ConstraintConstrainedElement_4014_target, "icons/linkTargetNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup source = new UMLNavigatorGroup(Messages.NavigatorGroupName_ConstraintConstrainedElement_4014_source, "icons/linkSourceNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getLinksTargetByType(Collections.singleton(view), Dependency2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), AssociationClassEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Association2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), InstanceSpecificationEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ComponentEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), SignalEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), InterfaceEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Model2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), EnumerationEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PackageEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ClassEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PrimitiveTypeEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), DataTypeEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ConstraintEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), CommentEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PropertyEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), SlotEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), OperationEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), RedefinableTemplateSignatureEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), TemplateParameterEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Property2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Property3EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Operation2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class3EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), InstanceSpecification2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Component2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Signal2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Interface2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Model3EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Enumeration2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), EnumerationLiteralEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Package2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class4EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ReceptionEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Property4EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Operation3EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class5EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PrimitiveType2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), DataType2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Property5EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Operation4EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Comment2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Constraint2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), ConstraintEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Constraint2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ if (!target.isEmpty()) {
+ result.add(target);
+ }
+ if (!source.isEmpty()) {
+ result.add(source);
+ }
+ return result.toArray();
+ }
+
+ case TemplateBindingEditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup target = new UMLNavigatorGroup(Messages.NavigatorGroupName_TemplateBinding_4015_target, "icons/linkTargetNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup source = new UMLNavigatorGroup(Messages.NavigatorGroupName_TemplateBinding_4015_source, "icons/linkSourceNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getLinksTargetByType(Collections.singleton(view), Dependency2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), AssociationClassEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Association2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), InstanceSpecificationEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ComponentEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), SignalEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), InterfaceEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Model2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), EnumerationEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PackageEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ClassEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PrimitiveTypeEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), DataTypeEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ConstraintEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), CommentEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PropertyEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), SlotEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), OperationEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), RedefinableTemplateSignatureEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), TemplateParameterEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Property2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Property3EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Operation2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class3EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), InstanceSpecification2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Component2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Signal2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Interface2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Model3EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Enumeration2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), EnumerationLiteralEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Package2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class4EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), ReceptionEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Property4EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Operation3EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Class5EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), PrimitiveType2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), DataType2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Property5EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Operation4EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Comment2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), Constraint2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), AssociationClassEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Association2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), ComponentEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), SignalEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), InterfaceEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Model2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), EnumerationEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PackageEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), ClassEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PrimitiveTypeEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), DataTypeEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PropertyEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), OperationEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Property2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Property3EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Operation2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class3EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Component2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Signal2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Interface2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Model3EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Enumeration2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Package2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class4EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Property4EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Operation3EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Class5EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), PrimitiveType2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), DataType2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Property5EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), Operation4EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ if (!target.isEmpty()) {
+ result.add(target);
+ }
+ if (!source.isEmpty()) {
+ result.add(source);
+ }
+ return result.toArray();
+ }
+ }
+ return EMPTY_ARRAY;
+ }
+
+ private Object[] getViewChildrenForAssociationClassEditPart(View view, Object parentElement) {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup incominglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_AssociationClass_2013_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_AssociationClass_2013_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getChildrenByType(Collections.singleton(view), AssociationClassAttributeCompartmentEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, PropertyEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AssociationClass2EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AssociationClass2EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AssociationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AssociationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Association3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Association3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), GeneralizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), GeneralizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), InterfaceRealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), SubstitutionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), SubstitutionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), PackageImportEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+
+ }
+
+ private Object[] getViewChildrenForDependency2EditPart(View view, Object parentElement) {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup incominglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Dependency_2014_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup(Messages.NavigatorGroupName_Dependency_2014_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ private Object[] getViewChildrenForModel(View view, Object parentElement) {
+ Collection result = new ArrayList();
+ UMLNavigatorGroup links = new UMLNavigatorGroup(Messages.NavigatorGroupName_Package_1000_links, "icons/linksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getChildrenByType(Collections.singleton(view), Dependency2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), AssociationClassEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), Association2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), InstanceSpecificationEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), ComponentEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), SignalEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), InterfaceEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), Model2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), EnumerationEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), PackageEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), ClassEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), PrimitiveTypeEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), DataTypeEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), ConstraintEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), CommentEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getDiagramLinksByType(Collections.singleton(view), CommentLinkDescriptorEditPart.VISUAL_ID);
+ links.addChildren(createNavigatorItems(connectedViews, links, false));
+ connectedViews = getDiagramLinksByType(Collections.singleton(view), AssociationClass2EditPart.VISUAL_ID);
+ links.addChildren(createNavigatorItems(connectedViews, links, false));
+ connectedViews = getDiagramLinksByType(Collections.singleton(view), AssociationEditPart.VISUAL_ID);
+ links.addChildren(createNavigatorItems(connectedViews, links, false));
+ connectedViews = getDiagramLinksByType(Collections.singleton(view), Association3EditPart.VISUAL_ID);
+ links.addChildren(createNavigatorItems(connectedViews, links, false));
+ connectedViews = getDiagramLinksByType(Collections.singleton(view), GeneralizationEditPart.VISUAL_ID);
+ links.addChildren(createNavigatorItems(connectedViews, links, false));
+ connectedViews = getDiagramLinksByType(Collections.singleton(view), InterfaceRealizationEditPart.VISUAL_ID);
+ links.addChildren(createNavigatorItems(connectedViews, links, false));
+ connectedViews = getDiagramLinksByType(Collections.singleton(view), SubstitutionEditPart.VISUAL_ID);
+ links.addChildren(createNavigatorItems(connectedViews, links, false));
+ connectedViews = getDiagramLinksByType(Collections.singleton(view), RealizationEditPart.VISUAL_ID);
+ links.addChildren(createNavigatorItems(connectedViews, links, false));
+ connectedViews = getDiagramLinksByType(Collections.singleton(view), AbstractionEditPart.VISUAL_ID);
+ links.addChildren(createNavigatorItems(connectedViews, links, false));
+ connectedViews = getDiagramLinksByType(Collections.singleton(view), UsageEditPart.VISUAL_ID);
+ links.addChildren(createNavigatorItems(connectedViews, links, false));
+ connectedViews = getDiagramLinksByType(Collections.singleton(view), DependencyEditPart.VISUAL_ID);
+ links.addChildren(createNavigatorItems(connectedViews, links, false));
+ connectedViews = getDiagramLinksByType(Collections.singleton(view), Dependency3EditPart.VISUAL_ID);
+ links.addChildren(createNavigatorItems(connectedViews, links, false));
+ connectedViews = getDiagramLinksByType(Collections.singleton(view), ElementImportEditPart.VISUAL_ID);
+ links.addChildren(createNavigatorItems(connectedViews, links, false));
+ connectedViews = getDiagramLinksByType(Collections.singleton(view), PackageImportEditPart.VISUAL_ID);
+ links.addChildren(createNavigatorItems(connectedViews, links, false));
+ connectedViews = getDiagramLinksByType(Collections.singleton(view), PackageMergeEditPart.VISUAL_ID);
+ links.addChildren(createNavigatorItems(connectedViews, links, false));
+ connectedViews = getDiagramLinksByType(Collections.singleton(view), ProfileApplicationEditPart.VISUAL_ID);
+ links.addChildren(createNavigatorItems(connectedViews, links, false));
+ connectedViews = getDiagramLinksByType(Collections.singleton(view), CommentAnnotatedElementEditPart.VISUAL_ID);
+ links.addChildren(createNavigatorItems(connectedViews, links, false));
+ connectedViews = getDiagramLinksByType(Collections.singleton(view), ConstraintConstrainedElementEditPart.VISUAL_ID);
+ links.addChildren(createNavigatorItems(connectedViews, links, false));
+ connectedViews = getDiagramLinksByType(Collections.singleton(view), TemplateBindingEditPart.VISUAL_ID);
+ links.addChildren(createNavigatorItems(connectedViews, links, false));
+ if (!links.isEmpty()) {
+ result.add(links);
+ }
+ return result.toArray();
+ }
+
+ /**
+ * @generated
+ */
+ public boolean hasChildren(Object element) {
+ return element instanceof IFile || getChildren(element).length > 0;
+ }
+
+ /**
+ * @generated
+ */
+ public void init(ICommonContentExtensionSite aConfig) {
+ }
+
+ /**
+ * @generated
+ */
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ myViewer = viewer;
+ }
+
+ /**
+ * @generated
+ */
+ private boolean isOwnView(View view) {
+ return ModelEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(view));
+ }
+
+ /**
+ * @generated
+ */
+ public void restoreState(IMemento aMemento) {
+ }
+
+ /**
+ * @generated
+ */
+ public void saveState(IMemento aMemento) {
+ }
+
+ /**
+ * @generated
+ */
+ private Collection selectViewsByType(Collection views, String type) {
+ Collection result = new ArrayList();
+ for (Iterator it = views.iterator(); it.hasNext();) {
+ View nextView = (View) it.next();
+ if (type.equals(nextView.getType()) && isOwnView(nextView)) {
+ result.add(nextView);
+ }
+ }
+ return result;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/navigator/UMLNavigatorGroup.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/navigator/UMLNavigatorGroup.java
new file mode 100644
index 00000000000..0f51b7fe70f
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/navigator/UMLNavigatorGroup.java
@@ -0,0 +1,110 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.navigator;
+
+import java.util.Collection;
+import java.util.LinkedList;
+
+/**
+ * @generated
+ */
+public class UMLNavigatorGroup extends UMLAbstractNavigatorItem {
+
+ /**
+ * @generated
+ */
+ private String myGroupName;
+
+ /**
+ * @generated
+ */
+ private String myIcon;
+
+ /**
+ * @generated
+ */
+ private Collection myChildren = new LinkedList();
+
+ /**
+ * @generated
+ */
+ UMLNavigatorGroup(String groupName, String icon, Object parent) {
+ super(parent);
+ myGroupName = groupName;
+ myIcon = icon;
+ }
+
+ /**
+ * @generated
+ */
+ public String getGroupName() {
+ return myGroupName;
+ }
+
+ /**
+ * @generated
+ */
+ public String getIcon() {
+ return myIcon;
+ }
+
+ /**
+ * @generated
+ */
+ public Object[] getChildren() {
+ return myChildren.toArray();
+ }
+
+ /**
+ * @generated
+ */
+ public void addChildren(Collection children) {
+ myChildren.addAll(children);
+ }
+
+ /**
+ * @generated
+ */
+ public void addChild(Object child) {
+ myChildren.add(child);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isEmpty() {
+ return myChildren.size() == 0;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean equals(Object obj) {
+ if (obj instanceof org.eclipse.papyrus.diagram.clazz.navigator.UMLNavigatorGroup) {
+ org.eclipse.papyrus.diagram.clazz.navigator.UMLNavigatorGroup anotherGroup = (org.eclipse.papyrus.diagram.clazz.navigator.UMLNavigatorGroup) obj;
+ if (getGroupName().equals(anotherGroup.getGroupName())) {
+ return getParent().equals(anotherGroup.getParent());
+ }
+ }
+ return super.equals(obj);
+ }
+
+ /**
+ * @generated
+ */
+ public int hashCode() {
+ return getGroupName().hashCode();
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/navigator/UMLNavigatorItem.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/navigator/UMLNavigatorItem.java
new file mode 100644
index 00000000000..2161efffa8c
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/navigator/UMLNavigatorItem.java
@@ -0,0 +1,97 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.navigator;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class UMLNavigatorItem extends UMLAbstractNavigatorItem {
+
+ /**
+ * @generated
+ */
+ static {
+ final Class[] supportedTypes = new Class[] { View.class, EObject.class };
+ Platform.getAdapterManager().registerAdapters(new IAdapterFactory() {
+
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (adaptableObject instanceof org.eclipse.papyrus.diagram.clazz.navigator.UMLNavigatorItem && (adapterType == View.class || adapterType == EObject.class)) {
+ return ((org.eclipse.papyrus.diagram.clazz.navigator.UMLNavigatorItem) adaptableObject).getView();
+ }
+ return null;
+ }
+
+ public Class[] getAdapterList() {
+ return supportedTypes;
+ }
+ }, org.eclipse.papyrus.diagram.clazz.navigator.UMLNavigatorItem.class);
+ }
+
+ /**
+ * @generated
+ */
+ private View myView;
+
+ /**
+ * @generated
+ */
+ private boolean myLeaf = false;
+
+ /**
+ * @generated
+ */
+ public UMLNavigatorItem(View view, Object parent, boolean isLeaf) {
+ super(parent);
+ myView = view;
+ myLeaf = isLeaf;
+ }
+
+ /**
+ * @generated
+ */
+ public View getView() {
+ return myView;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isLeaf() {
+ return myLeaf;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean equals(Object obj) {
+ if (obj instanceof org.eclipse.papyrus.diagram.clazz.navigator.UMLNavigatorItem) {
+ return EcoreUtil.getURI(getView()).equals(EcoreUtil.getURI(((org.eclipse.papyrus.diagram.clazz.navigator.UMLNavigatorItem) obj).getView()));
+ }
+ return super.equals(obj);
+ }
+
+ /**
+ * @generated
+ */
+ public int hashCode() {
+ return EcoreUtil.getURI(getView()).hashCode();
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/navigator/UMLNavigatorLabelProvider.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/navigator/UMLNavigatorLabelProvider.java
new file mode 100644
index 00000000000..fa45700bdc4
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/navigator/UMLNavigatorLabelProvider.java
@@ -0,0 +1,1540 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.navigator;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.jface.viewers.ITreePathLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.TreePath;
+import org.eclipse.jface.viewers.ViewerLabel;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.*;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationClass2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationClassEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationClassNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Class2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Class3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Class4EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Class5EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassName3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Comment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentBody2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentBodyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentLinkDescriptorEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Component2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentName3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Constraint2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataType2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataTypeEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataTypeName3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataTypeNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportAliasEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Enumeration2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.EnumerationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.EnumerationLiteralEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.EnumerationName3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.EnumerationNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.GeneralizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.GeneralizationIsSubstitutableEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InstanceSpecification2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InstanceSpecificationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InstanceSpecificationName3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InstanceSpecificationNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Interface2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceName3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceRealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceRealizationNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Model2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Model3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelName3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Operation2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Operation3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Operation4EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.OperationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Package2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageImportVisibilityEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageMergeEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageName3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PrimitiveType2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PrimitiveTypeEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PrimitiveTypeName3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PrimitiveTypeNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ProfileApplicationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Property2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Property3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Property4EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Property5EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PropertyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ReceptionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RedefinableTemplateSignatureEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Signal2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SignalEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SignalName3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SignalNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SlotEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SubstitutionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SubstitutionNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateParameterEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.WrappingLabelEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLParserProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.navigator.ICommonContentExtensionSite;
+import org.eclipse.ui.navigator.ICommonLabelProvider;
+import org.eclipse.uml2.uml.Association;
+import org.eclipse.uml2.uml.AssociationClass;
+import org.eclipse.uml2.uml.Dependency;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.ProfileApplication;
+import org.eclipse.uml2.uml.RedefinableTemplateSignature;
+
+/**
+ * @generated
+ */
+public class UMLNavigatorLabelProvider extends LabelProvider implements ICommonLabelProvider, ITreePathLabelProvider {
+
+ /**
+ * @generated
+ */
+ static {
+ UMLDiagramEditorPlugin.getInstance().getImageRegistry().put("Navigator?UnknownElement", ImageDescriptor.getMissingImageDescriptor()); //$NON-NLS-1$
+ UMLDiagramEditorPlugin.getInstance().getImageRegistry().put("Navigator?ImageNotFound", ImageDescriptor.getMissingImageDescriptor()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ public void updateLabel(ViewerLabel label, TreePath elementPath) {
+ Object element = elementPath.getLastSegment();
+ if (element instanceof UMLNavigatorItem && !isOwnView(((UMLNavigatorItem) element).getView())) {
+ return;
+ }
+ label.setText(getText(element));
+ label.setImage(getImage(element));
+ }
+
+ /**
+ * @generated
+ */
+ public Image getImage(Object element) {
+ if (element instanceof UMLNavigatorGroup) {
+ UMLNavigatorGroup group = (UMLNavigatorGroup) element;
+ return UMLDiagramEditorPlugin.getInstance().getBundledImage(group.getIcon());
+ }
+
+ if (element instanceof UMLNavigatorItem) {
+ UMLNavigatorItem navigatorItem = (UMLNavigatorItem) element;
+ if (!isOwnView(navigatorItem.getView())) {
+ return super.getImage(element);
+ }
+ return getImage(navigatorItem.getView());
+ }
+
+ return super.getImage(element);
+ }
+
+ /**
+ * @generated
+ */
+ public Image getImage(View view) {
+ switch (UMLVisualIDRegistry.getVisualID(view)) {
+ case ModelEditPart.VISUAL_ID:
+ return getImage("Navigator?Diagram?http://www.eclipse.org/uml2/2.1.0/UML?Package", UMLElementTypes.Package_1000); //$NON-NLS-1$
+ case Dependency2EditPart.VISUAL_ID:
+ return getImage("Navigator?TopLevelNode?http://www.eclipse.org/uml2/2.1.0/UML?Dependency", UMLElementTypes.Dependency_2014); //$NON-NLS-1$
+ case AssociationClassEditPart.VISUAL_ID:
+ return getImage("Navigator?TopLevelNode?http://www.eclipse.org/uml2/2.1.0/UML?AssociationClass", UMLElementTypes.AssociationClass_2013); //$NON-NLS-1$
+ case Association2EditPart.VISUAL_ID:
+ return getImage("Navigator?TopLevelNode?http://www.eclipse.org/uml2/2.1.0/UML?Association", UMLElementTypes.Association_2015); //$NON-NLS-1$
+ case InstanceSpecificationEditPart.VISUAL_ID:
+ return getImage("Navigator?TopLevelNode?http://www.eclipse.org/uml2/2.1.0/UML?InstanceSpecification", UMLElementTypes.InstanceSpecification_2001); //$NON-NLS-1$
+ case ComponentEditPart.VISUAL_ID:
+ return getImage("Navigator?TopLevelNode?http://www.eclipse.org/uml2/2.1.0/UML?Component", UMLElementTypes.Component_2002); //$NON-NLS-1$
+ case SignalEditPart.VISUAL_ID:
+ return getImage("Navigator?TopLevelNode?http://www.eclipse.org/uml2/2.1.0/UML?Signal", UMLElementTypes.Signal_2003); //$NON-NLS-1$
+ case InterfaceEditPart.VISUAL_ID:
+ return getImage("Navigator?TopLevelNode?http://www.eclipse.org/uml2/2.1.0/UML?Interface", UMLElementTypes.Interface_2004); //$NON-NLS-1$
+ case Model2EditPart.VISUAL_ID:
+ return getImage("Navigator?TopLevelNode?http://www.eclipse.org/uml2/2.1.0/UML?Model", UMLElementTypes.Model_2005); //$NON-NLS-1$
+ case EnumerationEditPart.VISUAL_ID:
+ return getImage("Navigator?TopLevelNode?http://www.eclipse.org/uml2/2.1.0/UML?Enumeration", UMLElementTypes.Enumeration_2006); //$NON-NLS-1$
+ case PackageEditPart.VISUAL_ID:
+ return getImage("Navigator?TopLevelNode?http://www.eclipse.org/uml2/2.1.0/UML?Package", UMLElementTypes.Package_2007); //$NON-NLS-1$
+ case ClassEditPart.VISUAL_ID:
+ return getImage("Navigator?TopLevelNode?http://www.eclipse.org/uml2/2.1.0/UML?Class", UMLElementTypes.Class_2008); //$NON-NLS-1$
+ case PrimitiveTypeEditPart.VISUAL_ID:
+ return getImage("Navigator?TopLevelNode?http://www.eclipse.org/uml2/2.1.0/UML?PrimitiveType", UMLElementTypes.PrimitiveType_2009); //$NON-NLS-1$
+ case DataTypeEditPart.VISUAL_ID:
+ return getImage("Navigator?TopLevelNode?http://www.eclipse.org/uml2/2.1.0/UML?DataType", UMLElementTypes.DataType_2010); //$NON-NLS-1$
+ case ConstraintEditPart.VISUAL_ID:
+ return getImage("Navigator?TopLevelNode?http://www.eclipse.org/uml2/2.1.0/UML?Constraint", UMLElementTypes.Constraint_2011); //$NON-NLS-1$
+ case CommentEditPart.VISUAL_ID:
+ return getImage("Navigator?TopLevelNode?http://www.eclipse.org/uml2/2.1.0/UML?Comment", UMLElementTypes.Comment_2012); //$NON-NLS-1$
+ case PropertyEditPart.VISUAL_ID:
+ return getImage("Navigator?Node?http://www.eclipse.org/uml2/2.1.0/UML?Property", UMLElementTypes.Property_3002); //$NON-NLS-1$
+ case SlotEditPart.VISUAL_ID:
+ return getImage("Navigator?Node?http://www.eclipse.org/uml2/2.1.0/UML?Slot", UMLElementTypes.Slot_3001); //$NON-NLS-1$
+ case OperationEditPart.VISUAL_ID:
+ return getImage("Navigator?Node?http://www.eclipse.org/uml2/2.1.0/UML?Operation", UMLElementTypes.Operation_3003); //$NON-NLS-1$
+ case Class2EditPart.VISUAL_ID:
+ return getImage("Navigator?Node?http://www.eclipse.org/uml2/2.1.0/UML?Class", UMLElementTypes.Class_3004); //$NON-NLS-1$
+ case RedefinableTemplateSignatureEditPart.VISUAL_ID:
+ return getImage("Navigator?Node?http://www.eclipse.org/uml2/2.1.0/UML?RedefinableTemplateSignature", UMLElementTypes.RedefinableTemplateSignature_3015); //$NON-NLS-1$
+ case TemplateParameterEditPart.VISUAL_ID:
+ return getImage("Navigator?Node?http://www.eclipse.org/uml2/2.1.0/UML?TemplateParameter", UMLElementTypes.TemplateParameter_3016); //$NON-NLS-1$
+ case Property2EditPart.VISUAL_ID:
+ return getImage("Navigator?Node?http://www.eclipse.org/uml2/2.1.0/UML?Property", UMLElementTypes.Property_3005); //$NON-NLS-1$
+ case Property3EditPart.VISUAL_ID:
+ return getImage("Navigator?Node?http://www.eclipse.org/uml2/2.1.0/UML?Property", UMLElementTypes.Property_3006); //$NON-NLS-1$
+ case Operation2EditPart.VISUAL_ID:
+ return getImage("Navigator?Node?http://www.eclipse.org/uml2/2.1.0/UML?Operation", UMLElementTypes.Operation_3007); //$NON-NLS-1$
+ case Class3EditPart.VISUAL_ID:
+ return getImage("Navigator?Node?http://www.eclipse.org/uml2/2.1.0/UML?Class", UMLElementTypes.Class_3008); //$NON-NLS-1$
+ case InstanceSpecification2EditPart.VISUAL_ID:
+ return getImage("Navigator?Node?http://www.eclipse.org/uml2/2.1.0/UML?InstanceSpecification", UMLElementTypes.InstanceSpecification_3020); //$NON-NLS-1$
+ case Component2EditPart.VISUAL_ID:
+ return getImage("Navigator?Node?http://www.eclipse.org/uml2/2.1.0/UML?Component", UMLElementTypes.Component_3021); //$NON-NLS-1$
+ case Signal2EditPart.VISUAL_ID:
+ return getImage("Navigator?Node?http://www.eclipse.org/uml2/2.1.0/UML?Signal", UMLElementTypes.Signal_3022); //$NON-NLS-1$
+ case Interface2EditPart.VISUAL_ID:
+ return getImage("Navigator?Node?http://www.eclipse.org/uml2/2.1.0/UML?Interface", UMLElementTypes.Interface_3023); //$NON-NLS-1$
+ case Model3EditPart.VISUAL_ID:
+ return getImage("Navigator?Node?http://www.eclipse.org/uml2/2.1.0/UML?Model", UMLElementTypes.Model_3024); //$NON-NLS-1$
+ case Enumeration2EditPart.VISUAL_ID:
+ return getImage("Navigator?Node?http://www.eclipse.org/uml2/2.1.0/UML?Enumeration", UMLElementTypes.Enumeration_3025); //$NON-NLS-1$
+ case EnumerationLiteralEditPart.VISUAL_ID:
+ return getImage("Navigator?Node?http://www.eclipse.org/uml2/2.1.0/UML?EnumerationLiteral", UMLElementTypes.EnumerationLiteral_3017); //$NON-NLS-1$
+ case Package2EditPart.VISUAL_ID:
+ return getImage("Navigator?Node?http://www.eclipse.org/uml2/2.1.0/UML?Package", UMLElementTypes.Package_3009); //$NON-NLS-1$
+ case Class4EditPart.VISUAL_ID:
+ return getImage("Navigator?Node?http://www.eclipse.org/uml2/2.1.0/UML?Class", UMLElementTypes.Class_3010); //$NON-NLS-1$
+ case ReceptionEditPart.VISUAL_ID:
+ return getImage("Navigator?Node?http://www.eclipse.org/uml2/2.1.0/UML?Reception", UMLElementTypes.Reception_3011); //$NON-NLS-1$
+ case Property4EditPart.VISUAL_ID:
+ return getImage("Navigator?Node?http://www.eclipse.org/uml2/2.1.0/UML?Property", UMLElementTypes.Property_3012); //$NON-NLS-1$
+ case Operation3EditPart.VISUAL_ID:
+ return getImage("Navigator?Node?http://www.eclipse.org/uml2/2.1.0/UML?Operation", UMLElementTypes.Operation_3013); //$NON-NLS-1$
+ case Class5EditPart.VISUAL_ID:
+ return getImage("Navigator?Node?http://www.eclipse.org/uml2/2.1.0/UML?Class", UMLElementTypes.Class_3014); //$NON-NLS-1$
+ case PrimitiveType2EditPart.VISUAL_ID:
+ return getImage("Navigator?Node?http://www.eclipse.org/uml2/2.1.0/UML?PrimitiveType", UMLElementTypes.PrimitiveType_3026); //$NON-NLS-1$
+ case DataType2EditPart.VISUAL_ID:
+ return getImage("Navigator?Node?http://www.eclipse.org/uml2/2.1.0/UML?DataType", UMLElementTypes.DataType_3027); //$NON-NLS-1$
+ case Property5EditPart.VISUAL_ID:
+ return getImage("Navigator?Node?http://www.eclipse.org/uml2/2.1.0/UML?Property", UMLElementTypes.Property_3018); //$NON-NLS-1$
+ case Operation4EditPart.VISUAL_ID:
+ return getImage("Navigator?Node?http://www.eclipse.org/uml2/2.1.0/UML?Operation", UMLElementTypes.Operation_3019); //$NON-NLS-1$
+ case Comment2EditPart.VISUAL_ID:
+ return getImage("Navigator?Node?http://www.eclipse.org/uml2/2.1.0/UML?Comment", UMLElementTypes.Comment_3028); //$NON-NLS-1$
+ case Constraint2EditPart.VISUAL_ID:
+ return getImage("Navigator?Node?http://www.eclipse.org/uml2/2.1.0/UML?Constraint", UMLElementTypes.Constraint_3029); //$NON-NLS-1$
+ case CommentLinkDescriptorEditPart.VISUAL_ID:
+ return getImage("Navigator?Link?CommentLinkDescriptor", UMLElementTypes.Link_4016); //$NON-NLS-1$
+ case AssociationClass2EditPart.VISUAL_ID:
+ return getImage("Navigator?Link?http://www.eclipse.org/uml2/2.1.0/UML?AssociationClass", UMLElementTypes.AssociationClass_4017); //$NON-NLS-1$
+ case AssociationEditPart.VISUAL_ID:
+ return getImage("Navigator?Link?http://www.eclipse.org/uml2/2.1.0/UML?Association", UMLElementTypes.Association_4001); //$NON-NLS-1$
+ case Association3EditPart.VISUAL_ID:
+ return getImage("Navigator?Link?http://www.eclipse.org/uml2/2.1.0/UML?Association", UMLElementTypes.Association_4019); //$NON-NLS-1$
+ case GeneralizationEditPart.VISUAL_ID:
+ return getImage("Navigator?Link?http://www.eclipse.org/uml2/2.1.0/UML?Generalization", UMLElementTypes.Generalization_4002); //$NON-NLS-1$
+ case InterfaceRealizationEditPart.VISUAL_ID:
+ return getImage("Navigator?Link?http://www.eclipse.org/uml2/2.1.0/UML?InterfaceRealization", UMLElementTypes.InterfaceRealization_4003); //$NON-NLS-1$
+ case SubstitutionEditPart.VISUAL_ID:
+ return getImage("Navigator?Link?http://www.eclipse.org/uml2/2.1.0/UML?Substitution", UMLElementTypes.Substitution_4004); //$NON-NLS-1$
+ case RealizationEditPart.VISUAL_ID:
+ return getImage("Navigator?Link?http://www.eclipse.org/uml2/2.1.0/UML?Realization", UMLElementTypes.Realization_4005); //$NON-NLS-1$
+ case AbstractionEditPart.VISUAL_ID:
+ return getImage("Navigator?Link?http://www.eclipse.org/uml2/2.1.0/UML?Abstraction", UMLElementTypes.Abstraction_4006); //$NON-NLS-1$
+ case UsageEditPart.VISUAL_ID:
+ return getImage("Navigator?Link?http://www.eclipse.org/uml2/2.1.0/UML?Usage", UMLElementTypes.Usage_4007); //$NON-NLS-1$
+ case DependencyEditPart.VISUAL_ID:
+ return getImage("Navigator?Link?http://www.eclipse.org/uml2/2.1.0/UML?Dependency", UMLElementTypes.Dependency_4008); //$NON-NLS-1$
+ case Dependency3EditPart.VISUAL_ID:
+ return getImage("Navigator?Link?http://www.eclipse.org/uml2/2.1.0/UML?Dependency", UMLElementTypes.Dependency_4018); //$NON-NLS-1$
+ case ElementImportEditPart.VISUAL_ID:
+ return getImage("Navigator?Link?http://www.eclipse.org/uml2/2.1.0/UML?ElementImport", UMLElementTypes.ElementImport_4009); //$NON-NLS-1$
+ case PackageImportEditPart.VISUAL_ID:
+ return getImage("Navigator?Link?http://www.eclipse.org/uml2/2.1.0/UML?PackageImport", UMLElementTypes.PackageImport_4010); //$NON-NLS-1$
+ case PackageMergeEditPart.VISUAL_ID:
+ return getImage("Navigator?Link?http://www.eclipse.org/uml2/2.1.0/UML?PackageMerge", UMLElementTypes.PackageMerge_4011); //$NON-NLS-1$
+ case ProfileApplicationEditPart.VISUAL_ID:
+ return getImage("Navigator?Link?http://www.eclipse.org/uml2/2.1.0/UML?ProfileApplication", UMLElementTypes.ProfileApplication_4012); //$NON-NLS-1$
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getImage("Navigator?Link?http://www.eclipse.org/uml2/2.1.0/UML?Comment?annotatedElement", UMLElementTypes.CommentAnnotatedElement_4013); //$NON-NLS-1$
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getImage("Navigator?Link?http://www.eclipse.org/uml2/2.1.0/UML?Constraint?constrainedElement", UMLElementTypes.ConstraintConstrainedElement_4014); //$NON-NLS-1$
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getImage("Navigator?Link?http://www.eclipse.org/uml2/2.1.0/UML?TemplateBinding", UMLElementTypes.TemplateBinding_4015); //$NON-NLS-1$
+ }
+ return getImage("Navigator?UnknownElement", null); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ private Image getImage(String key, IElementType elementType) {
+ ImageRegistry imageRegistry = UMLDiagramEditorPlugin.getInstance().getImageRegistry();
+ Image image = imageRegistry.get(key);
+ if (image == null && elementType != null && UMLElementTypes.isKnownElementType(elementType)) {
+ image = UMLElementTypes.getImage(elementType);
+ imageRegistry.put(key, image);
+ }
+
+ if (image == null) {
+ image = imageRegistry.get("Navigator?ImageNotFound"); //$NON-NLS-1$
+ imageRegistry.put(key, image);
+ }
+ return image;
+ }
+
+ /**
+ * @generated
+ */
+ public String getText(Object element) {
+ if (element instanceof UMLNavigatorGroup) {
+ UMLNavigatorGroup group = (UMLNavigatorGroup) element;
+ return group.getGroupName();
+ }
+
+ if (element instanceof UMLNavigatorItem) {
+ UMLNavigatorItem navigatorItem = (UMLNavigatorItem) element;
+ if (!isOwnView(navigatorItem.getView())) {
+ return null;
+ }
+ return getText(navigatorItem.getView());
+ }
+
+ return super.getText(element);
+ }
+
+ /**
+ * @generated
+ */
+ public String getText(View view) {
+ if (view.getElement() != null && view.getElement().eIsProxy()) {
+ return getUnresolvedDomainElementProxyText(view);
+ }
+ switch (UMLVisualIDRegistry.getVisualID(view)) {
+ case ModelEditPart.VISUAL_ID:
+ return getPackage_1000Text(view);
+ case Dependency2EditPart.VISUAL_ID:
+ return getDependency_2014Text(view);
+ case AssociationClassEditPart.VISUAL_ID:
+ return getAssociationClass_2013Text(view);
+ case Association2EditPart.VISUAL_ID:
+ return getAssociation_2015Text(view);
+ case InstanceSpecificationEditPart.VISUAL_ID:
+ return getInstanceSpecification_2001Text(view);
+ case ComponentEditPart.VISUAL_ID:
+ return getComponent_2002Text(view);
+ case SignalEditPart.VISUAL_ID:
+ return getSignal_2003Text(view);
+ case InterfaceEditPart.VISUAL_ID:
+ return getInterface_2004Text(view);
+ case Model2EditPart.VISUAL_ID:
+ return getModel_2005Text(view);
+ case EnumerationEditPart.VISUAL_ID:
+ return getEnumeration_2006Text(view);
+ case PackageEditPart.VISUAL_ID:
+ return getPackage_2007Text(view);
+ case ClassEditPart.VISUAL_ID:
+ return getClass_2008Text(view);
+ case PrimitiveTypeEditPart.VISUAL_ID:
+ return getPrimitiveType_2009Text(view);
+ case DataTypeEditPart.VISUAL_ID:
+ return getDataType_2010Text(view);
+ case ConstraintEditPart.VISUAL_ID:
+ return getConstraint_2011Text(view);
+ case CommentEditPart.VISUAL_ID:
+ return getComment_2012Text(view);
+ case PropertyEditPart.VISUAL_ID:
+ return getProperty_3002Text(view);
+ case SlotEditPart.VISUAL_ID:
+ return getSlot_3001Text(view);
+ case OperationEditPart.VISUAL_ID:
+ return getOperation_3003Text(view);
+ case Class2EditPart.VISUAL_ID:
+ return getClass_3004Text(view);
+ case RedefinableTemplateSignatureEditPart.VISUAL_ID:
+ return getRedefinableTemplateSignature_3015Text(view);
+ case TemplateParameterEditPart.VISUAL_ID:
+ return getTemplateParameter_3016Text(view);
+ case Property2EditPart.VISUAL_ID:
+ return getProperty_3005Text(view);
+ case Property3EditPart.VISUAL_ID:
+ return getProperty_3006Text(view);
+ case Operation2EditPart.VISUAL_ID:
+ return getOperation_3007Text(view);
+ case Class3EditPart.VISUAL_ID:
+ return getClass_3008Text(view);
+ case InstanceSpecification2EditPart.VISUAL_ID:
+ return getInstanceSpecification_3020Text(view);
+ case Component2EditPart.VISUAL_ID:
+ return getComponent_3021Text(view);
+ case Signal2EditPart.VISUAL_ID:
+ return getSignal_3022Text(view);
+ case Interface2EditPart.VISUAL_ID:
+ return getInterface_3023Text(view);
+ case Model3EditPart.VISUAL_ID:
+ return getModel_3024Text(view);
+ case Enumeration2EditPart.VISUAL_ID:
+ return getEnumeration_3025Text(view);
+ case EnumerationLiteralEditPart.VISUAL_ID:
+ return getEnumerationLiteral_3017Text(view);
+ case Package2EditPart.VISUAL_ID:
+ return getPackage_3009Text(view);
+ case Class4EditPart.VISUAL_ID:
+ return getClass_3010Text(view);
+ case ReceptionEditPart.VISUAL_ID:
+ return getReception_3011Text(view);
+ case Property4EditPart.VISUAL_ID:
+ return getProperty_3012Text(view);
+ case Operation3EditPart.VISUAL_ID:
+ return getOperation_3013Text(view);
+ case Class5EditPart.VISUAL_ID:
+ return getClass_3014Text(view);
+ case PrimitiveType2EditPart.VISUAL_ID:
+ return getPrimitiveType_3026Text(view);
+ case DataType2EditPart.VISUAL_ID:
+ return getDataType_3027Text(view);
+ case Property5EditPart.VISUAL_ID:
+ return getProperty_3018Text(view);
+ case Operation4EditPart.VISUAL_ID:
+ return getOperation_3019Text(view);
+ case Comment2EditPart.VISUAL_ID:
+ return getComment_3028Text(view);
+ case Constraint2EditPart.VISUAL_ID:
+ return getConstraint_3029Text(view);
+ case CommentLinkDescriptorEditPart.VISUAL_ID:
+ return getLink_4016Text(view);
+ case AssociationClass2EditPart.VISUAL_ID:
+ return getAssociationClass_4017Text(view);
+ case AssociationEditPart.VISUAL_ID:
+ return getAssociation_4001Text(view);
+ case Association3EditPart.VISUAL_ID:
+ return getAssociation_4019Text(view);
+ case GeneralizationEditPart.VISUAL_ID:
+ return getGeneralization_4002Text(view);
+ case InterfaceRealizationEditPart.VISUAL_ID:
+ return getInterfaceRealization_4003Text(view);
+ case SubstitutionEditPart.VISUAL_ID:
+ return getSubstitution_4004Text(view);
+ case RealizationEditPart.VISUAL_ID:
+ return getRealization_4005Text(view);
+ case AbstractionEditPart.VISUAL_ID:
+ return getAbstraction_4006Text(view);
+ case UsageEditPart.VISUAL_ID:
+ return getUsage_4007Text(view);
+ case DependencyEditPart.VISUAL_ID:
+ return getDependency_4008Text(view);
+ case Dependency3EditPart.VISUAL_ID:
+ return getDependency_4018Text(view);
+ case ElementImportEditPart.VISUAL_ID:
+ return getElementImport_4009Text(view);
+ case PackageImportEditPart.VISUAL_ID:
+ return getPackageImport_4010Text(view);
+ case PackageMergeEditPart.VISUAL_ID:
+ return getPackageMerge_4011Text(view);
+ case ProfileApplicationEditPart.VISUAL_ID:
+ return getProfileApplication_4012Text(view);
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return getCommentAnnotatedElement_4013Text(view);
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return getConstraintConstrainedElement_4014Text(view);
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getTemplateBinding_4015Text(view);
+ }
+ return getUnknownElementText(view);
+ }
+
+ /**
+ * @generated
+ */
+ private String getPackage_1000Text(View view) {
+ Package domainModelElement = (Package) view.getElement();
+ if (domainModelElement != null) {
+ return String.valueOf(domainModelElement.getName());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("No domain element for view with visualID = " + 1000); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private String getDependency_2014Text(View view) {
+ Dependency domainModelElement = (Dependency) view.getElement();
+ if (domainModelElement != null) {
+ return String.valueOf(domainModelElement.getName());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("No domain element for view with visualID = " + 2014); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private String getInstanceSpecification_2001Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.InstanceSpecification_2001, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(InstanceSpecificationNameEditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 5001); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getComponent_2002Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Component_2002, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(ComponentNameEditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 5004); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getSignal_2003Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Signal_2003, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(SignalNameEditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 5007); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getInterface_2004Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Interface_2004, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(InterfaceNameEditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 5010); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getModel_2005Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Model_2005, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(ModelNameEditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 5019); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getEnumeration_2006Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Enumeration_2006, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(EnumerationNameEditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 5022); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getPackage_2007Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Package_2007, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(PackageNameEditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 5025); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getClass_2008Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Class_2008, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(ClassNameEditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 5028); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getPrimitiveType_2009Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.PrimitiveType_2009, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(PrimitiveTypeNameEditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 5031); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getDataType_2010Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.DataType_2010, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(DataTypeNameEditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 5034); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getConstraint_2011Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Constraint_2011, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(ConstraintNameEditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 5037); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getComment_2012Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Comment_2012, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(CommentBodyEditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 5038); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getAssociationClass_2013Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.AssociationClass_2013, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(AssociationClassNameEditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 5065); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getAssociation_2015Text(View view) {
+ Association domainModelElement = (Association) view.getElement();
+ if (domainModelElement != null) {
+ return String.valueOf(domainModelElement.getName());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("No domain element for view with visualID = " + 2015); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private String getSlot_3001Text(View view) {
+ return ""; //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ private String getProperty_3002Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Property_3002, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(PropertyEditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 3002); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private String getOperation_3003Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Operation_3003, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(OperationEditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 3003); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private String getClass_3004Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Class_3004, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(Class2EditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 3004); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private String getProperty_3005Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Property_3005, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(Property2EditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 3005); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private String getProperty_3006Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Property_3006, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(Property3EditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 3006); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private String getOperation_3007Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Operation_3007, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(Operation2EditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 3007); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private String getClass_3008Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Class_3008, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(Class3EditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 3008); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private String getPackage_3009Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Package_3009, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(PackageName3EditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 5016); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getInstanceSpecification_3020Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.InstanceSpecification_3020, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(InstanceSpecificationName3EditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 5039); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getComponent_3021Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Component_3021, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(ComponentName3EditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 5042); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getSignal_3022Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Signal_3022, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(SignalName3EditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 5045); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getInterface_3023Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Interface_3023, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(InterfaceName3EditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 5048); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getModel_3024Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Model_3024, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(ModelName3EditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 5051); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getClass_3010Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Class_3010, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(ClassName3EditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 5013); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getReception_3011Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Reception_3011, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(ReceptionEditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 3011); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private String getProperty_3012Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Property_3012, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(Property4EditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 3012); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private String getOperation_3013Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Operation_3013, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(Operation3EditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 3013); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private String getClass_3014Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Class_3014, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(Class5EditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 3014); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private String getRedefinableTemplateSignature_3015Text(View view) {
+ RedefinableTemplateSignature domainModelElement = (RedefinableTemplateSignature) view.getElement();
+ if (domainModelElement != null) {
+ return String.valueOf(domainModelElement.getName());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("No domain element for view with visualID = " + 3015); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private String getTemplateParameter_3016Text(View view) {
+
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.TemplateParameter_3016, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(TemplateParameterEditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ return ""; //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private String getEnumeration_3025Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Enumeration_3025, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(EnumerationName3EditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 5054); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getEnumerationLiteral_3017Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.EnumerationLiteral_3017, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(EnumerationLiteralEditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 3017); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private String getPrimitiveType_3026Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.PrimitiveType_3026, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(PrimitiveTypeName3EditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 5057); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getDataType_3027Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.DataType_3027, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(DataTypeName3EditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 5060); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getProperty_3018Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Property_3018, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(Property5EditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 3018); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private String getOperation_3019Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Operation_3019, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(Operation4EditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 3019); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private String getComment_3028Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Comment_3028, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(CommentBody2EditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 5063); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getConstraint_3029Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Constraint_3029, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(ConstraintName2EditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 5064); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getLink_4016Text(View view) {
+ return ""; //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ private String getAssociationClass_4017Text(View view) {
+ AssociationClass domainModelElement = (AssociationClass) view.getElement();
+ if (domainModelElement != null) {
+ return String.valueOf(domainModelElement.getName());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("No domain element for view with visualID = " + 4017); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private String getAssociation_4001Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Association_4001, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(AssociationNameEditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 6001); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getAssociation_4019Text(View view) {
+ Association domainModelElement = (Association) view.getElement();
+ if (domainModelElement != null) {
+ return String.valueOf(domainModelElement.getName());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("No domain element for view with visualID = " + 4019); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private String getGeneralization_4002Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Generalization_4002, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(GeneralizationIsSubstitutableEditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 6007); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getInterfaceRealization_4003Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.InterfaceRealization_4003, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(InterfaceRealizationNameEditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 6008); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getSubstitution_4004Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Substitution_4004, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(SubstitutionNameEditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 6010); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getRealization_4005Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Realization_4005, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(RealizationNameEditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 6012); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getAbstraction_4006Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Abstraction_4006, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(AbstractionNameEditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 6014); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getUsage_4007Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Usage_4007, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(UsageNameEditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 6016); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getDependency_4008Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Dependency_4008, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(DependencyNameEditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 6026); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getDependency_4018Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.Dependency_4018, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(DependencyName3EditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 6028); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getElementImport_4009Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.ElementImport_4009, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(ElementImportAliasEditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 6020); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getPackageImport_4010Text(View view) {
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.PackageImport_4010, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(PackageImportVisibilityEditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 6022); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getPackageMerge_4011Text(View view) {
+ return ""; //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ private String getProfileApplication_4012Text(View view) {
+ ProfileApplication domainModelElement = (ProfileApplication) view.getElement();
+ if (domainModelElement != null) {
+ return String.valueOf(domainModelElement.isStrict());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("No domain element for view with visualID = " + 4012); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private String getCommentAnnotatedElement_4013Text(View view) {
+ return ""; //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ private String getConstraintConstrainedElement_4014Text(View view) {
+ return ""; //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ private String getTemplateBinding_4015Text(View view) {
+
+ IAdaptable hintAdapter = new UMLParserProvider.HintAdapter(UMLElementTypes.TemplateBinding_4015, (view.getElement() != null ? view.getElement() : view), UMLVisualIDRegistry
+ .getType(WrappingLabelEditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getUnknownElementText(View view) {
+ return "<UnknownElement Visual_ID = " + view.getType() + ">"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * @generated
+ */
+ private String getUnresolvedDomainElementProxyText(View view) {
+ return "<Unresolved domain element Visual_ID = " + view.getType() + ">"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * @generated
+ */
+ public void init(ICommonContentExtensionSite aConfig) {
+ }
+
+ /**
+ * @generated
+ */
+ public void restoreState(IMemento aMemento) {
+ }
+
+ /**
+ * @generated
+ */
+ public void saveState(IMemento aMemento) {
+ }
+
+ /**
+ * @generated
+ */
+ public String getDescription(Object anElement) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ private boolean isOwnView(View view) {
+ return ModelEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(view));
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/navigator/UMLNavigatorLinkHelper.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/navigator/UMLNavigatorLinkHelper.java
new file mode 100644
index 00000000000..4d1bffd3c66
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/navigator/UMLNavigatorLinkHelper.java
@@ -0,0 +1,128 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.navigator;
+
+import java.util.Iterator;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.common.ui.URIEditorInput;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.GraphicalViewer;
+import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.navigator.ILinkHelper;
+import org.eclipse.ui.part.FileEditorInput;
+
+/**
+ * @generated
+ */
+public class UMLNavigatorLinkHelper implements ILinkHelper {
+
+ /**
+ * @generated
+ */
+ private static IEditorInput getEditorInput(Diagram diagram) {
+ Resource diagramResource = diagram.eResource();
+ for (Iterator it = diagramResource.getContents().iterator(); it.hasNext();) {
+ EObject nextEObject = (EObject) it.next();
+ if (nextEObject == diagram) {
+ return new FileEditorInput(WorkspaceSynchronizer.getFile(diagramResource));
+ }
+ if (nextEObject instanceof Diagram) {
+ break;
+ }
+ }
+ URI uri = EcoreUtil.getURI(diagram);
+ String editorName = uri.lastSegment() + "#" + diagram.eResource().getContents().indexOf(diagram); //$NON-NLS-1$
+ IEditorInput editorInput = new URIEditorInput(uri, editorName);
+ return editorInput;
+ }
+
+ /**
+ * @generated
+ */
+ public IStructuredSelection findSelection(IEditorInput anInput) {
+ IDiagramDocument document = UMLDiagramEditorPlugin.getInstance().getDocumentProvider().getDiagramDocument(anInput);
+ if (document == null) {
+ return StructuredSelection.EMPTY;
+ }
+ Diagram diagram = document.getDiagram();
+ IFile file = WorkspaceSynchronizer.getFile(diagram.eResource());
+ if (file != null) {
+ UMLNavigatorItem item = new UMLNavigatorItem(diagram, file, false);
+ return new StructuredSelection(item);
+ }
+ return StructuredSelection.EMPTY;
+ }
+
+ /**
+ * @generated
+ */
+ public void activateEditor(IWorkbenchPage aPage, IStructuredSelection aSelection) {
+ if (aSelection == null || aSelection.isEmpty()) {
+ return;
+ }
+ if (false == aSelection.getFirstElement() instanceof UMLAbstractNavigatorItem) {
+ return;
+ }
+
+ UMLAbstractNavigatorItem abstractNavigatorItem = (UMLAbstractNavigatorItem) aSelection.getFirstElement();
+ View navigatorView = null;
+ if (abstractNavigatorItem instanceof UMLNavigatorItem) {
+ navigatorView = ((UMLNavigatorItem) abstractNavigatorItem).getView();
+ } else if (abstractNavigatorItem instanceof UMLNavigatorGroup) {
+ UMLNavigatorGroup navigatorGroup = (UMLNavigatorGroup) abstractNavigatorItem;
+ if (navigatorGroup.getParent() instanceof UMLNavigatorItem) {
+ navigatorView = ((UMLNavigatorItem) navigatorGroup.getParent()).getView();
+ }
+ }
+ if (navigatorView == null) {
+ return;
+ }
+ IEditorInput editorInput = getEditorInput(navigatorView.getDiagram());
+ IEditorPart editor = aPage.findEditor(editorInput);
+ if (editor == null) {
+ return;
+ }
+ aPage.bringToTop(editor);
+ if (editor instanceof DiagramEditor) {
+ DiagramEditor diagramEditor = (DiagramEditor) editor;
+ ResourceSet diagramEditorResourceSet = diagramEditor.getEditingDomain().getResourceSet();
+ EObject selectedView = diagramEditorResourceSet.getEObject(EcoreUtil.getURI(navigatorView), true);
+ if (selectedView == null) {
+ return;
+ }
+ GraphicalViewer graphicalViewer = (GraphicalViewer) diagramEditor.getAdapter(GraphicalViewer.class);
+ EditPart selectedEditPart = (EditPart) graphicalViewer.getEditPartRegistry().get(selectedView);
+ if (selectedEditPart != null) {
+ graphicalViewer.select(selectedEditPart);
+ }
+ }
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/navigator/UMLNavigatorSorter.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/navigator/UMLNavigatorSorter.java
new file mode 100644
index 00000000000..d85840942a2
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/navigator/UMLNavigatorSorter.java
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.navigator;
+
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class UMLNavigatorSorter extends ViewerSorter {
+
+ /**
+ * @generated
+ */
+ private static final int GROUP_CATEGORY = 7036;
+
+ /**
+ * @generated
+ */
+ public int category(Object element) {
+ if (element instanceof UMLNavigatorItem) {
+ UMLNavigatorItem item = (UMLNavigatorItem) element;
+ return UMLVisualIDRegistry.getVisualID(item.getView());
+ }
+ return GROUP_CATEGORY;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/parsers/AbstractParser.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/parsers/AbstractParser.java
new file mode 100644
index 00000000000..6b7c53ba3b4
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/parsers/AbstractParser.java
@@ -0,0 +1,401 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.parsers;
+
+import java.util.Arrays;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EEnum;
+import org.eclipse.emf.ecore.EEnumLiteral;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.papyrus.diagram.clazz.part.Messages;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+public abstract class AbstractParser implements IParser {
+
+ /**
+ * @generated
+ */
+ protected final EAttribute[] features;
+
+ /**
+ * @generated
+ */
+ private String viewPattern;
+
+ /**
+ * @generated
+ */
+ private String editorPattern;
+
+ /**
+ * @generated
+ */
+ private String editPattern;
+
+ /**
+ * @generated
+ */
+ public AbstractParser(EAttribute[] features) {
+ if (features == null || Arrays.asList(features).contains(null)) {
+ throw new IllegalArgumentException();
+ }
+ this.features = features;
+ }
+
+ /**
+ * @generated
+ */
+ public String getViewPattern() {
+ return viewPattern;
+ }
+
+ /**
+ * @generated
+ */
+ public void setViewPattern(String viewPattern) {
+ this.viewPattern = viewPattern;
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditorPattern() {
+ return editorPattern;
+ }
+
+ /**
+ * @generated
+ */
+ public void setEditorPattern(String editorPattern) {
+ this.editorPattern = editorPattern;
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditPattern() {
+ return editPattern;
+ }
+
+ /**
+ * @generated
+ */
+ public void setEditPattern(String editPattern) {
+ this.editPattern = editPattern;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isAffectingEvent(Object event, int flags) {
+ if (event instanceof Notification) {
+ return isAffectingFeature(((Notification) event).getFeature());
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isAffectingFeature(Object feature) {
+ for (int i = 0; i < features.length; i++) {
+ if (features[i] == feature) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor(IAdaptable element) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Object[] getValues(EObject element) {
+ Object[] values = new Object[features.length];
+ for (int i = 0; i < features.length; i++) {
+ values[i] = getValue(element, features[i]);
+ }
+ return values;
+ }
+
+ /**
+ * @generated
+ */
+ protected Object getValue(EObject element, EAttribute feature) {
+ Object value = element.eGet(feature);
+ Class iClass = feature.getEAttributeType().getInstanceClass();
+ if (String.class.equals(iClass)) {
+ if (value == null) {
+ value = ""; //$NON-NLS-1$
+ }
+ }
+ return value;
+ }
+
+ /**
+ * @generated
+ */
+ protected ICommand getParseCommand(IAdaptable adapter, Object[] values, int flags) {
+ if (values == null || validateNewValues(values).getCode() != IParserEditStatus.EDITABLE) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ EObject element = (EObject) adapter.getAdapter(EObject.class);
+ TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(element);
+ if (editingDomain == null) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ CompositeTransactionalCommand command = new CompositeTransactionalCommand(editingDomain, "Set Values"); //$NON-NLS-1$
+ for (int i = 0; i < values.length; i++) {
+ command.compose(getModificationCommand(element, features[i], values[i]));
+ }
+ return command;
+ }
+
+ /**
+ * @generated
+ */
+ protected ICommand getModificationCommand(EObject element, EAttribute feature, Object value) {
+ value = getValidNewValue(feature, value);
+ if (value instanceof InvalidValue) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ SetRequest request = new SetRequest(element, feature, value);
+ return new SetValueCommand(request);
+ }
+
+ /**
+ * @generated
+ */
+ protected IParserEditStatus validateNewValues(Object[] values) {
+ if (values.length != features.length) {
+ return ParserEditStatus.UNEDITABLE_STATUS;
+ }
+ for (int i = 0; i < values.length; i++) {
+ Object value = getValidNewValue(features[i], values[i]);
+ if (value instanceof InvalidValue) {
+ return new ParserEditStatus(UMLDiagramEditorPlugin.ID, IParserEditStatus.UNEDITABLE, value.toString());
+ }
+ }
+ return ParserEditStatus.EDITABLE_STATUS;
+ }
+
+ /**
+ * @generated
+ */
+ protected Object getValidNewValue(EAttribute feature, Object value) {
+ EClassifier type = feature.getEType();
+ if (type instanceof EDataType) {
+ Class iClass = type.getInstanceClass();
+ if (Boolean.TYPE.equals(iClass)) {
+ if (value instanceof Boolean) {
+ // ok
+ } else if (value instanceof String) {
+ value = Boolean.valueOf((String) value);
+ } else {
+ value = new InvalidValue(NLS.bind(Messages.AbstractParser_UnexpectedValueTypeMessage, iClass.getName()));
+ }
+ } else if (Character.TYPE.equals(iClass)) {
+ if (value instanceof Character) {
+ // ok
+ } else if (value instanceof String) {
+ String s = (String) value;
+ if (s.length() == 0) {
+ value = null;
+ } else {
+ value = new Character(s.charAt(0));
+ }
+ } else {
+ value = new InvalidValue(NLS.bind(Messages.AbstractParser_UnexpectedValueTypeMessage, iClass.getName()));
+ }
+ } else if (Byte.TYPE.equals(iClass)) {
+ if (value instanceof Byte) {
+ // ok
+ } else if (value instanceof Number) {
+ value = new Byte(((Number) value).byteValue());
+ } else if (value instanceof String) {
+ String s = (String) value;
+ if (s.length() == 0) {
+ value = null;
+ } else {
+ try {
+ value = Byte.valueOf(s);
+ } catch (NumberFormatException nfe) {
+ value = new InvalidValue(NLS.bind(Messages.AbstractParser_WrongStringConversionMessage, iClass.getName()));
+ }
+ }
+ } else {
+ value = new InvalidValue(NLS.bind(Messages.AbstractParser_UnexpectedValueTypeMessage, iClass.getName()));
+ }
+ } else if (Short.TYPE.equals(iClass)) {
+ if (value instanceof Short) {
+ // ok
+ } else if (value instanceof Number) {
+ value = new Short(((Number) value).shortValue());
+ } else if (value instanceof String) {
+ String s = (String) value;
+ if (s.length() == 0) {
+ value = null;
+ } else {
+ try {
+ value = Short.valueOf(s);
+ } catch (NumberFormatException nfe) {
+ value = new InvalidValue(NLS.bind(Messages.AbstractParser_WrongStringConversionMessage, iClass.getName()));
+ }
+ }
+ } else {
+ value = new InvalidValue(NLS.bind(Messages.AbstractParser_UnexpectedValueTypeMessage, iClass.getName()));
+ }
+ } else if (Integer.TYPE.equals(iClass)) {
+ if (value instanceof Integer) {
+ // ok
+ } else if (value instanceof Number) {
+ value = new Integer(((Number) value).intValue());
+ } else if (value instanceof String) {
+ String s = (String) value;
+ if (s.length() == 0) {
+ value = null;
+ } else {
+ try {
+ value = Integer.valueOf(s);
+ } catch (NumberFormatException nfe) {
+ value = new InvalidValue(NLS.bind(Messages.AbstractParser_WrongStringConversionMessage, iClass.getName()));
+ }
+ }
+ } else {
+ value = new InvalidValue(NLS.bind(Messages.AbstractParser_UnexpectedValueTypeMessage, iClass.getName()));
+ }
+ } else if (Long.TYPE.equals(iClass)) {
+ if (value instanceof Long) {
+ // ok
+ } else if (value instanceof Number) {
+ value = new Long(((Number) value).longValue());
+ } else if (value instanceof String) {
+ String s = (String) value;
+ if (s.length() == 0) {
+ value = null;
+ } else {
+ try {
+ value = Long.valueOf(s);
+ } catch (NumberFormatException nfe) {
+ value = new InvalidValue(NLS.bind(Messages.AbstractParser_WrongStringConversionMessage, iClass.getName()));
+ }
+ }
+ } else {
+ value = new InvalidValue(NLS.bind(Messages.AbstractParser_UnexpectedValueTypeMessage, iClass.getName()));
+ }
+ } else if (Float.TYPE.equals(iClass)) {
+ if (value instanceof Float) {
+ // ok
+ } else if (value instanceof Number) {
+ value = new Float(((Number) value).floatValue());
+ } else if (value instanceof String) {
+ String s = (String) value;
+ if (s.length() == 0) {
+ value = null;
+ } else {
+ try {
+ value = Float.valueOf(s);
+ } catch (NumberFormatException nfe) {
+ value = new InvalidValue(NLS.bind(Messages.AbstractParser_WrongStringConversionMessage, iClass.getName()));
+ }
+ }
+ } else {
+ value = new InvalidValue(NLS.bind(Messages.AbstractParser_UnexpectedValueTypeMessage, iClass.getName()));
+ }
+ } else if (Double.TYPE.equals(iClass)) {
+ if (value instanceof Double) {
+ // ok
+ } else if (value instanceof Number) {
+ value = new Double(((Number) value).doubleValue());
+ } else if (value instanceof String) {
+ String s = (String) value;
+ if (s.length() == 0) {
+ value = null;
+ } else {
+ try {
+ value = Double.valueOf(s);
+ } catch (NumberFormatException nfe) {
+ value = new InvalidValue(NLS.bind(Messages.AbstractParser_WrongStringConversionMessage, iClass.getName()));
+ }
+ }
+ } else {
+ value = new InvalidValue(NLS.bind(Messages.AbstractParser_UnexpectedValueTypeMessage, iClass.getName()));
+ }
+ } else if (type instanceof EEnum) {
+ if (value instanceof String) {
+ EEnumLiteral literal = ((EEnum) type).getEEnumLiteralByLiteral((String) value);
+ if (literal == null) {
+ value = new InvalidValue(NLS.bind(Messages.AbstractParser_UnknownLiteralMessage, value));
+ } else {
+ value = literal.getInstance();
+ }
+ } else {
+ value = new InvalidValue(NLS.bind(Messages.AbstractParser_UnexpectedValueTypeMessage, String.class.getName()));
+ }
+ }
+ }
+ return value;
+ }
+
+ /**
+ * @generated
+ */
+ protected class InvalidValue {
+
+ /**
+ * @generated
+ */
+ private String description;
+
+ /**
+ * @generated
+ */
+ public InvalidValue(String description) {
+ this.description = description;
+ }
+
+ /**
+ * @generated
+ */
+ public String toString() {
+ return description;
+ }
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/parsers/CompositeParser.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/parsers/CompositeParser.java
new file mode 100644
index 00000000000..94f99de8f08
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/parsers/CompositeParser.java
@@ -0,0 +1,86 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.parsers;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+
+/**
+ * @generated
+ */
+public class CompositeParser implements IParser {
+
+ /**
+ * @generated
+ */
+ private final IParser reader;
+
+ /**
+ * @generated
+ */
+ private final IParser writer;
+
+ /**
+ * @generated
+ */
+ public CompositeParser(IParser reader, IParser writer) {
+ this.reader = reader;
+ this.writer = writer;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isAffectingEvent(Object event, int flags) {
+ return reader.isAffectingEvent(event, flags);
+ }
+
+ /**
+ * @generated
+ */
+ public String getPrintString(IAdaptable adapter, int flags) {
+ return reader.getPrintString(adapter, flags);
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditString(IAdaptable adapter, int flags) {
+ return reader.getEditString(adapter, flags);
+ }
+
+ /**
+ * @generated
+ */
+ public IParserEditStatus isValidEditString(IAdaptable adapter, String editString) {
+ return writer.isValidEditString(adapter, editString);
+ }
+
+ /**
+ * @generated
+ */
+ public ICommand getParseCommand(IAdaptable adapter, String newString, int flags) {
+ return writer.getParseCommand(adapter, newString, flags);
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor(IAdaptable adapter) {
+ return writer.getCompletionProcessor(adapter);
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/parsers/MessageFormatParser.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/parsers/MessageFormatParser.java
new file mode 100644
index 00000000000..37eff0e5b08
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/parsers/MessageFormatParser.java
@@ -0,0 +1,215 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.parsers;
+
+import java.text.FieldPosition;
+import java.text.MessageFormat;
+import java.text.ParsePosition;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.papyrus.diagram.clazz.part.Messages;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+public class MessageFormatParser extends AbstractParser {
+
+ /**
+ * @generated
+ */
+ private String defaultPattern;
+
+ /**
+ * @generated
+ */
+ private MessageFormat viewProcessor;
+
+ /**
+ * @generated
+ */
+ private MessageFormat editorProcessor;
+
+ /**
+ * @generated
+ */
+ private MessageFormat editProcessor;
+
+ /**
+ * @generated
+ */
+ public MessageFormatParser(EAttribute[] features) {
+ super(features);
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultPattern() {
+ if (defaultPattern == null) {
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < features.length; i++) {
+ if (i > 0) {
+ sb.append(' ');
+ }
+ sb.append('{');
+ sb.append(i);
+ sb.append('}');
+ }
+ defaultPattern = sb.toString();
+ }
+ return defaultPattern;
+ }
+
+ /**
+ * @generated
+ */
+ public String getViewPattern() {
+ String pattern = super.getViewPattern();
+ return pattern != null ? pattern : getDefaultPattern();
+ }
+
+ /**
+ * @generated
+ */
+ public void setViewPattern(String viewPattern) {
+ super.setViewPattern(viewPattern);
+ viewProcessor = null;
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageFormat createViewProcessor(String viewPattern) {
+ return new MessageFormat(viewPattern);
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageFormat getViewProcessor() {
+ if (viewProcessor == null) {
+ viewProcessor = createViewProcessor(getViewPattern());
+ }
+ return viewProcessor;
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditorPattern() {
+ String pattern = super.getEditorPattern();
+ return pattern != null ? pattern : getDefaultPattern();
+ }
+
+ /**
+ * @generated
+ */
+ public void setEditorPattern(String editorPattern) {
+ super.setEditorPattern(editorPattern);
+ editorProcessor = null;
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageFormat createEditorProcessor(String editorPattern) {
+ return new MessageFormat(editorPattern);
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageFormat getEditorProcessor() {
+ if (editorProcessor == null) {
+ editorProcessor = createEditorProcessor(getEditorPattern());
+ }
+ return editorProcessor;
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditPattern() {
+ String pattern = super.getEditPattern();
+ return pattern != null ? pattern : getDefaultPattern();
+ }
+
+ /**
+ * @generated
+ */
+ public void setEditPattern(String editPattern) {
+ super.setEditPattern(editPattern);
+ editProcessor = null;
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageFormat createEditProcessor(String editPattern) {
+ return new MessageFormat(editPattern);
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageFormat getEditProcessor() {
+ if (editProcessor == null) {
+ editProcessor = createEditProcessor(getEditPattern());
+ }
+ return editProcessor;
+ }
+
+ /**
+ * @generated
+ */
+ public String getPrintString(IAdaptable adapter, int flags) {
+ EObject element = (EObject) adapter.getAdapter(EObject.class);
+ return getViewProcessor().format(getValues(element), new StringBuffer(), new FieldPosition(0)).toString();
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditString(IAdaptable adapter, int flags) {
+ EObject element = (EObject) adapter.getAdapter(EObject.class);
+ return getEditorProcessor().format(getValues(element), new StringBuffer(), new FieldPosition(0)).toString();
+ }
+
+ /**
+ * @generated
+ */
+ public IParserEditStatus isValidEditString(IAdaptable adapter, String editString) {
+ ParsePosition pos = new ParsePosition(0);
+ Object[] values = getEditProcessor().parse(editString, pos);
+ if (values == null) {
+ return new ParserEditStatus(UMLDiagramEditorPlugin.ID, IParserEditStatus.UNEDITABLE, NLS.bind(Messages.MessageFormatParser_InvalidInputError, new Integer(pos.getErrorIndex())));
+ }
+ return validateNewValues(values);
+ }
+
+ /**
+ * @generated
+ */
+ public ICommand getParseCommand(IAdaptable adapter, String newString, int flags) {
+ Object[] values = getEditProcessor().parse(newString, new ParsePosition(0));
+ return getParseCommand(adapter, values, flags);
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/DeleteElementAction.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/DeleteElementAction.java
new file mode 100644
index 00000000000..5a62ddc69ad
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/DeleteElementAction.java
@@ -0,0 +1,96 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.part;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.runtime.diagram.ui.actions.AbstractDeleteFromAction;
+import org.eclipse.gmf.runtime.diagram.ui.actions.ActionIds;
+import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
+import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @generated
+ */
+public class DeleteElementAction extends AbstractDeleteFromAction {
+
+ /**
+ * @generated
+ */
+ public DeleteElementAction(IWorkbenchPart part) {
+ super(part);
+ }
+
+ /**
+ * @generated
+ */
+ public DeleteElementAction(IWorkbenchPage workbenchPage) {
+ super(workbenchPage);
+ }
+
+ /**
+ * @generated
+ */
+ public void init() {
+ super.init();
+ setId(ActionIds.ACTION_DELETE_FROM_MODEL);
+ setText(DiagramUIMessages.DiagramEditor_Delete_from_Model);
+ setToolTipText(DiagramUIMessages.DiagramEditor_Delete_from_ModelToolTip);
+ ISharedImages workbenchImages = PlatformUI.getWorkbench().getSharedImages();
+ setHoverImageDescriptor(workbenchImages.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
+ setImageDescriptor(workbenchImages.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
+ setDisabledImageDescriptor(workbenchImages.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_DISABLED));
+ }
+
+ /**
+ * @generated
+ */
+ protected String getCommandLabel() {
+ return DiagramUIMessages.DiagramEditor_Delete_from_Model;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCommand(Request request) {
+ List operationSet = getOperationSet();
+ if (operationSet.isEmpty()) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ Iterator editParts = operationSet.iterator();
+ CompositeTransactionalCommand command = new CompositeTransactionalCommand(getEditingDomain(), getCommandLabel());
+ while (editParts.hasNext()) {
+ EditPart editPart = (EditPart) editParts.next();
+ Command curCommand = editPart.getCommand(request);
+ if (curCommand != null) {
+ command.compose(new CommandProxy(curCommand));
+ }
+ }
+ if (command.isEmpty() || command.size() != operationSet.size()) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ return new ICommandProxy(command);
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/DiagramEditorContextMenuProvider.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/DiagramEditorContextMenuProvider.java
new file mode 100644
index 00000000000..d5c3218a4b4
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/DiagramEditorContextMenuProvider.java
@@ -0,0 +1,79 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.part;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.gef.EditPartViewer;
+import org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.ContributionItemService;
+import org.eclipse.gmf.runtime.diagram.ui.actions.ActionIds;
+import org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * @generated
+ */
+public class DiagramEditorContextMenuProvider extends DiagramContextMenuProvider {
+
+ /**
+ * @generated
+ */
+ private IWorkbenchPart part;
+
+ /**
+ * @generated
+ */
+ private DeleteElementAction deleteAction;
+
+ /**
+ * @generated
+ */
+ public DiagramEditorContextMenuProvider(IWorkbenchPart part, EditPartViewer viewer) {
+ super(part, viewer);
+ this.part = part;
+ deleteAction = new DeleteElementAction(part);
+ deleteAction.init();
+ }
+
+ /**
+ * @generated
+ */
+ public void dispose() {
+ if (deleteAction != null) {
+ deleteAction.dispose();
+ deleteAction = null;
+ }
+ super.dispose();
+ }
+
+ /**
+ * @generated
+ */
+ public void buildContextMenu(final IMenuManager menu) {
+ getViewer().flush();
+ try {
+ TransactionUtil.getEditingDomain((EObject) getViewer().getContents().getModel()).runExclusive(new Runnable() {
+
+ public void run() {
+ ContributionItemService.getInstance().contributeToPopupMenu(DiagramEditorContextMenuProvider.this, part);
+ menu.remove(ActionIds.ACTION_DELETE_FROM_MODEL);
+ menu.appendToGroup("editGroup", deleteAction);
+ }
+ });
+ } catch (Exception e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Error building context menu", e);
+ }
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/Messages.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/Messages.java
new file mode 100644
index 00000000000..09f2c78d0c4
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/Messages.java
@@ -0,0 +1,1501 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.part;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * @generated
+ */
+public class Messages extends NLS {
+
+ /**
+ * @generated
+ */
+ public static String Abstraction1CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String Abstraction1CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String AbstractParser_UnexpectedValueTypeMessage;
+
+ /**
+ * @generated
+ */
+ public static String AbstractParser_UnknownLiteralMessage;
+
+ /**
+ * @generated
+ */
+ public static String AbstractParser_WrongStringConversionMessage;
+
+ /**
+ * @generated
+ */
+ public static String Association2CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String Association2CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String AssociationClass3CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String AssociationClass3CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String AssociationClassAttributeCompartmentEditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String Class1CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String Class1CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String ClassAttributeCompartment2EditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String ClassAttributeCompartmentEditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String Classifiers2Group_desc;
+
+ /**
+ * @generated
+ */
+ public static String Classifiers2Group_title;
+
+ /**
+ * @generated
+ */
+ public static String ClassNestedClassifierCompartment2EditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String ClassNestedClassifierCompartmentEditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String ClassOperationCompartment2EditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String ClassOperationCompartmentEditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String CommandName_OpenDiagram;
+
+ /**
+ * @generated
+ */
+ public static String Comment5CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String Comment5CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String Commentlink6CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String Commentlink6CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String Component2CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String Component2CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String ComponentAttributeCompartment2EditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String ComponentAttributeCompartmentEditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String ComponentNestedClassifierCompartment2EditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String ComponentNestedClassifierCompartmentEditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String ComponentOperationCompartment2EditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String ComponentOperationCompartmentEditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String Constraint3CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String Constraint3CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String Constraintlink4CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String Constraintlink4CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String DataType3CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String DataType3CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String DataTypeAttributeCompartment2EditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String DataTypeAttributeCompartmentEditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String DataTypeOperationCompartment2EditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String DataTypeOperationCompartmentEditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String Default1Group_desc;
+
+ /**
+ * @generated
+ */
+ public static String Default1Group_title;
+
+ /**
+ * @generated
+ */
+ public static String Dependency4CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String Dependency4CreationTool_title;
+
+ public static String DependencyBranchCreationTool_desc;
+
+ public static String DependencyBranchCreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String ElementImport5CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String ElementImport5CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String Enumeration4CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String Enumeration4CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String EnumerationEnumerationLiteralCompartment2EditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String EnumerationEnumerationLiteralCompartmentEditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String Features4Group_desc;
+
+ /**
+ * @generated
+ */
+ public static String Features4Group_title;
+
+ /**
+ * @generated
+ */
+ public static String Generalization6CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String Generalization6CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String InstanceSpecification8CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String InstanceSpecification8CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String InstanceSpecificationSlotCompartment2EditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String InstanceSpecificationSlotCompartmentEditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String Interface5CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String Interface5CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String InterfaceAttributeCompartment2EditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String InterfaceAttributeCompartmentEditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String InterfaceNestedClassifierCompartment2EditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String InterfaceNestedClassifierCompartmentEditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String InterfaceOperationCompartment2EditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String InterfaceOperationCompartmentEditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String InterfaceRealization7CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String InterfaceRealization7CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String LiteralEnumeration5CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String LiteralEnumeration5CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String MessageFormatParser_InvalidInputError;
+
+ /**
+ * @generated
+ */
+ public static String Model1CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String Model1CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String ModelElementSelectionPageMessage;
+
+ /**
+ * @generated
+ */
+ public static String ModelPackageableElementCompartment2EditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String ModelPackageableElementCompartmentEditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorActionProvider_OpenDiagramActionName;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Abstraction_4006_source;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Abstraction_4006_target;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Association_4001_source;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Association_4019_target;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Association_4019_source;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Association_4001_target;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_AssociationClass_2013_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_AssociationClass_2013_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Association_2015_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Association_2015_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_AssociationClass_4017_source;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_AssociationClass_4017_target;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Class_2008_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Class_2008_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Class_3004_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Class_3004_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Class_3008_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Class_3008_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Class_3010_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Class_3010_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Class_3014_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Class_3014_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Comment_2012_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Comment_2012_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Comment_3028_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Comment_3028_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_CommentAnnotatedElement_4013_source;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_CommentAnnotatedElement_4013_target;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Component_2002_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Component_2002_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Component_3021_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Component_3021_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Constraint_2011_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Constraint_2011_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Constraint_3029_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Constraint_3029_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_ConstraintConstrainedElement_4014_source;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_ConstraintConstrainedElement_4014_target;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_DataType_2010_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_DataType_2010_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_DataType_3027_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_DataType_3027_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Dependency_2014_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Dependency_2014_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Dependency_4008_source;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Dependency_4008_target;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Dependency_4018_source;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Dependency_4018_target;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_ElementImport_4009_source;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_ElementImport_4009_target;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Enumeration_2006_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Enumeration_2006_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Enumeration_3025_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Enumeration_3025_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_EnumerationLiteral_3017_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_EnumerationLiteral_3017_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Generalization_4002_source;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Generalization_4002_target;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_InstanceSpecification_2001_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_InstanceSpecification_2001_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_InstanceSpecification_3020_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_InstanceSpecification_3020_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Interface_2004_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Interface_2004_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Interface_3023_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Interface_3023_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_InterfaceRealization_4003_source;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_InterfaceRealization_4003_target;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Link_4016_source;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Link_4016_target;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Model_2005_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Model_2005_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Model_3024_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Model_3024_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Operation_3003_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Operation_3003_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Operation_3007_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Operation_3007_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Operation_3013_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Operation_3013_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Operation_3019_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Operation_3019_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Package_1000_links;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Package_2007_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Package_2007_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Package_3009_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Package_3009_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_PackageImport_4010_source;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_PackageImport_4010_target;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_PackageMerge_4011_source;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_PackageMerge_4011_target;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_PrimitiveType_2009_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_PrimitiveType_2009_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_PrimitiveType_3026_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_PrimitiveType_3026_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_ProfileApplication_4012_source;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Property_3002_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Property_3002_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Property_3005_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Property_3005_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Property_3006_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Property_3006_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Property_3012_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Property_3012_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Property_3018_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Property_3018_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Realization_4005_source;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Realization_4005_target;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Reception_3011_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Reception_3011_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_RedefinableTemplateSignature_3015_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_RedefinableTemplateSignature_3015_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Signal_2003_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Signal_2003_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Signal_3022_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Signal_3022_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Slot_3001_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Slot_3001_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Substitution_4004_source;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Substitution_4004_target;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_TemplateBinding_4015_source;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_TemplateBinding_4015_target;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_TemplateParameter_3016_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_TemplateParameter_3016_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Usage_4007_source;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_Usage_4007_target;
+
+ /**
+ * @generated
+ */
+ public static String Operation3CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String Operation3CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String Package2CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String Package2CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String PackageImport8CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String PackageImport8CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String PackageMerge9CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String PackageMerge9CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String PackagePackageableElementCompartment2EditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String PackagePackageableElementCompartmentEditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String PrimitiveType6CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String PrimitiveType6CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String ProfileApplication10CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String ProfileApplication10CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String Property2CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String Property2CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String Realization11CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String Realization11CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String Reception1CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String Reception1CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String RedefinableTemplateSignature1CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String RedefinableTemplateSignature1CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String RedefinableTemplateSignatureTemplateParameterCompartmentEditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String RelationShips3Group_desc;
+
+ /**
+ * @generated
+ */
+ public static String RelationShips3Group_title;
+
+ /**
+ * @generated
+ */
+ public static String Signal7CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String Signal7CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String SignalAttributeCompartment2EditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String SignalAttributeCompartmentEditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String Slot4CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String Slot4CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String Substitution12CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String Substitution12CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String Template5Group_desc;
+
+ /**
+ * @generated
+ */
+ public static String Template5Group_title;
+
+ /**
+ * @generated
+ */
+ public static String TemplateBinding14CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String TemplateBinding14CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String TemplateParameter2CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String TemplateParameter2CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String UMLCreationWizard_DiagramModelFilePageDescription;
+
+ /**
+ * @generated
+ */
+ public static String UMLCreationWizard_DiagramModelFilePageTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLCreationWizard_DomainModelFilePageDescription;
+
+ /**
+ * @generated
+ */
+ public static String UMLCreationWizard_DomainModelFilePageTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLCreationWizardCreationError;
+
+ /**
+ * @generated
+ */
+ public static String UMLCreationWizardOpenEditorError;
+
+ /**
+ * @generated
+ */
+ public static String UMLCreationWizardPageExtensionError;
+
+ /**
+ * @generated
+ */
+ public static String UMLCreationWizardTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLDiagramEditor_SaveAsErrorMessage;
+
+ /**
+ * @generated
+ */
+ public static String UMLDiagramEditor_SaveAsErrorTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLDiagramEditor_SaveErrorMessage;
+
+ /**
+ * @generated
+ */
+ public static String UMLDiagramEditor_SaveErrorTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLDiagramEditor_SavingDeletedFile;
+
+ /**
+ * @generated
+ */
+ public static String UMLDiagramEditorUtil_CreateDiagramCommandLabel;
+
+ /**
+ * @generated
+ */
+ public static String UMLDiagramEditorUtil_CreateDiagramProgressTask;
+
+ /**
+ * @generated
+ */
+ public static String UMLDiagramEditorUtil_OpenModelResourceErrorDialogMessage;
+
+ /**
+ * @generated
+ */
+ public static String UMLDiagramEditorUtil_OpenModelResourceErrorDialogTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLDocumentProvider_DiagramLoadingError;
+
+ /**
+ * @generated
+ */
+ public static String UMLDocumentProvider_handleElementContentChanged;
+
+ /**
+ * @generated
+ */
+ public static String UMLDocumentProvider_IncorrectInputError;
+
+ /**
+ * @generated
+ */
+ public static String UMLDocumentProvider_isModifiable;
+
+ /**
+ * @generated
+ */
+ public static String UMLDocumentProvider_NoDiagramInResourceError;
+
+ /**
+ * @generated
+ */
+ public static String UMLDocumentProvider_SaveAsOperation;
+
+ /**
+ * @generated
+ */
+ public static String UMLDocumentProvider_SaveDiagramTask;
+
+ /**
+ * @generated
+ */
+ public static String UMLDocumentProvider_SaveNextResourceTask;
+
+ /**
+ * @generated
+ */
+ public static String UMLDocumentProvider_UnsynchronizedFileSaveError;
+
+ /**
+ * @generated
+ */
+ public static String UMLElementChooserDialog_SelectModelElementTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLInitDiagramFileAction_InitDiagramFileResourceErrorDialogMessage;
+
+ /**
+ * @generated
+ */
+ public static String UMLInitDiagramFileAction_InitDiagramFileResourceErrorDialogTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLInitDiagramFileAction_InitDiagramFileWizardTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLInitDiagramFileAction_OpenModelFileDialogTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLModelingAssistantProviderMessage;
+
+ /**
+ * @generated
+ */
+ public static String UMLModelingAssistantProviderTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLNewDiagramFileWizard_CreationPageDescription;
+
+ /**
+ * @generated
+ */
+ public static String UMLNewDiagramFileWizard_CreationPageName;
+
+ /**
+ * @generated
+ */
+ public static String UMLNewDiagramFileWizard_CreationPageTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLNewDiagramFileWizard_IncorrectRootError;
+
+ /**
+ * @generated
+ */
+ public static String UMLNewDiagramFileWizard_InitDiagramCommand;
+
+ /**
+ * @generated
+ */
+ public static String UMLNewDiagramFileWizard_RootSelectionPageDescription;
+
+ /**
+ * @generated
+ */
+ public static String UMLNewDiagramFileWizard_RootSelectionPageInvalidSelectionMessage;
+
+ /**
+ * @generated
+ */
+ public static String UMLNewDiagramFileWizard_RootSelectionPageName;
+
+ /**
+ * @generated
+ */
+ public static String UMLNewDiagramFileWizard_RootSelectionPageNoSelectionMessage;
+
+ /**
+ * @generated
+ */
+ public static String UMLNewDiagramFileWizard_RootSelectionPageSelectionTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLNewDiagramFileWizard_RootSelectionPageTitle;
+
+ /**
+ * @generated
+ */
+ public static String Usage13CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String Usage13CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String ValidateActionMessage;
+
+ /**
+ * @generated
+ */
+ static {
+ NLS.initializeMessages("messages", Messages.class); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ private Messages() {
+ }
+
+ // TODO: put accessor fields manually
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/ModelElementSelectionPage.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/ModelElementSelectionPage.java
new file mode 100644
index 00000000000..e4cd4daa861
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/ModelElementSelectionPage.java
@@ -0,0 +1,156 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.part;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.FeatureMap;
+import org.eclipse.emf.edit.provider.IWrapperItemProvider;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+
+/**
+ * Wizard page that allows to select element from model.
+ *
+ * @generated
+ */
+public class ModelElementSelectionPage extends WizardPage {
+
+ /**
+ * @generated
+ */
+ protected EObject selectedModelElement;
+
+ /**
+ * @generated
+ */
+ private TreeViewer modelViewer;
+
+ /**
+ * @generated
+ */
+ public ModelElementSelectionPage(String pageName) {
+ super(pageName);
+ }
+
+ /**
+ * @generated
+ */
+ public EObject getModelElement() {
+ return selectedModelElement;
+ }
+
+ /**
+ * @generated
+ */
+ public void setModelElement(EObject modelElement) {
+ selectedModelElement = modelElement;
+ if (modelViewer != null) {
+ if (selectedModelElement != null) {
+ modelViewer.setInput(selectedModelElement.eResource());
+ modelViewer.setSelection(new StructuredSelection(selectedModelElement));
+ } else {
+ modelViewer.setInput(null);
+ }
+ setPageComplete(validatePage());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void createControl(Composite parent) {
+ initializeDialogUnits(parent);
+
+ Composite plate = new Composite(parent, SWT.NONE);
+ plate.setLayoutData(new GridData(GridData.FILL_BOTH));
+ GridLayout layout = new GridLayout();
+ layout.marginWidth = 0;
+ plate.setLayout(layout);
+ setControl(plate);
+
+ Label label = new Label(plate, SWT.NONE);
+ label.setText(getSelectionTitle());
+ label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
+
+ modelViewer = new TreeViewer(plate, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
+ GridData layoutData = new GridData(GridData.FILL_BOTH);
+ layoutData.heightHint = 300;
+ layoutData.widthHint = 300;
+ modelViewer.getTree().setLayoutData(layoutData);
+ modelViewer.setContentProvider(new AdapterFactoryContentProvider(UMLDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory()));
+ modelViewer.setLabelProvider(new AdapterFactoryLabelProvider(UMLDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory()));
+ if (selectedModelElement != null) {
+ modelViewer.setInput(selectedModelElement.eResource());
+ modelViewer.setSelection(new StructuredSelection(selectedModelElement));
+ }
+ modelViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ public void selectionChanged(SelectionChangedEvent event) {
+ ModelElementSelectionPage.this.updateSelection((IStructuredSelection) event.getSelection());
+ }
+ });
+
+ setPageComplete(validatePage());
+ }
+
+ /**
+ * Override to provide custom model element description.
+ *
+ * @generated
+ */
+ protected String getSelectionTitle() {
+ return Messages.ModelElementSelectionPageMessage;
+ }
+
+ /**
+ * @generated
+ */
+ protected void updateSelection(IStructuredSelection selection) {
+ selectedModelElement = null;
+ if (selection.size() == 1) {
+ Object selectedElement = selection.getFirstElement();
+ if (selectedElement instanceof IWrapperItemProvider) {
+ selectedElement = ((IWrapperItemProvider) selectedElement).getValue();
+ }
+ if (selectedElement instanceof FeatureMap.Entry) {
+ selectedElement = ((FeatureMap.Entry) selectedElement).getValue();
+ }
+ if (selectedElement instanceof EObject) {
+ selectedModelElement = (EObject) selectedElement;
+ }
+ }
+ setPageComplete(validatePage());
+ }
+
+ /**
+ * Override to provide specific validation of the selected model element.
+ *
+ * @generated
+ */
+ protected boolean validatePage() {
+ return true;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLCreationWizard.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLCreationWizard.java
new file mode 100644
index 00000000000..793bf6f6a2d
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLCreationWizard.java
@@ -0,0 +1,167 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.part;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.actions.WorkspaceModifyOperation;
+
+/**
+ * @generated
+ */
+public class UMLCreationWizard extends Wizard implements INewWizard {
+
+ /**
+ * @generated
+ */
+ private IWorkbench workbench;
+
+ /**
+ * @generated
+ */
+ protected IStructuredSelection selection;
+
+ /**
+ * @generated
+ */
+ protected UMLCreationWizardPage diagramModelFilePage;
+
+ /**
+ * @generated
+ */
+ protected UMLCreationWizardPage domainModelFilePage;
+
+ /**
+ * @generated
+ */
+ protected Resource diagram;
+
+ /**
+ * @generated
+ */
+ private boolean openNewlyCreatedDiagramEditor = true;
+
+ /**
+ * @generated
+ */
+ public IWorkbench getWorkbench() {
+ return workbench;
+ }
+
+ /**
+ * @generated
+ */
+ public IStructuredSelection getSelection() {
+ return selection;
+ }
+
+ /**
+ * @generated
+ */
+ public final Resource getDiagram() {
+ return diagram;
+ }
+
+ /**
+ * @generated
+ */
+ public final boolean isOpenNewlyCreatedDiagramEditor() {
+ return openNewlyCreatedDiagramEditor;
+ }
+
+ /**
+ * @generated
+ */
+ public void setOpenNewlyCreatedDiagramEditor(boolean openNewlyCreatedDiagramEditor) {
+ this.openNewlyCreatedDiagramEditor = openNewlyCreatedDiagramEditor;
+ }
+
+ /**
+ * @generated
+ */
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ this.workbench = workbench;
+ this.selection = selection;
+ setWindowTitle(Messages.UMLCreationWizardTitle);
+ setDefaultPageImageDescriptor(UMLDiagramEditorPlugin.getBundledImageDescriptor("icons/wizban/NewUMLWizard.gif")); //$NON-NLS-1$
+ setNeedsProgressMonitor(true);
+ }
+
+ /**
+ * @generated
+ */
+ public void addPages() {
+ diagramModelFilePage = new UMLCreationWizardPage("DiagramModelFile", getSelection(), "PapyrusUMLClass_diagram"); //$NON-NLS-1$ //$NON-NLS-2$
+ diagramModelFilePage.setTitle(Messages.UMLCreationWizard_DiagramModelFilePageTitle);
+ diagramModelFilePage.setDescription(Messages.UMLCreationWizard_DiagramModelFilePageDescription);
+ addPage(diagramModelFilePage);
+
+ domainModelFilePage = new UMLCreationWizardPage("DomainModelFile", getSelection(), "PapyrusUMLClass") { //$NON-NLS-1$ //$NON-NLS-2$
+
+ public void setVisible(boolean visible) {
+ if (visible) {
+ String fileName = diagramModelFilePage.getFileName();
+ fileName = fileName.substring(0, fileName.length() - ".PapyrusUMLClass_diagram".length()); //$NON-NLS-1$
+ setFileName(UMLDiagramEditorUtil.getUniqueFileName(getContainerFullPath(), fileName, "PapyrusUMLClass")); //$NON-NLS-1$
+ }
+ super.setVisible(visible);
+ }
+ };
+ domainModelFilePage.setTitle(Messages.UMLCreationWizard_DomainModelFilePageTitle);
+ domainModelFilePage.setDescription(Messages.UMLCreationWizard_DomainModelFilePageDescription);
+ addPage(domainModelFilePage);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean performFinish() {
+ IRunnableWithProgress op = new WorkspaceModifyOperation(null) {
+
+ protected void execute(IProgressMonitor monitor) throws CoreException, InterruptedException {
+ diagram = UMLDiagramEditorUtil.createDiagram(diagramModelFilePage.getURI(), domainModelFilePage.getURI(), monitor);
+ if (isOpenNewlyCreatedDiagramEditor() && diagram != null) {
+ try {
+ UMLDiagramEditorUtil.openDiagram(diagram);
+ } catch (PartInitException e) {
+ ErrorDialog.openError(getContainer().getShell(), Messages.UMLCreationWizardOpenEditorError, null, e.getStatus());
+ }
+ }
+ }
+ };
+ try {
+ getContainer().run(false, true, op);
+ } catch (InterruptedException e) {
+ return false;
+ } catch (InvocationTargetException e) {
+ if (e.getTargetException() instanceof CoreException) {
+ ErrorDialog.openError(getContainer().getShell(), Messages.UMLCreationWizardCreationError, null, ((CoreException) e.getTargetException()).getStatus());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Error creating diagram", e.getTargetException()); //$NON-NLS-1$
+ }
+ return false;
+ }
+ return diagram != null;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLCreationWizardPage.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLCreationWizardPage.java
new file mode 100644
index 00000000000..7574657314c
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLCreationWizardPage.java
@@ -0,0 +1,96 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.part;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
+
+/**
+ * @generated
+ */
+public class UMLCreationWizardPage extends WizardNewFileCreationPage {
+
+ /**
+ * @generated
+ */
+ private final String fileExtension;
+
+ /**
+ * @generated
+ */
+ public UMLCreationWizardPage(String pageName, IStructuredSelection selection, String fileExtension) {
+ super(pageName, selection);
+ this.fileExtension = fileExtension;
+ }
+
+ /**
+ * Override to create files with this extension.
+ *
+ * @generated
+ */
+ protected String getExtension() {
+ return fileExtension;
+ }
+
+ /**
+ * @generated
+ */
+ public URI getURI() {
+ return URI.createPlatformResourceURI(getFilePath().toString(), false);
+ }
+
+ /**
+ * @generated
+ */
+ protected IPath getFilePath() {
+ IPath path = getContainerFullPath();
+ if (path == null) {
+ path = new Path(""); //$NON-NLS-1$
+ }
+ String fileName = getFileName();
+ if (fileName != null) {
+ path = path.append(fileName);
+ }
+ return path;
+ }
+
+ /**
+ * @generated
+ */
+ public void createControl(Composite parent) {
+ super.createControl(parent);
+ setFileName(UMLDiagramEditorUtil.getUniqueFileName(getContainerFullPath(), getFileName(), getExtension()));
+ setPageComplete(validatePage());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean validatePage() {
+ if (!super.validatePage()) {
+ return false;
+ }
+ String extension = getExtension();
+ if (extension != null && !getFilePath().toString().endsWith("." + extension)) {
+ setErrorMessage(NLS.bind(Messages.UMLCreationWizardPageExtensionError, extension));
+ return false;
+ }
+ return true;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLDiagramActionBarContributor.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLDiagramActionBarContributor.java
new file mode 100644
index 00000000000..f1c4849b024
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLDiagramActionBarContributor.java
@@ -0,0 +1,36 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.part;
+
+import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramActionBarContributor;
+
+/**
+ * @generated
+ */
+public class UMLDiagramActionBarContributor extends DiagramActionBarContributor {
+
+ /**
+ * @generated
+ */
+ protected Class getEditorClass() {
+ return UMLDiagramEditor.class;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getEditorId() {
+ return UMLDiagramEditor.ID;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLDiagramEditor.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLDiagramEditor.java
new file mode 100644
index 00000000000..2c138fda428
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLDiagramEditor.java
@@ -0,0 +1,280 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.part;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.emf.common.ui.URIEditorInput;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
+import org.eclipse.gef.palette.PaletteRoot;
+import org.eclipse.gmf.runtime.common.ui.services.marker.MarkerNavigationService;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.ui.actions.ActionIds;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocumentProvider;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.papyrus.diagram.clazz.navigator.UMLNavigatorItem;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorMatchingStrategy;
+import org.eclipse.ui.IEditorReference;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.SaveAsDialog;
+import org.eclipse.ui.ide.IGotoMarker;
+import org.eclipse.ui.navigator.resources.ProjectExplorer;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.part.IShowInTargetList;
+import org.eclipse.ui.part.ShowInContext;
+
+/**
+ * @generated
+ */
+public class UMLDiagramEditor extends DiagramDocumentEditor implements IGotoMarker {
+
+ /**
+ * @generated
+ */
+ public static final String ID = "org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorID"; //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final String CONTEXT_ID = "org.eclipse.papyrus.diagram.clazz.ui.diagramContext"; //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public UMLDiagramEditor() {
+ super(true);
+ }
+
+ /**
+ * @generated
+ */
+ protected String getContextID() {
+ return CONTEXT_ID;
+ }
+
+ /**
+ * @generated
+ */
+ protected PaletteRoot createPaletteRoot(PaletteRoot existingPaletteRoot) {
+ PaletteRoot root = super.createPaletteRoot(existingPaletteRoot);
+ new UMLPaletteFactory().fillPalette(root);
+ return root;
+ }
+
+ /**
+ * @generated
+ */
+ protected PreferencesHint getPreferencesHint() {
+ return UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT;
+ }
+
+ /**
+ * @generated
+ */
+ public String getContributorId() {
+ return UMLDiagramEditorPlugin.ID;
+ }
+
+ /**
+ * @generated
+ */
+ public Object getAdapter(Class type) {
+ if (type == IShowInTargetList.class) {
+ return new IShowInTargetList() {
+
+ public String[] getShowInTargetIds() {
+ return new String[] { ProjectExplorer.VIEW_ID };
+ }
+ };
+ }
+ return super.getAdapter(type);
+ }
+
+ /**
+ * @generated
+ */
+ protected IDocumentProvider getDocumentProvider(IEditorInput input) {
+ if (input instanceof IFileEditorInput || input instanceof URIEditorInput) {
+ return UMLDiagramEditorPlugin.getInstance().getDocumentProvider();
+ }
+ return super.getDocumentProvider(input);
+ }
+
+ /**
+ * @generated
+ */
+ public TransactionalEditingDomain getEditingDomain() {
+ IDocument document = getEditorInput() != null ? getDocumentProvider().getDocument(getEditorInput()) : null;
+ if (document instanceof IDiagramDocument) {
+ return ((IDiagramDocument) document).getEditingDomain();
+ }
+ return super.getEditingDomain();
+ }
+
+ /**
+ * @generated
+ */
+ protected void setDocumentProvider(IEditorInput input) {
+ if (input instanceof IFileEditorInput || input instanceof URIEditorInput) {
+ setDocumentProvider(UMLDiagramEditorPlugin.getInstance().getDocumentProvider());
+ } else {
+ super.setDocumentProvider(input);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void gotoMarker(IMarker marker) {
+ MarkerNavigationService.getInstance().gotoMarker(this, marker);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isSaveAsAllowed() {
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public void doSaveAs() {
+ performSaveAs(new NullProgressMonitor());
+ }
+
+ /**
+ * @generated
+ */
+ protected void performSaveAs(IProgressMonitor progressMonitor) {
+ Shell shell = getSite().getShell();
+ IEditorInput input = getEditorInput();
+ SaveAsDialog dialog = new SaveAsDialog(shell);
+ IFile original = input instanceof IFileEditorInput ? ((IFileEditorInput) input).getFile() : null;
+ if (original != null) {
+ dialog.setOriginalFile(original);
+ }
+ dialog.create();
+ IDocumentProvider provider = getDocumentProvider();
+ if (provider == null) {
+ // editor has been programmatically closed while the dialog was open
+ return;
+ }
+ if (provider.isDeleted(input) && original != null) {
+ String message = NLS.bind(Messages.UMLDiagramEditor_SavingDeletedFile, original.getName());
+ dialog.setErrorMessage(null);
+ dialog.setMessage(message, IMessageProvider.WARNING);
+ }
+ if (dialog.open() == Window.CANCEL) {
+ if (progressMonitor != null) {
+ progressMonitor.setCanceled(true);
+ }
+ return;
+ }
+ IPath filePath = dialog.getResult();
+ if (filePath == null) {
+ if (progressMonitor != null) {
+ progressMonitor.setCanceled(true);
+ }
+ return;
+ }
+ IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
+ IFile file = workspaceRoot.getFile(filePath);
+ final IEditorInput newInput = new FileEditorInput(file);
+ // Check if the editor is already open
+ IEditorMatchingStrategy matchingStrategy = getEditorDescriptor().getEditorMatchingStrategy();
+ IEditorReference[] editorRefs = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences();
+ for (int i = 0; i < editorRefs.length; i++) {
+ if (matchingStrategy.matches(editorRefs[i], newInput)) {
+ MessageDialog.openWarning(shell, Messages.UMLDiagramEditor_SaveAsErrorTitle, Messages.UMLDiagramEditor_SaveAsErrorMessage);
+ return;
+ }
+ }
+ boolean success = false;
+ try {
+ provider.aboutToChange(newInput);
+ getDocumentProvider(newInput).saveDocument(progressMonitor, newInput, getDocumentProvider().getDocument(getEditorInput()), true);
+ success = true;
+ } catch (CoreException x) {
+ IStatus status = x.getStatus();
+ if (status == null || status.getSeverity() != IStatus.CANCEL) {
+ ErrorDialog.openError(shell, Messages.UMLDiagramEditor_SaveErrorTitle, Messages.UMLDiagramEditor_SaveErrorMessage, x.getStatus());
+ }
+ } finally {
+ provider.changed(newInput);
+ if (success) {
+ setInput(newInput);
+ }
+ }
+ if (progressMonitor != null) {
+ progressMonitor.setCanceled(!success);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public ShowInContext getShowInContext() {
+ return new ShowInContext(getEditorInput(), getNavigatorSelection());
+ }
+
+ /**
+ * @generated
+ */
+ private ISelection getNavigatorSelection() {
+ IDiagramDocument document = getDiagramDocument();
+ if (document == null) {
+ return StructuredSelection.EMPTY;
+ }
+ Diagram diagram = document.getDiagram();
+ IFile file = WorkspaceSynchronizer.getFile(diagram.eResource());
+ if (file != null) {
+ UMLNavigatorItem item = new UMLNavigatorItem(diagram, file, false);
+ return new StructuredSelection(item);
+ }
+ return StructuredSelection.EMPTY;
+ }
+
+ /**
+ * @generated
+ */
+ protected void configureGraphicalViewer() {
+ super.configureGraphicalViewer();
+ DiagramEditorContextMenuProvider provider = new DiagramEditorContextMenuProvider(this, getDiagramGraphicalViewer());
+ getDiagramGraphicalViewer().setContextMenu(provider);
+ getSite().registerContextMenu(ActionIds.DIAGRAM_EDITOR_CONTEXT_MENU, provider, getDiagramGraphicalViewer());
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLDiagramEditorPlugin.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLDiagramEditorPlugin.java
new file mode 100644
index 00000000000..27949a82459
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLDiagramEditorPlugin.java
@@ -0,0 +1,253 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.part;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;
+import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory;
+import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.eclipse.uml2.uml.edit.providers.UMLItemProviderAdapterFactory;
+import org.osgi.framework.BundleContext;
+
+/**
+ * @generated
+ */
+public class UMLDiagramEditorPlugin extends AbstractUIPlugin {
+
+ /**
+ * @generated
+ */
+ public static final String ID = "org.eclipse.papyrus.diagram.clazz"; //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final PreferencesHint DIAGRAM_PREFERENCES_HINT = new PreferencesHint(ID);
+
+ /**
+ * @generated
+ */
+ private static UMLDiagramEditorPlugin instance;
+
+ /**
+ * @generated
+ */
+ private ComposedAdapterFactory adapterFactory;
+
+ /**
+ * @generated
+ */
+ private UMLDocumentProvider documentProvider;
+
+ /**
+ * @generated
+ */
+ public UMLDiagramEditorPlugin() {
+ }
+
+ /**
+ * @generated
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ instance = this;
+ PreferencesHint.registerPreferenceStore(DIAGRAM_PREFERENCES_HINT, getPreferenceStore());
+ adapterFactory = createAdapterFactory();
+ }
+
+ /**
+ * @generated
+ */
+ public void stop(BundleContext context) throws Exception {
+ adapterFactory.dispose();
+ adapterFactory = null;
+ instance = null;
+ super.stop(context);
+ }
+
+ /**
+ * @generated
+ */
+ public static UMLDiagramEditorPlugin getInstance() {
+ return instance;
+ }
+
+ /**
+ * @generated
+ */
+ protected ComposedAdapterFactory createAdapterFactory() {
+ List factories = new ArrayList();
+ fillItemProviderFactories(factories);
+ return new ComposedAdapterFactory(factories);
+ }
+
+ /**
+ * @generated
+ */
+ protected void fillItemProviderFactories(List factories) {
+ factories.add(new UMLItemProviderAdapterFactory());
+ factories.add(new EcoreItemProviderAdapterFactory());
+ factories.add(new ResourceItemProviderAdapterFactory());
+ factories.add(new ReflectiveItemProviderAdapterFactory());
+ }
+
+ /**
+ * @generated
+ */
+ public AdapterFactory getItemProvidersAdapterFactory() {
+ return adapterFactory;
+ }
+
+ /**
+ * @generated
+ */
+ public ImageDescriptor getItemImageDescriptor(Object item) {
+ IItemLabelProvider labelProvider = (IItemLabelProvider) adapterFactory.adapt(item, IItemLabelProvider.class);
+ if (labelProvider != null) {
+ return ExtendedImageRegistry.getInstance().getImageDescriptor(labelProvider.getImage(item));
+ }
+ return null;
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given plug-in relative path.
+ *
+ * @generated
+ * @param path
+ * the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getBundledImageDescriptor(String path) {
+ return AbstractUIPlugin.imageDescriptorFromPlugin(ID, path);
+ }
+
+ /**
+ * Respects images residing in any plug-in. If path is relative, then this bundle is looked up for the image, otherwise, for absolute path, first segment is taken as id of plug-in with image
+ *
+ * @generated
+ * @param path
+ * the path to image, either absolute (with plug-in id as first segment), or relative for bundled images
+ * @return the image descriptor
+ */
+ public static ImageDescriptor findImageDescriptor(String path) {
+ final IPath p = new Path(path);
+ if (p.isAbsolute() && p.segmentCount() > 1) {
+ return AbstractUIPlugin.imageDescriptorFromPlugin(p.segment(0), p.removeFirstSegments(1).makeAbsolute().toString());
+ } else {
+ return getBundledImageDescriptor(p.makeAbsolute().toString());
+ }
+ }
+
+ /**
+ * Returns an image for the image file at the given plug-in relative path. Client do not need to dispose this image. Images will be disposed automatically.
+ *
+ * @generated
+ * @param path
+ * the path
+ * @return image instance
+ */
+ public Image getBundledImage(String path) {
+ Image image = getImageRegistry().get(path);
+ if (image == null) {
+ getImageRegistry().put(path, getBundledImageDescriptor(path));
+ image = getImageRegistry().get(path);
+ }
+ return image;
+ }
+
+ /**
+ * Returns string from plug-in's resource bundle
+ *
+ * @generated
+ */
+ public static String getString(String key) {
+ return Platform.getResourceString(getInstance().getBundle(), "%" + key); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ public UMLDocumentProvider getDocumentProvider() {
+ if (documentProvider == null) {
+ documentProvider = new UMLDocumentProvider();
+ }
+ return documentProvider;
+ }
+
+ /**
+ * @generated
+ */
+ public void logError(String error) {
+ logError(error, null);
+ }
+
+ /**
+ * @generated
+ */
+ public void logError(String error, Throwable throwable) {
+ if (error == null && throwable != null) {
+ error = throwable.getMessage();
+ }
+ getLog().log(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, IStatus.OK, error, throwable));
+ debug(error, throwable);
+ }
+
+ /**
+ * @generated
+ */
+ public void logInfo(String message) {
+ logInfo(message, null);
+ }
+
+ /**
+ * @generated
+ */
+ public void logInfo(String message, Throwable throwable) {
+ if (message == null && throwable != null) {
+ message = throwable.getMessage();
+ }
+ getLog().log(new Status(IStatus.INFO, UMLDiagramEditorPlugin.ID, IStatus.OK, message, throwable));
+ debug(message, throwable);
+ }
+
+ /**
+ * @generated
+ */
+ private void debug(String message, Throwable throwable) {
+ if (!isDebugging()) {
+ return;
+ }
+ if (message != null) {
+ System.err.println(message);
+ }
+ if (throwable != null) {
+ throwable.printStackTrace();
+ }
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLDiagramEditorUtil.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLDiagramEditorUtil.java
new file mode 100644
index 00000000000..963796207e1
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLDiagramEditorUtil.java
@@ -0,0 +1,386 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.part;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.OperationHistoryFactory;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.xmi.XMLResource;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.diagram.core.services.ViewService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramGraphicalViewer;
+import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory;
+import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelEditPart;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.UMLFactory;
+
+/**
+ * @generated
+ */
+public class UMLDiagramEditorUtil {
+
+ /**
+ * @generated
+ */
+ public static Map getSaveOptions() {
+ Map saveOptions = new HashMap();
+ saveOptions.put(XMLResource.OPTION_ENCODING, "UTF-8"); //$NON-NLS-1$
+ saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER);
+ return saveOptions;
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean openDiagram(Resource diagram) throws PartInitException {
+ String path = diagram.getURI().toPlatformString(true);
+ IResource workspaceResource = ResourcesPlugin.getWorkspace().getRoot().findMember(new Path(path));
+ if (workspaceResource instanceof IFile) {
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ return null != page.openEditor(new FileEditorInput((IFile) workspaceResource), UMLDiagramEditor.ID);
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public static void setCharset(IFile file) {
+ if (file == null) {
+ return;
+ }
+ try {
+ file.setCharset("UTF-8", new NullProgressMonitor()); //$NON-NLS-1$
+ } catch (CoreException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Unable to set charset for file " + file.getFullPath(), e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static String getUniqueFileName(IPath containerFullPath, String fileName, String extension) {
+ if (containerFullPath == null) {
+ containerFullPath = new Path(""); //$NON-NLS-1$
+ }
+ if (fileName == null || fileName.trim().length() == 0) {
+ fileName = "default"; //$NON-NLS-1$
+ }
+ IPath filePath = containerFullPath.append(fileName);
+ if (extension != null && !extension.equals(filePath.getFileExtension())) {
+ filePath = filePath.addFileExtension(extension);
+ }
+ extension = filePath.getFileExtension();
+ fileName = filePath.removeFileExtension().lastSegment();
+ int i = 1;
+ while (ResourcesPlugin.getWorkspace().getRoot().exists(filePath)) {
+ i++;
+ filePath = containerFullPath.append(fileName + i);
+ if (extension != null) {
+ filePath = filePath.addFileExtension(extension);
+ }
+ }
+ return filePath.lastSegment();
+ }
+
+ /**
+ * Runs the wizard in a dialog.
+ *
+ * @generated
+ */
+ public static void runWizard(Shell shell, Wizard wizard, String settingsKey) {
+ IDialogSettings pluginDialogSettings = UMLDiagramEditorPlugin.getInstance().getDialogSettings();
+ IDialogSettings wizardDialogSettings = pluginDialogSettings.getSection(settingsKey);
+ if (wizardDialogSettings == null) {
+ wizardDialogSettings = pluginDialogSettings.addNewSection(settingsKey);
+ }
+ wizard.setDialogSettings(wizardDialogSettings);
+ WizardDialog dialog = new WizardDialog(shell, wizard);
+ dialog.create();
+ dialog.getShell().setSize(Math.max(500, dialog.getShell().getSize().x), 500);
+ dialog.open();
+ }
+
+ /**
+ * This method should be called within a workspace modify operation since it creates resources.
+ *
+ * @generated
+ */
+ public static Resource createDiagram(URI diagramURI, URI modelURI, IProgressMonitor progressMonitor) {
+ TransactionalEditingDomain editingDomain = GMFEditingDomainFactory.INSTANCE.createEditingDomain();
+ progressMonitor.beginTask(Messages.UMLDiagramEditorUtil_CreateDiagramProgressTask, 3);
+ final Resource diagramResource = editingDomain.getResourceSet().createResource(diagramURI);
+ final Resource modelResource = editingDomain.getResourceSet().createResource(modelURI);
+ final String diagramName = diagramURI.lastSegment();
+ AbstractTransactionalCommand command = new AbstractTransactionalCommand(editingDomain, Messages.UMLDiagramEditorUtil_CreateDiagramCommandLabel, Collections.EMPTY_LIST) {
+
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ Package model = createInitialModel();
+ attachModelToResource(model, modelResource);
+
+ Diagram diagram = ViewService.createDiagram(model, ModelEditPart.MODEL_ID, UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
+ if (diagram != null) {
+ diagramResource.getContents().add(diagram);
+ diagram.setName(diagramName);
+ diagram.setElement(model);
+ }
+
+ try {
+ modelResource.save(org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorUtil.getSaveOptions());
+ diagramResource.save(org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorUtil.getSaveOptions());
+ } catch (IOException e) {
+
+ UMLDiagramEditorPlugin.getInstance().logError("Unable to store model and diagram resources", e); //$NON-NLS-1$
+ }
+ return CommandResult.newOKCommandResult();
+ }
+ };
+ try {
+ OperationHistoryFactory.getOperationHistory().execute(command, new SubProgressMonitor(progressMonitor, 1), null);
+ } catch (ExecutionException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Unable to create model and diagram", e); //$NON-NLS-1$
+ }
+ setCharset(WorkspaceSynchronizer.getFile(modelResource));
+ setCharset(WorkspaceSynchronizer.getFile(diagramResource));
+ return diagramResource;
+ }
+
+ /**
+ * Create a new instance of domain element associated with canvas.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ private static Package createInitialModel() {
+ return UMLFactory.eINSTANCE.createPackage();
+ }
+
+ /**
+ * Store model element in the resource.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ private static void attachModelToResource(Package model, Resource resource) {
+ resource.getContents().add(model);
+ }
+
+ /**
+ * @generated
+ */
+ public static void selectElementsInDiagram(IDiagramWorkbenchPart diagramPart, List/*EditPart*/editParts) {
+ diagramPart.getDiagramGraphicalViewer().deselectAll();
+
+ EditPart firstPrimary = null;
+ for (Iterator it = editParts.iterator(); it.hasNext();) {
+ EditPart nextPart = (EditPart) it.next();
+ diagramPart.getDiagramGraphicalViewer().appendSelection(nextPart);
+ if (firstPrimary == null && nextPart instanceof IPrimaryEditPart) {
+ firstPrimary = nextPart;
+ }
+ }
+
+ if (!editParts.isEmpty()) {
+ diagramPart.getDiagramGraphicalViewer().reveal(firstPrimary != null ? firstPrimary : (EditPart) editParts.get(0));
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private static int findElementsInDiagramByID(DiagramEditPart diagramPart, EObject element, List editPartCollector) {
+ IDiagramGraphicalViewer viewer = (IDiagramGraphicalViewer) diagramPart.getViewer();
+ final int intialNumOfEditParts = editPartCollector.size();
+
+ if (element instanceof View) { // support notation element lookup
+ EditPart editPart = (EditPart) viewer.getEditPartRegistry().get(element);
+ if (editPart != null) {
+ editPartCollector.add(editPart);
+ return 1;
+ }
+ }
+
+ String elementID = EMFCoreUtil.getProxyID(element);
+ List associatedParts = viewer.findEditPartsForElement(elementID, IGraphicalEditPart.class);
+ // perform the possible hierarchy disjoint -> take the top-most parts only
+ for (Iterator editPartIt = associatedParts.iterator(); editPartIt.hasNext();) {
+ EditPart nextPart = (EditPart) editPartIt.next();
+ EditPart parentPart = nextPart.getParent();
+ while (parentPart != null && !associatedParts.contains(parentPart)) {
+ parentPart = parentPart.getParent();
+ }
+ if (parentPart == null) {
+ editPartCollector.add(nextPart);
+ }
+ }
+
+ if (intialNumOfEditParts == editPartCollector.size()) {
+ if (!associatedParts.isEmpty()) {
+ editPartCollector.add(associatedParts.iterator().next());
+ } else {
+ if (element.eContainer() != null) {
+ return findElementsInDiagramByID(diagramPart, element.eContainer(), editPartCollector);
+ }
+ }
+ }
+ return editPartCollector.size() - intialNumOfEditParts;
+ }
+
+ /**
+ * @generated
+ */
+ public static View findView(DiagramEditPart diagramEditPart, EObject targetElement, LazyElement2ViewMap lazyElement2ViewMap) {
+ boolean hasStructuralURI = false;
+ if (targetElement.eResource() instanceof XMLResource) {
+ hasStructuralURI = ((XMLResource) targetElement.eResource()).getID(targetElement) == null;
+ }
+
+ View view = null;
+ if (hasStructuralURI && !lazyElement2ViewMap.getElement2ViewMap().isEmpty()) {
+ view = (View) lazyElement2ViewMap.getElement2ViewMap().get(targetElement);
+ } else if (findElementsInDiagramByID(diagramEditPart, targetElement, lazyElement2ViewMap.editPartTmpHolder) > 0) {
+ EditPart editPart = (EditPart) lazyElement2ViewMap.editPartTmpHolder.get(0);
+ lazyElement2ViewMap.editPartTmpHolder.clear();
+ view = editPart.getModel() instanceof View ? (View) editPart.getModel() : null;
+ }
+
+ return (view == null) ? diagramEditPart.getDiagramView() : view;
+ }
+
+ /**
+ * @generated
+ */
+ public static class LazyElement2ViewMap {
+
+ /**
+ * @generated
+ */
+ private Map element2ViewMap;
+
+ /**
+ * @generated
+ */
+ private View scope;
+
+ /**
+ * @generated
+ */
+ private Set elementSet;
+
+ /**
+ * @generated
+ */
+ public final List editPartTmpHolder = new ArrayList();
+
+ /**
+ * @generated
+ */
+ public LazyElement2ViewMap(View scope, Set elements) {
+ this.scope = scope;
+ this.elementSet = elements;
+ }
+
+ /**
+ * @generated
+ */
+ public final Map getElement2ViewMap() {
+ if (element2ViewMap == null) {
+ element2ViewMap = new HashMap();
+ // map possible notation elements to itself as these can't be found by view.getElement()
+ for (Iterator it = elementSet.iterator(); it.hasNext();) {
+ EObject element = (EObject) it.next();
+ if (element instanceof View) {
+ View view = (View) element;
+ if (view.getDiagram() == scope.getDiagram()) {
+ element2ViewMap.put(element, element); // take only those that part of our diagram
+ }
+ }
+ }
+
+ buildElement2ViewMap(scope, element2ViewMap, elementSet);
+ }
+ return element2ViewMap;
+ }
+
+ /**
+ * @generated
+ */
+ static Map buildElement2ViewMap(View parentView, Map element2ViewMap, Set elements) {
+ if (elements.size() == element2ViewMap.size())
+ return element2ViewMap;
+
+ if (parentView.isSetElement() && !element2ViewMap.containsKey(parentView.getElement()) && elements.contains(parentView.getElement())) {
+ element2ViewMap.put(parentView.getElement(), parentView);
+ if (elements.size() == element2ViewMap.size())
+ return element2ViewMap;
+ }
+
+ for (Iterator it = parentView.getChildren().iterator(); it.hasNext();) {
+ buildElement2ViewMap((View) it.next(), element2ViewMap, elements);
+ if (elements.size() == element2ViewMap.size())
+ return element2ViewMap;
+ }
+ for (Iterator it = parentView.getSourceEdges().iterator(); it.hasNext();) {
+ buildElement2ViewMap((View) it.next(), element2ViewMap, elements);
+ if (elements.size() == element2ViewMap.size())
+ return element2ViewMap;
+ }
+ for (Iterator it = parentView.getSourceEdges().iterator(); it.hasNext();) {
+ buildElement2ViewMap((View) it.next(), element2ViewMap, elements);
+ if (elements.size() == element2ViewMap.size())
+ return element2ViewMap;
+ }
+ return element2ViewMap;
+ }
+ } // LazyElement2ViewMap
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLDiagramUpdateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLDiagramUpdateCommand.java
new file mode 100644
index 00000000000..61d921911f4
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLDiagramUpdateCommand.java
@@ -0,0 +1,91 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.part;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.core.commands.IHandlerListener;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @generated
+ */
+public class UMLDiagramUpdateCommand implements IHandler {
+
+ /**
+ * @generated
+ */
+ public void addHandlerListener(IHandlerListener handlerListener) {
+ }
+
+ /**
+ * @generated
+ */
+ public void dispose() {
+ }
+
+ /**
+ * @generated
+ */
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection structuredSelection = (IStructuredSelection) selection;
+ if (structuredSelection.size() != 1) {
+ return null;
+ }
+ if (structuredSelection.getFirstElement() instanceof EditPart && ((EditPart) structuredSelection.getFirstElement()).getModel() instanceof View) {
+ EObject modelElement = ((View) ((EditPart) structuredSelection.getFirstElement()).getModel()).getElement();
+ List editPolicies = CanonicalEditPolicy.getRegisteredEditPolicies(modelElement);
+ for (Iterator it = editPolicies.iterator(); it.hasNext();) {
+ CanonicalEditPolicy nextEditPolicy = (CanonicalEditPolicy) it.next();
+ nextEditPolicy.refresh();
+ }
+
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isEnabled() {
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isHandled() {
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public void removeHandlerListener(IHandlerListener handlerListener) {
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLDiagramUpdater.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLDiagramUpdater.java
new file mode 100644
index 00000000000..6c533cd91f5
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLDiagramUpdater.java
@@ -0,0 +1,6244 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.part;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Association2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Association3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationClass2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationClassAttributeCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationClassEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Class2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Class3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Class4EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Class5EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassAttributeCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassAttributeCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassNestedClassifierCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassNestedClassifierCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassOperationCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassOperationCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Comment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Component2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentAttributeCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentAttributeCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentNestedClassifierCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentNestedClassifierCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentOperationCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentOperationCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Constraint2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataType2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataTypeAttributeCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataTypeAttributeCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataTypeEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataTypeOperationCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataTypeOperationCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Enumeration2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.EnumerationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.EnumerationEnumerationLiteralCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.EnumerationEnumerationLiteralCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.EnumerationLiteralEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.GeneralizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InstanceSpecification2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InstanceSpecificationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InstanceSpecificationSlotCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InstanceSpecificationSlotCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Interface2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceAttributeCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceAttributeCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceNestedClassifierCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceNestedClassifierCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceOperationCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceOperationCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceRealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Model2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Model3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelPackageableElementCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelPackageableElementCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Operation2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Operation3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Operation4EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.OperationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Package2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageMergeEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackagePackageableElementCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackagePackageableElementCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PrimitiveType2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PrimitiveTypeEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ProfileApplicationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Property2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Property3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Property4EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Property5EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PropertyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ReceptionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RedefinableTemplateSignatureEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RedefinableTemplateSignatureTemplateParameterCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Signal2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SignalAttributeCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SignalAttributeCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SignalEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SlotEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SubstitutionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateParameterEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.Abstraction;
+import org.eclipse.uml2.uml.Association;
+import org.eclipse.uml2.uml.AssociationClass;
+import org.eclipse.uml2.uml.BehavioredClassifier;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Classifier;
+import org.eclipse.uml2.uml.Comment;
+import org.eclipse.uml2.uml.Component;
+import org.eclipse.uml2.uml.Constraint;
+import org.eclipse.uml2.uml.DataType;
+import org.eclipse.uml2.uml.Dependency;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.ElementImport;
+import org.eclipse.uml2.uml.Enumeration;
+import org.eclipse.uml2.uml.EnumerationLiteral;
+import org.eclipse.uml2.uml.Generalization;
+import org.eclipse.uml2.uml.InstanceSpecification;
+import org.eclipse.uml2.uml.Interface;
+import org.eclipse.uml2.uml.InterfaceRealization;
+import org.eclipse.uml2.uml.Model;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.Namespace;
+import org.eclipse.uml2.uml.Operation;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.PackageImport;
+import org.eclipse.uml2.uml.PackageMerge;
+import org.eclipse.uml2.uml.PackageableElement;
+import org.eclipse.uml2.uml.PrimitiveType;
+import org.eclipse.uml2.uml.Profile;
+import org.eclipse.uml2.uml.ProfileApplication;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.Realization;
+import org.eclipse.uml2.uml.Reception;
+import org.eclipse.uml2.uml.RedefinableTemplateSignature;
+import org.eclipse.uml2.uml.Signal;
+import org.eclipse.uml2.uml.Slot;
+import org.eclipse.uml2.uml.Substitution;
+import org.eclipse.uml2.uml.TemplateBinding;
+import org.eclipse.uml2.uml.TemplateParameter;
+import org.eclipse.uml2.uml.TemplateSignature;
+import org.eclipse.uml2.uml.TemplateableElement;
+import org.eclipse.uml2.uml.Type;
+import org.eclipse.uml2.uml.UMLPackage;
+import org.eclipse.uml2.uml.Usage;
+
+/**
+ * @generated
+ */
+public class UMLDiagramUpdater {
+
+ /**
+ * @generated
+ */
+ public static List getAbstraction_4006ContainedLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getAbstraction_4006IncomingLinks(View view) {
+ Abstraction modelElement = (Abstraction) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_ElementImport_4009(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getAbstraction_4006OutgoingLinks(View view) {
+ Abstraction modelElement = (Abstraction) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getAssociation_4001ContainedLinks(View view) {
+ Association modelElement = (Association) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4002(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Substitution_4004(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getAssociation_4019ContainedLinks(View view) {
+ Association modelElement = (Association) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4002(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Substitution_4004(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getAssociation_4001IncomingLinks(View view) {
+ Association modelElement = (Association) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_AssociationClass_4017(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Association_4001(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Association_4019(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Generalization_4002(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4004(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_ElementImport_4009(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getAssociation_4019IncomingLinks(View view) {
+ Association modelElement = (Association) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_AssociationClass_4017(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Association_4001(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Association_4019(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Generalization_4002(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4004(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_ElementImport_4009(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getAssociation_4001OutgoingLinks(View view) {
+ Association modelElement = (Association) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_AssociationClass_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Association_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Association_4019(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4002(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getAssociation_4019OutgoingLinks(View view) {
+ Association modelElement = (Association) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_AssociationClass_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Association_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Association_4019(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4002(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getAssociationClass_2013ContainedLinks(View view) {
+ AssociationClass modelElement = (AssociationClass) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4002(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_InterfaceRealization_4003(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Substitution_4004(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getAssociation_2015ContainedLinks(View view) {
+ Association modelElement = (Association) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4002(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Substitution_4004(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getAssociationClass_2013IncomingLinks(View view) {
+ AssociationClass modelElement = (AssociationClass) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_AssociationClass_4017(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Association_4001(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Association_4019(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Generalization_4002(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4004(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_ElementImport_4009(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getAssociation_2015IncomingLinks(View view) {
+ Association modelElement = (Association) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_AssociationClass_4017(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Association_4001(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Association_4019(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Generalization_4002(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4004(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_ElementImport_4009(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getAssociationClass_2013OutgoingLinks(View view) {
+ AssociationClass modelElement = (AssociationClass) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_AssociationClass_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Association_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Association_4019(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4002(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_InterfaceRealization_4003(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getAssociation_2015OutgoingLinks(View view) {
+ Association modelElement = (Association) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_AssociationClass_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Association_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Association_4019(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4002(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getAssociationClass_4017ContainedLinks(View view) {
+ AssociationClass modelElement = (AssociationClass) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4002(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_InterfaceRealization_4003(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Substitution_4004(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getAssociationClass_4017IncomingLinks(View view) {
+ AssociationClass modelElement = (AssociationClass) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_AssociationClass_4017(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Association_4001(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Association_4019(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Generalization_4002(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4004(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_ElementImport_4009(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getAssociationClass_4017OutgoingLinks(View view) {
+ AssociationClass modelElement = (AssociationClass) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_AssociationClass_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Association_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Association_4019(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4002(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_InterfaceRealization_4003(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getAssociationClassAttributeCompartment_7034SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.EMPTY_LIST;
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ AssociationClass modelElement = (AssociationClass) containerView.getElement();
+ List result = new LinkedList();
+ for (Iterator it = modelElement.getOwnedAttributes().iterator(); it.hasNext();) {
+ Property childElement = (Property) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == PropertyEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getClass_2008ContainedLinks(View view) {
+ Class modelElement = (Class) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4002(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_InterfaceRealization_4003(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Substitution_4004(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getClass_2008IncomingLinks(View view) {
+ Class modelElement = (Class) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_AssociationClass_4017(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Association_4001(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Association_4019(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Generalization_4002(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4004(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_ElementImport_4009(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getClass_2008OutgoingLinks(View view) {
+ Class modelElement = (Class) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_AssociationClass_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Association_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Association_4019(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4002(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_InterfaceRealization_4003(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getClass_2008SemanticChildren(View view) {
+ if (!view.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ Class modelElement = (Class) view.getElement();
+ List result = new LinkedList();
+ {
+ TemplateSignature childElement = modelElement.getOwnedTemplateSignature();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == RedefinableTemplateSignatureEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getClass_3004ContainedLinks(View view) {
+ Class modelElement = (Class) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4002(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_InterfaceRealization_4003(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Substitution_4004(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getClass_3004IncomingLinks(View view) {
+ Class modelElement = (Class) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_AssociationClass_4017(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Association_4001(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Association_4019(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Generalization_4002(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4004(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_ElementImport_4009(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getClass_3004OutgoingLinks(View view) {
+ Class modelElement = (Class) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_AssociationClass_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Association_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Association_4019(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4002(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_InterfaceRealization_4003(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getClass_3008ContainedLinks(View view) {
+ Class modelElement = (Class) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4002(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_InterfaceRealization_4003(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Substitution_4004(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getClass_3008IncomingLinks(View view) {
+ Class modelElement = (Class) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_AssociationClass_4017(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Association_4001(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Association_4019(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Generalization_4002(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4004(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_ElementImport_4009(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getClass_3008OutgoingLinks(View view) {
+ Class modelElement = (Class) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_AssociationClass_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Association_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Association_4019(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4002(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_InterfaceRealization_4003(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getClass_3010ContainedLinks(View view) {
+ Class modelElement = (Class) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4002(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_InterfaceRealization_4003(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Substitution_4004(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getClass_3010IncomingLinks(View view) {
+ Class modelElement = (Class) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_AssociationClass_4017(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Association_4001(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Association_4019(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Generalization_4002(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4004(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_ElementImport_4009(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getClass_3010OutgoingLinks(View view) {
+ Class modelElement = (Class) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_AssociationClass_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Association_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Association_4019(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4002(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_InterfaceRealization_4003(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getClass_3010SemanticChildren(View view) {
+ if (!view.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ Class modelElement = (Class) view.getElement();
+ List result = new LinkedList();
+ {
+ TemplateSignature childElement = modelElement.getOwnedTemplateSignature();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == RedefinableTemplateSignatureEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getClass_3014ContainedLinks(View view) {
+ Class modelElement = (Class) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4002(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_InterfaceRealization_4003(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Substitution_4004(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getClass_3014IncomingLinks(View view) {
+ Class modelElement = (Class) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_AssociationClass_4017(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Association_4001(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Association_4019(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Generalization_4002(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4004(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_ElementImport_4009(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getClass_3014OutgoingLinks(View view) {
+ Class modelElement = (Class) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_AssociationClass_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Association_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Association_4019(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4002(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_InterfaceRealization_4003(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getClassAttributeCompartment_7011SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.EMPTY_LIST;
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ Class modelElement = (Class) containerView.getElement();
+ List result = new LinkedList();
+ for (Iterator it = modelElement.getOwnedAttributes().iterator(); it.hasNext();) {
+ Property childElement = (Property) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == Property4EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getClassAttributeCompartment_7017SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.EMPTY_LIST;
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ Class modelElement = (Class) containerView.getElement();
+ List result = new LinkedList();
+ for (Iterator it = modelElement.getOwnedAttributes().iterator(); it.hasNext();) {
+ Property childElement = (Property) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == Property4EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getClassNestedClassifierCompartment_7013SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.EMPTY_LIST;
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ Class modelElement = (Class) containerView.getElement();
+ List result = new LinkedList();
+ for (Iterator it = modelElement.getNestedClassifiers().iterator(); it.hasNext();) {
+ Classifier childElement = (Classifier) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == Class5EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getClassNestedClassifierCompartment_7019SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.EMPTY_LIST;
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ Class modelElement = (Class) containerView.getElement();
+ List result = new LinkedList();
+ for (Iterator it = modelElement.getNestedClassifiers().iterator(); it.hasNext();) {
+ Classifier childElement = (Classifier) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == Class5EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getClassOperationCompartment_7012SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.EMPTY_LIST;
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ Class modelElement = (Class) containerView.getElement();
+ List result = new LinkedList();
+ for (Iterator it = modelElement.getOwnedReceptions().iterator(); it.hasNext();) {
+ Reception childElement = (Reception) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == ReceptionEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ for (Iterator it = modelElement.getOwnedOperations().iterator(); it.hasNext();) {
+ Operation childElement = (Operation) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == Operation3EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getClassOperationCompartment_7018SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.EMPTY_LIST;
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ Class modelElement = (Class) containerView.getElement();
+ List result = new LinkedList();
+ for (Iterator it = modelElement.getOwnedReceptions().iterator(); it.hasNext();) {
+ Reception childElement = (Reception) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == ReceptionEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ for (Iterator it = modelElement.getOwnedOperations().iterator(); it.hasNext();) {
+ Operation childElement = (Operation) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == Operation3EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getComment_2012ContainedLinks(View view) {
+ Comment modelElement = (Comment) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getComment_2012IncomingLinks(View view) {
+ Comment modelElement = (Comment) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getComment_2012OutgoingLinks(View view) {
+ Comment modelElement = (Comment) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getComment_3028ContainedLinks(View view) {
+ Comment modelElement = (Comment) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getComment_3028IncomingLinks(View view) {
+ Comment modelElement = (Comment) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getComment_3028OutgoingLinks(View view) {
+ Comment modelElement = (Comment) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getComponent_2002ContainedLinks(View view) {
+ Component modelElement = (Component) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4002(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_InterfaceRealization_4003(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Substitution_4004(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getComponent_2002IncomingLinks(View view) {
+ Component modelElement = (Component) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_AssociationClass_4017(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Association_4001(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Association_4019(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Generalization_4002(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4004(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_ElementImport_4009(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getComponent_2002OutgoingLinks(View view) {
+ Component modelElement = (Component) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_AssociationClass_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Association_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Association_4019(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4002(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_InterfaceRealization_4003(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getComponent_2002SemanticChildren(View view) {
+ if (!view.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ Component modelElement = (Component) view.getElement();
+ List result = new LinkedList();
+ {
+ TemplateSignature childElement = modelElement.getOwnedTemplateSignature();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == RedefinableTemplateSignatureEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getComponent_3021ContainedLinks(View view) {
+ Component modelElement = (Component) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4002(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_InterfaceRealization_4003(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Substitution_4004(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getComponent_3021IncomingLinks(View view) {
+ Component modelElement = (Component) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_AssociationClass_4017(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Association_4001(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Association_4019(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Generalization_4002(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4004(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_ElementImport_4009(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getComponent_3021OutgoingLinks(View view) {
+ Component modelElement = (Component) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_AssociationClass_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Association_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Association_4019(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4002(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_InterfaceRealization_4003(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getComponent_3021SemanticChildren(View view) {
+ if (!view.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ Component modelElement = (Component) view.getElement();
+ List result = new LinkedList();
+ {
+ TemplateSignature childElement = modelElement.getOwnedTemplateSignature();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == RedefinableTemplateSignatureEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getComponentAttributeCompartment_7002SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.EMPTY_LIST;
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ Component modelElement = (Component) containerView.getElement();
+ List result = new LinkedList();
+ for (Iterator it = modelElement.getOwnedAttributes().iterator(); it.hasNext();) {
+ Property childElement = (Property) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == PropertyEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getComponentAttributeCompartment_7023SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.EMPTY_LIST;
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ Component modelElement = (Component) containerView.getElement();
+ List result = new LinkedList();
+ for (Iterator it = modelElement.getOwnedAttributes().iterator(); it.hasNext();) {
+ Property childElement = (Property) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == PropertyEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getComponentNestedClassifierCompartment_7004SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.EMPTY_LIST;
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ Component modelElement = (Component) containerView.getElement();
+ List result = new LinkedList();
+ for (Iterator it = modelElement.getNestedClassifiers().iterator(); it.hasNext();) {
+ Classifier childElement = (Classifier) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == Class2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getComponentNestedClassifierCompartment_7025SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.EMPTY_LIST;
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ Component modelElement = (Component) containerView.getElement();
+ List result = new LinkedList();
+ for (Iterator it = modelElement.getNestedClassifiers().iterator(); it.hasNext();) {
+ Classifier childElement = (Classifier) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == Class2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getComponentOperationCompartment_7003SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.EMPTY_LIST;
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ Component modelElement = (Component) containerView.getElement();
+ List result = new LinkedList();
+ for (Iterator it = modelElement.getOwnedOperations().iterator(); it.hasNext();) {
+ Operation childElement = (Operation) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == OperationEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getComponentOperationCompartment_7024SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.EMPTY_LIST;
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ Component modelElement = (Component) containerView.getElement();
+ List result = new LinkedList();
+ for (Iterator it = modelElement.getOwnedOperations().iterator(); it.hasNext();) {
+ Operation childElement = (Operation) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == OperationEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getConstraint_2011ContainedLinks(View view) {
+ Constraint modelElement = (Constraint) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getConstraint_2011IncomingLinks(View view) {
+ Constraint modelElement = (Constraint) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_ElementImport_4009(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getConstraint_2011OutgoingLinks(View view) {
+ Constraint modelElement = (Constraint) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ result.addAll(getOutgoingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getConstraint_3029ContainedLinks(View view) {
+ Constraint modelElement = (Constraint) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getConstraint_3029IncomingLinks(View view) {
+ Constraint modelElement = (Constraint) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_ElementImport_4009(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getConstraint_3029OutgoingLinks(View view) {
+ Constraint modelElement = (Constraint) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ result.addAll(getOutgoingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getContainedLinks(View view) {
+ switch (UMLVisualIDRegistry.getVisualID(view)) {
+ case ModelEditPart.VISUAL_ID:
+ return getPackage_1000ContainedLinks(view);
+ case Dependency2EditPart.VISUAL_ID:
+ return getDependency_2014ContainedLinks(view);
+ case AssociationClassEditPart.VISUAL_ID:
+ return getAssociationClass_2013ContainedLinks(view);
+ case Association2EditPart.VISUAL_ID:
+ return getAssociation_2015ContainedLinks(view);
+ case InstanceSpecificationEditPart.VISUAL_ID:
+ return getInstanceSpecification_2001ContainedLinks(view);
+ case ComponentEditPart.VISUAL_ID:
+ return getComponent_2002ContainedLinks(view);
+ case SignalEditPart.VISUAL_ID:
+ return getSignal_2003ContainedLinks(view);
+ case InterfaceEditPart.VISUAL_ID:
+ return getInterface_2004ContainedLinks(view);
+ case Model2EditPart.VISUAL_ID:
+ return getModel_2005ContainedLinks(view);
+ case EnumerationEditPart.VISUAL_ID:
+ return getEnumeration_2006ContainedLinks(view);
+ case PackageEditPart.VISUAL_ID:
+ return getPackage_2007ContainedLinks(view);
+ case ClassEditPart.VISUAL_ID:
+ return getClass_2008ContainedLinks(view);
+ case PrimitiveTypeEditPart.VISUAL_ID:
+ return getPrimitiveType_2009ContainedLinks(view);
+ case DataTypeEditPart.VISUAL_ID:
+ return getDataType_2010ContainedLinks(view);
+ case ConstraintEditPart.VISUAL_ID:
+ return getConstraint_2011ContainedLinks(view);
+ case CommentEditPart.VISUAL_ID:
+ return getComment_2012ContainedLinks(view);
+ case PropertyEditPart.VISUAL_ID:
+ return getProperty_3002ContainedLinks(view);
+ case SlotEditPart.VISUAL_ID:
+ return getSlot_3001ContainedLinks(view);
+ case OperationEditPart.VISUAL_ID:
+ return getOperation_3003ContainedLinks(view);
+ case Class2EditPart.VISUAL_ID:
+ return getClass_3004ContainedLinks(view);
+ case RedefinableTemplateSignatureEditPart.VISUAL_ID:
+ return getRedefinableTemplateSignature_3015ContainedLinks(view);
+ case TemplateParameterEditPart.VISUAL_ID:
+ return getTemplateParameter_3016ContainedLinks(view);
+ case Property2EditPart.VISUAL_ID:
+ return getProperty_3005ContainedLinks(view);
+ case Property3EditPart.VISUAL_ID:
+ return getProperty_3006ContainedLinks(view);
+ case Operation2EditPart.VISUAL_ID:
+ return getOperation_3007ContainedLinks(view);
+ case Class3EditPart.VISUAL_ID:
+ return getClass_3008ContainedLinks(view);
+ case InstanceSpecification2EditPart.VISUAL_ID:
+ return getInstanceSpecification_3020ContainedLinks(view);
+ case Component2EditPart.VISUAL_ID:
+ return getComponent_3021ContainedLinks(view);
+ case Signal2EditPart.VISUAL_ID:
+ return getSignal_3022ContainedLinks(view);
+ case Interface2EditPart.VISUAL_ID:
+ return getInterface_3023ContainedLinks(view);
+ case Model3EditPart.VISUAL_ID:
+ return getModel_3024ContainedLinks(view);
+ case Enumeration2EditPart.VISUAL_ID:
+ return getEnumeration_3025ContainedLinks(view);
+ case EnumerationLiteralEditPart.VISUAL_ID:
+ return getEnumerationLiteral_3017ContainedLinks(view);
+ case Package2EditPart.VISUAL_ID:
+ return getPackage_3009ContainedLinks(view);
+ case Class4EditPart.VISUAL_ID:
+ return getClass_3010ContainedLinks(view);
+ case ReceptionEditPart.VISUAL_ID:
+ return getReception_3011ContainedLinks(view);
+ case Property4EditPart.VISUAL_ID:
+ return getProperty_3012ContainedLinks(view);
+ case Operation3EditPart.VISUAL_ID:
+ return getOperation_3013ContainedLinks(view);
+ case Class5EditPart.VISUAL_ID:
+ return getClass_3014ContainedLinks(view);
+ case PrimitiveType2EditPart.VISUAL_ID:
+ return getPrimitiveType_3026ContainedLinks(view);
+ case DataType2EditPart.VISUAL_ID:
+ return getDataType_3027ContainedLinks(view);
+ case Property5EditPart.VISUAL_ID:
+ return getProperty_3018ContainedLinks(view);
+ case Operation4EditPart.VISUAL_ID:
+ return getOperation_3019ContainedLinks(view);
+ case Comment2EditPart.VISUAL_ID:
+ return getComment_3028ContainedLinks(view);
+ case Constraint2EditPart.VISUAL_ID:
+ return getConstraint_3029ContainedLinks(view);
+ case AssociationClass2EditPart.VISUAL_ID:
+ return getAssociationClass_4017ContainedLinks(view);
+ case AssociationEditPart.VISUAL_ID:
+ return getAssociation_4001ContainedLinks(view);
+ case Association3EditPart.VISUAL_ID:
+ return getAssociation_4019ContainedLinks(view);
+ case GeneralizationEditPart.VISUAL_ID:
+ return getGeneralization_4002ContainedLinks(view);
+ case InterfaceRealizationEditPart.VISUAL_ID:
+ return getInterfaceRealization_4003ContainedLinks(view);
+ case SubstitutionEditPart.VISUAL_ID:
+ return getSubstitution_4004ContainedLinks(view);
+ case RealizationEditPart.VISUAL_ID:
+ return getRealization_4005ContainedLinks(view);
+ case AbstractionEditPart.VISUAL_ID:
+ return getAbstraction_4006ContainedLinks(view);
+ case UsageEditPart.VISUAL_ID:
+ return getUsage_4007ContainedLinks(view);
+ case DependencyEditPart.VISUAL_ID:
+ return getDependency_4008ContainedLinks(view);
+ case Dependency3EditPart.VISUAL_ID:
+ return getDependency_4018ContainedLinks(view);
+ case ElementImportEditPart.VISUAL_ID:
+ return getElementImport_4009ContainedLinks(view);
+ case PackageImportEditPart.VISUAL_ID:
+ return getPackageImport_4010ContainedLinks(view);
+ case PackageMergeEditPart.VISUAL_ID:
+ return getPackageMerge_4011ContainedLinks(view);
+ case ProfileApplicationEditPart.VISUAL_ID:
+ return getProfileApplication_4012ContainedLinks(view);
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getTemplateBinding_4015ContainedLinks(view);
+ }
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getContainedTypeModelFacetLinks_Abstraction_4006(Package container) {
+ Collection result = new LinkedList();
+ for (Iterator links = container.getPackagedElements().iterator(); links.hasNext();) {
+ EObject linkObject = (EObject) links.next();
+ if (false == linkObject instanceof Abstraction) {
+ continue;
+ }
+ Abstraction link = (Abstraction) linkObject;
+ if (AbstractionEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ List targets = link.getSuppliers();
+ Object theTarget = targets.size() == 1 ? targets.get(0) : null;
+ if (false == theTarget instanceof NamedElement) {
+ continue;
+ }
+ NamedElement dst = (NamedElement) theTarget;
+ List sources = link.getClients();
+ Object theSource = sources.size() == 1 ? sources.get(0) : null;
+ if (false == theSource instanceof NamedElement) {
+ continue;
+ }
+ NamedElement src = (NamedElement) theSource;
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Abstraction_4006, AbstractionEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated-not
+ */
+ private static Collection getContainedTypeModelFacetLinks_Association_4001(Package container) {
+ Collection result = new LinkedList();
+ for (Iterator links = container.getPackagedElements().iterator(); links.hasNext();) {
+ EObject linkObject = (EObject) links.next();
+ if (false == linkObject instanceof Association) {
+ continue;
+ }
+ Association link = (Association) linkObject;
+ if (AssociationEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ Type src = null;
+ if (link.getEndTypes().size() > 0) {
+ src = link.getEndTypes().get(0);
+ }
+ Type dst = null;
+ if (link.getEndTypes().size() > 0) {
+ dst = link.getEndTypes().get(1);
+ }
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Association_4001, AssociationEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getContainedTypeModelFacetLinks_Association_4019(Package container) {
+ Collection result = new LinkedList();
+ for (Iterator links = container.getPackagedElements().iterator(); links.hasNext();) {
+ EObject linkObject = (EObject) links.next();
+ if (false == linkObject instanceof Association) {
+ continue;
+ }
+ Association link = (Association) linkObject;
+ if (Association3EditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ List targets = link.getEndTypes();
+ Object theTarget = targets.size() == 1 ? targets.get(0) : null;
+ if (false == theTarget instanceof Type) {
+ continue;
+ }
+ Type dst = (Type) theTarget;
+ List sources = link.getEndTypes();
+ Object theSource = sources.size() == 1 ? sources.get(0) : null;
+ if (false == theSource instanceof Type) {
+ continue;
+ }
+ Type src = (Type) theSource;
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Association_4019, Association3EditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated-not
+ */
+ private static Collection getContainedTypeModelFacetLinks_AssociationClass_4017(Package container) {
+ Collection result = new LinkedList();
+ for (Iterator links = container.getPackagedElements().iterator(); links.hasNext();) {
+ EObject linkObject = (EObject) links.next();
+ if (false == linkObject instanceof Association) {
+ continue;
+ }
+ Association link = (Association) linkObject;
+ if (AssociationEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ Type src = null;
+ if (link.getEndTypes().size() > 0) {
+ src = link.getEndTypes().get(0);
+ }
+ Type dst = null;
+ if (link.getEndTypes().size() > 0) {
+ dst = link.getEndTypes().get(1);
+ }
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Association_4001, AssociationEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getContainedTypeModelFacetLinks_Dependency_4008(Package container) {
+ Collection result = new LinkedList();
+ for (Iterator links = container.getPackagedElements().iterator(); links.hasNext();) {
+ EObject linkObject = (EObject) links.next();
+ if (false == linkObject instanceof Dependency) {
+ continue;
+ }
+ Dependency link = (Dependency) linkObject;
+ if (DependencyEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ List targets = link.getSuppliers();
+ Object theTarget = targets.size() == 1 ? targets.get(0) : null;
+ if (false == theTarget instanceof NamedElement) {
+ continue;
+ }
+ NamedElement dst = (NamedElement) theTarget;
+ List sources = link.getClients();
+ Object theSource = sources.size() == 1 ? sources.get(0) : null;
+ if (false == theSource instanceof NamedElement) {
+ continue;
+ }
+ NamedElement src = (NamedElement) theSource;
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Dependency_4008, DependencyEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getContainedTypeModelFacetLinks_Dependency_4018(Package container) {
+ Collection result = new LinkedList();
+ for (Iterator links = container.getPackagedElements().iterator(); links.hasNext();) {
+ EObject linkObject = (EObject) links.next();
+ if (false == linkObject instanceof Dependency) {
+ continue;
+ }
+ Dependency link = (Dependency) linkObject;
+ if (Dependency3EditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ List targets = link.getSuppliers();
+ Object theTarget = targets.size() == 1 ? targets.get(0) : null;
+ if (false == theTarget instanceof NamedElement) {
+ continue;
+ }
+ NamedElement dst = (NamedElement) theTarget;
+ List sources = link.getClients();
+ Object theSource = sources.size() == 1 ? sources.get(0) : null;
+ if (false == theSource instanceof NamedElement) {
+ continue;
+ }
+ NamedElement src = (NamedElement) theSource;
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Dependency_4018, Dependency3EditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getContainedTypeModelFacetLinks_ElementImport_4009(Namespace container) {
+ Collection result = new LinkedList();
+ for (Iterator links = container.getElementImports().iterator(); links.hasNext();) {
+ EObject linkObject = (EObject) links.next();
+ if (false == linkObject instanceof ElementImport) {
+ continue;
+ }
+ ElementImport link = (ElementImport) linkObject;
+ if (ElementImportEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ PackageableElement dst = link.getImportedElement();
+ result.add(new UMLLinkDescriptor(container, dst, link, UMLElementTypes.ElementImport_4009, ElementImportEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getContainedTypeModelFacetLinks_Generalization_4002(Classifier container) {
+ Collection result = new LinkedList();
+ for (Iterator links = container.getGeneralizations().iterator(); links.hasNext();) {
+ EObject linkObject = (EObject) links.next();
+ if (false == linkObject instanceof Generalization) {
+ continue;
+ }
+ Generalization link = (Generalization) linkObject;
+ if (GeneralizationEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ Classifier dst = link.getGeneral();
+ result.add(new UMLLinkDescriptor(container, dst, link, UMLElementTypes.Generalization_4002, GeneralizationEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getContainedTypeModelFacetLinks_InterfaceRealization_4003(BehavioredClassifier container) {
+ Collection result = new LinkedList();
+ for (Iterator links = container.getInterfaceRealizations().iterator(); links.hasNext();) {
+ EObject linkObject = (EObject) links.next();
+ if (false == linkObject instanceof InterfaceRealization) {
+ continue;
+ }
+ InterfaceRealization link = (InterfaceRealization) linkObject;
+ if (InterfaceRealizationEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ Interface dst = link.getContract();
+ result.add(new UMLLinkDescriptor(container, dst, link, UMLElementTypes.InterfaceRealization_4003, InterfaceRealizationEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getContainedTypeModelFacetLinks_PackageImport_4010(Namespace container) {
+ Collection result = new LinkedList();
+ for (Iterator links = container.getPackageImports().iterator(); links.hasNext();) {
+ EObject linkObject = (EObject) links.next();
+ if (false == linkObject instanceof PackageImport) {
+ continue;
+ }
+ PackageImport link = (PackageImport) linkObject;
+ if (PackageImportEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ Package dst = link.getImportedPackage();
+ result.add(new UMLLinkDescriptor(container, dst, link, UMLElementTypes.PackageImport_4010, PackageImportEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getContainedTypeModelFacetLinks_PackageMerge_4011(Package container) {
+ Collection result = new LinkedList();
+ for (Iterator links = container.getPackageMerges().iterator(); links.hasNext();) {
+ EObject linkObject = (EObject) links.next();
+ if (false == linkObject instanceof PackageMerge) {
+ continue;
+ }
+ PackageMerge link = (PackageMerge) linkObject;
+ if (PackageMergeEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ Package dst = link.getMergedPackage();
+ Package src = link.getReceivingPackage();
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.PackageMerge_4011, PackageMergeEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getContainedTypeModelFacetLinks_ProfileApplication_4012(Package container) {
+ Collection result = new LinkedList();
+ for (Iterator links = container.getProfileApplications().iterator(); links.hasNext();) {
+ EObject linkObject = (EObject) links.next();
+ if (false == linkObject instanceof ProfileApplication) {
+ continue;
+ }
+ ProfileApplication link = (ProfileApplication) linkObject;
+ if (ProfileApplicationEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ Profile dst = link.getAppliedProfile();
+ result.add(new UMLLinkDescriptor(container, dst, link, UMLElementTypes.ProfileApplication_4012, ProfileApplicationEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getContainedTypeModelFacetLinks_Realization_4005(Package container) {
+ Collection result = new LinkedList();
+ for (Iterator links = container.getPackagedElements().iterator(); links.hasNext();) {
+ EObject linkObject = (EObject) links.next();
+ if (false == linkObject instanceof Realization) {
+ continue;
+ }
+ Realization link = (Realization) linkObject;
+ if (RealizationEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ List targets = link.getSuppliers();
+ Object theTarget = targets.size() == 1 ? targets.get(0) : null;
+ if (false == theTarget instanceof NamedElement) {
+ continue;
+ }
+ NamedElement dst = (NamedElement) theTarget;
+ List sources = link.getClients();
+ Object theSource = sources.size() == 1 ? sources.get(0) : null;
+ if (false == theSource instanceof NamedElement) {
+ continue;
+ }
+ NamedElement src = (NamedElement) theSource;
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Realization_4005, RealizationEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getContainedTypeModelFacetLinks_Substitution_4004(Classifier container) {
+ Collection result = new LinkedList();
+ for (Iterator links = container.getSubstitutions().iterator(); links.hasNext();) {
+ EObject linkObject = (EObject) links.next();
+ if (false == linkObject instanceof Substitution) {
+ continue;
+ }
+ Substitution link = (Substitution) linkObject;
+ if (SubstitutionEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ Classifier dst = link.getContract();
+ Classifier src = link.getSubstitutingClassifier();
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Substitution_4004, SubstitutionEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getContainedTypeModelFacetLinks_TemplateBinding_4015(TemplateableElement container) {
+ Collection result = new LinkedList();
+ for (Iterator links = container.getTemplateBindings().iterator(); links.hasNext();) {
+ EObject linkObject = (EObject) links.next();
+ if (false == linkObject instanceof TemplateBinding) {
+ continue;
+ }
+ TemplateBinding link = (TemplateBinding) linkObject;
+ if (TemplateBindingEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ List targets = link.getTargets();
+ Object theTarget = targets.size() == 1 ? targets.get(0) : null;
+ if (false == theTarget instanceof Element) {
+ continue;
+ }
+ Element dst = (Element) theTarget;
+ TemplateableElement src = link.getBoundElement();
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.TemplateBinding_4015, TemplateBindingEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getContainedTypeModelFacetLinks_Usage_4007(Package container) {
+ Collection result = new LinkedList();
+ for (Iterator links = container.getPackagedElements().iterator(); links.hasNext();) {
+ EObject linkObject = (EObject) links.next();
+ if (false == linkObject instanceof Usage) {
+ continue;
+ }
+ Usage link = (Usage) linkObject;
+ if (UsageEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ List targets = link.getSuppliers();
+ Object theTarget = targets.size() == 1 ? targets.get(0) : null;
+ if (false == theTarget instanceof NamedElement) {
+ continue;
+ }
+ NamedElement dst = (NamedElement) theTarget;
+ List sources = link.getClients();
+ Object theSource = sources.size() == 1 ? sources.get(0) : null;
+ if (false == theSource instanceof NamedElement) {
+ continue;
+ }
+ NamedElement src = (NamedElement) theSource;
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Usage_4007, UsageEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getDataType_2010ContainedLinks(View view) {
+ DataType modelElement = (DataType) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4002(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Substitution_4004(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getDataType_2010IncomingLinks(View view) {
+ DataType modelElement = (DataType) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_AssociationClass_4017(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Association_4001(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Association_4019(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Generalization_4002(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4004(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_ElementImport_4009(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getDataType_2010OutgoingLinks(View view) {
+ DataType modelElement = (DataType) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_AssociationClass_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Association_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Association_4019(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4002(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getDataType_2010SemanticChildren(View view) {
+ if (!view.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ DataType modelElement = (DataType) view.getElement();
+ List result = new LinkedList();
+ {
+ TemplateSignature childElement = modelElement.getOwnedTemplateSignature();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == RedefinableTemplateSignatureEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getDataType_3027ContainedLinks(View view) {
+ DataType modelElement = (DataType) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4002(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Substitution_4004(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getDataType_3027IncomingLinks(View view) {
+ DataType modelElement = (DataType) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_AssociationClass_4017(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Association_4001(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Association_4019(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Generalization_4002(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4004(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_ElementImport_4009(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getDataType_3027OutgoingLinks(View view) {
+ DataType modelElement = (DataType) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_AssociationClass_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Association_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Association_4019(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4002(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getDataType_3027SemanticChildren(View view) {
+ if (!view.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ DataType modelElement = (DataType) view.getElement();
+ List result = new LinkedList();
+ {
+ TemplateSignature childElement = modelElement.getOwnedTemplateSignature();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == RedefinableTemplateSignatureEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getDataTypeAttributeCompartment_7020SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.EMPTY_LIST;
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ DataType modelElement = (DataType) containerView.getElement();
+ List result = new LinkedList();
+ for (Iterator it = modelElement.getOwnedAttributes().iterator(); it.hasNext();) {
+ Property childElement = (Property) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == Property5EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getDataTypeAttributeCompartment_7032SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.EMPTY_LIST;
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ DataType modelElement = (DataType) containerView.getElement();
+ List result = new LinkedList();
+ for (Iterator it = modelElement.getOwnedAttributes().iterator(); it.hasNext();) {
+ Property childElement = (Property) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == Property5EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getDataTypeOperationCompartment_7021SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.EMPTY_LIST;
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ DataType modelElement = (DataType) containerView.getElement();
+ List result = new LinkedList();
+ for (Iterator it = modelElement.getOwnedOperations().iterator(); it.hasNext();) {
+ Operation childElement = (Operation) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == Operation4EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getDataTypeOperationCompartment_7033SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.EMPTY_LIST;
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ DataType modelElement = (DataType) containerView.getElement();
+ List result = new LinkedList();
+ for (Iterator it = modelElement.getOwnedOperations().iterator(); it.hasNext();) {
+ Operation childElement = (Operation) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == Operation4EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getDependency_4008ContainedLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getDependency_4018ContainedLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getDependency_4008IncomingLinks(View view) {
+ Dependency modelElement = (Dependency) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_ElementImport_4009(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getDependency_4018IncomingLinks(View view) {
+ Dependency modelElement = (Dependency) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_ElementImport_4009(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getDependency_4008OutgoingLinks(View view) {
+ Dependency modelElement = (Dependency) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getDependency_4018OutgoingLinks(View view) {
+ Dependency modelElement = (Dependency) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getElementImport_4009ContainedLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getElementImport_4009IncomingLinks(View view) {
+ ElementImport modelElement = (ElementImport) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getElementImport_4009OutgoingLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEnumeration_2006ContainedLinks(View view) {
+ Enumeration modelElement = (Enumeration) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4002(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Substitution_4004(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEnumeration_2006IncomingLinks(View view) {
+ Enumeration modelElement = (Enumeration) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_AssociationClass_4017(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Association_4001(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Association_4019(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Generalization_4002(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4004(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_ElementImport_4009(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEnumeration_2006OutgoingLinks(View view) {
+ Enumeration modelElement = (Enumeration) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_AssociationClass_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Association_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Association_4019(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4002(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEnumeration_3025ContainedLinks(View view) {
+ Enumeration modelElement = (Enumeration) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4002(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Substitution_4004(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEnumeration_3025IncomingLinks(View view) {
+ Enumeration modelElement = (Enumeration) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_AssociationClass_4017(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Association_4001(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Association_4019(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Generalization_4002(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4004(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_ElementImport_4009(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEnumeration_3025OutgoingLinks(View view) {
+ Enumeration modelElement = (Enumeration) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_AssociationClass_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Association_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Association_4019(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4002(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEnumerationEnumerationLiteralCompartment_7015SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.EMPTY_LIST;
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ Enumeration modelElement = (Enumeration) containerView.getElement();
+ List result = new LinkedList();
+ for (Iterator it = modelElement.getOwnedLiterals().iterator(); it.hasNext();) {
+ EnumerationLiteral childElement = (EnumerationLiteral) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == EnumerationLiteralEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEnumerationEnumerationLiteralCompartment_7031SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.EMPTY_LIST;
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ Enumeration modelElement = (Enumeration) containerView.getElement();
+ List result = new LinkedList();
+ for (Iterator it = modelElement.getOwnedLiterals().iterator(); it.hasNext();) {
+ EnumerationLiteral childElement = (EnumerationLiteral) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == EnumerationLiteralEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEnumerationLiteral_3017ContainedLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEnumerationLiteral_3017IncomingLinks(View view) {
+ EnumerationLiteral modelElement = (EnumerationLiteral) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_ElementImport_4009(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEnumerationLiteral_3017OutgoingLinks(View view) {
+ EnumerationLiteral modelElement = (EnumerationLiteral) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getGeneralization_4002ContainedLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getGeneralization_4002IncomingLinks(View view) {
+ Generalization modelElement = (Generalization) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getGeneralization_4002OutgoingLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(Element target, Map crossReferences) {
+ Collection result = new LinkedList();
+ Collection settings = (Collection) crossReferences.get(target);
+ for (Iterator it = settings.iterator(); it.hasNext();) {
+ EStructuralFeature.Setting setting = (EStructuralFeature.Setting) it.next();
+ if (setting.getEStructuralFeature() == UMLPackage.eINSTANCE.getComment_AnnotatedElement()) {
+ result.add(new UMLLinkDescriptor(setting.getEObject(), target, UMLElementTypes.CommentAnnotatedElement_4013, CommentAnnotatedElementEditPart.VISUAL_ID));
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(Element target, Map crossReferences) {
+ Collection result = new LinkedList();
+ Collection settings = (Collection) crossReferences.get(target);
+ for (Iterator it = settings.iterator(); it.hasNext();) {
+ EStructuralFeature.Setting setting = (EStructuralFeature.Setting) it.next();
+ if (setting.getEStructuralFeature() == UMLPackage.eINSTANCE.getConstraint_ConstrainedElement()) {
+ result.add(new UMLLinkDescriptor(setting.getEObject(), target, UMLElementTypes.ConstraintConstrainedElement_4014, ConstraintConstrainedElementEditPart.VISUAL_ID));
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getIncomingLinks(View view) {
+ switch (UMLVisualIDRegistry.getVisualID(view)) {
+ case Dependency2EditPart.VISUAL_ID:
+ return getDependency_2014IncomingLinks(view);
+ case AssociationClassEditPart.VISUAL_ID:
+ return getAssociationClass_2013IncomingLinks(view);
+ case Association2EditPart.VISUAL_ID:
+ return getAssociation_2015IncomingLinks(view);
+ case InstanceSpecificationEditPart.VISUAL_ID:
+ return getInstanceSpecification_2001IncomingLinks(view);
+ case ComponentEditPart.VISUAL_ID:
+ return getComponent_2002IncomingLinks(view);
+ case SignalEditPart.VISUAL_ID:
+ return getSignal_2003IncomingLinks(view);
+ case InterfaceEditPart.VISUAL_ID:
+ return getInterface_2004IncomingLinks(view);
+ case Model2EditPart.VISUAL_ID:
+ return getModel_2005IncomingLinks(view);
+ case EnumerationEditPart.VISUAL_ID:
+ return getEnumeration_2006IncomingLinks(view);
+ case PackageEditPart.VISUAL_ID:
+ return getPackage_2007IncomingLinks(view);
+ case ClassEditPart.VISUAL_ID:
+ return getClass_2008IncomingLinks(view);
+ case PrimitiveTypeEditPart.VISUAL_ID:
+ return getPrimitiveType_2009IncomingLinks(view);
+ case DataTypeEditPart.VISUAL_ID:
+ return getDataType_2010IncomingLinks(view);
+ case ConstraintEditPart.VISUAL_ID:
+ return getConstraint_2011IncomingLinks(view);
+ case CommentEditPart.VISUAL_ID:
+ return getComment_2012IncomingLinks(view);
+ case PropertyEditPart.VISUAL_ID:
+ return getProperty_3002IncomingLinks(view);
+ case SlotEditPart.VISUAL_ID:
+ return getSlot_3001IncomingLinks(view);
+ case OperationEditPart.VISUAL_ID:
+ return getOperation_3003IncomingLinks(view);
+ case Class2EditPart.VISUAL_ID:
+ return getClass_3004IncomingLinks(view);
+ case RedefinableTemplateSignatureEditPart.VISUAL_ID:
+ return getRedefinableTemplateSignature_3015IncomingLinks(view);
+ case TemplateParameterEditPart.VISUAL_ID:
+ return getTemplateParameter_3016IncomingLinks(view);
+ case Property2EditPart.VISUAL_ID:
+ return getProperty_3005IncomingLinks(view);
+ case Property3EditPart.VISUAL_ID:
+ return getProperty_3006IncomingLinks(view);
+ case Operation2EditPart.VISUAL_ID:
+ return getOperation_3007IncomingLinks(view);
+ case Class3EditPart.VISUAL_ID:
+ return getClass_3008IncomingLinks(view);
+ case InstanceSpecification2EditPart.VISUAL_ID:
+ return getInstanceSpecification_3020IncomingLinks(view);
+ case Component2EditPart.VISUAL_ID:
+ return getComponent_3021IncomingLinks(view);
+ case Signal2EditPart.VISUAL_ID:
+ return getSignal_3022IncomingLinks(view);
+ case Interface2EditPart.VISUAL_ID:
+ return getInterface_3023IncomingLinks(view);
+ case Model3EditPart.VISUAL_ID:
+ return getModel_3024IncomingLinks(view);
+ case Enumeration2EditPart.VISUAL_ID:
+ return getEnumeration_3025IncomingLinks(view);
+ case EnumerationLiteralEditPart.VISUAL_ID:
+ return getEnumerationLiteral_3017IncomingLinks(view);
+ case Package2EditPart.VISUAL_ID:
+ return getPackage_3009IncomingLinks(view);
+ case Class4EditPart.VISUAL_ID:
+ return getClass_3010IncomingLinks(view);
+ case ReceptionEditPart.VISUAL_ID:
+ return getReception_3011IncomingLinks(view);
+ case Property4EditPart.VISUAL_ID:
+ return getProperty_3012IncomingLinks(view);
+ case Operation3EditPart.VISUAL_ID:
+ return getOperation_3013IncomingLinks(view);
+ case Class5EditPart.VISUAL_ID:
+ return getClass_3014IncomingLinks(view);
+ case PrimitiveType2EditPart.VISUAL_ID:
+ return getPrimitiveType_3026IncomingLinks(view);
+ case DataType2EditPart.VISUAL_ID:
+ return getDataType_3027IncomingLinks(view);
+ case Property5EditPart.VISUAL_ID:
+ return getProperty_3018IncomingLinks(view);
+ case Operation4EditPart.VISUAL_ID:
+ return getOperation_3019IncomingLinks(view);
+ case Comment2EditPart.VISUAL_ID:
+ return getComment_3028IncomingLinks(view);
+ case Constraint2EditPart.VISUAL_ID:
+ return getConstraint_3029IncomingLinks(view);
+ case AssociationClass2EditPart.VISUAL_ID:
+ return getAssociationClass_4017IncomingLinks(view);
+ case AssociationEditPart.VISUAL_ID:
+ return getAssociation_4001IncomingLinks(view);
+ case Association3EditPart.VISUAL_ID:
+ return getAssociation_4019IncomingLinks(view);
+ case GeneralizationEditPart.VISUAL_ID:
+ return getGeneralization_4002IncomingLinks(view);
+ case InterfaceRealizationEditPart.VISUAL_ID:
+ return getInterfaceRealization_4003IncomingLinks(view);
+ case SubstitutionEditPart.VISUAL_ID:
+ return getSubstitution_4004IncomingLinks(view);
+ case RealizationEditPart.VISUAL_ID:
+ return getRealization_4005IncomingLinks(view);
+ case AbstractionEditPart.VISUAL_ID:
+ return getAbstraction_4006IncomingLinks(view);
+ case UsageEditPart.VISUAL_ID:
+ return getUsage_4007IncomingLinks(view);
+ case DependencyEditPart.VISUAL_ID:
+ return getDependency_4008IncomingLinks(view);
+ case Dependency3EditPart.VISUAL_ID:
+ return getDependency_4018IncomingLinks(view);
+ case ElementImportEditPart.VISUAL_ID:
+ return getElementImport_4009IncomingLinks(view);
+ case PackageImportEditPart.VISUAL_ID:
+ return getPackageImport_4010IncomingLinks(view);
+ case PackageMergeEditPart.VISUAL_ID:
+ return getPackageMerge_4011IncomingLinks(view);
+ case ProfileApplicationEditPart.VISUAL_ID:
+ return getProfileApplication_4012IncomingLinks(view);
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getTemplateBinding_4015IncomingLinks(view);
+ }
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getIncomingTypeModelFacetLinks_Abstraction_4006(NamedElement target, Map crossReferences) {
+ Collection result = new LinkedList();
+ Collection settings = (Collection) crossReferences.get(target);
+ for (Iterator it = settings.iterator(); it.hasNext();) {
+ EStructuralFeature.Setting setting = (EStructuralFeature.Setting) it.next();
+ if (setting.getEStructuralFeature() != UMLPackage.eINSTANCE.getDependency_Supplier() || false == setting.getEObject() instanceof Abstraction) {
+ continue;
+ }
+ Abstraction link = (Abstraction) setting.getEObject();
+ if (AbstractionEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ List sources = link.getClients();
+ Object theSource = sources.size() == 1 ? sources.get(0) : null;
+ if (false == theSource instanceof NamedElement) {
+ continue;
+ }
+ NamedElement src = (NamedElement) theSource;
+ result.add(new UMLLinkDescriptor(src, target, link, UMLElementTypes.Abstraction_4006, AbstractionEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated-not
+ */
+ private static Collection getIncomingTypeModelFacetLinks_Association_4001(Type target, Map crossReferences) {
+ Collection result = new LinkedList();
+ Collection settings = (Collection) crossReferences.get(target);
+ for (Iterator it = settings.iterator(); it.hasNext();) {
+ EStructuralFeature.Setting setting = (EStructuralFeature.Setting) it.next();
+ if (setting.getEStructuralFeature() != UMLPackage.eINSTANCE.getAssociation_EndType() || false == setting.getEObject() instanceof Association) {
+ continue;
+ }
+ Association link = (Association) setting.getEObject();
+ if (AssociationEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ Type src = null;
+ if (link.getEndTypes().size() > 0) {
+ src = link.getEndTypes().get(0);
+ }
+ result.add(new UMLLinkDescriptor(src, target, link, UMLElementTypes.Association_4001, AssociationEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getIncomingTypeModelFacetLinks_Association_4019(Type target, Map crossReferences) {
+ Collection result = new LinkedList();
+ Collection settings = (Collection) crossReferences.get(target);
+ for (Iterator it = settings.iterator(); it.hasNext();) {
+ EStructuralFeature.Setting setting = (EStructuralFeature.Setting) it.next();
+ if (setting.getEStructuralFeature() != UMLPackage.eINSTANCE.getAssociation_EndType() || false == setting.getEObject() instanceof Association) {
+ continue;
+ }
+ Association link = (Association) setting.getEObject();
+ if (Association3EditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ List sources = link.getEndTypes();
+ Object theSource = sources.size() == 1 ? sources.get(0) : null;
+ if (false == theSource instanceof Type) {
+ continue;
+ }
+ Type src = (Type) theSource;
+ result.add(new UMLLinkDescriptor(src, target, link, UMLElementTypes.Association_4019, Association3EditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated-not
+ */
+ private static Collection getIncomingTypeModelFacetLinks_AssociationClass_4017(Type target, Map crossReferences) {
+ Collection result = new LinkedList();
+ Collection settings = (Collection) crossReferences.get(target);
+ for (Iterator it = settings.iterator(); it.hasNext();) {
+ EStructuralFeature.Setting setting = (EStructuralFeature.Setting) it.next();
+ if (setting.getEStructuralFeature() != UMLPackage.eINSTANCE.getAssociation_EndType() || false == setting.getEObject() instanceof Association) {
+ continue;
+ }
+ Association link = (Association) setting.getEObject();
+ if (AssociationEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ Type src = null;
+ if (link.getEndTypes().size() > 0) {
+ src = link.getEndTypes().get(0);
+ }
+ result.add(new UMLLinkDescriptor(src, target, link, UMLElementTypes.Association_4001, AssociationEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getIncomingTypeModelFacetLinks_Dependency_4008(NamedElement target, Map crossReferences) {
+ Collection result = new LinkedList();
+ Collection settings = (Collection) crossReferences.get(target);
+ for (Iterator it = settings.iterator(); it.hasNext();) {
+ EStructuralFeature.Setting setting = (EStructuralFeature.Setting) it.next();
+ if (setting.getEStructuralFeature() != UMLPackage.eINSTANCE.getDependency_Supplier() || false == setting.getEObject() instanceof Dependency) {
+ continue;
+ }
+ Dependency link = (Dependency) setting.getEObject();
+ if (DependencyEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ List sources = link.getClients();
+ Object theSource = sources.size() == 1 ? sources.get(0) : null;
+ if (false == theSource instanceof NamedElement) {
+ continue;
+ }
+ NamedElement src = (NamedElement) theSource;
+ result.add(new UMLLinkDescriptor(src, target, link, UMLElementTypes.Dependency_4008, DependencyEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getIncomingTypeModelFacetLinks_Dependency_4018(NamedElement target, Map crossReferences) {
+ Collection result = new LinkedList();
+ Collection settings = (Collection) crossReferences.get(target);
+ for (Iterator it = settings.iterator(); it.hasNext();) {
+ EStructuralFeature.Setting setting = (EStructuralFeature.Setting) it.next();
+ if (setting.getEStructuralFeature() != UMLPackage.eINSTANCE.getDependency_Supplier() || false == setting.getEObject() instanceof Dependency) {
+ continue;
+ }
+ Dependency link = (Dependency) setting.getEObject();
+ if (Dependency3EditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ List sources = link.getClients();
+ Object theSource = sources.size() == 1 ? sources.get(0) : null;
+ if (false == theSource instanceof NamedElement) {
+ continue;
+ }
+ NamedElement src = (NamedElement) theSource;
+ result.add(new UMLLinkDescriptor(src, target, link, UMLElementTypes.Dependency_4018, Dependency3EditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getIncomingTypeModelFacetLinks_ElementImport_4009(PackageableElement target, Map crossReferences) {
+ Collection result = new LinkedList();
+ Collection settings = (Collection) crossReferences.get(target);
+ for (Iterator it = settings.iterator(); it.hasNext();) {
+ EStructuralFeature.Setting setting = (EStructuralFeature.Setting) it.next();
+ if (setting.getEStructuralFeature() != UMLPackage.eINSTANCE.getElementImport_ImportedElement() || false == setting.getEObject() instanceof ElementImport) {
+ continue;
+ }
+ ElementImport link = (ElementImport) setting.getEObject();
+ if (ElementImportEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ if (false == link.eContainer() instanceof Namespace) {
+ continue;
+ }
+ Namespace container = (Namespace) link.eContainer();
+ result.add(new UMLLinkDescriptor(container, target, link, UMLElementTypes.ElementImport_4009, ElementImportEditPart.VISUAL_ID));
+
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getIncomingTypeModelFacetLinks_Generalization_4002(Classifier target, Map crossReferences) {
+ Collection result = new LinkedList();
+ Collection settings = (Collection) crossReferences.get(target);
+ for (Iterator it = settings.iterator(); it.hasNext();) {
+ EStructuralFeature.Setting setting = (EStructuralFeature.Setting) it.next();
+ if (setting.getEStructuralFeature() != UMLPackage.eINSTANCE.getGeneralization_General() || false == setting.getEObject() instanceof Generalization) {
+ continue;
+ }
+ Generalization link = (Generalization) setting.getEObject();
+ if (GeneralizationEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ if (false == link.eContainer() instanceof Classifier) {
+ continue;
+ }
+ Classifier container = (Classifier) link.eContainer();
+ result.add(new UMLLinkDescriptor(container, target, link, UMLElementTypes.Generalization_4002, GeneralizationEditPart.VISUAL_ID));
+
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getIncomingTypeModelFacetLinks_InterfaceRealization_4003(Interface target, Map crossReferences) {
+ Collection result = new LinkedList();
+ Collection settings = (Collection) crossReferences.get(target);
+ for (Iterator it = settings.iterator(); it.hasNext();) {
+ EStructuralFeature.Setting setting = (EStructuralFeature.Setting) it.next();
+ if (setting.getEStructuralFeature() != UMLPackage.eINSTANCE.getInterfaceRealization_Contract() || false == setting.getEObject() instanceof InterfaceRealization) {
+ continue;
+ }
+ InterfaceRealization link = (InterfaceRealization) setting.getEObject();
+ if (InterfaceRealizationEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ if (false == link.eContainer() instanceof BehavioredClassifier) {
+ continue;
+ }
+ BehavioredClassifier container = (BehavioredClassifier) link.eContainer();
+ result.add(new UMLLinkDescriptor(container, target, link, UMLElementTypes.InterfaceRealization_4003, InterfaceRealizationEditPart.VISUAL_ID));
+
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getIncomingTypeModelFacetLinks_PackageImport_4010(Package target, Map crossReferences) {
+ Collection result = new LinkedList();
+ Collection settings = (Collection) crossReferences.get(target);
+ for (Iterator it = settings.iterator(); it.hasNext();) {
+ EStructuralFeature.Setting setting = (EStructuralFeature.Setting) it.next();
+ if (setting.getEStructuralFeature() != UMLPackage.eINSTANCE.getPackageImport_ImportedPackage() || false == setting.getEObject() instanceof PackageImport) {
+ continue;
+ }
+ PackageImport link = (PackageImport) setting.getEObject();
+ if (PackageImportEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ if (false == link.eContainer() instanceof Namespace) {
+ continue;
+ }
+ Namespace container = (Namespace) link.eContainer();
+ result.add(new UMLLinkDescriptor(container, target, link, UMLElementTypes.PackageImport_4010, PackageImportEditPart.VISUAL_ID));
+
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getIncomingTypeModelFacetLinks_PackageMerge_4011(Package target, Map crossReferences) {
+ Collection result = new LinkedList();
+ Collection settings = (Collection) crossReferences.get(target);
+ for (Iterator it = settings.iterator(); it.hasNext();) {
+ EStructuralFeature.Setting setting = (EStructuralFeature.Setting) it.next();
+ if (setting.getEStructuralFeature() != UMLPackage.eINSTANCE.getPackageMerge_MergedPackage() || false == setting.getEObject() instanceof PackageMerge) {
+ continue;
+ }
+ PackageMerge link = (PackageMerge) setting.getEObject();
+ if (PackageMergeEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ Package src = link.getReceivingPackage();
+ result.add(new UMLLinkDescriptor(src, target, link, UMLElementTypes.PackageMerge_4011, PackageMergeEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getIncomingTypeModelFacetLinks_Realization_4005(NamedElement target, Map crossReferences) {
+ Collection result = new LinkedList();
+ Collection settings = (Collection) crossReferences.get(target);
+ for (Iterator it = settings.iterator(); it.hasNext();) {
+ EStructuralFeature.Setting setting = (EStructuralFeature.Setting) it.next();
+ if (setting.getEStructuralFeature() != UMLPackage.eINSTANCE.getDependency_Supplier() || false == setting.getEObject() instanceof Realization) {
+ continue;
+ }
+ Realization link = (Realization) setting.getEObject();
+ if (RealizationEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ List sources = link.getClients();
+ Object theSource = sources.size() == 1 ? sources.get(0) : null;
+ if (false == theSource instanceof NamedElement) {
+ continue;
+ }
+ NamedElement src = (NamedElement) theSource;
+ result.add(new UMLLinkDescriptor(src, target, link, UMLElementTypes.Realization_4005, RealizationEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getIncomingTypeModelFacetLinks_Substitution_4004(Classifier target, Map crossReferences) {
+ Collection result = new LinkedList();
+ Collection settings = (Collection) crossReferences.get(target);
+ for (Iterator it = settings.iterator(); it.hasNext();) {
+ EStructuralFeature.Setting setting = (EStructuralFeature.Setting) it.next();
+ if (setting.getEStructuralFeature() != UMLPackage.eINSTANCE.getSubstitution_Contract() || false == setting.getEObject() instanceof Substitution) {
+ continue;
+ }
+ Substitution link = (Substitution) setting.getEObject();
+ if (SubstitutionEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ Classifier src = link.getSubstitutingClassifier();
+ result.add(new UMLLinkDescriptor(src, target, link, UMLElementTypes.Substitution_4004, SubstitutionEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getIncomingTypeModelFacetLinks_TemplateBinding_4015(Element target, Map crossReferences) {
+ Collection result = new LinkedList();
+ Collection settings = (Collection) crossReferences.get(target);
+ for (Iterator it = settings.iterator(); it.hasNext();) {
+ EStructuralFeature.Setting setting = (EStructuralFeature.Setting) it.next();
+ if (setting.getEStructuralFeature() != UMLPackage.eINSTANCE.getDirectedRelationship_Target() || false == setting.getEObject() instanceof TemplateBinding) {
+ continue;
+ }
+ TemplateBinding link = (TemplateBinding) setting.getEObject();
+ if (TemplateBindingEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ TemplateableElement src = link.getBoundElement();
+ result.add(new UMLLinkDescriptor(src, target, link, UMLElementTypes.TemplateBinding_4015, TemplateBindingEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getIncomingTypeModelFacetLinks_Usage_4007(NamedElement target, Map crossReferences) {
+ Collection result = new LinkedList();
+ Collection settings = (Collection) crossReferences.get(target);
+ for (Iterator it = settings.iterator(); it.hasNext();) {
+ EStructuralFeature.Setting setting = (EStructuralFeature.Setting) it.next();
+ if (setting.getEStructuralFeature() != UMLPackage.eINSTANCE.getDependency_Supplier() || false == setting.getEObject() instanceof Usage) {
+ continue;
+ }
+ Usage link = (Usage) setting.getEObject();
+ if (UsageEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ List sources = link.getClients();
+ Object theSource = sources.size() == 1 ? sources.get(0) : null;
+ if (false == theSource instanceof NamedElement) {
+ continue;
+ }
+ NamedElement src = (NamedElement) theSource;
+ result.add(new UMLLinkDescriptor(src, target, link, UMLElementTypes.Usage_4007, UsageEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getInstanceSpecification_2001ContainedLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getInstanceSpecification_2001IncomingLinks(View view) {
+ InstanceSpecification modelElement = (InstanceSpecification) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_ElementImport_4009(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getInstanceSpecification_2001OutgoingLinks(View view) {
+ InstanceSpecification modelElement = (InstanceSpecification) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getInstanceSpecification_3020ContainedLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getInstanceSpecification_3020IncomingLinks(View view) {
+ InstanceSpecification modelElement = (InstanceSpecification) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_ElementImport_4009(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getInstanceSpecification_3020OutgoingLinks(View view) {
+ InstanceSpecification modelElement = (InstanceSpecification) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getInstanceSpecificationSlotCompartment_7001SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.EMPTY_LIST;
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ InstanceSpecification modelElement = (InstanceSpecification) containerView.getElement();
+ List result = new LinkedList();
+ for (Iterator it = modelElement.getSlots().iterator(); it.hasNext();) {
+ Slot childElement = (Slot) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == SlotEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getInstanceSpecificationSlotCompartment_7022SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.EMPTY_LIST;
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ InstanceSpecification modelElement = (InstanceSpecification) containerView.getElement();
+ List result = new LinkedList();
+ for (Iterator it = modelElement.getSlots().iterator(); it.hasNext();) {
+ Slot childElement = (Slot) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == SlotEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getInterface_2004ContainedLinks(View view) {
+ Interface modelElement = (Interface) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4002(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Substitution_4004(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getInterface_2004IncomingLinks(View view) {
+ Interface modelElement = (Interface) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_AssociationClass_4017(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Association_4001(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Association_4019(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Generalization_4002(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_InterfaceRealization_4003(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4004(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_ElementImport_4009(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getInterface_2004OutgoingLinks(View view) {
+ Interface modelElement = (Interface) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_AssociationClass_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Association_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Association_4019(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4002(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getInterface_2004SemanticChildren(View view) {
+ if (!view.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ Interface modelElement = (Interface) view.getElement();
+ List result = new LinkedList();
+ {
+ TemplateSignature childElement = modelElement.getOwnedTemplateSignature();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == RedefinableTemplateSignatureEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getInterface_3023ContainedLinks(View view) {
+ Interface modelElement = (Interface) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4002(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Substitution_4004(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getInterface_3023IncomingLinks(View view) {
+ Interface modelElement = (Interface) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_AssociationClass_4017(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Association_4001(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Association_4019(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Generalization_4002(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_InterfaceRealization_4003(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4004(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_ElementImport_4009(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getInterface_3023OutgoingLinks(View view) {
+ Interface modelElement = (Interface) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_AssociationClass_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Association_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Association_4019(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4002(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getInterface_3023SemanticChildren(View view) {
+ if (!view.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ Interface modelElement = (Interface) view.getElement();
+ List result = new LinkedList();
+ {
+ TemplateSignature childElement = modelElement.getOwnedTemplateSignature();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == RedefinableTemplateSignatureEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getInterfaceAttributeCompartment_7006SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.EMPTY_LIST;
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ Interface modelElement = (Interface) containerView.getElement();
+ List result = new LinkedList();
+ for (Iterator it = modelElement.getOwnedAttributes().iterator(); it.hasNext();) {
+ Property childElement = (Property) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == Property3EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getInterfaceAttributeCompartment_7027SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.EMPTY_LIST;
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ Interface modelElement = (Interface) containerView.getElement();
+ List result = new LinkedList();
+ for (Iterator it = modelElement.getOwnedAttributes().iterator(); it.hasNext();) {
+ Property childElement = (Property) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == Property3EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getInterfaceNestedClassifierCompartment_7008SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.EMPTY_LIST;
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ Interface modelElement = (Interface) containerView.getElement();
+ List result = new LinkedList();
+ for (Iterator it = modelElement.getNestedClassifiers().iterator(); it.hasNext();) {
+ Classifier childElement = (Classifier) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == Class3EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getInterfaceNestedClassifierCompartment_7029SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.EMPTY_LIST;
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ Interface modelElement = (Interface) containerView.getElement();
+ List result = new LinkedList();
+ for (Iterator it = modelElement.getNestedClassifiers().iterator(); it.hasNext();) {
+ Classifier childElement = (Classifier) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == Class3EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getInterfaceOperationCompartment_7007SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.EMPTY_LIST;
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ Interface modelElement = (Interface) containerView.getElement();
+ List result = new LinkedList();
+ for (Iterator it = modelElement.getOwnedOperations().iterator(); it.hasNext();) {
+ Operation childElement = (Operation) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == Operation2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getInterfaceOperationCompartment_7028SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.EMPTY_LIST;
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ Interface modelElement = (Interface) containerView.getElement();
+ List result = new LinkedList();
+ for (Iterator it = modelElement.getOwnedOperations().iterator(); it.hasNext();) {
+ Operation childElement = (Operation) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == Operation2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getInterfaceRealization_4003ContainedLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getInterfaceRealization_4003IncomingLinks(View view) {
+ InterfaceRealization modelElement = (InterfaceRealization) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_ElementImport_4009(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getInterfaceRealization_4003OutgoingLinks(View view) {
+ InterfaceRealization modelElement = (InterfaceRealization) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getModel_2005ContainedLinks(View view) {
+ Model modelElement = (Model) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getContainedTypeModelFacetLinks_AssociationClass_4017(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Association_4001(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Association_4019(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Dependency_4018(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageMerge_4011(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ProfileApplication_4012(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getModel_2005IncomingLinks(View view) {
+ Model modelElement = (Model) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_ElementImport_4009(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_PackageImport_4010(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_PackageMerge_4011(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getModel_2005OutgoingLinks(View view) {
+ Model modelElement = (Model) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_PackageMerge_4011(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ProfileApplication_4012(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getModel_2005SemanticChildren(View view) {
+ if (!view.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ Model modelElement = (Model) view.getElement();
+ List result = new LinkedList();
+ {
+ TemplateSignature childElement = modelElement.getOwnedTemplateSignature();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == RedefinableTemplateSignatureEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getModel_3024ContainedLinks(View view) {
+ Model modelElement = (Model) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getContainedTypeModelFacetLinks_AssociationClass_4017(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Association_4001(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Association_4019(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Dependency_4018(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageMerge_4011(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ProfileApplication_4012(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getModel_3024IncomingLinks(View view) {
+ Model modelElement = (Model) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_ElementImport_4009(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_PackageImport_4010(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_PackageMerge_4011(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getModel_3024OutgoingLinks(View view) {
+ Model modelElement = (Model) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_PackageMerge_4011(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ProfileApplication_4012(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getModel_3024SemanticChildren(View view) {
+ if (!view.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ Model modelElement = (Model) view.getElement();
+ List result = new LinkedList();
+ {
+ TemplateSignature childElement = modelElement.getOwnedTemplateSignature();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == RedefinableTemplateSignatureEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getModelPackageableElementCompartment_7009SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.EMPTY_LIST;
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ Model modelElement = (Model) containerView.getElement();
+ List result = new LinkedList();
+ for (Iterator it = modelElement.getPackagedElements().iterator(); it.hasNext();) {
+ PackageableElement childElement = (PackageableElement) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == InstanceSpecification2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == Component2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == Signal2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == Interface2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == Model3EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == Enumeration2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == Package2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == Class4EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == PrimitiveType2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == DataType2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == Constraint2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ for (Iterator it = modelElement.getOwnedComments().iterator(); it.hasNext();) {
+ Comment childElement = (Comment) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == Comment2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getModelPackageableElementCompartment_7030SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.EMPTY_LIST;
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ Model modelElement = (Model) containerView.getElement();
+ List result = new LinkedList();
+ for (Iterator it = modelElement.getPackagedElements().iterator(); it.hasNext();) {
+ PackageableElement childElement = (PackageableElement) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == InstanceSpecification2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == Component2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == Signal2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == Interface2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == Model3EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == Enumeration2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == Package2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == Class4EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == PrimitiveType2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == DataType2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == Constraint2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ for (Iterator it = modelElement.getOwnedComments().iterator(); it.hasNext();) {
+ Comment childElement = (Comment) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == Comment2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getOperation_3003ContainedLinks(View view) {
+ Operation modelElement = (Operation) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getOperation_3003IncomingLinks(View view) {
+ Operation modelElement = (Operation) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getOperation_3003OutgoingLinks(View view) {
+ Operation modelElement = (Operation) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getOperation_3007ContainedLinks(View view) {
+ Operation modelElement = (Operation) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getOperation_3007IncomingLinks(View view) {
+ Operation modelElement = (Operation) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getOperation_3007OutgoingLinks(View view) {
+ Operation modelElement = (Operation) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getOperation_3013ContainedLinks(View view) {
+ Operation modelElement = (Operation) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getOperation_3013IncomingLinks(View view) {
+ Operation modelElement = (Operation) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getOperation_3013OutgoingLinks(View view) {
+ Operation modelElement = (Operation) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getOperation_3019ContainedLinks(View view) {
+ Operation modelElement = (Operation) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getOperation_3019IncomingLinks(View view) {
+ Operation modelElement = (Operation) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getOperation_3019OutgoingLinks(View view) {
+ Operation modelElement = (Operation) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getOutgoingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(Comment source) {
+ Collection result = new LinkedList();
+ for (Iterator destinations = source.getAnnotatedElements().iterator(); destinations.hasNext();) {
+ Element destination = (Element) destinations.next();
+ result.add(new UMLLinkDescriptor(source, destination, UMLElementTypes.CommentAnnotatedElement_4013, CommentAnnotatedElementEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getOutgoingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(Constraint source) {
+ Collection result = new LinkedList();
+ for (Iterator destinations = source.getConstrainedElements().iterator(); destinations.hasNext();) {
+ Element destination = (Element) destinations.next();
+ result.add(new UMLLinkDescriptor(source, destination, UMLElementTypes.ConstraintConstrainedElement_4014, ConstraintConstrainedElementEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getOutgoingLinks(View view) {
+ switch (UMLVisualIDRegistry.getVisualID(view)) {
+ case Dependency2EditPart.VISUAL_ID:
+ return getDependency_2014OutgoingLinks(view);
+ case AssociationClassEditPart.VISUAL_ID:
+ return getAssociationClass_2013OutgoingLinks(view);
+ case Association2EditPart.VISUAL_ID:
+ return getAssociation_2015OutgoingLinks(view);
+ case InstanceSpecificationEditPart.VISUAL_ID:
+ return getInstanceSpecification_2001OutgoingLinks(view);
+ case ComponentEditPart.VISUAL_ID:
+ return getComponent_2002OutgoingLinks(view);
+ case SignalEditPart.VISUAL_ID:
+ return getSignal_2003OutgoingLinks(view);
+ case InterfaceEditPart.VISUAL_ID:
+ return getInterface_2004OutgoingLinks(view);
+ case Model2EditPart.VISUAL_ID:
+ return getModel_2005OutgoingLinks(view);
+ case EnumerationEditPart.VISUAL_ID:
+ return getEnumeration_2006OutgoingLinks(view);
+ case PackageEditPart.VISUAL_ID:
+ return getPackage_2007OutgoingLinks(view);
+ case ClassEditPart.VISUAL_ID:
+ return getClass_2008OutgoingLinks(view);
+ case PrimitiveTypeEditPart.VISUAL_ID:
+ return getPrimitiveType_2009OutgoingLinks(view);
+ case DataTypeEditPart.VISUAL_ID:
+ return getDataType_2010OutgoingLinks(view);
+ case ConstraintEditPart.VISUAL_ID:
+ return getConstraint_2011OutgoingLinks(view);
+ case CommentEditPart.VISUAL_ID:
+ return getComment_2012OutgoingLinks(view);
+ case PropertyEditPart.VISUAL_ID:
+ return getProperty_3002OutgoingLinks(view);
+ case SlotEditPart.VISUAL_ID:
+ return getSlot_3001OutgoingLinks(view);
+ case OperationEditPart.VISUAL_ID:
+ return getOperation_3003OutgoingLinks(view);
+ case Class2EditPart.VISUAL_ID:
+ return getClass_3004OutgoingLinks(view);
+ case RedefinableTemplateSignatureEditPart.VISUAL_ID:
+ return getRedefinableTemplateSignature_3015OutgoingLinks(view);
+ case TemplateParameterEditPart.VISUAL_ID:
+ return getTemplateParameter_3016OutgoingLinks(view);
+ case Property2EditPart.VISUAL_ID:
+ return getProperty_3005OutgoingLinks(view);
+ case Property3EditPart.VISUAL_ID:
+ return getProperty_3006OutgoingLinks(view);
+ case Operation2EditPart.VISUAL_ID:
+ return getOperation_3007OutgoingLinks(view);
+ case Class3EditPart.VISUAL_ID:
+ return getClass_3008OutgoingLinks(view);
+ case InstanceSpecification2EditPart.VISUAL_ID:
+ return getInstanceSpecification_3020OutgoingLinks(view);
+ case Component2EditPart.VISUAL_ID:
+ return getComponent_3021OutgoingLinks(view);
+ case Signal2EditPart.VISUAL_ID:
+ return getSignal_3022OutgoingLinks(view);
+ case Interface2EditPart.VISUAL_ID:
+ return getInterface_3023OutgoingLinks(view);
+ case Model3EditPart.VISUAL_ID:
+ return getModel_3024OutgoingLinks(view);
+ case Enumeration2EditPart.VISUAL_ID:
+ return getEnumeration_3025OutgoingLinks(view);
+ case EnumerationLiteralEditPart.VISUAL_ID:
+ return getEnumerationLiteral_3017OutgoingLinks(view);
+ case Package2EditPart.VISUAL_ID:
+ return getPackage_3009OutgoingLinks(view);
+ case Class4EditPart.VISUAL_ID:
+ return getClass_3010OutgoingLinks(view);
+ case ReceptionEditPart.VISUAL_ID:
+ return getReception_3011OutgoingLinks(view);
+ case Property4EditPart.VISUAL_ID:
+ return getProperty_3012OutgoingLinks(view);
+ case Operation3EditPart.VISUAL_ID:
+ return getOperation_3013OutgoingLinks(view);
+ case Class5EditPart.VISUAL_ID:
+ return getClass_3014OutgoingLinks(view);
+ case PrimitiveType2EditPart.VISUAL_ID:
+ return getPrimitiveType_3026OutgoingLinks(view);
+ case DataType2EditPart.VISUAL_ID:
+ return getDataType_3027OutgoingLinks(view);
+ case Property5EditPart.VISUAL_ID:
+ return getProperty_3018OutgoingLinks(view);
+ case Operation4EditPart.VISUAL_ID:
+ return getOperation_3019OutgoingLinks(view);
+ case Comment2EditPart.VISUAL_ID:
+ return getComment_3028OutgoingLinks(view);
+ case Constraint2EditPart.VISUAL_ID:
+ return getConstraint_3029OutgoingLinks(view);
+ case AssociationClass2EditPart.VISUAL_ID:
+ return getAssociationClass_4017OutgoingLinks(view);
+ case AssociationEditPart.VISUAL_ID:
+ return getAssociation_4001OutgoingLinks(view);
+ case Association3EditPart.VISUAL_ID:
+ return getAssociation_4019OutgoingLinks(view);
+ case GeneralizationEditPart.VISUAL_ID:
+ return getGeneralization_4002OutgoingLinks(view);
+ case InterfaceRealizationEditPart.VISUAL_ID:
+ return getInterfaceRealization_4003OutgoingLinks(view);
+ case SubstitutionEditPart.VISUAL_ID:
+ return getSubstitution_4004OutgoingLinks(view);
+ case RealizationEditPart.VISUAL_ID:
+ return getRealization_4005OutgoingLinks(view);
+ case AbstractionEditPart.VISUAL_ID:
+ return getAbstraction_4006OutgoingLinks(view);
+ case UsageEditPart.VISUAL_ID:
+ return getUsage_4007OutgoingLinks(view);
+ case DependencyEditPart.VISUAL_ID:
+ return getDependency_4008OutgoingLinks(view);
+ case Dependency3EditPart.VISUAL_ID:
+ return getDependency_4018OutgoingLinks(view);
+ case ElementImportEditPart.VISUAL_ID:
+ return getElementImport_4009OutgoingLinks(view);
+ case PackageImportEditPart.VISUAL_ID:
+ return getPackageImport_4010OutgoingLinks(view);
+ case PackageMergeEditPart.VISUAL_ID:
+ return getPackageMerge_4011OutgoingLinks(view);
+ case ProfileApplicationEditPart.VISUAL_ID:
+ return getProfileApplication_4012OutgoingLinks(view);
+ case TemplateBindingEditPart.VISUAL_ID:
+ return getTemplateBinding_4015OutgoingLinks(view);
+ }
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getOutgoingTypeModelFacetLinks_Abstraction_4006(NamedElement source) {
+ Package container = null;
+ // Find container element for the link.
+ // Climb up by containment hierarchy starting from the source
+ // and return the first element that is instance of the container class.
+ for (EObject element = source; element != null && container == null; element = element.eContainer()) {
+ if (element instanceof Package) {
+ container = (Package) element;
+ }
+ }
+ if (container == null) {
+ return Collections.EMPTY_LIST;
+ }
+ Collection result = new LinkedList();
+ for (Iterator links = container.getPackagedElements().iterator(); links.hasNext();) {
+ EObject linkObject = (EObject) links.next();
+ if (false == linkObject instanceof Abstraction) {
+ continue;
+ }
+ Abstraction link = (Abstraction) linkObject;
+ if (AbstractionEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ List targets = link.getSuppliers();
+ Object theTarget = targets.size() == 1 ? targets.get(0) : null;
+ if (false == theTarget instanceof NamedElement) {
+ continue;
+ }
+ NamedElement dst = (NamedElement) theTarget;
+ List sources = link.getClients();
+ Object theSource = sources.size() == 1 ? sources.get(0) : null;
+ if (false == theSource instanceof NamedElement) {
+ continue;
+ }
+ NamedElement src = (NamedElement) theSource;
+ if (src != source) {
+ continue;
+ }
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Abstraction_4006, AbstractionEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated-not
+ */
+ private static Collection getOutgoingTypeModelFacetLinks_Association_4001(Type source) {
+ Package container = null;
+ // Find container element for the link.
+ // Climb up by containment hierarchy starting from the source
+ // and return the first element that is instance of the container class.
+ for (EObject element = source; element != null && container == null; element = element.eContainer()) {
+ if (element instanceof Package) {
+ container = (Package) element;
+ }
+ }
+ if (container == null) {
+ return Collections.EMPTY_LIST;
+ }
+ Collection result = new LinkedList();
+ for (Iterator links = container.getPackagedElements().iterator(); links.hasNext();) {
+ EObject linkObject = (EObject) links.next();
+ if (false == linkObject instanceof Association) {
+ continue;
+ }
+ Association link = (Association) linkObject;
+ if (AssociationEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ Type src = null;
+ if (link.getEndTypes().size() > 0) {
+ src = link.getEndTypes().get(0);
+ }
+ Type dst = null;
+ if (link.getEndTypes().size() > 0) {
+ dst = link.getEndTypes().get(1);
+ }
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Association_4001, AssociationEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getOutgoingTypeModelFacetLinks_Association_4019(Type source) {
+ Package container = null;
+ // Find container element for the link.
+ // Climb up by containment hierarchy starting from the source
+ // and return the first element that is instance of the container class.
+ for (EObject element = source; element != null && container == null; element = element.eContainer()) {
+ if (element instanceof Package) {
+ container = (Package) element;
+ }
+ }
+ if (container == null) {
+ return Collections.EMPTY_LIST;
+ }
+ Collection result = new LinkedList();
+ for (Iterator links = container.getPackagedElements().iterator(); links.hasNext();) {
+ EObject linkObject = (EObject) links.next();
+ if (false == linkObject instanceof Association) {
+ continue;
+ }
+ Association link = (Association) linkObject;
+ if (Association3EditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ List targets = link.getEndTypes();
+ Object theTarget = targets.size() == 1 ? targets.get(0) : null;
+ if (false == theTarget instanceof Type) {
+ continue;
+ }
+ Type dst = (Type) theTarget;
+ List sources = link.getEndTypes();
+ Object theSource = sources.size() == 1 ? sources.get(0) : null;
+ if (false == theSource instanceof Type) {
+ continue;
+ }
+ Type src = (Type) theSource;
+ if (src != source) {
+ continue;
+ }
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Association_4019, Association3EditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated-not
+ */
+ private static Collection getOutgoingTypeModelFacetLinks_AssociationClass_4017(Type source) {
+ Package container = null;
+ // Find container element for the link.
+ // Climb up by containment hierarchy starting from the source
+ // and return the first element that is instance of the container class.
+ for (EObject element = source; element != null && container == null; element = element.eContainer()) {
+ if (element instanceof Package) {
+ container = (Package) element;
+ }
+ }
+ if (container == null) {
+ return Collections.EMPTY_LIST;
+ }
+ Collection result = new LinkedList();
+ for (Iterator links = container.getPackagedElements().iterator(); links.hasNext();) {
+ EObject linkObject = (EObject) links.next();
+ if (false == linkObject instanceof Association) {
+ continue;
+ }
+ Association link = (Association) linkObject;
+ if (AssociationEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ Type src = null;
+ if (link.getEndTypes().size() > 0) {
+ src = link.getEndTypes().get(0);
+ }
+ Type dst = null;
+ if (link.getEndTypes().size() > 0) {
+ dst = link.getEndTypes().get(1);
+ }
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Association_4001, AssociationEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getOutgoingTypeModelFacetLinks_Dependency_4008(NamedElement source) {
+ Package container = null;
+ // Find container element for the link.
+ // Climb up by containment hierarchy starting from the source
+ // and return the first element that is instance of the container class.
+ for (EObject element = source; element != null && container == null; element = element.eContainer()) {
+ if (element instanceof Package) {
+ container = (Package) element;
+ }
+ }
+ if (container == null) {
+ return Collections.EMPTY_LIST;
+ }
+ Collection result = new LinkedList();
+ for (Iterator links = container.getPackagedElements().iterator(); links.hasNext();) {
+ EObject linkObject = (EObject) links.next();
+ if (false == linkObject instanceof Dependency) {
+ continue;
+ }
+ Dependency link = (Dependency) linkObject;
+ if (DependencyEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ List targets = link.getSuppliers();
+ Object theTarget = targets.size() == 1 ? targets.get(0) : null;
+ if (false == theTarget instanceof NamedElement) {
+ continue;
+ }
+ NamedElement dst = (NamedElement) theTarget;
+ List sources = link.getClients();
+ Object theSource = sources.size() == 1 ? sources.get(0) : null;
+ if (false == theSource instanceof NamedElement) {
+ continue;
+ }
+ NamedElement src = (NamedElement) theSource;
+ if (src != source) {
+ continue;
+ }
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Dependency_4008, DependencyEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getOutgoingTypeModelFacetLinks_Dependency_4018(NamedElement source) {
+ Package container = null;
+ // Find container element for the link.
+ // Climb up by containment hierarchy starting from the source
+ // and return the first element that is instance of the container class.
+ for (EObject element = source; element != null && container == null; element = element.eContainer()) {
+ if (element instanceof Package) {
+ container = (Package) element;
+ }
+ }
+ if (container == null) {
+ return Collections.EMPTY_LIST;
+ }
+ Collection result = new LinkedList();
+ for (Iterator links = container.getPackagedElements().iterator(); links.hasNext();) {
+ EObject linkObject = (EObject) links.next();
+ if (false == linkObject instanceof Dependency) {
+ continue;
+ }
+ Dependency link = (Dependency) linkObject;
+ if (Dependency3EditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ List targets = link.getSuppliers();
+ Object theTarget = targets.size() == 1 ? targets.get(0) : null;
+ if (false == theTarget instanceof NamedElement) {
+ continue;
+ }
+ NamedElement dst = (NamedElement) theTarget;
+ List sources = link.getClients();
+ Object theSource = sources.size() == 1 ? sources.get(0) : null;
+ if (false == theSource instanceof NamedElement) {
+ continue;
+ }
+ NamedElement src = (NamedElement) theSource;
+ if (src != source) {
+ continue;
+ }
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Dependency_4018, Dependency3EditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getOutgoingTypeModelFacetLinks_PackageMerge_4011(Package source) {
+ Package container = null;
+ // Find container element for the link.
+ // Climb up by containment hierarchy starting from the source
+ // and return the first element that is instance of the container class.
+ for (EObject element = source; element != null && container == null; element = element.eContainer()) {
+ if (element instanceof Package) {
+ container = (Package) element;
+ }
+ }
+ if (container == null) {
+ return Collections.EMPTY_LIST;
+ }
+ Collection result = new LinkedList();
+ for (Iterator links = container.getPackageMerges().iterator(); links.hasNext();) {
+ EObject linkObject = (EObject) links.next();
+ if (false == linkObject instanceof PackageMerge) {
+ continue;
+ }
+ PackageMerge link = (PackageMerge) linkObject;
+ if (PackageMergeEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ Package dst = link.getMergedPackage();
+ Package src = link.getReceivingPackage();
+ if (src != source) {
+ continue;
+ }
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.PackageMerge_4011, PackageMergeEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getOutgoingTypeModelFacetLinks_Realization_4005(NamedElement source) {
+ Package container = null;
+ // Find container element for the link.
+ // Climb up by containment hierarchy starting from the source
+ // and return the first element that is instance of the container class.
+ for (EObject element = source; element != null && container == null; element = element.eContainer()) {
+ if (element instanceof Package) {
+ container = (Package) element;
+ }
+ }
+ if (container == null) {
+ return Collections.EMPTY_LIST;
+ }
+ Collection result = new LinkedList();
+ for (Iterator links = container.getPackagedElements().iterator(); links.hasNext();) {
+ EObject linkObject = (EObject) links.next();
+ if (false == linkObject instanceof Realization) {
+ continue;
+ }
+ Realization link = (Realization) linkObject;
+ if (RealizationEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ List targets = link.getSuppliers();
+ Object theTarget = targets.size() == 1 ? targets.get(0) : null;
+ if (false == theTarget instanceof NamedElement) {
+ continue;
+ }
+ NamedElement dst = (NamedElement) theTarget;
+ List sources = link.getClients();
+ Object theSource = sources.size() == 1 ? sources.get(0) : null;
+ if (false == theSource instanceof NamedElement) {
+ continue;
+ }
+ NamedElement src = (NamedElement) theSource;
+ if (src != source) {
+ continue;
+ }
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Realization_4005, RealizationEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getOutgoingTypeModelFacetLinks_Substitution_4004(Classifier source) {
+ Classifier container = null;
+ // Find container element for the link.
+ // Climb up by containment hierarchy starting from the source
+ // and return the first element that is instance of the container class.
+ for (EObject element = source; element != null && container == null; element = element.eContainer()) {
+ if (element instanceof Classifier) {
+ container = (Classifier) element;
+ }
+ }
+ if (container == null) {
+ return Collections.EMPTY_LIST;
+ }
+ Collection result = new LinkedList();
+ for (Iterator links = container.getSubstitutions().iterator(); links.hasNext();) {
+ EObject linkObject = (EObject) links.next();
+ if (false == linkObject instanceof Substitution) {
+ continue;
+ }
+ Substitution link = (Substitution) linkObject;
+ if (SubstitutionEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ Classifier dst = link.getContract();
+ Classifier src = link.getSubstitutingClassifier();
+ if (src != source) {
+ continue;
+ }
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Substitution_4004, SubstitutionEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getOutgoingTypeModelFacetLinks_TemplateBinding_4015(TemplateableElement source) {
+ TemplateableElement container = null;
+ // Find container element for the link.
+ // Climb up by containment hierarchy starting from the source
+ // and return the first element that is instance of the container class.
+ for (EObject element = source; element != null && container == null; element = element.eContainer()) {
+ if (element instanceof TemplateableElement) {
+ container = (TemplateableElement) element;
+ }
+ }
+ if (container == null) {
+ return Collections.EMPTY_LIST;
+ }
+ Collection result = new LinkedList();
+ for (Iterator links = container.getTemplateBindings().iterator(); links.hasNext();) {
+ EObject linkObject = (EObject) links.next();
+ if (false == linkObject instanceof TemplateBinding) {
+ continue;
+ }
+ TemplateBinding link = (TemplateBinding) linkObject;
+ if (TemplateBindingEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ List targets = link.getTargets();
+ Object theTarget = targets.size() == 1 ? targets.get(0) : null;
+ if (false == theTarget instanceof Element) {
+ continue;
+ }
+ Element dst = (Element) theTarget;
+ TemplateableElement src = link.getBoundElement();
+ if (src != source) {
+ continue;
+ }
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.TemplateBinding_4015, TemplateBindingEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getOutgoingTypeModelFacetLinks_Usage_4007(NamedElement source) {
+ Package container = null;
+ // Find container element for the link.
+ // Climb up by containment hierarchy starting from the source
+ // and return the first element that is instance of the container class.
+ for (EObject element = source; element != null && container == null; element = element.eContainer()) {
+ if (element instanceof Package) {
+ container = (Package) element;
+ }
+ }
+ if (container == null) {
+ return Collections.EMPTY_LIST;
+ }
+ Collection result = new LinkedList();
+ for (Iterator links = container.getPackagedElements().iterator(); links.hasNext();) {
+ EObject linkObject = (EObject) links.next();
+ if (false == linkObject instanceof Usage) {
+ continue;
+ }
+ Usage link = (Usage) linkObject;
+ if (UsageEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ List targets = link.getSuppliers();
+ Object theTarget = targets.size() == 1 ? targets.get(0) : null;
+ if (false == theTarget instanceof NamedElement) {
+ continue;
+ }
+ NamedElement dst = (NamedElement) theTarget;
+ List sources = link.getClients();
+ Object theSource = sources.size() == 1 ? sources.get(0) : null;
+ if (false == theSource instanceof NamedElement) {
+ continue;
+ }
+ NamedElement src = (NamedElement) theSource;
+ if (src != source) {
+ continue;
+ }
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Usage_4007, UsageEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getPackage_1000ContainedLinks(View view) {
+ Package modelElement = (Package) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getContainedTypeModelFacetLinks_AssociationClass_4017(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Association_4001(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Association_4019(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Dependency_4018(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageMerge_4011(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ProfileApplication_4012(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getDependency_2014ContainedLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getPackage_1000SemanticChildren(View view) {
+ if (!view.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ Package modelElement = (Package) view.getElement();
+ List result = new LinkedList();
+ for (Iterator it = modelElement.getPackagedElements().iterator(); it.hasNext();) {
+ PackageableElement childElement = (PackageableElement) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == Dependency2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == AssociationClassEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == Association2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == InstanceSpecificationEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == ComponentEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == SignalEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == InterfaceEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == Model2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == EnumerationEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == PackageEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == ClassEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == PrimitiveTypeEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == DataTypeEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == ConstraintEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ for (Iterator it = modelElement.getOwnedComments().iterator(); it.hasNext();) {
+ Comment childElement = (Comment) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == CommentEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getPackage_2007ContainedLinks(View view) {
+ Package modelElement = (Package) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getContainedTypeModelFacetLinks_AssociationClass_4017(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Association_4001(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Association_4019(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Dependency_4018(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageMerge_4011(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ProfileApplication_4012(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getPackage_2007IncomingLinks(View view) {
+ Package modelElement = (Package) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_ElementImport_4009(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_PackageImport_4010(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_PackageMerge_4011(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getPackage_2007OutgoingLinks(View view) {
+ Package modelElement = (Package) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_PackageMerge_4011(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ProfileApplication_4012(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getPackage_2007SemanticChildren(View view) {
+ if (!view.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ Package modelElement = (Package) view.getElement();
+ List result = new LinkedList();
+ {
+ TemplateSignature childElement = modelElement.getOwnedTemplateSignature();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == RedefinableTemplateSignatureEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getPackage_3009ContainedLinks(View view) {
+ Package modelElement = (Package) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getContainedTypeModelFacetLinks_AssociationClass_4017(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Association_4001(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Association_4019(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Dependency_4018(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageMerge_4011(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ProfileApplication_4012(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getPackage_3009IncomingLinks(View view) {
+ Package modelElement = (Package) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_ElementImport_4009(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_PackageImport_4010(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_PackageMerge_4011(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getPackage_3009OutgoingLinks(View view) {
+ Package modelElement = (Package) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_PackageMerge_4011(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ProfileApplication_4012(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getPackage_3009SemanticChildren(View view) {
+ if (!view.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ Package modelElement = (Package) view.getElement();
+ List result = new LinkedList();
+ {
+ TemplateSignature childElement = modelElement.getOwnedTemplateSignature();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == RedefinableTemplateSignatureEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getPackageImport_4010ContainedLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getPackageImport_4010IncomingLinks(View view) {
+ PackageImport modelElement = (PackageImport) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getPackageImport_4010OutgoingLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getPackageMerge_4011ContainedLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getPackageMerge_4011IncomingLinks(View view) {
+ PackageMerge modelElement = (PackageMerge) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getPackageMerge_4011OutgoingLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getPackagePackageableElementCompartment_7010SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.EMPTY_LIST;
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ Package modelElement = (Package) containerView.getElement();
+ List result = new LinkedList();
+ for (Iterator it = modelElement.getPackagedElements().iterator(); it.hasNext();) {
+ PackageableElement childElement = (PackageableElement) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == InstanceSpecification2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == Component2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == Signal2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == Interface2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == Model3EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == Enumeration2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == Package2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == Class4EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == PrimitiveType2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == DataType2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == Constraint2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ for (Iterator it = modelElement.getOwnedComments().iterator(); it.hasNext();) {
+ Comment childElement = (Comment) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == Comment2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getPackagePackageableElementCompartment_7016SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.EMPTY_LIST;
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ Package modelElement = (Package) containerView.getElement();
+ List result = new LinkedList();
+ for (Iterator it = modelElement.getPackagedElements().iterator(); it.hasNext();) {
+ PackageableElement childElement = (PackageableElement) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == InstanceSpecification2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == Component2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == Signal2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == Interface2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == Model3EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == Enumeration2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == Package2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == Class4EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == PrimitiveType2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == DataType2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == Constraint2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ for (Iterator it = modelElement.getOwnedComments().iterator(); it.hasNext();) {
+ Comment childElement = (Comment) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == Comment2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getPrimitiveType_2009ContainedLinks(View view) {
+ PrimitiveType modelElement = (PrimitiveType) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4002(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Substitution_4004(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getPrimitiveType_2009IncomingLinks(View view) {
+ PrimitiveType modelElement = (PrimitiveType) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_AssociationClass_4017(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Association_4001(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Association_4019(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Generalization_4002(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4004(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_ElementImport_4009(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getPrimitiveType_2009OutgoingLinks(View view) {
+ PrimitiveType modelElement = (PrimitiveType) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_AssociationClass_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Association_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Association_4019(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4002(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getPrimitiveType_3026ContainedLinks(View view) {
+ PrimitiveType modelElement = (PrimitiveType) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4002(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Substitution_4004(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getPrimitiveType_3026IncomingLinks(View view) {
+ PrimitiveType modelElement = (PrimitiveType) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_AssociationClass_4017(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Association_4001(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Association_4019(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Generalization_4002(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4004(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_ElementImport_4009(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getPrimitiveType_3026OutgoingLinks(View view) {
+ PrimitiveType modelElement = (PrimitiveType) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_AssociationClass_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Association_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Association_4019(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4002(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getProfileApplication_4012ContainedLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getProfileApplication_4012IncomingLinks(View view) {
+ ProfileApplication modelElement = (ProfileApplication) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getProfileApplication_4012OutgoingLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getProperty_3002ContainedLinks(View view) {
+ Property modelElement = (Property) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getContainedTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getProperty_3002IncomingLinks(View view) {
+ Property modelElement = (Property) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getProperty_3002OutgoingLinks(View view) {
+ Property modelElement = (Property) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getProperty_3005ContainedLinks(View view) {
+ Property modelElement = (Property) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getContainedTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getProperty_3005IncomingLinks(View view) {
+ Property modelElement = (Property) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getProperty_3005OutgoingLinks(View view) {
+ Property modelElement = (Property) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getProperty_3006ContainedLinks(View view) {
+ Property modelElement = (Property) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getContainedTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getProperty_3006IncomingLinks(View view) {
+ Property modelElement = (Property) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getProperty_3006OutgoingLinks(View view) {
+ Property modelElement = (Property) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getProperty_3012ContainedLinks(View view) {
+ Property modelElement = (Property) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getContainedTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getProperty_3012IncomingLinks(View view) {
+ Property modelElement = (Property) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getProperty_3012OutgoingLinks(View view) {
+ Property modelElement = (Property) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getProperty_3018ContainedLinks(View view) {
+ Property modelElement = (Property) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getContainedTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getProperty_3018IncomingLinks(View view) {
+ Property modelElement = (Property) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getProperty_3018OutgoingLinks(View view) {
+ Property modelElement = (Property) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getRealization_4005ContainedLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getRealization_4005IncomingLinks(View view) {
+ Realization modelElement = (Realization) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_ElementImport_4009(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getRealization_4005OutgoingLinks(View view) {
+ Realization modelElement = (Realization) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getReception_3011ContainedLinks(View view) {
+ Reception modelElement = (Reception) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getReception_3011IncomingLinks(View view) {
+ Reception modelElement = (Reception) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getReception_3011OutgoingLinks(View view) {
+ Reception modelElement = (Reception) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getRedefinableTemplateSignature_3015ContainedLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getRedefinableTemplateSignature_3015IncomingLinks(View view) {
+ RedefinableTemplateSignature modelElement = (RedefinableTemplateSignature) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getRedefinableTemplateSignature_3015OutgoingLinks(View view) {
+ RedefinableTemplateSignature modelElement = (RedefinableTemplateSignature) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getRedefinableTemplateSignatureTemplateParameterCompartment_7014SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.EMPTY_LIST;
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ RedefinableTemplateSignature modelElement = (RedefinableTemplateSignature) containerView.getElement();
+ List result = new LinkedList();
+ for (Iterator it = modelElement.getParameters().iterator(); it.hasNext();) {
+ TemplateParameter childElement = (TemplateParameter) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == TemplateParameterEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getSemanticChildren(View view) {
+ switch (UMLVisualIDRegistry.getVisualID(view)) {
+ case ComponentEditPart.VISUAL_ID:
+ return getComponent_2002SemanticChildren(view);
+ case SignalEditPart.VISUAL_ID:
+ return getSignal_2003SemanticChildren(view);
+ case InterfaceEditPart.VISUAL_ID:
+ return getInterface_2004SemanticChildren(view);
+ case Model2EditPart.VISUAL_ID:
+ return getModel_2005SemanticChildren(view);
+ case PackageEditPart.VISUAL_ID:
+ return getPackage_2007SemanticChildren(view);
+ case ClassEditPart.VISUAL_ID:
+ return getClass_2008SemanticChildren(view);
+ case DataTypeEditPart.VISUAL_ID:
+ return getDataType_2010SemanticChildren(view);
+ case Component2EditPart.VISUAL_ID:
+ return getComponent_3021SemanticChildren(view);
+ case Signal2EditPart.VISUAL_ID:
+ return getSignal_3022SemanticChildren(view);
+ case Interface2EditPart.VISUAL_ID:
+ return getInterface_3023SemanticChildren(view);
+ case Model3EditPart.VISUAL_ID:
+ return getModel_3024SemanticChildren(view);
+ case Package2EditPart.VISUAL_ID:
+ return getPackage_3009SemanticChildren(view);
+ case Class4EditPart.VISUAL_ID:
+ return getClass_3010SemanticChildren(view);
+ case DataType2EditPart.VISUAL_ID:
+ return getDataType_3027SemanticChildren(view);
+ case AssociationClassAttributeCompartmentEditPart.VISUAL_ID:
+ return getAssociationClassAttributeCompartment_7034SemanticChildren(view);
+ case InstanceSpecificationSlotCompartmentEditPart.VISUAL_ID:
+ return getInstanceSpecificationSlotCompartment_7001SemanticChildren(view);
+ case ComponentAttributeCompartmentEditPart.VISUAL_ID:
+ return getComponentAttributeCompartment_7002SemanticChildren(view);
+ case ComponentOperationCompartmentEditPart.VISUAL_ID:
+ return getComponentOperationCompartment_7003SemanticChildren(view);
+ case ComponentNestedClassifierCompartmentEditPart.VISUAL_ID:
+ return getComponentNestedClassifierCompartment_7004SemanticChildren(view);
+ case RedefinableTemplateSignatureTemplateParameterCompartmentEditPart.VISUAL_ID:
+ return getRedefinableTemplateSignatureTemplateParameterCompartment_7014SemanticChildren(view);
+ case SignalAttributeCompartmentEditPart.VISUAL_ID:
+ return getSignalAttributeCompartment_7005SemanticChildren(view);
+ case InterfaceAttributeCompartmentEditPart.VISUAL_ID:
+ return getInterfaceAttributeCompartment_7006SemanticChildren(view);
+ case InterfaceOperationCompartmentEditPart.VISUAL_ID:
+ return getInterfaceOperationCompartment_7007SemanticChildren(view);
+ case InterfaceNestedClassifierCompartmentEditPart.VISUAL_ID:
+ return getInterfaceNestedClassifierCompartment_7008SemanticChildren(view);
+ case ModelPackageableElementCompartmentEditPart.VISUAL_ID:
+ return getModelPackageableElementCompartment_7009SemanticChildren(view);
+ case InstanceSpecificationSlotCompartment2EditPart.VISUAL_ID:
+ return getInstanceSpecificationSlotCompartment_7022SemanticChildren(view);
+ case ComponentAttributeCompartment2EditPart.VISUAL_ID:
+ return getComponentAttributeCompartment_7023SemanticChildren(view);
+ case ComponentOperationCompartment2EditPart.VISUAL_ID:
+ return getComponentOperationCompartment_7024SemanticChildren(view);
+ case ComponentNestedClassifierCompartment2EditPart.VISUAL_ID:
+ return getComponentNestedClassifierCompartment_7025SemanticChildren(view);
+ case SignalAttributeCompartment2EditPart.VISUAL_ID:
+ return getSignalAttributeCompartment_7026SemanticChildren(view);
+ case InterfaceAttributeCompartment2EditPart.VISUAL_ID:
+ return getInterfaceAttributeCompartment_7027SemanticChildren(view);
+ case InterfaceOperationCompartment2EditPart.VISUAL_ID:
+ return getInterfaceOperationCompartment_7028SemanticChildren(view);
+ case InterfaceNestedClassifierCompartment2EditPart.VISUAL_ID:
+ return getInterfaceNestedClassifierCompartment_7029SemanticChildren(view);
+ case ModelPackageableElementCompartment2EditPart.VISUAL_ID:
+ return getModelPackageableElementCompartment_7030SemanticChildren(view);
+ case EnumerationEnumerationLiteralCompartment2EditPart.VISUAL_ID:
+ return getEnumerationEnumerationLiteralCompartment_7031SemanticChildren(view);
+ case PackagePackageableElementCompartmentEditPart.VISUAL_ID:
+ return getPackagePackageableElementCompartment_7010SemanticChildren(view);
+ case ClassAttributeCompartmentEditPart.VISUAL_ID:
+ return getClassAttributeCompartment_7011SemanticChildren(view);
+ case ClassOperationCompartmentEditPart.VISUAL_ID:
+ return getClassOperationCompartment_7012SemanticChildren(view);
+ case ClassNestedClassifierCompartmentEditPart.VISUAL_ID:
+ return getClassNestedClassifierCompartment_7013SemanticChildren(view);
+ case DataTypeAttributeCompartment2EditPart.VISUAL_ID:
+ return getDataTypeAttributeCompartment_7032SemanticChildren(view);
+ case DataTypeOperationCompartment2EditPart.VISUAL_ID:
+ return getDataTypeOperationCompartment_7033SemanticChildren(view);
+ case EnumerationEnumerationLiteralCompartmentEditPart.VISUAL_ID:
+ return getEnumerationEnumerationLiteralCompartment_7015SemanticChildren(view);
+ case PackagePackageableElementCompartment2EditPart.VISUAL_ID:
+ return getPackagePackageableElementCompartment_7016SemanticChildren(view);
+ case ClassAttributeCompartment2EditPart.VISUAL_ID:
+ return getClassAttributeCompartment_7017SemanticChildren(view);
+ case ClassOperationCompartment2EditPart.VISUAL_ID:
+ return getClassOperationCompartment_7018SemanticChildren(view);
+ case ClassNestedClassifierCompartment2EditPart.VISUAL_ID:
+ return getClassNestedClassifierCompartment_7019SemanticChildren(view);
+ case DataTypeAttributeCompartmentEditPart.VISUAL_ID:
+ return getDataTypeAttributeCompartment_7020SemanticChildren(view);
+ case DataTypeOperationCompartmentEditPart.VISUAL_ID:
+ return getDataTypeOperationCompartment_7021SemanticChildren(view);
+ case ModelEditPart.VISUAL_ID:
+ return getPackage_1000SemanticChildren(view);
+ }
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getSignal_2003ContainedLinks(View view) {
+ Signal modelElement = (Signal) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4002(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Substitution_4004(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getSignal_2003IncomingLinks(View view) {
+ Signal modelElement = (Signal) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_AssociationClass_4017(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Association_4001(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Association_4019(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Generalization_4002(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4004(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_ElementImport_4009(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getSignal_2003OutgoingLinks(View view) {
+ Signal modelElement = (Signal) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_AssociationClass_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Association_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Association_4019(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4002(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getSignal_2003SemanticChildren(View view) {
+ if (!view.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ Signal modelElement = (Signal) view.getElement();
+ List result = new LinkedList();
+ {
+ TemplateSignature childElement = modelElement.getOwnedTemplateSignature();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == RedefinableTemplateSignatureEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getSignal_3022ContainedLinks(View view) {
+ Signal modelElement = (Signal) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4002(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Substitution_4004(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getSignal_3022IncomingLinks(View view) {
+ Signal modelElement = (Signal) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_AssociationClass_4017(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Association_4001(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Association_4019(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Generalization_4002(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4004(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_ElementImport_4009(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getSignal_3022OutgoingLinks(View view) {
+ Signal modelElement = (Signal) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_AssociationClass_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Association_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Association_4019(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4002(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ElementImport_4009(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_PackageImport_4010(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_TemplateBinding_4015(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getSignal_3022SemanticChildren(View view) {
+ if (!view.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ Signal modelElement = (Signal) view.getElement();
+ List result = new LinkedList();
+ {
+ TemplateSignature childElement = modelElement.getOwnedTemplateSignature();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == RedefinableTemplateSignatureEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getSignalAttributeCompartment_7005SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.EMPTY_LIST;
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ Signal modelElement = (Signal) containerView.getElement();
+ List result = new LinkedList();
+ for (Iterator it = modelElement.getOwnedAttributes().iterator(); it.hasNext();) {
+ Property childElement = (Property) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == Property2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getSignalAttributeCompartment_7026SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.EMPTY_LIST;
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ Signal modelElement = (Signal) containerView.getElement();
+ List result = new LinkedList();
+ for (Iterator it = modelElement.getOwnedAttributes().iterator(); it.hasNext();) {
+ Property childElement = (Property) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == Property2EditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getSlot_3001ContainedLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getSlot_3001IncomingLinks(View view) {
+ Slot modelElement = (Slot) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getSlot_3001OutgoingLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getSubstitution_4004ContainedLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getSubstitution_4004IncomingLinks(View view) {
+ Substitution modelElement = (Substitution) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_ElementImport_4009(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getSubstitution_4004OutgoingLinks(View view) {
+ Substitution modelElement = (Substitution) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getTemplateBinding_4015ContainedLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getDependency_2014IncomingLinks(View view) {
+ Dependency modelElement = (Dependency) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_ElementImport_4009(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getTemplateBinding_4015IncomingLinks(View view) {
+ TemplateBinding modelElement = (TemplateBinding) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getDependency_2014OutgoingLinks(View view) {
+ Dependency modelElement = (Dependency) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getTemplateBinding_4015OutgoingLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getTemplateParameter_3016ContainedLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getTemplateParameter_3016IncomingLinks(View view) {
+ TemplateParameter modelElement = (TemplateParameter) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getTemplateParameter_3016OutgoingLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getUsage_4007ContainedLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getUsage_4007IncomingLinks(View view) {
+ Usage modelElement = (Usage) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingTypeModelFacetLinks_Realization_4005(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4006(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4007(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4008(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4018(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_ElementImport_4009(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4013(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4014(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_TemplateBinding_4015(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getUsage_4007OutgoingLinks(View view) {
+ Usage modelElement = (Usage) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingTypeModelFacetLinks_Realization_4005(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4006(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4007(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4008(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4018(modelElement));
+ return result;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLDocumentProvider.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLDocumentProvider.java
new file mode 100644
index 00000000000..76cd552d85c
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLDocumentProvider.java
@@ -0,0 +1,993 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.part;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceStatus;
+import org.eclipse.core.resources.IStorage;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.core.runtime.jobs.MultiRule;
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.common.ui.URIEditorInput;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.util.EContentAdapter;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.transaction.NotificationFilter;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.diagram.core.DiagramEditingDomainFactory;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.AbstractDocumentProvider;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.DiagramDocument;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocumentProvider;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.internal.EditorStatusCodes;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.internal.util.DiagramIOUtil;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactory;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.jface.operation.IRunnableContext;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.part.FileEditorInput;
+
+/**
+ * @generated
+ */
+public class UMLDocumentProvider extends AbstractDocumentProvider implements IDiagramDocumentProvider {
+
+ /**
+ * @generated
+ */
+ protected ElementInfo createElementInfo(Object element) throws CoreException {
+ if (false == element instanceof FileEditorInput && false == element instanceof URIEditorInput) {
+ throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, 0, NLS.bind(Messages.UMLDocumentProvider_IncorrectInputError, new Object[] { element,
+ "org.eclipse.ui.part.FileEditorInput", "org.eclipse.emf.common.ui.URIEditorInput" }), //$NON-NLS-1$ //$NON-NLS-2$
+ null));
+ }
+ IEditorInput editorInput = (IEditorInput) element;
+ IDiagramDocument document = (IDiagramDocument) createDocument(editorInput);
+
+ ResourceSetInfo info = new ResourceSetInfo(document, editorInput);
+ info.setModificationStamp(computeModificationStamp(info));
+ info.fStatus = null;
+ return info;
+ }
+
+ /**
+ * @generated
+ */
+ protected IDocument createDocument(Object element) throws CoreException {
+ if (false == element instanceof FileEditorInput && false == element instanceof URIEditorInput) {
+ throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, 0, NLS.bind(Messages.UMLDocumentProvider_IncorrectInputError, new Object[] { element,
+ "org.eclipse.ui.part.FileEditorInput", "org.eclipse.emf.common.ui.URIEditorInput" }), //$NON-NLS-1$ //$NON-NLS-2$
+ null));
+ }
+ IDocument document = createEmptyDocument();
+ setDocumentContent(document, (IEditorInput) element);
+ setupDocument(element, document);
+ return document;
+ }
+
+ /**
+ * Sets up the given document as it would be provided for the given element. The content of the document is not changed. This default implementation is empty. Subclasses may reimplement.
+ *
+ * @param element
+ * the blue-print element
+ * @param document
+ * the document to set up
+ * @generated
+ */
+ protected void setupDocument(Object element, IDocument document) {
+ // for subclasses
+ }
+
+ /**
+ * @generated
+ */
+ private long computeModificationStamp(ResourceSetInfo info) {
+ int result = 0;
+ for (Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/it = info.getLoadedResourcesIterator(); it.hasNext();) {
+ Resource nextResource = (Resource) it.next();
+ IFile file = WorkspaceSynchronizer.getFile(nextResource);
+ if (file != null) {
+ if (file.getLocation() != null) {
+ result += file.getLocation().toFile().lastModified();
+ } else {
+ result += file.getModificationStamp();
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected IDocument createEmptyDocument() {
+ DiagramDocument document = new DiagramDocument();
+ document.setEditingDomain(createEditingDomain());
+ return document;
+ }
+
+ /**
+ * @generated
+ */
+ private TransactionalEditingDomain createEditingDomain() {
+ TransactionalEditingDomain editingDomain = DiagramEditingDomainFactory.getInstance().createEditingDomain();
+ editingDomain.setID("org.eclipse.papyrus.diagram.clazz.EditingDomain"); //$NON-NLS-1$
+ final NotificationFilter diagramResourceModifiedFilter = NotificationFilter.createNotifierFilter(editingDomain.getResourceSet())
+ .and(NotificationFilter.createEventTypeFilter(Notification.ADD)).and(NotificationFilter.createFeatureFilter(ResourceSet.class, ResourceSet.RESOURCE_SET__RESOURCES));
+ editingDomain.getResourceSet().eAdapters().add(new Adapter() {
+
+ private Notifier myTarger;
+
+ public Notifier getTarget() {
+ return myTarger;
+ }
+
+ public boolean isAdapterForType(Object type) {
+ return false;
+ }
+
+ public void notifyChanged(Notification notification) {
+ if (diagramResourceModifiedFilter.matches(notification)) {
+ Object value = notification.getNewValue();
+ if (value instanceof Resource) {
+ ((Resource) value).setTrackingModification(true);
+ }
+ }
+ }
+
+ public void setTarget(Notifier newTarget) {
+ myTarger = newTarget;
+ }
+
+ });
+
+ return editingDomain;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setDocumentContent(IDocument document, IEditorInput element) throws CoreException {
+ IDiagramDocument diagramDocument = (IDiagramDocument) document;
+ TransactionalEditingDomain domain = diagramDocument.getEditingDomain();
+ if (element instanceof FileEditorInput) {
+ IStorage storage = ((FileEditorInput) element).getStorage();
+ Diagram diagram = DiagramIOUtil.load(domain, storage, true, getProgressMonitor());
+ document.setContent(diagram);
+ } else if (element instanceof URIEditorInput) {
+ URI uri = ((URIEditorInput) element).getURI();
+ Resource resource = null;
+ try {
+ resource = domain.getResourceSet().getResource(uri.trimFragment(), false);
+ if (resource == null) {
+ resource = domain.getResourceSet().createResource(uri.trimFragment());
+ }
+ if (!resource.isLoaded()) {
+ try {
+ Map options = new HashMap(GMFResourceFactory.getDefaultLoadOptions());
+ // @see 171060
+ // options.put(org.eclipse.emf.ecore.xmi.XMLResource.OPTION_RECORD_UNKNOWN_FEATURE, Boolean.TRUE);
+ resource.load(options);
+ } catch (IOException e) {
+ resource.unload();
+ throw e;
+ }
+ }
+ if (uri.fragment() != null) {
+ EObject rootElement = resource.getEObject(uri.fragment());
+ if (rootElement instanceof Diagram) {
+ document.setContent((Diagram) rootElement);
+ return;
+ }
+ } else {
+ for (Iterator it = resource.getContents().iterator(); it.hasNext();) {
+ Object rootElement = it.next();
+ if (rootElement instanceof Diagram) {
+ document.setContent((Diagram) rootElement);
+ return;
+ }
+ }
+ }
+ throw new RuntimeException(Messages.UMLDocumentProvider_NoDiagramInResourceError);
+ } catch (Exception e) {
+ CoreException thrownExcp = null;
+ if (e instanceof CoreException) {
+ thrownExcp = (CoreException) e;
+ } else {
+ String msg = e.getLocalizedMessage();
+ thrownExcp = new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, 0, msg != null ? msg : Messages.UMLDocumentProvider_DiagramLoadingError, e));
+ }
+ throw thrownExcp;
+ }
+ } else {
+ throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, 0, NLS.bind(Messages.UMLDocumentProvider_IncorrectInputError, new Object[] { element,
+ "org.eclipse.ui.part.FileEditorInput", "org.eclipse.emf.common.ui.URIEditorInput" }), //$NON-NLS-1$ //$NON-NLS-2$
+ null));
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public long getModificationStamp(Object element) {
+ ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ return computeModificationStamp(info);
+ }
+ return super.getModificationStamp(element);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isDeleted(Object element) {
+ IDiagramDocument document = getDiagramDocument(element);
+ if (document != null) {
+ Resource diagramResource = document.getDiagram().eResource();
+ if (diagramResource != null) {
+ IFile file = WorkspaceSynchronizer.getFile(diagramResource);
+ return file == null || file.getLocation() == null || !file.getLocation().toFile().exists();
+ }
+ }
+ return super.isDeleted(element);
+ }
+
+ /**
+ * @generated
+ */
+ public ResourceSetInfo getResourceSetInfo(Object editorInput) {
+ return (ResourceSetInfo) super.getElementInfo(editorInput);
+ }
+
+ /**
+ * @generated
+ */
+ protected void disposeElementInfo(Object element, ElementInfo info) {
+ if (info instanceof ResourceSetInfo) {
+ ResourceSetInfo resourceSetInfo = (ResourceSetInfo) info;
+ resourceSetInfo.dispose();
+ }
+ super.disposeElementInfo(element, info);
+ }
+
+ /**
+ * @generated
+ */
+ protected void doValidateState(Object element, Object computationContext) throws CoreException {
+ ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ Collection/*<org.eclipse.core.resources.IFile>*/files2Validate = new ArrayList/*<org.eclipse.core.resources.IFile>*/();
+ for (Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/it = info.getLoadedResourcesIterator(); it.hasNext();) {
+ Resource nextResource = (Resource) it.next();
+ IFile file = WorkspaceSynchronizer.getFile(nextResource);
+ if (file != null && file.isReadOnly()) {
+ files2Validate.add(file);
+ }
+ }
+ ResourcesPlugin.getWorkspace().validateEdit((IFile[]) files2Validate.toArray(new IFile[files2Validate.size()]), computationContext);
+ }
+
+ super.doValidateState(element, computationContext);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isReadOnly(Object element) {
+ ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ if (info.isUpdateCache()) {
+ try {
+ updateCache(element);
+ } catch (CoreException ex) {
+ UMLDiagramEditorPlugin.getInstance().logError(Messages.UMLDocumentProvider_isModifiable, ex);
+ // Error message to log was initially taken from org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.internal.l10n.EditorMessages.StorageDocumentProvider_isModifiable
+ }
+ }
+ return info.isReadOnly();
+ }
+ return super.isReadOnly(element);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isModifiable(Object element) {
+ if (!isStateValidated(element)) {
+ if (element instanceof FileEditorInput || element instanceof URIEditorInput) {
+ return true;
+ }
+ }
+ ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ if (info.isUpdateCache()) {
+ try {
+ updateCache(element);
+ } catch (CoreException ex) {
+ UMLDiagramEditorPlugin.getInstance().logError(Messages.UMLDocumentProvider_isModifiable, ex);
+ // Error message to log was initially taken from org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.internal.l10n.EditorMessages.StorageDocumentProvider_isModifiable
+ }
+ }
+ return info.isModifiable();
+ }
+ return super.isModifiable(element);
+ }
+
+ /**
+ * @generated
+ */
+ protected void updateCache(Object element) throws CoreException {
+ ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ for (Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/it = info.getLoadedResourcesIterator(); it.hasNext();) {
+ Resource nextResource = (Resource) it.next();
+ IFile file = WorkspaceSynchronizer.getFile(nextResource);
+ if (file != null && file.isReadOnly()) {
+ info.setReadOnly(true);
+ info.setModifiable(false);
+ return;
+ }
+ }
+ info.setReadOnly(false);
+ info.setModifiable(true);
+ return;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void doUpdateStateCache(Object element) throws CoreException {
+ ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ info.setUpdateCache(true);
+ }
+ super.doUpdateStateCache(element);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isSynchronized(Object element) {
+ ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ return info.isSynchronized();
+ }
+ return super.isSynchronized(element);
+ }
+
+ /**
+ * @generated
+ */
+ protected ISchedulingRule getResetRule(Object element) {
+ ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ Collection/*<org.eclipse.core.runtime.jobs.ISchedulingRule>*/rules = new ArrayList/*<org.eclipse.core.runtime.jobs.ISchedulingRule>*/();
+ for (Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/it = info.getLoadedResourcesIterator(); it.hasNext();) {
+ Resource nextResource = (Resource) it.next();
+ IFile file = WorkspaceSynchronizer.getFile(nextResource);
+ if (file != null) {
+ rules.add(ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(file));
+ }
+ }
+ return new MultiRule((ISchedulingRule[]) rules.toArray(new ISchedulingRule[rules.size()]));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected ISchedulingRule getSaveRule(Object element) {
+ ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ Collection/*<org.eclipse.core.runtime.jobs.ISchedulingRule>*/rules = new ArrayList/*<org.eclipse.core.runtime.jobs.ISchedulingRule>*/();
+ for (Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/it = info.getLoadedResourcesIterator(); it.hasNext();) {
+ Resource nextResource = (Resource) it.next();
+ IFile file = WorkspaceSynchronizer.getFile(nextResource);
+ if (file != null) {
+ rules.add(computeSchedulingRule(file));
+ }
+ }
+ return new MultiRule((ISchedulingRule[]) rules.toArray(new ISchedulingRule[rules.size()]));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected ISchedulingRule getSynchronizeRule(Object element) {
+ ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ Collection/*<org.eclipse.core.runtime.jobs.ISchedulingRule>*/rules = new ArrayList/*<org.eclipse.core.runtime.jobs.ISchedulingRule>*/();
+ for (Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/it = info.getLoadedResourcesIterator(); it.hasNext();) {
+ Resource nextResource = (Resource) it.next();
+ IFile file = WorkspaceSynchronizer.getFile(nextResource);
+ if (file != null) {
+ rules.add(ResourcesPlugin.getWorkspace().getRuleFactory().refreshRule(file));
+ }
+ }
+ return new MultiRule((ISchedulingRule[]) rules.toArray(new ISchedulingRule[rules.size()]));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected ISchedulingRule getValidateStateRule(Object element) {
+ ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ Collection/*<org.eclipse.core.runtime.jobs.ISchedulingRule>*/files = new ArrayList/*<org.eclipse.core.runtime.jobs.ISchedulingRule>*/();
+ for (Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/it = info.getLoadedResourcesIterator(); it.hasNext();) {
+ Resource nextResource = (Resource) it.next();
+ IFile file = WorkspaceSynchronizer.getFile(nextResource);
+ if (file != null) {
+ files.add(file);
+ }
+ }
+ return ResourcesPlugin.getWorkspace().getRuleFactory().validateEditRule((IFile[]) files.toArray(new IFile[files.size()]));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ private ISchedulingRule computeSchedulingRule(IResource toCreateOrModify) {
+ if (toCreateOrModify.exists())
+ return ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(toCreateOrModify);
+
+ IResource parent = toCreateOrModify;
+ do {
+ /*
+ * XXX This is a workaround for
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=67601
+ * IResourceRuleFactory.createRule should iterate the hierarchy
+ * itself.
+ */
+ toCreateOrModify = parent;
+ parent = toCreateOrModify.getParent();
+ } while (parent != null && !parent.exists());
+
+ return ResourcesPlugin.getWorkspace().getRuleFactory().createRule(toCreateOrModify);
+ }
+
+ /**
+ * @generated
+ */
+ protected void doSynchronize(Object element, IProgressMonitor monitor) throws CoreException {
+ ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ for (Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/it = info.getLoadedResourcesIterator(); it.hasNext();) {
+ Resource nextResource = (Resource) it.next();
+ handleElementChanged(info, nextResource, monitor);
+ }
+ return;
+ }
+ super.doSynchronize(element, monitor);
+ }
+
+ /**
+ * @generated
+ */
+ protected void doSaveDocument(IProgressMonitor monitor, Object element, IDocument document, boolean overwrite) throws CoreException {
+ ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ if (!overwrite && !info.isSynchronized()) {
+ throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, IResourceStatus.OUT_OF_SYNC_LOCAL, Messages.UMLDocumentProvider_UnsynchronizedFileSaveError, null));
+ }
+ info.stopResourceListening();
+ fireElementStateChanging(element);
+ try {
+ monitor.beginTask(Messages.UMLDocumentProvider_SaveDiagramTask, info.getResourceSet().getResources().size() + 1); //"Saving diagram"
+ for (Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/it = info.getLoadedResourcesIterator(); it.hasNext();) {
+ Resource nextResource = (Resource) it.next();
+ monitor.setTaskName(NLS.bind(Messages.UMLDocumentProvider_SaveNextResourceTask, nextResource.getURI()));
+ if (nextResource.isLoaded() && !info.getEditingDomain().isReadOnly(nextResource)) {
+ try {
+ nextResource.save(UMLDiagramEditorUtil.getSaveOptions());
+ } catch (IOException e) {
+ fireElementStateChangeFailed(element);
+ throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, EditorStatusCodes.RESOURCE_FAILURE, e.getLocalizedMessage(), null));
+ }
+ }
+ monitor.worked(1);
+ }
+ monitor.done();
+ info.setModificationStamp(computeModificationStamp(info));
+ } catch (RuntimeException x) {
+ fireElementStateChangeFailed(element);
+ throw x;
+ } finally {
+ info.startResourceListening();
+ }
+ } else {
+ URI newResoruceURI;
+ List affectedFiles = null;
+ if (element instanceof FileEditorInput) {
+ IFile newFile = ((FileEditorInput) element).getFile();
+ affectedFiles = Collections.singletonList(newFile);
+ newResoruceURI = URI.createPlatformResourceURI(newFile.getFullPath().toString(), true);
+ } else if (element instanceof URIEditorInput) {
+ newResoruceURI = ((URIEditorInput) element).getURI();
+ } else {
+ fireElementStateChangeFailed(element);
+ throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, 0, NLS.bind(Messages.UMLDocumentProvider_IncorrectInputError, new Object[] { element,
+ "org.eclipse.ui.part.FileEditorInput", "org.eclipse.emf.common.ui.URIEditorInput" }), //$NON-NLS-1$ //$NON-NLS-2$
+ null));
+ }
+ if (false == document instanceof IDiagramDocument) {
+ fireElementStateChangeFailed(element);
+ throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, 0,
+ "Incorrect document used: " + document + " instead of org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ IDiagramDocument diagramDocument = (IDiagramDocument) document;
+ final Resource newResource = diagramDocument.getEditingDomain().getResourceSet().createResource(newResoruceURI);
+ final Diagram diagramCopy = (Diagram) EcoreUtil.copy(diagramDocument.getDiagram());
+ try {
+ new AbstractTransactionalCommand(diagramDocument.getEditingDomain(), NLS.bind(Messages.UMLDocumentProvider_SaveAsOperation, diagramCopy.getName()), affectedFiles) {
+
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ newResource.getContents().add(diagramCopy);
+ return CommandResult.newOKCommandResult();
+ }
+ }.execute(monitor, null);
+ newResource.save(UMLDiagramEditorUtil.getSaveOptions());
+ } catch (ExecutionException e) {
+ fireElementStateChangeFailed(element);
+ throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, 0, e.getLocalizedMessage(), null));
+ } catch (IOException e) {
+ fireElementStateChangeFailed(element);
+ throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, 0, e.getLocalizedMessage(), null));
+ }
+ newResource.unload();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleElementChanged(ResourceSetInfo info, Resource changedResource, IProgressMonitor monitor) {
+ IFile file = WorkspaceSynchronizer.getFile(changedResource);
+ if (file != null) {
+ try {
+ file.refreshLocal(IResource.DEPTH_INFINITE, monitor);
+ } catch (CoreException ex) {
+ UMLDiagramEditorPlugin.getInstance().logError(Messages.UMLDocumentProvider_handleElementContentChanged, ex);
+ // Error message to log was initially taken from org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.internal.l10n.EditorMessages.FileDocumentProvider_handleElementContentChanged
+ }
+ }
+ changedResource.unload();
+
+ fireElementContentAboutToBeReplaced(info.getEditorInput());
+ removeUnchangedElementListeners(info.getEditorInput(), info);
+ info.fStatus = null;
+ try {
+ setDocumentContent(info.fDocument, info.getEditorInput());
+ } catch (CoreException e) {
+ info.fStatus = e.getStatus();
+ }
+ if (!info.fCanBeSaved) {
+ info.setModificationStamp(computeModificationStamp(info));
+ }
+ addUnchangedElementListeners(info.getEditorInput(), info);
+ fireElementContentReplaced(info.getEditorInput());
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleElementMoved(IEditorInput input, URI uri) {
+ if (input instanceof FileEditorInput) {
+ IFile newFile = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(URI.decode(uri.path())).removeFirstSegments(1));
+ fireElementMoved(input, newFile == null ? null : new FileEditorInput(newFile));
+ return;
+ }
+ // TODO: append suffix to the URI! (use diagram as a parameter)
+ fireElementMoved(input, new URIEditorInput(uri));
+ }
+
+ /**
+ * @generated
+ */
+ public IEditorInput createInputWithEditingDomain(IEditorInput editorInput, TransactionalEditingDomain domain) {
+ return editorInput;
+ }
+
+ /**
+ * @generated
+ */
+ public IDiagramDocument getDiagramDocument(Object element) {
+ IDocument doc = getDocument(element);
+ if (doc instanceof IDiagramDocument) {
+ return (IDiagramDocument) doc;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected IRunnableContext getOperationRunner(IProgressMonitor monitor) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected class ResourceSetInfo extends ElementInfo {
+
+ /**
+ * @generated
+ */
+ private long myModificationStamp = IResource.NULL_STAMP;
+
+ /**
+ * @generated
+ */
+ private WorkspaceSynchronizer mySynchronizer;
+
+ /**
+ * @generated
+ */
+ private Collection myUnSynchronizedResources = new ArrayList();
+
+ /**
+ * @generated
+ */
+ private IDiagramDocument myDocument;
+
+ /**
+ * @generated
+ */
+ private IEditorInput myEditorInput;
+
+ /**
+ * @generated
+ */
+ private boolean myUpdateCache = true;
+
+ /**
+ * @generated
+ */
+ private boolean myModifiable = false;
+
+ /**
+ * @generated
+ */
+ private boolean myReadOnly = true;
+
+ /**
+ * @generated
+ */
+ private ResourceSetModificationListener myResourceSetListener;
+
+ /**
+ * @generated
+ */
+ public ResourceSetInfo(IDiagramDocument document, IEditorInput editorInput) {
+ super(document);
+ myDocument = document;
+ myEditorInput = editorInput;
+ startResourceListening();
+ myResourceSetListener = new ResourceSetModificationListener(this);
+ getResourceSet().eAdapters().add(myResourceSetListener);
+ }
+
+ /**
+ * @generated
+ */
+ public long getModificationStamp() {
+ return myModificationStamp;
+ }
+
+ /**
+ * @generated
+ */
+ public void setModificationStamp(long modificationStamp) {
+ myModificationStamp = modificationStamp;
+ }
+
+ /**
+ * @generated
+ */
+ public TransactionalEditingDomain getEditingDomain() {
+ return myDocument.getEditingDomain();
+ }
+
+ /**
+ * @generated
+ */
+ public ResourceSet getResourceSet() {
+ return getEditingDomain().getResourceSet();
+ }
+
+ /**
+ * @generated
+ */
+ public Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/getLoadedResourcesIterator() {
+ return new ArrayList/*<org.eclipse.emf.ecore.resource.Resource>*/(getResourceSet().getResources()).iterator();
+ }
+
+ /**
+ * @generated
+ */
+ public IEditorInput getEditorInput() {
+ return myEditorInput;
+ }
+
+ /**
+ * @generated
+ */
+ public void dispose() {
+ stopResourceListening();
+ getResourceSet().eAdapters().remove(myResourceSetListener);
+ for (Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/it = getLoadedResourcesIterator(); it.hasNext();) {
+ Resource resource = (Resource) it.next();
+ resource.unload();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isSynchronized() {
+ return myUnSynchronizedResources.size() == 0;
+ }
+
+ /**
+ * @generated
+ */
+ public void setUnSynchronized(Resource resource) {
+ myUnSynchronizedResources.add(resource);
+ }
+
+ /**
+ * @generated
+ */
+ public void setSynchronized(Resource resource) {
+ myUnSynchronizedResources.remove(resource);
+ }
+
+ /**
+ * @generated
+ */
+ public final void stopResourceListening() {
+ mySynchronizer.dispose();
+ mySynchronizer = null;
+ }
+
+ /**
+ * @generated
+ */
+ public final void startResourceListening() {
+ mySynchronizer = new WorkspaceSynchronizer(getEditingDomain(), new SynchronizerDelegate());
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isUpdateCache() {
+ return myUpdateCache;
+ }
+
+ /**
+ * @generated
+ */
+ public void setUpdateCache(boolean update) {
+ myUpdateCache = update;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isModifiable() {
+ return myModifiable;
+ }
+
+ /**
+ * @generated
+ */
+ public void setModifiable(boolean modifiable) {
+ myModifiable = modifiable;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isReadOnly() {
+ return myReadOnly;
+ }
+
+ /**
+ * @generated
+ */
+ public void setReadOnly(boolean readOnly) {
+ myReadOnly = readOnly;
+ }
+
+ /**
+ * @generated
+ */
+ private class SynchronizerDelegate implements WorkspaceSynchronizer.Delegate {
+
+ /**
+ * @generated
+ */
+ public void dispose() {
+ }
+
+ /**
+ * @generated
+ */
+ public boolean handleResourceChanged(final Resource resource) {
+ synchronized (ResourceSetInfo.this) {
+ if (ResourceSetInfo.this.fCanBeSaved) {
+ ResourceSetInfo.this.setUnSynchronized(resource);
+ return true;
+ }
+ }
+ Display.getDefault().asyncExec(new Runnable() {
+
+ public void run() {
+ handleElementChanged(ResourceSetInfo.this, resource, null);
+ }
+ });
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean handleResourceDeleted(Resource resource) {
+ synchronized (ResourceSetInfo.this) {
+ if (ResourceSetInfo.this.fCanBeSaved) {
+ ResourceSetInfo.this.setUnSynchronized(resource);
+ return true;
+ }
+ }
+ Display.getDefault().asyncExec(new Runnable() {
+
+ public void run() {
+ fireElementDeleted(ResourceSetInfo.this.getEditorInput());
+ }
+ });
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean handleResourceMoved(Resource resource, final URI newURI) {
+ synchronized (ResourceSetInfo.this) {
+ if (ResourceSetInfo.this.fCanBeSaved) {
+ ResourceSetInfo.this.setUnSynchronized(resource);
+ return true;
+ }
+ }
+ if (myDocument.getDiagram().eResource() == resource) {
+ Display.getDefault().asyncExec(new Runnable() {
+
+ public void run() {
+ handleElementMoved(ResourceSetInfo.this.getEditorInput(), newURI);
+ }
+ });
+ } else {
+ handleResourceDeleted(resource);
+ }
+ return true;
+ }
+
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private class ResourceSetModificationListener extends EContentAdapter {
+
+ /**
+ * @generated
+ */
+ private NotificationFilter myModifiedFilter;
+
+ /**
+ * @generated
+ */
+ private ResourceSetInfo myInfo;
+
+ /**
+ * @generated
+ */
+ public ResourceSetModificationListener(ResourceSetInfo info) {
+ myInfo = info;
+ myModifiedFilter = NotificationFilter.createEventTypeFilter(Notification.SET).or(NotificationFilter.createEventTypeFilter(Notification.UNSET)).and(
+ NotificationFilter.createFeatureFilter(Resource.class, Resource.RESOURCE__IS_MODIFIED));
+ }
+
+ /**
+ * @generated
+ */
+ public void notifyChanged(Notification notification) {
+ if (notification.getNotifier() instanceof ResourceSet) {
+ super.notifyChanged(notification);
+ }
+ if (!notification.isTouch() && myModifiedFilter.matches(notification)) {
+ if (notification.getNotifier() instanceof Resource) {
+ Resource resource = (Resource) notification.getNotifier();
+ if (resource.isLoaded()) {
+ boolean modified = false;
+ for (Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/it = myInfo.getLoadedResourcesIterator(); it.hasNext() && !modified;) {
+ Resource nextResource = (Resource) it.next();
+ if (nextResource.isLoaded()) {
+ modified = nextResource.isModified();
+ }
+ }
+ boolean dirtyStateChanged = false;
+ synchronized (myInfo) {
+ if (modified != myInfo.fCanBeSaved) {
+ myInfo.fCanBeSaved = modified;
+ dirtyStateChanged = true;
+ }
+ if (!resource.isModified()) {
+ myInfo.setSynchronized(resource);
+ }
+ }
+ if (dirtyStateChanged) {
+ fireElementDirtyStateChanged(myInfo.getEditorInput(), modified);
+
+ if (!modified) {
+ myInfo.setModificationStamp(computeModificationStamp(myInfo));
+ }
+ }
+ }
+ }
+ }
+ }
+
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLDomainModelElementTester.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLDomainModelElementTester.java
new file mode 100644
index 00000000000..07804e61988
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLDomainModelElementTester.java
@@ -0,0 +1,776 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.part;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class UMLDomainModelElementTester extends PropertyTester {
+
+ /**
+ * @generated
+ */
+ public boolean test(Object receiver, String method, Object[] args, Object expectedValue) {
+ if (false == receiver instanceof EObject) {
+ return false;
+ }
+ EObject eObject = (EObject) receiver;
+ EClass eClass = eObject.eClass();
+ if (eClass == UMLPackage.eINSTANCE.getComment()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getElement()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getPackage()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getPackageableElement()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getNamedElement()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getDependency()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getDirectedRelationship()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getRelationship()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getNamespace()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getElementImport()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getPackageImport()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getConstraint()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getValueSpecification()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getTypedElement()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getType()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getAssociation()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getClassifier()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getRedefinableElement()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getTemplateableElement()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getTemplateBinding()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getTemplateSignature()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getTemplateParameter()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getParameterableElement()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getTemplateParameterSubstitution()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getGeneralization()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getGeneralizationSet()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getFeature()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getSubstitution()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getRealization()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getAbstraction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getOpaqueExpression()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getParameter()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getMultiplicityElement()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getConnectableElement()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getConnectableElementTemplateParameter()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getConnectorEnd()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getProperty()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getDeploymentTarget()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getDeployment()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getDeployedArtifact()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getDeploymentSpecification()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getArtifact()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getManifestation()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getOperation()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getBehavioralFeature()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getBehavior()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getClass_()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getBehavioredClassifier()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getInterfaceRealization()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getInterface()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getReception()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getSignal()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getProtocolStateMachine()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getStateMachine()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getRegion()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getVertex()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getTransition()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getTrigger()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getEvent()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getPort()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getState()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getConnectionPointReference()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getPseudostate()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getProtocolConformance()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getEncapsulatedClassifier()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getStructuredClassifier()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getConnector()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getExtension()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getExtensionEnd()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getStereotype()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getImage()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getProfile()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getModel()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getParameterSet()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getDataType()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getOperationTemplateParameter()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getStructuralFeature()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getCollaborationUse()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getCollaboration()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getUseCase()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getInclude()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getExtend()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getExtensionPoint()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getRedefinableTemplateSignature()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getClassifierTemplateParameter()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getStringExpression()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getExpression()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getUsage()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getPackageMerge()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getProfileApplication()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getEnumeration()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getEnumerationLiteral()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getInstanceSpecification()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getSlot()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getPrimitiveType()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getLiteralSpecification()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getLiteralInteger()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getLiteralString()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getLiteralBoolean()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getLiteralNull()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getInstanceValue()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getLiteralUnlimitedNatural()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getOpaqueBehavior()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getFunctionBehavior()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getOpaqueAction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getAction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getExecutableNode()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getActivityNode()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getStructuredActivityNode()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getActivityGroup()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getActivity()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getVariable()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getActivityEdge()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getActivityPartition()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getInterruptibleActivityRegion()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getExceptionHandler()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getObjectNode()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getOutputPin()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getPin()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getInputPin()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getCallAction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getInvocationAction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getSendSignalAction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getCallOperationAction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getCallBehaviorAction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getSequenceNode()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getControlNode()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getControlFlow()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getInitialNode()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getActivityParameterNode()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getValuePin()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getMessage()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getMessageEnd()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getInteraction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getInteractionFragment()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getLifeline()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getPartDecomposition()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getInteractionUse()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getGate()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getGeneralOrdering()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getOccurrenceSpecification()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getInteractionOperand()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getInteractionConstraint()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getExecutionSpecification()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getStateInvariant()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getActionExecutionSpecification()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getBehaviorExecutionSpecification()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getExecutionEvent()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getCreationEvent()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getDestructionEvent()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getSendOperationEvent()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getMessageEvent()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getSendSignalEvent()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getMessageOccurrenceSpecification()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getExecutionOccurrenceSpecification()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getReceiveOperationEvent()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getReceiveSignalEvent()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getActor()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getCallEvent()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getChangeEvent()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getSignalEvent()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getAnyReceiveEvent()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getForkNode()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getFlowFinalNode()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getFinalNode()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getCentralBufferNode()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getMergeNode()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getDecisionNode()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getActivityFinalNode()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getComponentRealization()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getComponent()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getNode()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getDevice()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getExecutionEnvironment()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getCommunicationPath()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getCombinedFragment()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getContinuation()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getConsiderIgnoreFragment()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getCreateObjectAction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getDestroyObjectAction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getTestIdentityAction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getReadSelfAction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getStructuralFeatureAction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getReadStructuralFeatureAction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getWriteStructuralFeatureAction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getClearStructuralFeatureAction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getRemoveStructuralFeatureValueAction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getAddStructuralFeatureValueAction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getLinkAction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getLinkEndData()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getQualifierValue()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getReadLinkAction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getLinkEndCreationData()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getCreateLinkAction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getWriteLinkAction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getDestroyLinkAction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getLinkEndDestructionData()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getClearAssociationAction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getBroadcastSignalAction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getSendObjectAction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getValueSpecificationAction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getTimeExpression()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getObservation()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getDuration()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getDurationInterval()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getInterval()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getTimeConstraint()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getIntervalConstraint()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getTimeInterval()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getDurationConstraint()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getTimeObservation()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getDurationObservation()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getFinalState()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getTimeEvent()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getVariableAction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getReadVariableAction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getWriteVariableAction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getClearVariableAction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getAddVariableValueAction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getRemoveVariableValueAction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getRaiseExceptionAction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getActionInputPin()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getInformationItem()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getInformationFlow()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getReadExtentAction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getReclassifyObjectAction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getReadIsClassifiedObjectAction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getStartClassifierBehaviorAction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getReadLinkObjectEndAction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getReadLinkObjectEndQualifierAction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getCreateLinkObjectAction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getAcceptEventAction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getAcceptCallAction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getReplyAction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getUnmarshallAction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getReduceAction()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getJoinNode()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getDataStoreNode()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getObjectFlow()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getConditionalNode()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getClause()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getLoopNode()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getExpansionNode()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getExpansionRegion()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getProtocolTransition()) {
+ return true;
+ }
+ if (eClass == UMLPackage.eINSTANCE.getAssociationClass()) {
+ return true;
+ }
+ return false;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLInitDiagramFileAction.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLInitDiagramFileAction.java
new file mode 100644
index 00000000000..0bbb95e81aa
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLInitDiagramFileAction.java
@@ -0,0 +1,99 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.part;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.common.util.WrappedException;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelEditPart;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * @generated
+ */
+public class UMLInitDiagramFileAction implements IObjectActionDelegate {
+
+ /**
+ * @generated
+ */
+ private IWorkbenchPart targetPart;
+
+ /**
+ * @generated
+ */
+ private URI domainModelURI;
+
+ /**
+ * @generated
+ */
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+ this.targetPart = targetPart;
+ }
+
+ /**
+ * @generated
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ domainModelURI = null;
+ action.setEnabled(false);
+ if (selection instanceof IStructuredSelection == false || selection.isEmpty()) {
+ return;
+ }
+ IFile file = (IFile) ((IStructuredSelection) selection).getFirstElement();
+ domainModelURI = URI.createPlatformResourceURI(file.getFullPath().toString(), true);
+ action.setEnabled(true);
+ }
+
+ /**
+ * @generated
+ */
+ private Shell getShell() {
+ return targetPart.getSite().getShell();
+ }
+
+ /**
+ * @generated
+ */
+ public void run(IAction action) {
+ TransactionalEditingDomain editingDomain = GMFEditingDomainFactory.INSTANCE.createEditingDomain();
+ ResourceSet resourceSet = editingDomain.getResourceSet();
+ EObject diagramRoot = null;
+ try {
+ Resource resource = resourceSet.getResource(domainModelURI, true);
+ diagramRoot = (EObject) resource.getContents().get(0);
+ } catch (WrappedException ex) {
+ UMLDiagramEditorPlugin.getInstance().logError("Unable to load resource: " + domainModelURI, ex); //$NON-NLS-1$
+ }
+ if (diagramRoot == null) {
+ MessageDialog.openError(getShell(), Messages.UMLInitDiagramFileAction_InitDiagramFileResourceErrorDialogTitle, Messages.UMLInitDiagramFileAction_InitDiagramFileResourceErrorDialogMessage);
+ return;
+ }
+ Wizard wizard = new UMLNewDiagramFileWizard(domainModelURI, diagramRoot, editingDomain);
+ wizard.setWindowTitle(NLS.bind(Messages.UMLInitDiagramFileAction_InitDiagramFileWizardTitle, ModelEditPart.MODEL_ID));
+ UMLDiagramEditorUtil.runWizard(getShell(), wizard, "InitDiagramFile"); //$NON-NLS-1$
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLLinkDescriptor.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLLinkDescriptor.java
new file mode 100644
index 00000000000..37feb386894
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLLinkDescriptor.java
@@ -0,0 +1,105 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.part;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+
+/**
+ * @generated
+ */
+public class UMLLinkDescriptor extends UMLNodeDescriptor {
+
+ /**
+ * @generated
+ */
+ private EObject mySource;
+
+ /**
+ * @generated
+ */
+ private EObject myDestination;
+
+ /**
+ * @generated
+ */
+ private IAdaptable mySemanticAdapter;
+
+ /**
+ * @generated
+ */
+ private UMLLinkDescriptor(EObject source, EObject destination, EObject linkElement, int linkVID) {
+ super(linkElement, linkVID);
+ mySource = source;
+ myDestination = destination;
+ }
+
+ /**
+ * @generated
+ */
+ public UMLLinkDescriptor(EObject source, EObject destination, IElementType elementType, int linkVID) {
+ this(source, destination, (EObject) null, linkVID);
+ final IElementType elementTypeCopy = elementType;
+ mySemanticAdapter = new IAdaptable() {
+
+ public Object getAdapter(Class adapter) {
+ if (IElementType.class.equals(adapter)) {
+ return elementTypeCopy;
+ }
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public UMLLinkDescriptor(EObject source, EObject destination, EObject linkElement, IElementType elementType, int linkVID) {
+ this(source, destination, linkElement, linkVID);
+ final IElementType elementTypeCopy = elementType;
+ mySemanticAdapter = new EObjectAdapter(linkElement) {
+
+ public Object getAdapter(Class adapter) {
+ if (IElementType.class.equals(adapter)) {
+ return elementTypeCopy;
+ }
+ return super.getAdapter(adapter);
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public EObject getSource() {
+ return mySource;
+ }
+
+ /**
+ * @generated
+ */
+ public EObject getDestination() {
+ return myDestination;
+ }
+
+ /**
+ * @generated
+ */
+ public IAdaptable getSemanticAdapter() {
+ return mySemanticAdapter;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLLoadResourceAction.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLLoadResourceAction.java
new file mode 100644
index 00000000000..7c511af55b0
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLLoadResourceAction.java
@@ -0,0 +1,76 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.part;
+
+import org.eclipse.emf.edit.ui.action.LoadResourceAction;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelEditPart;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * @generated
+ */
+public class UMLLoadResourceAction implements IObjectActionDelegate {
+
+ /**
+ * @generated
+ */
+ private ModelEditPart mySelectedElement;
+
+ /**
+ * @generated
+ */
+ private Shell myShell;
+
+ /**
+ * @generated
+ */
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+ myShell = targetPart.getSite().getShell();
+ }
+
+ /**
+ * @generated
+ */
+ public void run(IAction action) {
+ LoadResourceAction.LoadResourceDialog loadResourceDialog = new LoadResourceAction.LoadResourceDialog(myShell, mySelectedElement.getEditingDomain());
+ loadResourceDialog.open();
+ }
+
+ /**
+ * @generated
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ mySelectedElement = null;
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection structuredSelection = (IStructuredSelection) selection;
+ if (structuredSelection.size() == 1 && structuredSelection.getFirstElement() instanceof ModelEditPart) {
+ mySelectedElement = (ModelEditPart) structuredSelection.getFirstElement();
+ }
+ }
+ action.setEnabled(isEnabled());
+ }
+
+ /**
+ * @generated
+ */
+ private boolean isEnabled() {
+ return mySelectedElement != null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLMatchingStrategy.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLMatchingStrategy.java
new file mode 100644
index 00000000000..f3f9e391f9b
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLMatchingStrategy.java
@@ -0,0 +1,47 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.part;
+
+import org.eclipse.emf.common.ui.URIEditorInput;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorMatchingStrategy;
+import org.eclipse.ui.IEditorReference;
+import org.eclipse.ui.PartInitException;
+
+/**
+ * @generated
+ */
+public class UMLMatchingStrategy implements IEditorMatchingStrategy {
+
+ /**
+ * @generated
+ */
+ public boolean matches(IEditorReference editorRef, IEditorInput input) {
+ IEditorInput editorInput;
+ try {
+ editorInput = editorRef.getEditorInput();
+ } catch (PartInitException e) {
+ return false;
+ }
+
+ if (editorInput.equals(input)) {
+ return true;
+ }
+ if (editorInput instanceof URIEditorInput && input instanceof URIEditorInput) {
+ return ((URIEditorInput) editorInput).getURI().equals(((URIEditorInput) input).getURI());
+ }
+ return false;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLNewDiagramFileWizard.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLNewDiagramFileWizard.java
new file mode 100644
index 00000000000..eefdec10a99
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLNewDiagramFileWizard.java
@@ -0,0 +1,176 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.part;
+
+import java.io.IOException;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.OperationHistoryFactory;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.diagram.core.services.ViewService;
+import org.eclipse.gmf.runtime.diagram.core.services.view.CreateDiagramViewOperation;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelEditPart;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
+
+/**
+ * @generated
+ */
+public class UMLNewDiagramFileWizard extends Wizard {
+
+ /**
+ * @generated
+ */
+ private WizardNewFileCreationPage myFileCreationPage;
+
+ /**
+ * @generated
+ */
+ private ModelElementSelectionPage diagramRootElementSelectionPage;
+
+ /**
+ * @generated
+ */
+ private TransactionalEditingDomain myEditingDomain;
+
+ /**
+ * @generated
+ */
+ public UMLNewDiagramFileWizard(URI domainModelURI, EObject diagramRoot, TransactionalEditingDomain editingDomain) {
+ assert domainModelURI != null : "Domain model uri must be specified"; //$NON-NLS-1$
+ assert diagramRoot != null : "Doagram root element must be specified"; //$NON-NLS-1$
+ assert editingDomain != null : "Editing domain must be specified"; //$NON-NLS-1$
+
+ myFileCreationPage = new WizardNewFileCreationPage(Messages.UMLNewDiagramFileWizard_CreationPageName, StructuredSelection.EMPTY);
+ myFileCreationPage.setTitle(Messages.UMLNewDiagramFileWizard_CreationPageTitle);
+ myFileCreationPage.setDescription(NLS.bind(Messages.UMLNewDiagramFileWizard_CreationPageDescription, ModelEditPart.MODEL_ID));
+ IPath filePath;
+ String fileName = domainModelURI.trimFileExtension().lastSegment();
+ if (domainModelURI.isPlatformResource()) {
+ filePath = new Path(domainModelURI.trimSegments(1).toPlatformString(true));
+ } else if (domainModelURI.isFile()) {
+ filePath = new Path(domainModelURI.trimSegments(1).toFileString());
+ } else {
+ // TODO : use some default path
+ throw new IllegalArgumentException("Unsupported URI: " + domainModelURI); //$NON-NLS-1$
+ }
+ myFileCreationPage.setContainerFullPath(filePath);
+ myFileCreationPage.setFileName(UMLDiagramEditorUtil.getUniqueFileName(filePath, fileName, "PapyrusUMLClass_diagram")); //$NON-NLS-1$
+
+ diagramRootElementSelectionPage = new DiagramRootElementSelectionPage(Messages.UMLNewDiagramFileWizard_RootSelectionPageName);
+ diagramRootElementSelectionPage.setTitle(Messages.UMLNewDiagramFileWizard_RootSelectionPageTitle);
+ diagramRootElementSelectionPage.setDescription(Messages.UMLNewDiagramFileWizard_RootSelectionPageDescription);
+ diagramRootElementSelectionPage.setModelElement(diagramRoot);
+
+ myEditingDomain = editingDomain;
+ }
+
+ /**
+ * @generated
+ */
+ public void addPages() {
+ addPage(myFileCreationPage);
+ addPage(diagramRootElementSelectionPage);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean performFinish() {
+ List affectedFiles = new LinkedList();
+ IFile diagramFile = myFileCreationPage.createNewFile();
+ UMLDiagramEditorUtil.setCharset(diagramFile);
+ affectedFiles.add(diagramFile);
+ URI diagramModelURI = URI.createPlatformResourceURI(diagramFile.getFullPath().toString(), true);
+ ResourceSet resourceSet = myEditingDomain.getResourceSet();
+ final Resource diagramResource = resourceSet.createResource(diagramModelURI);
+ AbstractTransactionalCommand command = new AbstractTransactionalCommand(myEditingDomain, Messages.UMLNewDiagramFileWizard_InitDiagramCommand, affectedFiles) {
+
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ int diagramVID = UMLVisualIDRegistry.getDiagramVisualID(diagramRootElementSelectionPage.getModelElement());
+ if (diagramVID != ModelEditPart.VISUAL_ID) {
+ return CommandResult.newErrorCommandResult(Messages.UMLNewDiagramFileWizard_IncorrectRootError);
+ }
+ Diagram diagram = ViewService.createDiagram(diagramRootElementSelectionPage.getModelElement(), ModelEditPart.MODEL_ID, UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
+ diagramResource.getContents().add(diagram);
+ return CommandResult.newOKCommandResult();
+ }
+ };
+ try {
+ OperationHistoryFactory.getOperationHistory().execute(command, new NullProgressMonitor(), null);
+ diagramResource.save(UMLDiagramEditorUtil.getSaveOptions());
+ UMLDiagramEditorUtil.openDiagram(diagramResource);
+ } catch (ExecutionException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Unable to create model and diagram", e); //$NON-NLS-1$
+ } catch (IOException ex) {
+ UMLDiagramEditorPlugin.getInstance().logError("Save operation failed for: " + diagramModelURI, ex); //$NON-NLS-1$
+ } catch (PartInitException ex) {
+ UMLDiagramEditorPlugin.getInstance().logError("Unable to open editor", ex); //$NON-NLS-1$
+ }
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ private static class DiagramRootElementSelectionPage extends ModelElementSelectionPage {
+
+ /**
+ * @generated
+ */
+ protected DiagramRootElementSelectionPage(String pageName) {
+ super(pageName);
+ }
+
+ /**
+ * @generated
+ */
+ protected String getSelectionTitle() {
+ return Messages.UMLNewDiagramFileWizard_RootSelectionPageSelectionTitle;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean validatePage() {
+ if (selectedModelElement == null) {
+ setErrorMessage(Messages.UMLNewDiagramFileWizard_RootSelectionPageNoSelectionMessage);
+ return false;
+ }
+ boolean result = ViewService.getInstance().provides(
+ new CreateDiagramViewOperation(new EObjectAdapter(selectedModelElement), ModelEditPart.MODEL_ID, UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT));
+ setErrorMessage(result ? null : Messages.UMLNewDiagramFileWizard_RootSelectionPageInvalidSelectionMessage);
+ return result;
+ }
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLNodeDescriptor.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLNodeDescriptor.java
new file mode 100644
index 00000000000..74c1ba90cd6
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLNodeDescriptor.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.part;
+
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * @generated
+ */
+public class UMLNodeDescriptor {
+
+ /**
+ * @generated
+ */
+ private EObject myModelElement;
+
+ /**
+ * @generated
+ */
+ private int myVisualID;
+
+ /**
+ * @generated
+ */
+ private String myType;
+
+ /**
+ * @generated
+ */
+ public UMLNodeDescriptor(EObject modelElement, int visualID) {
+ myModelElement = modelElement;
+ myVisualID = visualID;
+ }
+
+ /**
+ * @generated
+ */
+ public EObject getModelElement() {
+ return myModelElement;
+ }
+
+ /**
+ * @generated
+ */
+ public int getVisualID() {
+ return myVisualID;
+ }
+
+ /**
+ * @generated
+ */
+ public String getType() {
+ if (myType == null) {
+ myType = UMLVisualIDRegistry.getType(getVisualID());
+ }
+ return myType;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLPaletteFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLPaletteFactory.java
new file mode 100644
index 00000000000..fdc2036c9a8
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLPaletteFactory.java
@@ -0,0 +1,642 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.part;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gef.Tool;
+import org.eclipse.gef.palette.PaletteContainer;
+import org.eclipse.gef.palette.PaletteDrawer;
+import org.eclipse.gef.palette.PaletteGroup;
+import org.eclipse.gef.palette.PaletteRoot;
+import org.eclipse.gef.palette.ToolEntry;
+import org.eclipse.gmf.runtime.diagram.ui.tools.UnspecifiedTypeConnectionTool;
+import org.eclipse.gmf.runtime.diagram.ui.tools.UnspecifiedTypeCreationTool;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class UMLPaletteFactory {
+
+ /**
+ * @generated
+ */
+ private static class LinkToolEntry extends ToolEntry {
+
+ /**
+ * @generated
+ */
+ private final List relationshipTypes;
+
+ /**
+ * @generated
+ */
+ private LinkToolEntry(String title, String description, List relationshipTypes) {
+ super(title, description, null, null);
+ this.relationshipTypes = relationshipTypes;
+ }
+
+ /**
+ * @generated
+ */
+ public Tool createTool() {
+ Tool tool = new UnspecifiedTypeConnectionTool(relationshipTypes);
+ tool.setProperties(getToolProperties());
+ return tool;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private static class NodeToolEntry extends ToolEntry {
+
+ /**
+ * @generated
+ */
+ private final List elementTypes;
+
+ /**
+ * @generated
+ */
+ private NodeToolEntry(String title, String description, List elementTypes) {
+ super(title, description, null, null);
+ this.elementTypes = elementTypes;
+ }
+
+ /**
+ * @generated
+ */
+ public Tool createTool() {
+ Tool tool = new UnspecifiedTypeCreationTool(elementTypes);
+ tool.setProperties(getToolProperties());
+ return tool;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createAbstraction1CreationTool() {
+ List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1);
+ types.add(UMLElementTypes.Abstraction_4006);
+ LinkToolEntry entry = new LinkToolEntry(Messages.Abstraction1CreationTool_title, Messages.Abstraction1CreationTool_desc, types);
+ entry.setSmallIcon(UMLElementTypes.getImageDescriptor(UMLElementTypes.Abstraction_4006));
+ entry.setLargeIcon(entry.getSmallIcon());
+ return entry;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createAssociation2CreationTool() {
+ List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1);
+ types.add(UMLElementTypes.Association_4001);
+ LinkToolEntry entry = new LinkToolEntry(Messages.Association2CreationTool_title, Messages.Association2CreationTool_desc, types);
+ entry.setSmallIcon(UMLElementTypes.getImageDescriptor(UMLElementTypes.Association_4001));
+ entry.setLargeIcon(entry.getSmallIcon());
+ return entry;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createAssociationClass3CreationTool() {
+ List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1);
+ types.add(UMLElementTypes.AssociationClass_4017);
+ LinkToolEntry entry = new LinkToolEntry(Messages.AssociationClass3CreationTool_title, Messages.AssociationClass3CreationTool_desc, types);
+ entry.setSmallIcon(UMLElementTypes.getImageDescriptor(UMLElementTypes.AssociationClass_4017));
+ entry.setLargeIcon(entry.getSmallIcon());
+ return entry;
+ }
+
+ private ToolEntry createBranchDependencyCreationTool() {
+ List/* <IElementType> */types = new ArrayList/* <IElementType> */(2);
+ types.add(UMLElementTypes.Dependency_4018);
+ LinkToolEntry entry = new LinkToolEntry(Messages.DependencyBranchCreationTool_title, Messages.DependencyBranchCreationTool_desc, types);
+ entry.setSmallIcon(UMLElementTypes.getImageDescriptor(UMLElementTypes.Dependency_4008));
+ entry.setLargeIcon(entry.getSmallIcon());
+ return entry;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createClass1CreationTool() {
+ List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(5);
+ types.add(UMLElementTypes.Class_3004);
+ types.add(UMLElementTypes.Class_3008);
+ types.add(UMLElementTypes.Class_3010);
+ types.add(UMLElementTypes.Class_3014);
+ types.add(UMLElementTypes.Class_2008);
+ NodeToolEntry entry = new NodeToolEntry(Messages.Class1CreationTool_title, Messages.Class1CreationTool_desc, types);
+ entry.setSmallIcon(UMLElementTypes.getImageDescriptor(UMLElementTypes.Class_3004));
+ entry.setLargeIcon(entry.getSmallIcon());
+ return entry;
+ }
+
+ /**
+ * Creates "Classifiers" palette tool group
+ *
+ * @generated
+ */
+ private PaletteContainer createClassifiers2Group() {
+ PaletteDrawer paletteContainer = new PaletteDrawer(Messages.Classifiers2Group_title);
+ paletteContainer.setDescription(Messages.Classifiers2Group_desc);
+ paletteContainer.add(createClass1CreationTool());
+ paletteContainer.add(createComponent2CreationTool());
+ paletteContainer.add(createDataType3CreationTool());
+ paletteContainer.add(createEnumeration4CreationTool());
+ paletteContainer.add(createInterface5CreationTool());
+ paletteContainer.add(createPrimitiveType6CreationTool());
+ paletteContainer.add(createSignal7CreationTool());
+ paletteContainer.add(createInstanceSpecification8CreationTool());
+ return paletteContainer;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createComment5CreationTool() {
+ List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(2);
+ types.add(UMLElementTypes.Comment_3028);
+ types.add(UMLElementTypes.Comment_2012);
+ NodeToolEntry entry = new NodeToolEntry(Messages.Comment5CreationTool_title, Messages.Comment5CreationTool_desc, types);
+ entry.setSmallIcon(UMLElementTypes.getImageDescriptor(UMLElementTypes.Comment_3028));
+ entry.setLargeIcon(entry.getSmallIcon());
+ return entry;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createCommentlink6CreationTool() {
+ List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1);
+ types.add(UMLElementTypes.CommentAnnotatedElement_4013);
+ LinkToolEntry entry = new LinkToolEntry(Messages.Commentlink6CreationTool_title, Messages.Commentlink6CreationTool_desc, types);
+ entry.setSmallIcon(UMLElementTypes.getImageDescriptor(UMLElementTypes.CommentAnnotatedElement_4013));
+ entry.setLargeIcon(entry.getSmallIcon());
+ return entry;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createComponent2CreationTool() {
+ List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(2);
+ types.add(UMLElementTypes.Component_2002);
+ types.add(UMLElementTypes.Component_3021);
+ NodeToolEntry entry = new NodeToolEntry(Messages.Component2CreationTool_title, Messages.Component2CreationTool_desc, types);
+ entry.setSmallIcon(UMLElementTypes.getImageDescriptor(UMLElementTypes.Component_2002));
+ entry.setLargeIcon(entry.getSmallIcon());
+ return entry;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createConstraint3CreationTool() {
+ List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(2);
+ types.add(UMLElementTypes.Constraint_3029);
+ types.add(UMLElementTypes.Constraint_2011);
+ NodeToolEntry entry = new NodeToolEntry(Messages.Constraint3CreationTool_title, Messages.Constraint3CreationTool_desc, types);
+ entry.setSmallIcon(UMLElementTypes.getImageDescriptor(UMLElementTypes.Constraint_3029));
+ entry.setLargeIcon(entry.getSmallIcon());
+ return entry;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createConstraintlink4CreationTool() {
+ List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1);
+ types.add(UMLElementTypes.ConstraintConstrainedElement_4014);
+ LinkToolEntry entry = new LinkToolEntry(Messages.Constraintlink4CreationTool_title, Messages.Constraintlink4CreationTool_desc, types);
+ entry.setSmallIcon(UMLElementTypes.getImageDescriptor(UMLElementTypes.ConstraintConstrainedElement_4014));
+ entry.setLargeIcon(entry.getSmallIcon());
+ return entry;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createDataType3CreationTool() {
+ List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(2);
+ types.add(UMLElementTypes.DataType_3027);
+ types.add(UMLElementTypes.DataType_2010);
+ NodeToolEntry entry = new NodeToolEntry(Messages.DataType3CreationTool_title, Messages.DataType3CreationTool_desc, types);
+ entry.setSmallIcon(UMLElementTypes.getImageDescriptor(UMLElementTypes.DataType_3027));
+ entry.setLargeIcon(entry.getSmallIcon());
+ return entry;
+ }
+
+ /**
+ * Creates "Default" palette tool group
+ *
+ * @generated
+ */
+ private PaletteContainer createDefault1Group() {
+ PaletteGroup paletteContainer = new PaletteGroup(Messages.Default1Group_title);
+ paletteContainer.setDescription(Messages.Default1Group_desc);
+ paletteContainer.add(createModel1CreationTool());
+ paletteContainer.add(createPackage2CreationTool());
+ paletteContainer.add(createConstraint3CreationTool());
+ paletteContainer.add(createConstraintlink4CreationTool());
+ paletteContainer.add(createComment5CreationTool());
+ paletteContainer.add(createCommentlink6CreationTool());
+ return paletteContainer;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createDependency4CreationTool() {
+ List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(2);
+ types.add(UMLElementTypes.Dependency_4008);
+ LinkToolEntry entry = new LinkToolEntry(Messages.Dependency4CreationTool_title, Messages.Dependency4CreationTool_desc, types);
+ entry.setSmallIcon(UMLElementTypes.getImageDescriptor(UMLElementTypes.Dependency_4008));
+ entry.setLargeIcon(entry.getSmallIcon());
+ return entry;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createElementImport5CreationTool() {
+ List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1);
+ types.add(UMLElementTypes.ElementImport_4009);
+ LinkToolEntry entry = new LinkToolEntry(Messages.ElementImport5CreationTool_title, Messages.ElementImport5CreationTool_desc, types);
+ entry.setSmallIcon(UMLElementTypes.getImageDescriptor(UMLElementTypes.ElementImport_4009));
+ entry.setLargeIcon(entry.getSmallIcon());
+ return entry;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createEnumeration4CreationTool() {
+ List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(2);
+ types.add(UMLElementTypes.Enumeration_3025);
+ types.add(UMLElementTypes.Enumeration_2006);
+ NodeToolEntry entry = new NodeToolEntry(Messages.Enumeration4CreationTool_title, Messages.Enumeration4CreationTool_desc, types);
+ entry.setSmallIcon(UMLElementTypes.getImageDescriptor(UMLElementTypes.Enumeration_3025));
+ entry.setLargeIcon(entry.getSmallIcon());
+ return entry;
+ }
+
+ /**
+ * Creates "Features" palette tool group
+ *
+ * @generated
+ */
+ private PaletteContainer createFeatures4Group() {
+ PaletteDrawer paletteContainer = new PaletteDrawer(Messages.Features4Group_title);
+ paletteContainer.setDescription(Messages.Features4Group_desc);
+ paletteContainer.add(createReception1CreationTool());
+ paletteContainer.add(createProperty2CreationTool());
+ paletteContainer.add(createOperation3CreationTool());
+ paletteContainer.add(createSlot4CreationTool());
+ paletteContainer.add(createLiteralEnumeration5CreationTool());
+ return paletteContainer;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createGeneralization6CreationTool() {
+ List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1);
+ types.add(UMLElementTypes.Generalization_4002);
+ LinkToolEntry entry = new LinkToolEntry(Messages.Generalization6CreationTool_title, Messages.Generalization6CreationTool_desc, types);
+ entry.setSmallIcon(UMLElementTypes.getImageDescriptor(UMLElementTypes.Generalization_4002));
+ entry.setLargeIcon(entry.getSmallIcon());
+ return entry;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createInstanceSpecification8CreationTool() {
+ List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(2);
+ types.add(UMLElementTypes.InstanceSpecification_2001);
+ types.add(UMLElementTypes.InstanceSpecification_3020);
+ NodeToolEntry entry = new NodeToolEntry(Messages.InstanceSpecification8CreationTool_title, Messages.InstanceSpecification8CreationTool_desc, types);
+ entry.setSmallIcon(UMLElementTypes.getImageDescriptor(UMLElementTypes.InstanceSpecification_2001));
+ entry.setLargeIcon(entry.getSmallIcon());
+ return entry;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createInterface5CreationTool() {
+ List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(2);
+ types.add(UMLElementTypes.Interface_2004);
+ types.add(UMLElementTypes.Interface_3023);
+ NodeToolEntry entry = new NodeToolEntry(Messages.Interface5CreationTool_title, Messages.Interface5CreationTool_desc, types);
+ entry.setSmallIcon(UMLElementTypes.getImageDescriptor(UMLElementTypes.Interface_2004));
+ entry.setLargeIcon(entry.getSmallIcon());
+ return entry;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createInterfaceRealization7CreationTool() {
+ List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1);
+ types.add(UMLElementTypes.InterfaceRealization_4003);
+ LinkToolEntry entry = new LinkToolEntry(Messages.InterfaceRealization7CreationTool_title, Messages.InterfaceRealization7CreationTool_desc, types);
+ entry.setSmallIcon(UMLElementTypes.getImageDescriptor(UMLElementTypes.InterfaceRealization_4003));
+ entry.setLargeIcon(entry.getSmallIcon());
+ return entry;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createLiteralEnumeration5CreationTool() {
+ List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1);
+ types.add(UMLElementTypes.EnumerationLiteral_3017);
+ NodeToolEntry entry = new NodeToolEntry(Messages.LiteralEnumeration5CreationTool_title, Messages.LiteralEnumeration5CreationTool_desc, types);
+ entry.setSmallIcon(UMLElementTypes.getImageDescriptor(UMLElementTypes.EnumerationLiteral_3017));
+ entry.setLargeIcon(entry.getSmallIcon());
+ return entry;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createModel1CreationTool() {
+ List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(2);
+ types.add(UMLElementTypes.Model_2005);
+ types.add(UMLElementTypes.Model_3024);
+ NodeToolEntry entry = new NodeToolEntry(Messages.Model1CreationTool_title, Messages.Model1CreationTool_desc, types);
+ entry.setSmallIcon(UMLElementTypes.getImageDescriptor(UMLElementTypes.Model_2005));
+ entry.setLargeIcon(entry.getSmallIcon());
+ return entry;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createOperation3CreationTool() {
+ List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(4);
+ types.add(UMLElementTypes.Operation_3003);
+ types.add(UMLElementTypes.Operation_3007);
+ types.add(UMLElementTypes.Operation_3013);
+ types.add(UMLElementTypes.Operation_3019);
+ NodeToolEntry entry = new NodeToolEntry(Messages.Operation3CreationTool_title, Messages.Operation3CreationTool_desc, types);
+ entry.setSmallIcon(UMLElementTypes.getImageDescriptor(UMLElementTypes.Operation_3003));
+ entry.setLargeIcon(entry.getSmallIcon());
+ return entry;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createPackage2CreationTool() {
+ List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(2);
+ types.add(UMLElementTypes.Package_3009);
+ types.add(UMLElementTypes.Package_2007);
+ NodeToolEntry entry = new NodeToolEntry(Messages.Package2CreationTool_title, Messages.Package2CreationTool_desc, types);
+ entry.setSmallIcon(UMLElementTypes.getImageDescriptor(UMLElementTypes.Package_3009));
+ entry.setLargeIcon(entry.getSmallIcon());
+ return entry;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createPackageImport8CreationTool() {
+ List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1);
+ types.add(UMLElementTypes.PackageImport_4010);
+ LinkToolEntry entry = new LinkToolEntry(Messages.PackageImport8CreationTool_title, Messages.PackageImport8CreationTool_desc, types);
+ entry.setSmallIcon(UMLElementTypes.getImageDescriptor(UMLElementTypes.PackageImport_4010));
+ entry.setLargeIcon(entry.getSmallIcon());
+ return entry;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createPackageMerge9CreationTool() {
+ List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1);
+ types.add(UMLElementTypes.PackageMerge_4011);
+ LinkToolEntry entry = new LinkToolEntry(Messages.PackageMerge9CreationTool_title, Messages.PackageMerge9CreationTool_desc, types);
+ entry.setSmallIcon(UMLElementTypes.getImageDescriptor(UMLElementTypes.PackageMerge_4011));
+ entry.setLargeIcon(entry.getSmallIcon());
+ return entry;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createPrimitiveType6CreationTool() {
+ List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(2);
+ types.add(UMLElementTypes.PrimitiveType_3026);
+ types.add(UMLElementTypes.PrimitiveType_2009);
+ NodeToolEntry entry = new NodeToolEntry(Messages.PrimitiveType6CreationTool_title, Messages.PrimitiveType6CreationTool_desc, types);
+ entry.setSmallIcon(UMLElementTypes.getImageDescriptor(UMLElementTypes.PrimitiveType_3026));
+ entry.setLargeIcon(entry.getSmallIcon());
+ return entry;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createProfileApplication10CreationTool() {
+ List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1);
+ types.add(UMLElementTypes.ProfileApplication_4012);
+ LinkToolEntry entry = new LinkToolEntry(Messages.ProfileApplication10CreationTool_title, Messages.ProfileApplication10CreationTool_desc, types);
+ entry.setSmallIcon(UMLElementTypes.getImageDescriptor(UMLElementTypes.ProfileApplication_4012));
+ entry.setLargeIcon(entry.getSmallIcon());
+ return entry;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createProperty2CreationTool() {
+ List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(5);
+ types.add(UMLElementTypes.Property_3002);
+ types.add(UMLElementTypes.Property_3005);
+ types.add(UMLElementTypes.Property_3006);
+ types.add(UMLElementTypes.Property_3012);
+ types.add(UMLElementTypes.Property_3018);
+ NodeToolEntry entry = new NodeToolEntry(Messages.Property2CreationTool_title, Messages.Property2CreationTool_desc, types);
+ entry.setSmallIcon(UMLElementTypes.getImageDescriptor(UMLElementTypes.Property_3002));
+ entry.setLargeIcon(entry.getSmallIcon());
+ return entry;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createRealization11CreationTool() {
+ List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1);
+ types.add(UMLElementTypes.Realization_4005);
+ LinkToolEntry entry = new LinkToolEntry(Messages.Realization11CreationTool_title, Messages.Realization11CreationTool_desc, types);
+ entry.setSmallIcon(UMLElementTypes.getImageDescriptor(UMLElementTypes.Realization_4005));
+ entry.setLargeIcon(entry.getSmallIcon());
+ return entry;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createReception1CreationTool() {
+ List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1);
+ types.add(UMLElementTypes.Reception_3011);
+ NodeToolEntry entry = new NodeToolEntry(Messages.Reception1CreationTool_title, Messages.Reception1CreationTool_desc, types);
+ entry.setSmallIcon(UMLElementTypes.getImageDescriptor(UMLElementTypes.Reception_3011));
+ entry.setLargeIcon(entry.getSmallIcon());
+ return entry;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createRedefinableTemplateSignature1CreationTool() {
+ List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1);
+ types.add(UMLElementTypes.RedefinableTemplateSignature_3015);
+ NodeToolEntry entry = new NodeToolEntry(Messages.RedefinableTemplateSignature1CreationTool_title, Messages.RedefinableTemplateSignature1CreationTool_desc, types);
+ entry.setSmallIcon(UMLElementTypes.getImageDescriptor(UMLElementTypes.RedefinableTemplateSignature_3015));
+ entry.setLargeIcon(entry.getSmallIcon());
+ return entry;
+ }
+
+ /**
+ * Creates "RelationShips" palette tool group
+ *
+ * @generated
+ */
+ private PaletteContainer createRelationShips3Group() {
+ PaletteDrawer paletteContainer = new PaletteDrawer(Messages.RelationShips3Group_title);
+ paletteContainer.setDescription(Messages.RelationShips3Group_desc);
+ paletteContainer.add(createAbstraction1CreationTool());
+ paletteContainer.add(createAssociation2CreationTool());
+ paletteContainer.add(createAssociationClass3CreationTool());
+ paletteContainer.add(createDependency4CreationTool());
+ paletteContainer.add(createBranchDependencyCreationTool());
+ paletteContainer.add(createElementImport5CreationTool());
+ paletteContainer.add(createGeneralization6CreationTool());
+ paletteContainer.add(createInterfaceRealization7CreationTool());
+ paletteContainer.add(createPackageImport8CreationTool());
+ paletteContainer.add(createPackageMerge9CreationTool());
+ paletteContainer.add(createProfileApplication10CreationTool());
+ paletteContainer.add(createRealization11CreationTool());
+ paletteContainer.add(createSubstitution12CreationTool());
+ paletteContainer.add(createUsage13CreationTool());
+ paletteContainer.add(createTemplateBinding14CreationTool());
+ return paletteContainer;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createSignal7CreationTool() {
+ List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(2);
+ types.add(UMLElementTypes.Signal_2003);
+ types.add(UMLElementTypes.Signal_3022);
+ NodeToolEntry entry = new NodeToolEntry(Messages.Signal7CreationTool_title, Messages.Signal7CreationTool_desc, types);
+ entry.setSmallIcon(UMLElementTypes.getImageDescriptor(UMLElementTypes.Signal_2003));
+ entry.setLargeIcon(entry.getSmallIcon());
+ return entry;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createSlot4CreationTool() {
+ List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1);
+ types.add(UMLElementTypes.Slot_3001);
+ NodeToolEntry entry = new NodeToolEntry(Messages.Slot4CreationTool_title, Messages.Slot4CreationTool_desc, types);
+ entry.setSmallIcon(UMLElementTypes.getImageDescriptor(UMLElementTypes.Slot_3001));
+ entry.setLargeIcon(entry.getSmallIcon());
+ return entry;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createSubstitution12CreationTool() {
+ List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1);
+ types.add(UMLElementTypes.Substitution_4004);
+ LinkToolEntry entry = new LinkToolEntry(Messages.Substitution12CreationTool_title, Messages.Substitution12CreationTool_desc, types);
+ entry.setSmallIcon(UMLElementTypes.getImageDescriptor(UMLElementTypes.Substitution_4004));
+ entry.setLargeIcon(entry.getSmallIcon());
+ return entry;
+ }
+
+ /**
+ * Creates "Template" palette tool group
+ *
+ * @generated
+ */
+ private PaletteContainer createTemplate5Group() {
+ PaletteDrawer paletteContainer = new PaletteDrawer(Messages.Template5Group_title);
+ paletteContainer.setDescription(Messages.Template5Group_desc);
+ paletteContainer.add(createRedefinableTemplateSignature1CreationTool());
+ paletteContainer.add(createTemplateParameter2CreationTool());
+ return paletteContainer;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createTemplateBinding14CreationTool() {
+ List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1);
+ types.add(UMLElementTypes.TemplateBinding_4015);
+ LinkToolEntry entry = new LinkToolEntry(Messages.TemplateBinding14CreationTool_title, Messages.TemplateBinding14CreationTool_desc, types);
+ entry.setSmallIcon(UMLElementTypes.getImageDescriptor(UMLElementTypes.TemplateBinding_4015));
+ entry.setLargeIcon(entry.getSmallIcon());
+ return entry;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createTemplateParameter2CreationTool() {
+ List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1);
+ types.add(UMLElementTypes.TemplateParameter_3016);
+ NodeToolEntry entry = new NodeToolEntry(Messages.TemplateParameter2CreationTool_title, Messages.TemplateParameter2CreationTool_desc, types);
+ entry.setSmallIcon(UMLElementTypes.getImageDescriptor(UMLElementTypes.TemplateParameter_3016));
+ entry.setLargeIcon(entry.getSmallIcon());
+ return entry;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createUsage13CreationTool() {
+ List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1);
+ types.add(UMLElementTypes.Usage_4007);
+ LinkToolEntry entry = new LinkToolEntry(Messages.Usage13CreationTool_title, Messages.Usage13CreationTool_desc, types);
+ entry.setSmallIcon(UMLElementTypes.getImageDescriptor(UMLElementTypes.Usage_4007));
+ entry.setLargeIcon(entry.getSmallIcon());
+ return entry;
+ }
+
+ /**
+ * @generated
+ */
+ public void fillPalette(PaletteRoot paletteRoot) {
+ paletteRoot.add(createDefault1Group());
+ paletteRoot.add(createClassifiers2Group());
+ paletteRoot.add(createRelationShips3Group());
+ paletteRoot.add(createFeatures4Group());
+ paletteRoot.add(createTemplate5Group());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLUriEditorInputTester.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLUriEditorInputTester.java
new file mode 100644
index 00000000000..6225922f2ad
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLUriEditorInputTester.java
@@ -0,0 +1,35 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.part;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.emf.common.ui.URIEditorInput;
+
+/**
+ * @generated
+ */
+public class UMLUriEditorInputTester extends PropertyTester {
+
+ /**
+ * @generated
+ */
+ public boolean test(Object receiver, String method, Object[] args, Object expectedValue) {
+ if (false == receiver instanceof URIEditorInput) {
+ return false;
+ }
+ URIEditorInput editorInput = (URIEditorInput) receiver;
+ return "PapyrusUMLClass_diagram".equals(editorInput.getURI().fileExtension()); //$NON-NLS-1$
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLVisualIDRegistry.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLVisualIDRegistry.java
new file mode 100644
index 00000000000..34194ab07f0
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/UMLVisualIDRegistry.java
@@ -0,0 +1,1492 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.part;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.*;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * This registry is used to determine which type of visual object should be created for the corresponding Diagram, Node, ChildNode or Link represented by a domain model object.
+ *
+ * @generated
+ */
+public class UMLVisualIDRegistry {
+
+ /**
+ * @generated
+ */
+ private static final String DEBUG_KEY = "org.eclipse.papyrus.diagram.clazz/debug/visualID"; //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static int getVisualID(View view) {
+ if (view instanceof Diagram) {
+ if (ModelEditPart.MODEL_ID.equals(view.getType())) {
+ return ModelEditPart.VISUAL_ID;
+ } else {
+ return -1;
+ }
+ }
+ return org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry.getVisualID(view.getType());
+ }
+
+ /**
+ * @generated
+ */
+ public static String getModelID(View view) {
+ View diagram = view.getDiagram();
+ while (view != diagram) {
+ EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
+ if (annotation != null) {
+ return (String) annotation.getDetails().get("modelID"); //$NON-NLS-1$
+ }
+ view = (View) view.eContainer();
+ }
+ return diagram != null ? diagram.getType() : null;
+ }
+
+ /**
+ * @generated
+ */
+ public static int getVisualID(String type) {
+ try {
+ return Integer.parseInt(type);
+ } catch (NumberFormatException e) {
+ if (Boolean.TRUE.toString().equalsIgnoreCase(Platform.getDebugOption(DEBUG_KEY))) {
+ UMLDiagramEditorPlugin.getInstance().logError("Unable to parse view type as a visualID number: " + type);
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * @generated
+ */
+ public static String getType(int visualID) {
+ return String.valueOf(visualID);
+ }
+
+ /**
+ * @generated
+ */
+ public static int getDiagramVisualID(EObject domainElement) {
+ if (domainElement == null) {
+ return -1;
+ }
+ if (UMLPackage.eINSTANCE.getPackage().isSuperTypeOf(domainElement.eClass()) && isDiagram((Package) domainElement)) {
+ return ModelEditPart.VISUAL_ID;
+ }
+ return -1;
+ }
+
+ /**
+ * @generated
+ */
+ public static int getNodeVisualID(View containerView, EObject domainElement) {
+ if (domainElement == null) {
+ return -1;
+ }
+ String containerModelID = org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry.getModelID(containerView);
+ if (!ModelEditPart.MODEL_ID.equals(containerModelID)) {
+ return -1;
+ }
+ int containerVisualID;
+ if (ModelEditPart.MODEL_ID.equals(containerModelID)) {
+ containerVisualID = org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry.getVisualID(containerView);
+ } else {
+ if (containerView instanceof Diagram) {
+ containerVisualID = ModelEditPart.VISUAL_ID;
+ } else {
+ return -1;
+ }
+ }
+ switch (containerVisualID) {
+ case ComponentEditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getRedefinableTemplateSignature().isSuperTypeOf(domainElement.eClass())) {
+ return RedefinableTemplateSignatureEditPart.VISUAL_ID;
+ }
+ break;
+ case SignalEditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getRedefinableTemplateSignature().isSuperTypeOf(domainElement.eClass())) {
+ return RedefinableTemplateSignatureEditPart.VISUAL_ID;
+ }
+ break;
+ case InterfaceEditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getRedefinableTemplateSignature().isSuperTypeOf(domainElement.eClass())) {
+ return RedefinableTemplateSignatureEditPart.VISUAL_ID;
+ }
+ break;
+ case Model2EditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getRedefinableTemplateSignature().isSuperTypeOf(domainElement.eClass())) {
+ return RedefinableTemplateSignatureEditPart.VISUAL_ID;
+ }
+ break;
+ case PackageEditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getRedefinableTemplateSignature().isSuperTypeOf(domainElement.eClass())) {
+ return RedefinableTemplateSignatureEditPart.VISUAL_ID;
+ }
+ break;
+ case ClassEditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getRedefinableTemplateSignature().isSuperTypeOf(domainElement.eClass())) {
+ return RedefinableTemplateSignatureEditPart.VISUAL_ID;
+ }
+ break;
+ case DataTypeEditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getRedefinableTemplateSignature().isSuperTypeOf(domainElement.eClass())) {
+ return RedefinableTemplateSignatureEditPart.VISUAL_ID;
+ }
+ break;
+ case Component2EditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getRedefinableTemplateSignature().isSuperTypeOf(domainElement.eClass())) {
+ return RedefinableTemplateSignatureEditPart.VISUAL_ID;
+ }
+ break;
+ case Signal2EditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getRedefinableTemplateSignature().isSuperTypeOf(domainElement.eClass())) {
+ return RedefinableTemplateSignatureEditPart.VISUAL_ID;
+ }
+ break;
+ case Interface2EditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getRedefinableTemplateSignature().isSuperTypeOf(domainElement.eClass())) {
+ return RedefinableTemplateSignatureEditPart.VISUAL_ID;
+ }
+ break;
+ case Model3EditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getRedefinableTemplateSignature().isSuperTypeOf(domainElement.eClass())) {
+ return RedefinableTemplateSignatureEditPart.VISUAL_ID;
+ }
+ break;
+ case Package2EditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getRedefinableTemplateSignature().isSuperTypeOf(domainElement.eClass())) {
+ return RedefinableTemplateSignatureEditPart.VISUAL_ID;
+ }
+ break;
+ case Class4EditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getRedefinableTemplateSignature().isSuperTypeOf(domainElement.eClass())) {
+ return RedefinableTemplateSignatureEditPart.VISUAL_ID;
+ }
+ break;
+ case DataType2EditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getRedefinableTemplateSignature().isSuperTypeOf(domainElement.eClass())) {
+ return RedefinableTemplateSignatureEditPart.VISUAL_ID;
+ }
+ break;
+ case AssociationClassAttributeCompartmentEditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getProperty().isSuperTypeOf(domainElement.eClass())) {
+ return PropertyEditPart.VISUAL_ID;
+ }
+ break;
+ case InstanceSpecificationSlotCompartmentEditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getSlot().isSuperTypeOf(domainElement.eClass())) {
+ return SlotEditPart.VISUAL_ID;
+ }
+ break;
+ case ComponentAttributeCompartmentEditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getProperty().isSuperTypeOf(domainElement.eClass())) {
+ return PropertyEditPart.VISUAL_ID;
+ }
+ break;
+ case ComponentOperationCompartmentEditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getOperation().isSuperTypeOf(domainElement.eClass())) {
+ return OperationEditPart.VISUAL_ID;
+ }
+ break;
+ case ComponentNestedClassifierCompartmentEditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getClass_().isSuperTypeOf(domainElement.eClass())) {
+ return Class2EditPart.VISUAL_ID;
+ }
+ break;
+ case RedefinableTemplateSignatureTemplateParameterCompartmentEditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getTemplateParameter().isSuperTypeOf(domainElement.eClass())) {
+ return TemplateParameterEditPart.VISUAL_ID;
+ }
+ break;
+ case SignalAttributeCompartmentEditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getProperty().isSuperTypeOf(domainElement.eClass())) {
+ return Property2EditPart.VISUAL_ID;
+ }
+ break;
+ case InterfaceAttributeCompartmentEditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getProperty().isSuperTypeOf(domainElement.eClass())) {
+ return Property3EditPart.VISUAL_ID;
+ }
+ break;
+ case InterfaceOperationCompartmentEditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getOperation().isSuperTypeOf(domainElement.eClass())) {
+ return Operation2EditPart.VISUAL_ID;
+ }
+ break;
+ case InterfaceNestedClassifierCompartmentEditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getClass_().isSuperTypeOf(domainElement.eClass())) {
+ return Class3EditPart.VISUAL_ID;
+ }
+ break;
+ case ModelPackageableElementCompartmentEditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getInstanceSpecification().isSuperTypeOf(domainElement.eClass())) {
+ return InstanceSpecification2EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getComponent().isSuperTypeOf(domainElement.eClass())) {
+ return Component2EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getSignal().isSuperTypeOf(domainElement.eClass())) {
+ return Signal2EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getInterface().isSuperTypeOf(domainElement.eClass())) {
+ return Interface2EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getModel().isSuperTypeOf(domainElement.eClass())) {
+ return Model3EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getEnumeration().isSuperTypeOf(domainElement.eClass())) {
+ return Enumeration2EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getPackage().isSuperTypeOf(domainElement.eClass())) {
+ return Package2EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getClass_().isSuperTypeOf(domainElement.eClass())) {
+ return Class4EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getPrimitiveType().isSuperTypeOf(domainElement.eClass())) {
+ return PrimitiveType2EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getDataType().isSuperTypeOf(domainElement.eClass())) {
+ return DataType2EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getComment().isSuperTypeOf(domainElement.eClass())) {
+ return Comment2EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getConstraint().isSuperTypeOf(domainElement.eClass())) {
+ return Constraint2EditPart.VISUAL_ID;
+ }
+ break;
+ case InstanceSpecificationSlotCompartment2EditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getSlot().isSuperTypeOf(domainElement.eClass())) {
+ return SlotEditPart.VISUAL_ID;
+ }
+ break;
+ case ComponentAttributeCompartment2EditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getProperty().isSuperTypeOf(domainElement.eClass())) {
+ return PropertyEditPart.VISUAL_ID;
+ }
+ break;
+ case ComponentOperationCompartment2EditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getOperation().isSuperTypeOf(domainElement.eClass())) {
+ return OperationEditPart.VISUAL_ID;
+ }
+ break;
+ case ComponentNestedClassifierCompartment2EditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getClass_().isSuperTypeOf(domainElement.eClass())) {
+ return Class2EditPart.VISUAL_ID;
+ }
+ break;
+ case SignalAttributeCompartment2EditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getProperty().isSuperTypeOf(domainElement.eClass())) {
+ return Property2EditPart.VISUAL_ID;
+ }
+ break;
+ case InterfaceAttributeCompartment2EditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getProperty().isSuperTypeOf(domainElement.eClass())) {
+ return Property3EditPart.VISUAL_ID;
+ }
+ break;
+ case InterfaceOperationCompartment2EditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getOperation().isSuperTypeOf(domainElement.eClass())) {
+ return Operation2EditPart.VISUAL_ID;
+ }
+ break;
+ case InterfaceNestedClassifierCompartment2EditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getClass_().isSuperTypeOf(domainElement.eClass())) {
+ return Class3EditPart.VISUAL_ID;
+ }
+ break;
+ case ModelPackageableElementCompartment2EditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getInstanceSpecification().isSuperTypeOf(domainElement.eClass())) {
+ return InstanceSpecification2EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getComponent().isSuperTypeOf(domainElement.eClass())) {
+ return Component2EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getSignal().isSuperTypeOf(domainElement.eClass())) {
+ return Signal2EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getInterface().isSuperTypeOf(domainElement.eClass())) {
+ return Interface2EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getModel().isSuperTypeOf(domainElement.eClass())) {
+ return Model3EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getEnumeration().isSuperTypeOf(domainElement.eClass())) {
+ return Enumeration2EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getPackage().isSuperTypeOf(domainElement.eClass())) {
+ return Package2EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getClass_().isSuperTypeOf(domainElement.eClass())) {
+ return Class4EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getPrimitiveType().isSuperTypeOf(domainElement.eClass())) {
+ return PrimitiveType2EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getDataType().isSuperTypeOf(domainElement.eClass())) {
+ return DataType2EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getComment().isSuperTypeOf(domainElement.eClass())) {
+ return Comment2EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getConstraint().isSuperTypeOf(domainElement.eClass())) {
+ return Constraint2EditPart.VISUAL_ID;
+ }
+ break;
+ case EnumerationEnumerationLiteralCompartment2EditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getEnumerationLiteral().isSuperTypeOf(domainElement.eClass())) {
+ return EnumerationLiteralEditPart.VISUAL_ID;
+ }
+ break;
+ case PackagePackageableElementCompartmentEditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getInstanceSpecification().isSuperTypeOf(domainElement.eClass())) {
+ return InstanceSpecification2EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getComponent().isSuperTypeOf(domainElement.eClass())) {
+ return Component2EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getSignal().isSuperTypeOf(domainElement.eClass())) {
+ return Signal2EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getInterface().isSuperTypeOf(domainElement.eClass())) {
+ return Interface2EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getModel().isSuperTypeOf(domainElement.eClass())) {
+ return Model3EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getEnumeration().isSuperTypeOf(domainElement.eClass())) {
+ return Enumeration2EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getPackage().isSuperTypeOf(domainElement.eClass())) {
+ return Package2EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getClass_().isSuperTypeOf(domainElement.eClass())) {
+ return Class4EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getPrimitiveType().isSuperTypeOf(domainElement.eClass())) {
+ return PrimitiveType2EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getDataType().isSuperTypeOf(domainElement.eClass())) {
+ return DataType2EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getComment().isSuperTypeOf(domainElement.eClass())) {
+ return Comment2EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getConstraint().isSuperTypeOf(domainElement.eClass())) {
+ return Constraint2EditPart.VISUAL_ID;
+ }
+ break;
+ case ClassAttributeCompartmentEditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getProperty().isSuperTypeOf(domainElement.eClass())) {
+ return Property4EditPart.VISUAL_ID;
+ }
+ break;
+ case ClassOperationCompartmentEditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getReception().isSuperTypeOf(domainElement.eClass())) {
+ return ReceptionEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getOperation().isSuperTypeOf(domainElement.eClass())) {
+ return Operation3EditPart.VISUAL_ID;
+ }
+ break;
+ case ClassNestedClassifierCompartmentEditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getClass_().isSuperTypeOf(domainElement.eClass())) {
+ return Class5EditPart.VISUAL_ID;
+ }
+ break;
+ case DataTypeAttributeCompartment2EditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getProperty().isSuperTypeOf(domainElement.eClass())) {
+ return Property5EditPart.VISUAL_ID;
+ }
+ break;
+ case DataTypeOperationCompartment2EditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getOperation().isSuperTypeOf(domainElement.eClass())) {
+ return Operation4EditPart.VISUAL_ID;
+ }
+ break;
+ case EnumerationEnumerationLiteralCompartmentEditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getEnumerationLiteral().isSuperTypeOf(domainElement.eClass())) {
+ return EnumerationLiteralEditPart.VISUAL_ID;
+ }
+ break;
+ case PackagePackageableElementCompartment2EditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getInstanceSpecification().isSuperTypeOf(domainElement.eClass())) {
+ return InstanceSpecification2EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getComponent().isSuperTypeOf(domainElement.eClass())) {
+ return Component2EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getSignal().isSuperTypeOf(domainElement.eClass())) {
+ return Signal2EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getInterface().isSuperTypeOf(domainElement.eClass())) {
+ return Interface2EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getModel().isSuperTypeOf(domainElement.eClass())) {
+ return Model3EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getEnumeration().isSuperTypeOf(domainElement.eClass())) {
+ return Enumeration2EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getPackage().isSuperTypeOf(domainElement.eClass())) {
+ return Package2EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getClass_().isSuperTypeOf(domainElement.eClass())) {
+ return Class4EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getPrimitiveType().isSuperTypeOf(domainElement.eClass())) {
+ return PrimitiveType2EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getDataType().isSuperTypeOf(domainElement.eClass())) {
+ return DataType2EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getComment().isSuperTypeOf(domainElement.eClass())) {
+ return Comment2EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getConstraint().isSuperTypeOf(domainElement.eClass())) {
+ return Constraint2EditPart.VISUAL_ID;
+ }
+ break;
+ case ClassAttributeCompartment2EditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getProperty().isSuperTypeOf(domainElement.eClass())) {
+ return Property4EditPart.VISUAL_ID;
+ }
+ break;
+ case ClassOperationCompartment2EditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getReception().isSuperTypeOf(domainElement.eClass())) {
+ return ReceptionEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getOperation().isSuperTypeOf(domainElement.eClass())) {
+ return Operation3EditPart.VISUAL_ID;
+ }
+ break;
+ case ClassNestedClassifierCompartment2EditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getClass_().isSuperTypeOf(domainElement.eClass())) {
+ return Class5EditPart.VISUAL_ID;
+ }
+ break;
+ case DataTypeAttributeCompartmentEditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getProperty().isSuperTypeOf(domainElement.eClass())) {
+ return Property5EditPart.VISUAL_ID;
+ }
+ break;
+ case DataTypeOperationCompartmentEditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getOperation().isSuperTypeOf(domainElement.eClass())) {
+ return Operation4EditPart.VISUAL_ID;
+ }
+ break;
+ case ModelEditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getDependency().isSuperTypeOf(domainElement.eClass())) {
+ return Dependency2EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getAssociationClass().isSuperTypeOf(domainElement.eClass())) {
+ return AssociationClassEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getAssociation().isSuperTypeOf(domainElement.eClass())) {
+ return Association2EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getInstanceSpecification().isSuperTypeOf(domainElement.eClass())) {
+ return InstanceSpecificationEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getComponent().isSuperTypeOf(domainElement.eClass())) {
+ return ComponentEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getSignal().isSuperTypeOf(domainElement.eClass())) {
+ return SignalEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getInterface().isSuperTypeOf(domainElement.eClass())) {
+ return InterfaceEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getModel().isSuperTypeOf(domainElement.eClass())) {
+ return Model2EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getEnumeration().isSuperTypeOf(domainElement.eClass())) {
+ return EnumerationEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getPackage().isSuperTypeOf(domainElement.eClass())) {
+ return PackageEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getClass_().isSuperTypeOf(domainElement.eClass())) {
+ return ClassEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getPrimitiveType().isSuperTypeOf(domainElement.eClass())) {
+ return PrimitiveTypeEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getDataType().isSuperTypeOf(domainElement.eClass())) {
+ return DataTypeEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getConstraint().isSuperTypeOf(domainElement.eClass())) {
+ return ConstraintEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getComment().isSuperTypeOf(domainElement.eClass())) {
+ return CommentEditPart.VISUAL_ID;
+ }
+ break;
+ }
+ return -1;
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canCreateNode(View containerView, int nodeVisualID) {
+ String containerModelID = org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry.getModelID(containerView);
+ if (!ModelEditPart.MODEL_ID.equals(containerModelID)) {
+ return false;
+ }
+ int containerVisualID;
+ if (ModelEditPart.MODEL_ID.equals(containerModelID)) {
+ containerVisualID = org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry.getVisualID(containerView);
+ } else {
+ if (containerView instanceof Diagram) {
+ containerVisualID = ModelEditPart.VISUAL_ID;
+ } else {
+ return false;
+ }
+ }
+ switch (containerVisualID) {
+ case AssociationClassEditPart.VISUAL_ID:
+ if (AssociationClassNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (AssociationClassName2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (AssociationClassQualifiedNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (AssociationClassAttributeCompartmentEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case InstanceSpecificationEditPart.VISUAL_ID:
+ if (InstanceSpecificationNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (InstanceSpecificationName2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (InstanceSpecificationQualifiedNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (InstanceSpecificationSlotCompartmentEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case ComponentEditPart.VISUAL_ID:
+ if (ComponentNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ComponentName2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ComponentQualifiedNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ComponentAttributeCompartmentEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ComponentOperationCompartmentEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ComponentNestedClassifierCompartmentEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (RedefinableTemplateSignatureEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case SignalEditPart.VISUAL_ID:
+ if (SignalNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (SignalName2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (SignalQualifiedNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (SignalAttributeCompartmentEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (RedefinableTemplateSignatureEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case InterfaceEditPart.VISUAL_ID:
+ if (InterfaceNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (InterfaceName2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (InterfaceQualifiedNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (InterfaceAttributeCompartmentEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (InterfaceOperationCompartmentEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (InterfaceNestedClassifierCompartmentEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (RedefinableTemplateSignatureEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case Model2EditPart.VISUAL_ID:
+ if (ModelNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ModelName2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ModelQualifiedNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ModelPackageableElementCompartmentEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (RedefinableTemplateSignatureEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case EnumerationEditPart.VISUAL_ID:
+ if (EnumerationNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (EnumerationName2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (EnumerationQualifiedNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (EnumerationEnumerationLiteralCompartmentEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case PackageEditPart.VISUAL_ID:
+ if (PackageNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (PackageName2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (PackageQualifiedNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (PackagePackageableElementCompartment2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (RedefinableTemplateSignatureEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case ClassEditPart.VISUAL_ID:
+ if (ClassNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ClassName2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ClassQualifiedNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ClassAttributeCompartment2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ClassOperationCompartment2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ClassNestedClassifierCompartment2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (RedefinableTemplateSignatureEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case PrimitiveTypeEditPart.VISUAL_ID:
+ if (PrimitiveTypeNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (PrimitiveTypeName2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (PrimitiveTypeQualifiedNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case DataTypeEditPart.VISUAL_ID:
+ if (DataTypeNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (DataTypeName2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (DataTypeQualifiedNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (DataTypeAttributeCompartmentEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (DataTypeOperationCompartmentEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (RedefinableTemplateSignatureEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case ConstraintEditPart.VISUAL_ID:
+ if (ConstraintNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case CommentEditPart.VISUAL_ID:
+ if (CommentBodyEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case RedefinableTemplateSignatureEditPart.VISUAL_ID:
+ if (RedefinableTemplateSignatureTemplateParameterCompartmentEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case InstanceSpecification2EditPart.VISUAL_ID:
+ if (InstanceSpecificationName3EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (InstanceSpecificationName4EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (InstanceSpecificationQualifiedName2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (InstanceSpecificationSlotCompartment2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case Component2EditPart.VISUAL_ID:
+ if (ComponentName3EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ComponentName4EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ComponentQualifiedName2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ComponentAttributeCompartment2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ComponentOperationCompartment2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ComponentNestedClassifierCompartment2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (RedefinableTemplateSignatureEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case Signal2EditPart.VISUAL_ID:
+ if (SignalName3EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (SignalName4EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (SignalQualifiedName2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (SignalAttributeCompartment2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (RedefinableTemplateSignatureEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case Interface2EditPart.VISUAL_ID:
+ if (InterfaceName3EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (InterfaceName4EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (InterfaceQualifiedName2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (InterfaceAttributeCompartment2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (InterfaceOperationCompartment2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (InterfaceNestedClassifierCompartment2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (RedefinableTemplateSignatureEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case Model3EditPart.VISUAL_ID:
+ if (ModelName3EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ModelName4EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ModelQualifiedName2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ModelPackageableElementCompartment2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (RedefinableTemplateSignatureEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case Enumeration2EditPart.VISUAL_ID:
+ if (EnumerationName3EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (EnumerationName4EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (EnumerationQualifiedName2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (EnumerationEnumerationLiteralCompartment2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case Package2EditPart.VISUAL_ID:
+ if (PackageName3EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (PackageName4EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (PackageQualifiedName2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (PackagePackageableElementCompartmentEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (RedefinableTemplateSignatureEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case Class4EditPart.VISUAL_ID:
+ if (ClassName3EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ClassName4EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ClassQualifiedName2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ClassAttributeCompartmentEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ClassOperationCompartmentEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ClassNestedClassifierCompartmentEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (RedefinableTemplateSignatureEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case PrimitiveType2EditPart.VISUAL_ID:
+ if (PrimitiveTypeName3EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (PrimitiveTypeName4EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (PrimitiveTypeQualifiedName2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case DataType2EditPart.VISUAL_ID:
+ if (DataTypeName3EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (DataTypeName4EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (DataTypeQualifiedName2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (DataTypeAttributeCompartment2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (DataTypeOperationCompartment2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (RedefinableTemplateSignatureEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case Comment2EditPart.VISUAL_ID:
+ if (CommentBody2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case Constraint2EditPart.VISUAL_ID:
+ if (ConstraintName2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case AssociationClassAttributeCompartmentEditPart.VISUAL_ID:
+ if (PropertyEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case InstanceSpecificationSlotCompartmentEditPart.VISUAL_ID:
+ if (SlotEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case ComponentAttributeCompartmentEditPart.VISUAL_ID:
+ if (PropertyEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case ComponentOperationCompartmentEditPart.VISUAL_ID:
+ if (OperationEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case ComponentNestedClassifierCompartmentEditPart.VISUAL_ID:
+ if (Class2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case RedefinableTemplateSignatureTemplateParameterCompartmentEditPart.VISUAL_ID:
+ if (TemplateParameterEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case SignalAttributeCompartmentEditPart.VISUAL_ID:
+ if (Property2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case InterfaceAttributeCompartmentEditPart.VISUAL_ID:
+ if (Property3EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case InterfaceOperationCompartmentEditPart.VISUAL_ID:
+ if (Operation2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case InterfaceNestedClassifierCompartmentEditPart.VISUAL_ID:
+ if (Class3EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case ModelPackageableElementCompartmentEditPart.VISUAL_ID:
+ if (InstanceSpecification2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (Component2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (Signal2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (Interface2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (Model3EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (Enumeration2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (Package2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (Class4EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (PrimitiveType2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (DataType2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (Comment2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (Constraint2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case InstanceSpecificationSlotCompartment2EditPart.VISUAL_ID:
+ if (SlotEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case ComponentAttributeCompartment2EditPart.VISUAL_ID:
+ if (PropertyEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case ComponentOperationCompartment2EditPart.VISUAL_ID:
+ if (OperationEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case ComponentNestedClassifierCompartment2EditPart.VISUAL_ID:
+ if (Class2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case SignalAttributeCompartment2EditPart.VISUAL_ID:
+ if (Property2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case InterfaceAttributeCompartment2EditPart.VISUAL_ID:
+ if (Property3EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case InterfaceOperationCompartment2EditPart.VISUAL_ID:
+ if (Operation2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case InterfaceNestedClassifierCompartment2EditPart.VISUAL_ID:
+ if (Class3EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case ModelPackageableElementCompartment2EditPart.VISUAL_ID:
+ if (InstanceSpecification2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (Component2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (Signal2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (Interface2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (Model3EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (Enumeration2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (Package2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (Class4EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (PrimitiveType2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (DataType2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (Comment2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (Constraint2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case EnumerationEnumerationLiteralCompartment2EditPart.VISUAL_ID:
+ if (EnumerationLiteralEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case PackagePackageableElementCompartmentEditPart.VISUAL_ID:
+ if (InstanceSpecification2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (Component2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (Signal2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (Interface2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (Model3EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (Enumeration2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (Package2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (Class4EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (PrimitiveType2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (DataType2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (Comment2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (Constraint2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case ClassAttributeCompartmentEditPart.VISUAL_ID:
+ if (Property4EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case ClassOperationCompartmentEditPart.VISUAL_ID:
+ if (ReceptionEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (Operation3EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case ClassNestedClassifierCompartmentEditPart.VISUAL_ID:
+ if (Class5EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case DataTypeAttributeCompartment2EditPart.VISUAL_ID:
+ if (Property5EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case DataTypeOperationCompartment2EditPart.VISUAL_ID:
+ if (Operation4EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case EnumerationEnumerationLiteralCompartmentEditPart.VISUAL_ID:
+ if (EnumerationLiteralEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case PackagePackageableElementCompartment2EditPart.VISUAL_ID:
+ if (InstanceSpecification2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (Component2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (Signal2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (Interface2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (Model3EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (Enumeration2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (Package2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (Class4EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (PrimitiveType2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (DataType2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (Comment2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (Constraint2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case ClassAttributeCompartment2EditPart.VISUAL_ID:
+ if (Property4EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case ClassOperationCompartment2EditPart.VISUAL_ID:
+ if (ReceptionEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (Operation3EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case ClassNestedClassifierCompartment2EditPart.VISUAL_ID:
+ if (Class5EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case DataTypeAttributeCompartmentEditPart.VISUAL_ID:
+ if (Property5EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case DataTypeOperationCompartmentEditPart.VISUAL_ID:
+ if (Operation4EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case ModelEditPart.VISUAL_ID:
+ if (Dependency2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (AssociationClassEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (Association2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (InstanceSpecificationEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ComponentEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (SignalEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (InterfaceEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (Model2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (EnumerationEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (PackageEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ClassEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (PrimitiveTypeEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (DataTypeEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ConstraintEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (CommentEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case AssociationEditPart.VISUAL_ID:
+ if (AssociationNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (AssociationName2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (AssociationName3EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (AssociationName4EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (AssociationName5EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (AssociationName6EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case GeneralizationEditPart.VISUAL_ID:
+ if (GeneralizationIsSubstitutableEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case InterfaceRealizationEditPart.VISUAL_ID:
+ if (InterfaceRealizationNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (InterfaceRealizationName2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case SubstitutionEditPart.VISUAL_ID:
+ if (SubstitutionNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (SubstitutionName2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case RealizationEditPart.VISUAL_ID:
+ if (RealizationNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (RealizationName2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case AbstractionEditPart.VISUAL_ID:
+ if (AbstractionNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (AbstractionName2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case UsageEditPart.VISUAL_ID:
+ if (UsageNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (UsageName2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case DependencyEditPart.VISUAL_ID:
+ if (DependencyNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (DependencyName2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case Dependency3EditPart.VISUAL_ID:
+ if (DependencyName3EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (DependencyName4EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case ElementImportEditPart.VISUAL_ID:
+ if (ElementImportAliasEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ElementImportAlias2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case PackageImportEditPart.VISUAL_ID:
+ if (PackageImportVisibilityEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case TemplateBindingEditPart.VISUAL_ID:
+ if (WrappingLabelEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public static int getLinkWithClassVisualID(EObject domainElement) {
+ if (domainElement == null) {
+ return -1;
+ }
+ if (UMLPackage.eINSTANCE.getAssociationClass().isSuperTypeOf(domainElement.eClass())) {
+ return AssociationClass2EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getAssociation().isSuperTypeOf(domainElement.eClass())) {
+ return AssociationEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getAssociation().isSuperTypeOf(domainElement.eClass())) {
+ return Association3EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getGeneralization().isSuperTypeOf(domainElement.eClass())) {
+ return GeneralizationEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getInterfaceRealization().isSuperTypeOf(domainElement.eClass())) {
+ return InterfaceRealizationEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getSubstitution().isSuperTypeOf(domainElement.eClass())) {
+ return SubstitutionEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getRealization().isSuperTypeOf(domainElement.eClass())) {
+ return RealizationEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getAbstraction().isSuperTypeOf(domainElement.eClass())) {
+ return AbstractionEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getUsage().isSuperTypeOf(domainElement.eClass())) {
+ return UsageEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getDependency().isSuperTypeOf(domainElement.eClass())) {
+ return DependencyEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getDependency().isSuperTypeOf(domainElement.eClass())) {
+ return Dependency3EditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getElementImport().isSuperTypeOf(domainElement.eClass())) {
+ return ElementImportEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getPackageImport().isSuperTypeOf(domainElement.eClass())) {
+ return PackageImportEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getPackageMerge().isSuperTypeOf(domainElement.eClass())) {
+ return PackageMergeEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getProfileApplication().isSuperTypeOf(domainElement.eClass())) {
+ return ProfileApplicationEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getTemplateBinding().isSuperTypeOf(domainElement.eClass())) {
+ return TemplateBindingEditPart.VISUAL_ID;
+ }
+ return -1;
+ }
+
+ /**
+ * User can change implementation of this method to handle some specific situations not covered by default logic.
+ *
+ * @generated
+ */
+ private static boolean isDiagram(Package element) {
+ return true;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/ValidateAction.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/ValidateAction.java
new file mode 100644
index 00000000000..8151028635c
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/part/ValidateAction.java
@@ -0,0 +1,274 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.part;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.emf.common.util.Diagnostic;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.Diagnostician;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.emf.validation.model.EvaluationMode;
+import org.eclipse.emf.validation.model.IConstraintStatus;
+import org.eclipse.emf.validation.service.IBatchValidator;
+import org.eclipse.emf.validation.service.ModelValidationService;
+import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
+import org.eclipse.gef.EditPartViewer;
+import org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor;
+import org.eclipse.gmf.runtime.diagram.ui.OffscreenEditPartFactory;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart;
+import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLMarkerNavigationProvider;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLValidationProvider;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation;
+
+/**
+ * @generated
+ */
+public class ValidateAction extends Action {
+
+ /**
+ * @generated
+ */
+ public static final String VALIDATE_ACTION_KEY = "validateAction"; //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ private IWorkbenchPartDescriptor workbenchPartDescriptor;
+
+ /**
+ * @generated
+ */
+ public ValidateAction(IWorkbenchPartDescriptor workbenchPartDescriptor) {
+ setId(VALIDATE_ACTION_KEY);
+ setText(Messages.ValidateActionMessage);
+ this.workbenchPartDescriptor = workbenchPartDescriptor;
+ }
+
+ /**
+ * @generated
+ */
+ public void run() {
+ IWorkbenchPart workbenchPart = workbenchPartDescriptor.getPartPage().getActivePart();
+ if (workbenchPart instanceof IDiagramWorkbenchPart) {
+ final IDiagramWorkbenchPart part = (IDiagramWorkbenchPart) workbenchPart;
+ try {
+ new WorkspaceModifyDelegatingOperation(new IRunnableWithProgress() {
+
+ public void run(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
+ runValidation(part.getDiagramEditPart(), part.getDiagram());
+ }
+ }).run(new NullProgressMonitor());
+ } catch (Exception e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Validation action failed", e); //$NON-NLS-1$
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void runValidation(View view) {
+ try {
+ if (UMLDiagramEditorUtil.openDiagram(view.eResource())) {
+ IEditorPart editorPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ if (editorPart instanceof IDiagramWorkbenchPart) {
+ runValidation(((IDiagramWorkbenchPart) editorPart).getDiagramEditPart(), view);
+ } else {
+ runNonUIValidation(view);
+ }
+ }
+ } catch (Exception e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Validation action failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void runNonUIValidation(View view) {
+ DiagramEditPart diagramEditPart = OffscreenEditPartFactory.getInstance().createDiagramEditPart(view.getDiagram());
+ runValidation(diagramEditPart, view);
+ }
+
+ /**
+ * @generated
+ */
+ public static void runValidation(DiagramEditPart diagramEditPart, View view) {
+ final DiagramEditPart fpart = diagramEditPart;
+ final View fview = view;
+ TransactionalEditingDomain txDomain = TransactionUtil.getEditingDomain(view);
+ UMLValidationProvider.runWithConstraints(txDomain, new Runnable() {
+
+ public void run() {
+ validate(fpart, fview);
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ private static Diagnostic runEMFValidator(View target) {
+ if (target.isSetElement() && target.getElement() != null) {
+ return new Diagnostician() {
+
+ public String getObjectLabel(EObject eObject) {
+ return EMFCoreUtil.getQualifiedName(eObject, true);
+ }
+ }.validate(target.getElement());
+ }
+ return Diagnostic.OK_INSTANCE;
+ }
+
+ /**
+ * @generated
+ */
+ private static void validate(DiagramEditPart diagramEditPart, View view) {
+ IFile target = view.eResource() != null ? WorkspaceSynchronizer.getFile(view.eResource()) : null;
+ if (target != null) {
+ UMLMarkerNavigationProvider.deleteMarkers(target);
+ }
+ Diagnostic diagnostic = runEMFValidator(view);
+ createMarkers(target, diagnostic, diagramEditPart);
+ IBatchValidator validator = (IBatchValidator) ModelValidationService.getInstance().newValidator(EvaluationMode.BATCH);
+ validator.setIncludeLiveConstraints(true);
+ if (view.isSetElement() && view.getElement() != null) {
+ IStatus status = validator.validate(view.getElement());
+ createMarkers(target, status, diagramEditPart);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private static void createMarkers(IFile target, IStatus validationStatus, DiagramEditPart diagramEditPart) {
+ if (validationStatus.isOK()) {
+ return;
+ }
+ final IStatus rootStatus = validationStatus;
+ List allStatuses = new ArrayList();
+ UMLDiagramEditorUtil.LazyElement2ViewMap element2ViewMap = new UMLDiagramEditorUtil.LazyElement2ViewMap(diagramEditPart.getDiagramView(), collectTargetElements(rootStatus, new HashSet(),
+ allStatuses));
+ for (Iterator it = allStatuses.iterator(); it.hasNext();) {
+ IConstraintStatus nextStatus = (IConstraintStatus) it.next();
+ View view = UMLDiagramEditorUtil.findView(diagramEditPart, nextStatus.getTarget(), element2ViewMap);
+ addMarker(diagramEditPart.getViewer(), target, view.eResource().getURIFragment(view), EMFCoreUtil.getQualifiedName(nextStatus.getTarget(), true), nextStatus.getMessage(), nextStatus
+ .getSeverity());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private static void createMarkers(IFile target, Diagnostic emfValidationStatus, DiagramEditPart diagramEditPart) {
+ if (emfValidationStatus.getSeverity() == Diagnostic.OK) {
+ return;
+ }
+ final Diagnostic rootStatus = emfValidationStatus;
+ List allDiagnostics = new ArrayList();
+ UMLDiagramEditorUtil.LazyElement2ViewMap element2ViewMap = new UMLDiagramEditorUtil.LazyElement2ViewMap(diagramEditPart.getDiagramView(), collectTargetElements(rootStatus, new HashSet(),
+ allDiagnostics));
+ for (Iterator it = emfValidationStatus.getChildren().iterator(); it.hasNext();) {
+ Diagnostic nextDiagnostic = (Diagnostic) it.next();
+ List data = nextDiagnostic.getData();
+ if (data != null && !data.isEmpty() && data.get(0) instanceof EObject) {
+ EObject element = (EObject) data.get(0);
+ View view = UMLDiagramEditorUtil.findView(diagramEditPart, element, element2ViewMap);
+ addMarker(diagramEditPart.getViewer(), target, view.eResource().getURIFragment(view), EMFCoreUtil.getQualifiedName(element, true), nextDiagnostic.getMessage(),
+ diagnosticToStatusSeverity(nextDiagnostic.getSeverity()));
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private static void addMarker(EditPartViewer viewer, IFile target, String elementId, String location, String message, int statusSeverity) {
+ if (target == null) {
+ return;
+ }
+ UMLMarkerNavigationProvider.addMarker(target, elementId, location, message, statusSeverity);
+ }
+
+ /**
+ * @generated
+ */
+ private static int diagnosticToStatusSeverity(int diagnosticSeverity) {
+ if (diagnosticSeverity == Diagnostic.OK) {
+ return IStatus.OK;
+ } else if (diagnosticSeverity == Diagnostic.INFO) {
+ return IStatus.INFO;
+ } else if (diagnosticSeverity == Diagnostic.WARNING) {
+ return IStatus.WARNING;
+ } else if (diagnosticSeverity == Diagnostic.ERROR || diagnosticSeverity == Diagnostic.CANCEL) {
+ return IStatus.ERROR;
+ }
+ return IStatus.INFO;
+ }
+
+ /**
+ * @generated
+ */
+ private static Set collectTargetElements(IStatus status, Set targetElementCollector, List allConstraintStatuses) {
+ if (status instanceof IConstraintStatus) {
+ targetElementCollector.add(((IConstraintStatus) status).getTarget());
+ allConstraintStatuses.add(status);
+ }
+ if (status.isMultiStatus()) {
+ IStatus[] children = status.getChildren();
+ for (int i = 0; i < children.length; i++) {
+ collectTargetElements(children[i], targetElementCollector, allConstraintStatuses);
+ }
+ }
+ return targetElementCollector;
+ }
+
+ /**
+ * @generated
+ */
+ private static Set collectTargetElements(Diagnostic diagnostic, Set targetElementCollector, List allDiagnostics) {
+ List data = diagnostic.getData();
+ EObject target = null;
+ if (data != null && !data.isEmpty() && data.get(0) instanceof EObject) {
+ target = (EObject) data.get(0);
+ targetElementCollector.add(target);
+ allDiagnostics.add(diagnostic);
+ }
+ if (diagnostic.getChildren() != null && !diagnostic.getChildren().isEmpty()) {
+ for (Iterator it = diagnostic.getChildren().iterator(); it.hasNext();) {
+ collectTargetElements((Diagnostic) it.next(), targetElementCollector, allDiagnostics);
+ }
+ }
+ return targetElementCollector;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/AbstractionPreferencePage.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/AbstractionPreferencePage.java
new file mode 100644
index 00000000000..5b3efc756d8
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/AbstractionPreferencePage.java
@@ -0,0 +1,119 @@
+/****************************************************************************
+ * Copyright (c) 2008 Atos Origin.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thibault Landre (Atos Origin) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.preferences.pages.AbstractPapyrusLinkPreferencePage;
+
+/**
+ * @generated
+ */
+public class AbstractionPreferencePage extends AbstractPapyrusLinkPreferencePage {
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(IPreferenceStore store) {
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.getInstance().ID;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontColorPreferenceName() {
+ return IPapyrusPreferencesConstant.ABSTRACTION_PREF_SMOOTHNESS;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontPreferenceName() {
+ return IPapyrusPreferencesConstant.ABSTRACTION_PREF_FONT;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getJumpLinkReversePreferenceName() {
+ return IPapyrusPreferencesConstant.ABSTRACTION_PREF_JUMPLINK_REVERSE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getJumpLinkStatusPreferenceName() {
+ return IPapyrusPreferencesConstant.ABSTRACTION_PREF_JUMPLINK_STATUS;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getJumpLinkTypePreferenceName() {
+ return IPapyrusPreferencesConstant.ABSTRACTION_PREF_JUMPLINK_TYPE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getLineColorPreferenceName() {
+ return IPapyrusPreferencesConstant.ABSTRACTION_PREF_LINE_COLOR;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getRoutingDistancePolicyPreferenceName() {
+ return IPapyrusPreferencesConstant.ABSTRACTION_PREF_ROUTING_DISTANCE_POLICY;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getRoutingObstructionPolicyPreferenceName() {
+ return IPapyrusPreferencesConstant.ABSTRACTION_PREF_ROUTING_OBSTRUCTION_POLICY;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getRoutingStylePreferenceName() {
+ return IPapyrusPreferencesConstant.ABSTRACTION_PREF_ROUTING_STYLE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getSmoothnessPreferenceName() {
+ return IPapyrusPreferencesConstant.ABSTRACTION_PREF_SMOOTHNESS;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/AssociationClass_2013PreferencePage.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/AssociationClass_2013PreferencePage.java
new file mode 100644
index 00000000000..bad86616121
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/AssociationClass_2013PreferencePage.java
@@ -0,0 +1,71 @@
+/****************************************************************************
+ * Copyright (c) 2008 Atos Origin.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thibault Landre (Atos Origin) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.preferences.pages.AbstractPapyrusNodePreferencePage;
+
+/**
+ * @generated
+ */
+public class AssociationClass_2013PreferencePage extends AbstractPapyrusNodePreferencePage {
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(IPreferenceStore store) {
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.getInstance().ID;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFillColorPreferenceName() {
+ return IPapyrusPreferencesConstant.ASSOCIATIONCLASS_2013_PREF_FILL_COLOR;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontColorPreferenceName() {
+ return IPapyrusPreferencesConstant.ASSOCIATIONCLASS_2013_PREF_FONT_COLOR;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontPreferenceName() {
+ return IPapyrusPreferencesConstant.ASSOCIATIONCLASS_2013_PREF_FONT;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getLineColorPreferenceName() {
+ return IPapyrusPreferencesConstant.ASSOCIATIONCLASS_2013_PREF_LINE_COLOR;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/AssociationPreferencePage.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/AssociationPreferencePage.java
new file mode 100644
index 00000000000..bb12ce24d47
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/AssociationPreferencePage.java
@@ -0,0 +1,119 @@
+/****************************************************************************
+ * Copyright (c) 2008 Atos Origin.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thibault Landre (Atos Origin) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.preferences.pages.AbstractPapyrusLinkPreferencePage;
+
+/**
+ * @generated
+ */
+public class AssociationPreferencePage extends AbstractPapyrusLinkPreferencePage {
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(IPreferenceStore store) {
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.getInstance().ID;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontColorPreferenceName() {
+ return IPapyrusPreferencesConstant.ASSOCIATION_PREF_SMOOTHNESS;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontPreferenceName() {
+ return IPapyrusPreferencesConstant.ASSOCIATION_PREF_FONT;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getJumpLinkReversePreferenceName() {
+ return IPapyrusPreferencesConstant.ASSOCIATION_PREF_JUMPLINK_REVERSE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getJumpLinkStatusPreferenceName() {
+ return IPapyrusPreferencesConstant.ASSOCIATION_PREF_JUMPLINK_STATUS;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getJumpLinkTypePreferenceName() {
+ return IPapyrusPreferencesConstant.ASSOCIATION_PREF_JUMPLINK_TYPE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getLineColorPreferenceName() {
+ return IPapyrusPreferencesConstant.ASSOCIATION_PREF_LINE_COLOR;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getRoutingDistancePolicyPreferenceName() {
+ return IPapyrusPreferencesConstant.ASSOCIATION_PREF_ROUTING_DISTANCE_POLICY;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getRoutingObstructionPolicyPreferenceName() {
+ return IPapyrusPreferencesConstant.ASSOCIATION_PREF_ROUTING_OBSTRUCTION_POLICY;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getRoutingStylePreferenceName() {
+ return IPapyrusPreferencesConstant.ASSOCIATION_PREF_ROUTING_STYLE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getSmoothnessPreferenceName() {
+ return IPapyrusPreferencesConstant.ASSOCIATION_PREF_SMOOTHNESS;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/ClassDiagramPreferencePage.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/ClassDiagramPreferencePage.java
new file mode 100644
index 00000000000..155617d0df5
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/ClassDiagramPreferencePage.java
@@ -0,0 +1,45 @@
+/****************************************************************************
+ * Copyright (c) 2008 Atos Origin.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thibault Landre (Atos Origin) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.preferences.pages.AbstractPapyrusPreferencePage;
+import org.eclipse.swt.widgets.Composite;
+
+public class ClassDiagramPreferencePage extends AbstractPapyrusPreferencePage {
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(IPreferenceStore store) {
+ // Do nothing
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createPageContents(Composite parent) {
+ // Do nothing
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.getInstance().ID;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/Class_2008PreferencePage.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/Class_2008PreferencePage.java
new file mode 100644
index 00000000000..267517df7ce
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/Class_2008PreferencePage.java
@@ -0,0 +1,71 @@
+/****************************************************************************
+ * Copyright (c) 2008 Atos Origin.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thibault Landre (Atos Origin) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.preferences.pages.AbstractPapyrusNodePreferencePage;
+
+/**
+ * @generated
+ */
+public class Class_2008PreferencePage extends AbstractPapyrusNodePreferencePage {
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(IPreferenceStore store) {
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.getInstance().ID;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFillColorPreferenceName() {
+ return IPapyrusPreferencesConstant.CLASS_2008_PREF_FILL_COLOR;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontColorPreferenceName() {
+ return IPapyrusPreferencesConstant.CLASS_2008_PREF_FONT_COLOR;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontPreferenceName() {
+ return IPapyrusPreferencesConstant.CLASS_2008_PREF_FONT;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getLineColorPreferenceName() {
+ return IPapyrusPreferencesConstant.CLASS_2008_PREF_LINE_COLOR;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/Comment_2012PreferencePage.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/Comment_2012PreferencePage.java
new file mode 100644
index 00000000000..fe8fbf1576e
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/Comment_2012PreferencePage.java
@@ -0,0 +1,71 @@
+/****************************************************************************
+ * Copyright (c) 2008 Atos Origin.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thibault Landre (Atos Origin) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.preferences.pages.AbstractPapyrusNodePreferencePage;
+
+/**
+ * @generated
+ */
+public class Comment_2012PreferencePage extends AbstractPapyrusNodePreferencePage {
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(IPreferenceStore store) {
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.getInstance().ID;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFillColorPreferenceName() {
+ return IPapyrusPreferencesConstant.COMMENT_2012_PREF_FILL_COLOR;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontColorPreferenceName() {
+ return IPapyrusPreferencesConstant.COMMENT_2012_PREF_FONT_COLOR;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontPreferenceName() {
+ return IPapyrusPreferencesConstant.COMMENT_2012_PREF_FONT;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getLineColorPreferenceName() {
+ return IPapyrusPreferencesConstant.COMMENT_2012_PREF_LINE_COLOR;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/Component_2002PreferencePage.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/Component_2002PreferencePage.java
new file mode 100644
index 00000000000..c7692809110
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/Component_2002PreferencePage.java
@@ -0,0 +1,71 @@
+/****************************************************************************
+ * Copyright (c) 2008 Atos Origin.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thibault Landre (Atos Origin) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.preferences.pages.AbstractPapyrusNodePreferencePage;
+
+/**
+ * @generated
+ */
+public class Component_2002PreferencePage extends AbstractPapyrusNodePreferencePage {
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(IPreferenceStore store) {
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.getInstance().ID;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFillColorPreferenceName() {
+ return IPapyrusPreferencesConstant.COMPONENT_2002_PREF_FILL_COLOR;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontColorPreferenceName() {
+ return IPapyrusPreferencesConstant.COMPONENT_2002_PREF_FONT_COLOR;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontPreferenceName() {
+ return IPapyrusPreferencesConstant.COMPONENT_2002_PREF_FONT;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getLineColorPreferenceName() {
+ return IPapyrusPreferencesConstant.COMPONENT_2002_PREF_LINE_COLOR;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/Constraint_2011PreferencePage.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/Constraint_2011PreferencePage.java
new file mode 100644
index 00000000000..b3300e9b329
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/Constraint_2011PreferencePage.java
@@ -0,0 +1,71 @@
+/****************************************************************************
+ * Copyright (c) 2008 Atos Origin.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thibault Landre (Atos Origin) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.preferences.pages.AbstractPapyrusNodePreferencePage;
+
+/**
+ * @generated
+ */
+public class Constraint_2011PreferencePage extends AbstractPapyrusNodePreferencePage {
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(IPreferenceStore store) {
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.getInstance().ID;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFillColorPreferenceName() {
+ return IPapyrusPreferencesConstant.CONSTRAINT_2011_PREF_FILL_COLOR;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontColorPreferenceName() {
+ return IPapyrusPreferencesConstant.CONSTRAINT_2011_PREF_FONT_COLOR;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontPreferenceName() {
+ return IPapyrusPreferencesConstant.CONSTRAINT_2011_PREF_FONT;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getLineColorPreferenceName() {
+ return IPapyrusPreferencesConstant.CONSTRAINT_2011_PREF_LINE_COLOR;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/DataType_2010PreferencePage.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/DataType_2010PreferencePage.java
new file mode 100644
index 00000000000..5e2d9f1b5f7
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/DataType_2010PreferencePage.java
@@ -0,0 +1,71 @@
+/****************************************************************************
+ * Copyright (c) 2008 Atos Origin.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thibault Landre (Atos Origin) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.preferences.pages.AbstractPapyrusNodePreferencePage;
+
+/**
+ * @generated
+ */
+public class DataType_2010PreferencePage extends AbstractPapyrusNodePreferencePage {
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(IPreferenceStore store) {
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.getInstance().ID;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFillColorPreferenceName() {
+ return IPapyrusPreferencesConstant.DATATYPE_2010_PREF_FILL_COLOR;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontColorPreferenceName() {
+ return IPapyrusPreferencesConstant.DATATYPE_2010_PREF_FONT_COLOR;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontPreferenceName() {
+ return IPapyrusPreferencesConstant.DATATYPE_2010_PREF_FONT;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getLineColorPreferenceName() {
+ return IPapyrusPreferencesConstant.DATATYPE_2010_PREF_LINE_COLOR;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/DependencyPreferencePage.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/DependencyPreferencePage.java
new file mode 100644
index 00000000000..95398ec5771
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/DependencyPreferencePage.java
@@ -0,0 +1,119 @@
+/****************************************************************************
+ * Copyright (c) 2008 Atos Origin.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thibault Landre (Atos Origin) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.preferences.pages.AbstractPapyrusLinkPreferencePage;
+
+/**
+ * @generated
+ */
+public class DependencyPreferencePage extends AbstractPapyrusLinkPreferencePage {
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(IPreferenceStore store) {
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.getInstance().ID;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontColorPreferenceName() {
+ return IPapyrusPreferencesConstant.DEPENDENCY_PREF_SMOOTHNESS;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontPreferenceName() {
+ return IPapyrusPreferencesConstant.DEPENDENCY_PREF_FONT;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getJumpLinkReversePreferenceName() {
+ return IPapyrusPreferencesConstant.DEPENDENCY_PREF_JUMPLINK_REVERSE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getJumpLinkStatusPreferenceName() {
+ return IPapyrusPreferencesConstant.DEPENDENCY_PREF_JUMPLINK_STATUS;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getJumpLinkTypePreferenceName() {
+ return IPapyrusPreferencesConstant.DEPENDENCY_PREF_JUMPLINK_TYPE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getLineColorPreferenceName() {
+ return IPapyrusPreferencesConstant.DEPENDENCY_PREF_LINE_COLOR;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getRoutingDistancePolicyPreferenceName() {
+ return IPapyrusPreferencesConstant.DEPENDENCY_PREF_ROUTING_DISTANCE_POLICY;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getRoutingObstructionPolicyPreferenceName() {
+ return IPapyrusPreferencesConstant.DEPENDENCY_PREF_ROUTING_OBSTRUCTION_POLICY;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getRoutingStylePreferenceName() {
+ return IPapyrusPreferencesConstant.DEPENDENCY_PREF_ROUTING_STYLE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getSmoothnessPreferenceName() {
+ return IPapyrusPreferencesConstant.DEPENDENCY_PREF_SMOOTHNESS;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/DiagramAppearancePreferencePage.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/DiagramAppearancePreferencePage.java
new file mode 100644
index 00000000000..ab7d8145ecf
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/DiagramAppearancePreferencePage.java
@@ -0,0 +1,29 @@
+/****************************************************************************
+ * Copyright (c) 2008 Atos Origin.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thibault Landre (Atos Origin) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.preferences;
+
+import org.eclipse.gmf.runtime.diagram.ui.preferences.AppearancePreferencePage;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+public class DiagramAppearancePreferencePage extends AppearancePreferencePage {
+
+ /**
+ * @generated
+ */
+ public DiagramAppearancePreferencePage() {
+ setPreferenceStore(UMLDiagramEditorPlugin.getInstance().getPreferenceStore());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/DiagramConnectionsPreferencePage.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/DiagramConnectionsPreferencePage.java
new file mode 100644
index 00000000000..b36cbfcb7da
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/DiagramConnectionsPreferencePage.java
@@ -0,0 +1,29 @@
+/****************************************************************************
+ * Copyright (c) 2008 Atos Origin.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thibault Landre (Atos Origin) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.preferences;
+
+import org.eclipse.gmf.runtime.diagram.ui.preferences.ConnectionsPreferencePage;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+public class DiagramConnectionsPreferencePage extends ConnectionsPreferencePage {
+
+ /**
+ * @generated
+ */
+ public DiagramConnectionsPreferencePage() {
+ setPreferenceStore(UMLDiagramEditorPlugin.getInstance().getPreferenceStore());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/DiagramGeneralPreferencePage.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/DiagramGeneralPreferencePage.java
new file mode 100644
index 00000000000..335c28ebd2f
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/DiagramGeneralPreferencePage.java
@@ -0,0 +1,29 @@
+/****************************************************************************
+ * Copyright (c) 2008 Atos Origin.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thibault Landre (Atos Origin) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.preferences;
+
+import org.eclipse.gmf.runtime.diagram.ui.preferences.DiagramsPreferencePage;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+public class DiagramGeneralPreferencePage extends DiagramsPreferencePage {
+
+ /**
+ * @generated
+ */
+ public DiagramGeneralPreferencePage() {
+ setPreferenceStore(UMLDiagramEditorPlugin.getInstance().getPreferenceStore());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/DiagramPreferenceInitializer.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/DiagramPreferenceInitializer.java
new file mode 100644
index 00000000000..747c377a1e4
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/DiagramPreferenceInitializer.java
@@ -0,0 +1,73 @@
+/****************************************************************************
+ * Copyright (c) 2008 Atos Origin.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thibault Landre (Atos Origin) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.preferences;
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+public class DiagramPreferenceInitializer extends AbstractPreferenceInitializer {
+
+ /**
+ * @generated
+ */
+ protected IPreferenceStore getPreferenceStore() {
+ return UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
+ }
+
+ /**
+ * @generated NOT
+ */
+ public void initializeDefaultPreferences() {
+ IPreferenceStore store = getPreferenceStore();
+ AssociationClass_2013PreferencePage.initDefaults(store);
+ InstanceSpecification_2001PreferencePage.initDefaults(store);
+ Component_2002PreferencePage.initDefaults(store);
+ Signal_2003PreferencePage.initDefaults(store);
+ Interface_2004PreferencePage.initDefaults(store);
+ Model_2005PreferencePage.initDefaults(store);
+ Enumeration_2006PreferencePage.initDefaults(store);
+ Package_2007PreferencePage.initDefaults(store);
+ Class_2008PreferencePage.initDefaults(store);
+ PrimitiveType_2009PreferencePage.initDefaults(store);
+ DataType_2010PreferencePage.initDefaults(store);
+ Constraint_2011PreferencePage.initDefaults(store);
+ Comment_2012PreferencePage.initDefaults(store);
+
+ AssociationPreferencePage.initDefaults(store);
+ GeneralizationPreferencePage.initDefaults(store);
+ InterfaceRealizationPreferencePage.initDefaults(store);
+ SubstitutionPreferencePage.initDefaults(store);
+ RealizationPreferencePage.initDefaults(store);
+ AbstractionPreferencePage.initDefaults(store);
+ UsagePreferencePage.initDefaults(store);
+ DependencyPreferencePage.initDefaults(store);
+ ElementImportPreferencePage.initDefaults(store);
+ PackageImportPreferencePage.initDefaults(store);
+ PackageMergePreferencePage.initDefaults(store);
+ ProfileApplicationPreferencePage.initDefaults(store);
+ TemplateBindingPreferencePage.initDefaults(store);
+
+ // TODO: QuickFix to enable Global Properties. Global Properties should be re-enable in the Papyrus Diagram Page (and in the corresponding generators).
+ store.setDefault(IPreferenceConstants.PREF_SHOW_CONNECTION_HANDLES, true);
+ store.setDefault(IPreferenceConstants.PREF_SHOW_POPUP_BARS, true);
+ store.setDefault(IPreferenceConstants.PREF_ENABLE_ANIMATED_LAYOUT, true);
+ store.setDefault(IPreferenceConstants.PREF_ENABLE_ANIMATED_ZOOM, true);
+ store.setDefault(IPreferenceConstants.PREF_ENABLE_ANTIALIAS, true);
+
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/DiagramPrintingPreferencePage.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/DiagramPrintingPreferencePage.java
new file mode 100644
index 00000000000..10ff8f0a649
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/DiagramPrintingPreferencePage.java
@@ -0,0 +1,29 @@
+/****************************************************************************
+ * Copyright (c) 2008 Atos Origin.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thibault Landre (Atos Origin) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.preferences;
+
+import org.eclipse.gmf.runtime.diagram.ui.preferences.PrintingPreferencePage;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+public class DiagramPrintingPreferencePage extends PrintingPreferencePage {
+
+ /**
+ * @generated
+ */
+ public DiagramPrintingPreferencePage() {
+ setPreferenceStore(UMLDiagramEditorPlugin.getInstance().getPreferenceStore());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/DiagramRulersAndGridPreferencePage.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/DiagramRulersAndGridPreferencePage.java
new file mode 100644
index 00000000000..8376abdc238
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/DiagramRulersAndGridPreferencePage.java
@@ -0,0 +1,29 @@
+/****************************************************************************
+ * Copyright (c) 2008 Atos Origin.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thibault Landre (Atos Origin) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.preferences;
+
+import org.eclipse.gmf.runtime.diagram.ui.preferences.RulerGridPreferencePage;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+public class DiagramRulersAndGridPreferencePage extends RulerGridPreferencePage {
+
+ /**
+ * @generated
+ */
+ public DiagramRulersAndGridPreferencePage() {
+ setPreferenceStore(UMLDiagramEditorPlugin.getInstance().getPreferenceStore());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/ElementImportPreferencePage.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/ElementImportPreferencePage.java
new file mode 100644
index 00000000000..4aa56d1ce8b
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/ElementImportPreferencePage.java
@@ -0,0 +1,119 @@
+/****************************************************************************
+ * Copyright (c) 2008 Atos Origin.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thibault Landre (Atos Origin) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.preferences.pages.AbstractPapyrusLinkPreferencePage;
+
+/**
+ * @generated
+ */
+public class ElementImportPreferencePage extends AbstractPapyrusLinkPreferencePage {
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(IPreferenceStore store) {
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.getInstance().ID;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontColorPreferenceName() {
+ return IPapyrusPreferencesConstant.ELEMENTIMPORT_PREF_SMOOTHNESS;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontPreferenceName() {
+ return IPapyrusPreferencesConstant.ELEMENTIMPORT_PREF_FONT;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getJumpLinkReversePreferenceName() {
+ return IPapyrusPreferencesConstant.ELEMENTIMPORT_PREF_JUMPLINK_REVERSE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getJumpLinkStatusPreferenceName() {
+ return IPapyrusPreferencesConstant.ELEMENTIMPORT_PREF_JUMPLINK_STATUS;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getJumpLinkTypePreferenceName() {
+ return IPapyrusPreferencesConstant.ELEMENTIMPORT_PREF_JUMPLINK_TYPE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getLineColorPreferenceName() {
+ return IPapyrusPreferencesConstant.ELEMENTIMPORT_PREF_LINE_COLOR;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getRoutingDistancePolicyPreferenceName() {
+ return IPapyrusPreferencesConstant.ELEMENTIMPORT_PREF_ROUTING_DISTANCE_POLICY;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getRoutingObstructionPolicyPreferenceName() {
+ return IPapyrusPreferencesConstant.ELEMENTIMPORT_PREF_ROUTING_OBSTRUCTION_POLICY;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getRoutingStylePreferenceName() {
+ return IPapyrusPreferencesConstant.ELEMENTIMPORT_PREF_ROUTING_STYLE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getSmoothnessPreferenceName() {
+ return IPapyrusPreferencesConstant.ELEMENTIMPORT_PREF_SMOOTHNESS;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/Enumeration_2006PreferencePage.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/Enumeration_2006PreferencePage.java
new file mode 100644
index 00000000000..0091e2a5f2c
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/Enumeration_2006PreferencePage.java
@@ -0,0 +1,71 @@
+/****************************************************************************
+ * Copyright (c) 2008 Atos Origin.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thibault Landre (Atos Origin) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.preferences.pages.AbstractPapyrusNodePreferencePage;
+
+/**
+ * @generated
+ */
+public class Enumeration_2006PreferencePage extends AbstractPapyrusNodePreferencePage {
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(IPreferenceStore store) {
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.getInstance().ID;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFillColorPreferenceName() {
+ return IPapyrusPreferencesConstant.ENUMERATION_2006_PREF_FILL_COLOR;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontColorPreferenceName() {
+ return IPapyrusPreferencesConstant.ENUMERATION_2006_PREF_FONT_COLOR;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontPreferenceName() {
+ return IPapyrusPreferencesConstant.ENUMERATION_2006_PREF_FONT;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getLineColorPreferenceName() {
+ return IPapyrusPreferencesConstant.ENUMERATION_2006_PREF_LINE_COLOR;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/GeneralizationPreferencePage.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/GeneralizationPreferencePage.java
new file mode 100644
index 00000000000..b8169889249
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/GeneralizationPreferencePage.java
@@ -0,0 +1,119 @@
+/****************************************************************************
+ * Copyright (c) 2008 Atos Origin.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thibault Landre (Atos Origin) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.preferences.pages.AbstractPapyrusLinkPreferencePage;
+
+/**
+ * @generated
+ */
+public class GeneralizationPreferencePage extends AbstractPapyrusLinkPreferencePage {
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(IPreferenceStore store) {
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.getInstance().ID;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontColorPreferenceName() {
+ return IPapyrusPreferencesConstant.GENERALIZATION_PREF_SMOOTHNESS;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontPreferenceName() {
+ return IPapyrusPreferencesConstant.GENERALIZATION_PREF_FONT;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getJumpLinkReversePreferenceName() {
+ return IPapyrusPreferencesConstant.GENERALIZATION_PREF_JUMPLINK_REVERSE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getJumpLinkStatusPreferenceName() {
+ return IPapyrusPreferencesConstant.GENERALIZATION_PREF_JUMPLINK_STATUS;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getJumpLinkTypePreferenceName() {
+ return IPapyrusPreferencesConstant.GENERALIZATION_PREF_JUMPLINK_TYPE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getLineColorPreferenceName() {
+ return IPapyrusPreferencesConstant.GENERALIZATION_PREF_LINE_COLOR;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getRoutingDistancePolicyPreferenceName() {
+ return IPapyrusPreferencesConstant.GENERALIZATION_PREF_ROUTING_DISTANCE_POLICY;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getRoutingObstructionPolicyPreferenceName() {
+ return IPapyrusPreferencesConstant.GENERALIZATION_PREF_ROUTING_OBSTRUCTION_POLICY;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getRoutingStylePreferenceName() {
+ return IPapyrusPreferencesConstant.GENERALIZATION_PREF_ROUTING_STYLE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getSmoothnessPreferenceName() {
+ return IPapyrusPreferencesConstant.GENERALIZATION_PREF_SMOOTHNESS;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/IPapyrusPreferencesConstant.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/IPapyrusPreferencesConstant.java
new file mode 100644
index 00000000000..8cd872d1331
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/IPapyrusPreferencesConstant.java
@@ -0,0 +1,930 @@
+/****************************************************************************
+ * Copyright (c) 2008 Atos Origin.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thibault Landre (Atos Origin) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.preferences;
+
+/**
+ * @generated
+ */
+public interface IPapyrusPreferencesConstant {
+
+ /**
+ * @generated
+ */
+ public static final String ABSTRACTION_PREF_FONT = "Abstraction.font";
+
+ /**
+ * @generated
+ */
+ public static final String ABSTRACTION_PREF_FONT_COLOR = "Abstraction.font.color";
+
+ /**
+ * @generated
+ */
+ public static final String ABSTRACTION_PREF_JUMPLINK_REVERSE = "Abstraction.jumplink.reverse";
+
+ /**
+ * @generated
+ */
+ public static final String ABSTRACTION_PREF_JUMPLINK_STATUS = "Abstraction.jumplink.status";
+
+ /**
+ * @generated
+ */
+ public static final String ABSTRACTION_PREF_JUMPLINK_TYPE = "Abstraction.jumplink.type";
+
+ /**
+ * @generated
+ */
+ public static final String ABSTRACTION_PREF_LINE_COLOR = "Abstraction.line.color";
+
+ /**
+ * @generated
+ */
+ public static final String ABSTRACTION_PREF_ROUTING_DISTANCE_POLICY = "Abstraction.routing.distance.policy";
+
+ /**
+ * @generated
+ */
+ public static final String ABSTRACTION_PREF_ROUTING_OBSTRUCTION_POLICY = "Abstraction.routing.obstruction.policy";
+
+ /**
+ * @generated
+ */
+ public static final String ABSTRACTION_PREF_ROUTING_STYLE = "Abstraction.routing.style";
+
+ /**
+ * @generated
+ */
+ public static final String ABSTRACTION_PREF_SMOOTHNESS = "Abstraction.smoothness";
+
+ /**
+ * @generated
+ */
+ public static final String ASSOCIATION_PREF_FONT = "Association.font";
+
+ /**
+ * @generated
+ */
+ public static final String ASSOCIATION_PREF_FONT_COLOR = "Association.font.color";
+
+ /**
+ * @generated
+ */
+ public static final String ASSOCIATION_PREF_JUMPLINK_REVERSE = "Association.jumplink.reverse";
+
+ /**
+ * @generated
+ */
+ public static final String ASSOCIATION_PREF_JUMPLINK_STATUS = "Association.jumplink.status";
+
+ /**
+ * @generated
+ */
+ public static final String ASSOCIATION_PREF_JUMPLINK_TYPE = "Association.jumplink.type";
+
+ /**
+ * @generated
+ */
+ public static final String ASSOCIATION_PREF_LINE_COLOR = "Association.line.color";
+
+ /**
+ * @generated
+ */
+ public static final String ASSOCIATION_PREF_ROUTING_DISTANCE_POLICY = "Association.routing.distance.policy";
+
+ /**
+ * @generated
+ */
+ public static final String ASSOCIATION_PREF_ROUTING_OBSTRUCTION_POLICY = "Association.routing.obstruction.policy";
+
+ /**
+ * @generated
+ */
+ public static final String ASSOCIATION_PREF_ROUTING_STYLE = "Association.routing.style";
+
+ /**
+ * @generated
+ */
+ public static final String ASSOCIATION_PREF_SMOOTHNESS = "Association.smoothness";
+
+ /**
+ * @generated
+ */
+ public static final String ASSOCIATIONCLASS_2013_PREF_FILL_COLOR = "AssociationClass_2013.fill.color";
+
+ /**
+ * @generated
+ */
+ public static final String ASSOCIATIONCLASS_2013_PREF_FONT = "AssociationClass_2013.font";
+
+ /**
+ * @generated
+ */
+ public static final String ASSOCIATIONCLASS_2013_PREF_FONT_COLOR = "AssociationClass_2013.font.color";
+
+ /**
+ * @generated
+ */
+ public static final String ASSOCIATIONCLASS_2013_PREF_LINE_COLOR = "AssociationClass_2013.line.color";
+
+ /**
+ * @generated
+ */
+ public static final String CLASS_2008_PREF_FILL_COLOR = "Class_2008.fill.color";
+
+ /**
+ * @generated
+ */
+ public static final String CLASS_2008_PREF_FONT = "Class_2008.font";
+
+ /**
+ * @generated
+ */
+ public static final String CLASS_2008_PREF_FONT_COLOR = "Class_2008.font.color";
+
+ /**
+ * @generated
+ */
+ public static final String CLASS_2008_PREF_LINE_COLOR = "Class_2008.line.color";
+
+ /**
+ * @generated
+ */
+ public static final String COMMENT_2012_PREF_FILL_COLOR = "Comment_2012.fill.color";
+
+ /**
+ * @generated
+ */
+ public static final String COMMENT_2012_PREF_FONT = "Comment_2012.font";
+
+ /**
+ * @generated
+ */
+ public static final String COMMENT_2012_PREF_FONT_COLOR = "Comment_2012.font.color";
+
+ /**
+ * @generated
+ */
+ public static final String COMMENT_2012_PREF_LINE_COLOR = "Comment_2012.line.color";
+
+ /**
+ * @generated
+ */
+ public static final String COMPONENT_2002_PREF_FILL_COLOR = "Component_2002.fill.color";
+
+ /**
+ * @generated
+ */
+ public static final String COMPONENT_2002_PREF_FONT = "Component_2002.font";
+
+ /**
+ * @generated
+ */
+ public static final String COMPONENT_2002_PREF_FONT_COLOR = "Component_2002.font.color";
+
+ /**
+ * @generated
+ */
+ public static final String COMPONENT_2002_PREF_LINE_COLOR = "Component_2002.line.color";
+
+ /**
+ * @generated
+ */
+ public static final String CONSTRAINT_2011_PREF_FILL_COLOR = "Constraint_2011.fill.color";
+
+ /**
+ * @generated
+ */
+ public static final String CONSTRAINT_2011_PREF_FONT = "Constraint_2011.font";
+
+ /**
+ * @generated
+ */
+ public static final String CONSTRAINT_2011_PREF_FONT_COLOR = "Constraint_2011.font.color";
+
+ /**
+ * @generated
+ */
+ public static final String CONSTRAINT_2011_PREF_LINE_COLOR = "Constraint_2011.line.color";
+
+ /**
+ * @generated
+ */
+ public static final String DATATYPE_2010_PREF_FILL_COLOR = "DataType_2010.fill.color";
+
+ /**
+ * @generated
+ */
+ public static final String DATATYPE_2010_PREF_FONT = "DataType_2010.font";
+
+ /**
+ * @generated
+ */
+ public static final String DATATYPE_2010_PREF_FONT_COLOR = "DataType_2010.font.color";
+
+ /**
+ * @generated
+ */
+ public static final String DATATYPE_2010_PREF_LINE_COLOR = "DataType_2010.line.color";
+
+ /**
+ * @generated
+ */
+ public static final String DEPENDENCY_PREF_FONT = "Dependency.font";
+
+ /**
+ * @generated
+ */
+ public static final String DEPENDENCY_PREF_FONT_COLOR = "Dependency.font.color";
+
+ /**
+ * @generated
+ */
+ public static final String DEPENDENCY_PREF_JUMPLINK_REVERSE = "Dependency.jumplink.reverse";
+
+ /**
+ * @generated
+ */
+ public static final String DEPENDENCY_PREF_JUMPLINK_STATUS = "Dependency.jumplink.status";
+
+ /**
+ * @generated
+ */
+ public static final String DEPENDENCY_PREF_JUMPLINK_TYPE = "Dependency.jumplink.type";
+
+ /**
+ * @generated
+ */
+ public static final String DEPENDENCY_PREF_LINE_COLOR = "Dependency.line.color";
+
+ /**
+ * @generated
+ */
+ public static final String DEPENDENCY_PREF_ROUTING_DISTANCE_POLICY = "Dependency.routing.distance.policy";
+
+ /**
+ * @generated
+ */
+ public static final String DEPENDENCY_PREF_ROUTING_OBSTRUCTION_POLICY = "Dependency.routing.obstruction.policy";
+
+ /**
+ * @generated
+ */
+ public static final String DEPENDENCY_PREF_ROUTING_STYLE = "Dependency.routing.style";
+
+ /**
+ * @generated
+ */
+ public static final String DEPENDENCY_PREF_SMOOTHNESS = "Dependency.smoothness";
+
+ /**
+ * @generated
+ */
+ public static final String ELEMENTIMPORT_PREF_FONT = "ElementImport.font";
+
+ /**
+ * @generated
+ */
+ public static final String ELEMENTIMPORT_PREF_FONT_COLOR = "ElementImport.font.color";
+
+ /**
+ * @generated
+ */
+ public static final String ELEMENTIMPORT_PREF_JUMPLINK_REVERSE = "ElementImport.jumplink.reverse";
+
+ /**
+ * @generated
+ */
+ public static final String ELEMENTIMPORT_PREF_JUMPLINK_STATUS = "ElementImport.jumplink.status";
+
+ /**
+ * @generated
+ */
+ public static final String ELEMENTIMPORT_PREF_JUMPLINK_TYPE = "ElementImport.jumplink.type";
+
+ /**
+ * @generated
+ */
+ public static final String ELEMENTIMPORT_PREF_LINE_COLOR = "ElementImport.line.color";
+
+ /**
+ * @generated
+ */
+ public static final String ELEMENTIMPORT_PREF_ROUTING_DISTANCE_POLICY = "ElementImport.routing.distance.policy";
+
+ /**
+ * @generated
+ */
+ public static final String ELEMENTIMPORT_PREF_ROUTING_OBSTRUCTION_POLICY = "ElementImport.routing.obstruction.policy";
+
+ /**
+ * @generated
+ */
+ public static final String ELEMENTIMPORT_PREF_ROUTING_STYLE = "ElementImport.routing.style";
+
+ /**
+ * @generated
+ */
+ public static final String ELEMENTIMPORT_PREF_SMOOTHNESS = "ElementImport.smoothness";
+
+ /**
+ * @generated
+ */
+ public static final String ENUMERATION_2006_PREF_FILL_COLOR = "Enumeration_2006.fill.color";
+
+ /**
+ * @generated
+ */
+ public static final String ENUMERATION_2006_PREF_FONT = "Enumeration_2006.font";
+
+ /**
+ * @generated
+ */
+ public static final String ENUMERATION_2006_PREF_FONT_COLOR = "Enumeration_2006.font.color";
+
+ /**
+ * @generated
+ */
+ public static final String ENUMERATION_2006_PREF_LINE_COLOR = "Enumeration_2006.line.color";
+
+ /**
+ * @generated
+ */
+ public static final String GENERALIZATION_PREF_FONT = "Generalization.font";
+
+ /**
+ * @generated
+ */
+ public static final String GENERALIZATION_PREF_FONT_COLOR = "Generalization.font.color";
+
+ /**
+ * @generated
+ */
+ public static final String GENERALIZATION_PREF_JUMPLINK_REVERSE = "Generalization.jumplink.reverse";
+
+ /**
+ * @generated
+ */
+ public static final String GENERALIZATION_PREF_JUMPLINK_STATUS = "Generalization.jumplink.status";
+
+ /**
+ * @generated
+ */
+ public static final String GENERALIZATION_PREF_JUMPLINK_TYPE = "Generalization.jumplink.type";
+
+ /**
+ * @generated
+ */
+ public static final String GENERALIZATION_PREF_LINE_COLOR = "Generalization.line.color";
+
+ /**
+ * @generated
+ */
+ public static final String GENERALIZATION_PREF_ROUTING_DISTANCE_POLICY = "Generalization.routing.distance.policy";
+
+ /**
+ * @generated
+ */
+ public static final String GENERALIZATION_PREF_ROUTING_OBSTRUCTION_POLICY = "Generalization.routing.obstruction.policy";
+
+ /**
+ * @generated
+ */
+ public static final String GENERALIZATION_PREF_ROUTING_STYLE = "Generalization.routing.style";
+
+ /**
+ * @generated
+ */
+ public static final String GENERALIZATION_PREF_SMOOTHNESS = "Generalization.smoothness";
+
+ /**
+ * @generated
+ */
+ public static final String INSTANCESPECIFICATION_2001_PREF_FILL_COLOR = "InstanceSpecification_2001.fill.color";
+
+ /**
+ * @generated
+ */
+ public static final String INSTANCESPECIFICATION_2001_PREF_FONT = "InstanceSpecification_2001.font";
+
+ /**
+ * @generated
+ */
+ public static final String INSTANCESPECIFICATION_2001_PREF_FONT_COLOR = "InstanceSpecification_2001.font.color";
+
+ /**
+ * @generated
+ */
+ public static final String INSTANCESPECIFICATION_2001_PREF_LINE_COLOR = "InstanceSpecification_2001.line.color";
+
+ /**
+ * @generated
+ */
+ public static final String INTERFACE_2004_PREF_FILL_COLOR = "Interface_2004.fill.color";
+
+ /**
+ * @generated
+ */
+ public static final String INTERFACE_2004_PREF_FONT = "Interface_2004.font";
+
+ /**
+ * @generated
+ */
+ public static final String INTERFACE_2004_PREF_FONT_COLOR = "Interface_2004.font.color";
+
+ /**
+ * @generated
+ */
+ public static final String INTERFACE_2004_PREF_LINE_COLOR = "Interface_2004.line.color";
+
+ /**
+ * @generated
+ */
+ public static final String INTERFACEREALIZATION_PREF_FONT = "InterfaceRealization.font";
+
+ /**
+ * @generated
+ */
+ public static final String INTERFACEREALIZATION_PREF_FONT_COLOR = "InterfaceRealization.font.color";
+
+ /**
+ * @generated
+ */
+ public static final String INTERFACEREALIZATION_PREF_JUMPLINK_REVERSE = "InterfaceRealization.jumplink.reverse";
+
+ /**
+ * @generated
+ */
+ public static final String INTERFACEREALIZATION_PREF_JUMPLINK_STATUS = "InterfaceRealization.jumplink.status";
+
+ /**
+ * @generated
+ */
+ public static final String INTERFACEREALIZATION_PREF_JUMPLINK_TYPE = "InterfaceRealization.jumplink.type";
+
+ /**
+ * @generated
+ */
+ public static final String INTERFACEREALIZATION_PREF_LINE_COLOR = "InterfaceRealization.line.color";
+
+ /**
+ * @generated
+ */
+ public static final String INTERFACEREALIZATION_PREF_ROUTING_DISTANCE_POLICY = "InterfaceRealization.routing.distance.policy";
+
+ /**
+ * @generated
+ */
+ public static final String INTERFACEREALIZATION_PREF_ROUTING_OBSTRUCTION_POLICY = "InterfaceRealization.routing.obstruction.policy";
+
+ /**
+ * @generated
+ */
+ public static final String INTERFACEREALIZATION_PREF_ROUTING_STYLE = "InterfaceRealization.routing.style";
+
+ /**
+ * @generated
+ */
+ public static final String INTERFACEREALIZATION_PREF_SMOOTHNESS = "InterfaceRealization.smoothness";
+
+ /**
+ * @generated
+ */
+ public static final String MODEL_2005_PREF_FILL_COLOR = "Model_2005.fill.color";
+
+ /**
+ * @generated
+ */
+ public static final String MODEL_2005_PREF_FONT = "Model_2005.font";
+
+ /**
+ * @generated
+ */
+ public static final String MODEL_2005_PREF_FONT_COLOR = "Model_2005.font.color";
+
+ /**
+ * @generated
+ */
+ public static final String MODEL_2005_PREF_LINE_COLOR = "Model_2005.line.color";
+
+ /**
+ * @generated
+ */
+ public static final String PACKAGE_2007_PREF_FILL_COLOR = "Package_2007.fill.color";
+
+ /**
+ * @generated
+ */
+ public static final String PACKAGE_2007_PREF_FONT = "Package_2007.font";
+
+ /**
+ * @generated
+ */
+ public static final String PACKAGE_2007_PREF_FONT_COLOR = "Package_2007.font.color";
+
+ /**
+ * @generated
+ */
+ public static final String PACKAGE_2007_PREF_LINE_COLOR = "Package_2007.line.color";
+
+ /**
+ * @generated
+ */
+ public static final String PACKAGEIMPORT_PREF_FONT = "PackageImport.font";
+
+ /**
+ * @generated
+ */
+ public static final String PACKAGEIMPORT_PREF_FONT_COLOR = "PackageImport.font.color";
+
+ /**
+ * @generated
+ */
+ public static final String PACKAGEIMPORT_PREF_JUMPLINK_REVERSE = "PackageImport.jumplink.reverse";
+
+ /**
+ * @generated
+ */
+ public static final String PACKAGEIMPORT_PREF_JUMPLINK_STATUS = "PackageImport.jumplink.status";
+
+ /**
+ * @generated
+ */
+ public static final String PACKAGEIMPORT_PREF_JUMPLINK_TYPE = "PackageImport.jumplink.type";
+
+ /**
+ * @generated
+ */
+ public static final String PACKAGEIMPORT_PREF_LINE_COLOR = "PackageImport.line.color";
+
+ /**
+ * @generated
+ */
+ public static final String PACKAGEIMPORT_PREF_ROUTING_DISTANCE_POLICY = "PackageImport.routing.distance.policy";
+
+ /**
+ * @generated
+ */
+ public static final String PACKAGEIMPORT_PREF_ROUTING_OBSTRUCTION_POLICY = "PackageImport.routing.obstruction.policy";
+
+ /**
+ * @generated
+ */
+ public static final String PACKAGEIMPORT_PREF_ROUTING_STYLE = "PackageImport.routing.style";
+
+ /**
+ * @generated
+ */
+ public static final String PACKAGEIMPORT_PREF_SMOOTHNESS = "PackageImport.smoothness";
+
+ /**
+ * @generated
+ */
+ public static final String PACKAGEMERGE_PREF_FONT = "PackageMerge.font";
+
+ /**
+ * @generated
+ */
+ public static final String PACKAGEMERGE_PREF_FONT_COLOR = "PackageMerge.font.color";
+
+ /**
+ * @generated
+ */
+ public static final String PACKAGEMERGE_PREF_JUMPLINK_REVERSE = "PackageMerge.jumplink.reverse";
+
+ /**
+ * @generated
+ */
+ public static final String PACKAGEMERGE_PREF_JUMPLINK_STATUS = "PackageMerge.jumplink.status";
+
+ /**
+ * @generated
+ */
+ public static final String PACKAGEMERGE_PREF_JUMPLINK_TYPE = "PackageMerge.jumplink.type";
+
+ /**
+ * @generated
+ */
+ public static final String PACKAGEMERGE_PREF_LINE_COLOR = "PackageMerge.line.color";
+
+ /**
+ * @generated
+ */
+ public static final String PACKAGEMERGE_PREF_ROUTING_DISTANCE_POLICY = "PackageMerge.routing.distance.policy";
+
+ /**
+ * @generated
+ */
+ public static final String PACKAGEMERGE_PREF_ROUTING_OBSTRUCTION_POLICY = "PackageMerge.routing.obstruction.policy";
+
+ /**
+ * @generated
+ */
+ public static final String PACKAGEMERGE_PREF_ROUTING_STYLE = "PackageMerge.routing.style";
+
+ /**
+ * @generated
+ */
+ public static final String PACKAGEMERGE_PREF_SMOOTHNESS = "PackageMerge.smoothness";
+
+ /**
+ * @generated
+ */
+ public static final String PRIMITIVETYPE_2009_PREF_FILL_COLOR = "PrimitiveType_2009.fill.color";
+
+ /**
+ * @generated
+ */
+ public static final String PRIMITIVETYPE_2009_PREF_FONT = "PrimitiveType_2009.font";
+
+ /**
+ * @generated
+ */
+ public static final String PRIMITIVETYPE_2009_PREF_FONT_COLOR = "PrimitiveType_2009.font.color";
+
+ /**
+ * @generated
+ */
+ public static final String PRIMITIVETYPE_2009_PREF_LINE_COLOR = "PrimitiveType_2009.line.color";
+
+ /**
+ * @generated
+ */
+ public static final String PROFILEAPPLICATION_PREF_FONT = "ProfileApplication.font";
+
+ /**
+ * @generated
+ */
+ public static final String PROFILEAPPLICATION_PREF_FONT_COLOR = "ProfileApplication.font.color";
+
+ /**
+ * @generated
+ */
+ public static final String PROFILEAPPLICATION_PREF_JUMPLINK_REVERSE = "ProfileApplication.jumplink.reverse";
+
+ /**
+ * @generated
+ */
+ public static final String PROFILEAPPLICATION_PREF_JUMPLINK_STATUS = "ProfileApplication.jumplink.status";
+
+ /**
+ * @generated
+ */
+ public static final String PROFILEAPPLICATION_PREF_JUMPLINK_TYPE = "ProfileApplication.jumplink.type";
+
+ /**
+ * @generated
+ */
+ public static final String PROFILEAPPLICATION_PREF_LINE_COLOR = "ProfileApplication.line.color";
+
+ /**
+ * @generated
+ */
+ public static final String PROFILEAPPLICATION_PREF_ROUTING_DISTANCE_POLICY = "ProfileApplication.routing.distance.policy";
+
+ /**
+ * @generated
+ */
+ public static final String PROFILEAPPLICATION_PREF_ROUTING_OBSTRUCTION_POLICY = "ProfileApplication.routing.obstruction.policy";
+
+ /**
+ * @generated
+ */
+ public static final String PROFILEAPPLICATION_PREF_ROUTING_STYLE = "ProfileApplication.routing.style";
+
+ /**
+ * @generated
+ */
+ public static final String PROFILEAPPLICATION_PREF_SMOOTHNESS = "ProfileApplication.smoothness";
+
+ /**
+ * @generated
+ */
+ public static final String REALIZATION_PREF_FONT = "Realization.font";
+
+ /**
+ * @generated
+ */
+ public static final String REALIZATION_PREF_FONT_COLOR = "Realization.font.color";
+
+ /**
+ * @generated
+ */
+ public static final String REALIZATION_PREF_JUMPLINK_REVERSE = "Realization.jumplink.reverse";
+
+ /**
+ * @generated
+ */
+ public static final String REALIZATION_PREF_JUMPLINK_STATUS = "Realization.jumplink.status";
+
+ /**
+ * @generated
+ */
+ public static final String REALIZATION_PREF_JUMPLINK_TYPE = "Realization.jumplink.type";
+
+ /**
+ * @generated
+ */
+ public static final String REALIZATION_PREF_LINE_COLOR = "Realization.line.color";
+
+ /**
+ * @generated
+ */
+ public static final String REALIZATION_PREF_ROUTING_DISTANCE_POLICY = "Realization.routing.distance.policy";
+
+ /**
+ * @generated
+ */
+ public static final String REALIZATION_PREF_ROUTING_OBSTRUCTION_POLICY = "Realization.routing.obstruction.policy";
+
+ /**
+ * @generated
+ */
+ public static final String REALIZATION_PREF_ROUTING_STYLE = "Realization.routing.style";
+
+ /**
+ * @generated
+ */
+ public static final String REALIZATION_PREF_SMOOTHNESS = "Realization.smoothness";
+
+ /**
+ * @generated
+ */
+ public static final String SIGNAL_2003_PREF_FILL_COLOR = "Signal_2003.fill.color";
+
+ /**
+ * @generated
+ */
+ public static final String SIGNAL_2003_PREF_FONT = "Signal_2003.font";
+
+ /**
+ * @generated
+ */
+ public static final String SIGNAL_2003_PREF_FONT_COLOR = "Signal_2003.font.color";
+
+ /**
+ * @generated
+ */
+ public static final String SIGNAL_2003_PREF_LINE_COLOR = "Signal_2003.line.color";
+
+ /**
+ * @generated
+ */
+ public static final String SUBSTITUTION_PREF_FONT = "Substitution.font";
+
+ /**
+ * @generated
+ */
+ public static final String SUBSTITUTION_PREF_FONT_COLOR = "Substitution.font.color";
+
+ /**
+ * @generated
+ */
+ public static final String SUBSTITUTION_PREF_JUMPLINK_REVERSE = "Substitution.jumplink.reverse";
+
+ /**
+ * @generated
+ */
+ public static final String SUBSTITUTION_PREF_JUMPLINK_STATUS = "Substitution.jumplink.status";
+
+ /**
+ * @generated
+ */
+ public static final String SUBSTITUTION_PREF_JUMPLINK_TYPE = "Substitution.jumplink.type";
+
+ /**
+ * @generated
+ */
+ public static final String SUBSTITUTION_PREF_LINE_COLOR = "Substitution.line.color";
+
+ /**
+ * @generated
+ */
+ public static final String SUBSTITUTION_PREF_ROUTING_DISTANCE_POLICY = "Substitution.routing.distance.policy";
+
+ /**
+ * @generated
+ */
+ public static final String SUBSTITUTION_PREF_ROUTING_OBSTRUCTION_POLICY = "Substitution.routing.obstruction.policy";
+
+ /**
+ * @generated
+ */
+ public static final String SUBSTITUTION_PREF_ROUTING_STYLE = "Substitution.routing.style";
+
+ /**
+ * @generated
+ */
+ public static final String SUBSTITUTION_PREF_SMOOTHNESS = "Substitution.smoothness";
+
+ /**
+ * @generated
+ */
+ public static final String TEMPLATEBINDING_PREF_FONT = "TemplateBinding.font";
+
+ /**
+ * @generated
+ */
+ public static final String TEMPLATEBINDING_PREF_FONT_COLOR = "TemplateBinding.font.color";
+
+ /**
+ * @generated
+ */
+ public static final String TEMPLATEBINDING_PREF_JUMPLINK_REVERSE = "TemplateBinding.jumplink.reverse";
+
+ /**
+ * @generated
+ */
+ public static final String TEMPLATEBINDING_PREF_JUMPLINK_STATUS = "TemplateBinding.jumplink.status";
+
+ /**
+ * @generated
+ */
+ public static final String TEMPLATEBINDING_PREF_JUMPLINK_TYPE = "TemplateBinding.jumplink.type";
+
+ /**
+ * @generated
+ */
+ public static final String TEMPLATEBINDING_PREF_LINE_COLOR = "TemplateBinding.line.color";
+
+ /**
+ * @generated
+ */
+ public static final String TEMPLATEBINDING_PREF_ROUTING_DISTANCE_POLICY = "TemplateBinding.routing.distance.policy";
+
+ /**
+ * @generated
+ */
+ public static final String TEMPLATEBINDING_PREF_ROUTING_OBSTRUCTION_POLICY = "TemplateBinding.routing.obstruction.policy";
+
+ /**
+ * @generated
+ */
+ public static final String TEMPLATEBINDING_PREF_ROUTING_STYLE = "TemplateBinding.routing.style";
+
+ /**
+ * @generated
+ */
+ public static final String TEMPLATEBINDING_PREF_SMOOTHNESS = "TemplateBinding.smoothness";
+
+ /**
+ * @generated
+ */
+ public static final String USAGE_PREF_FONT = "Usage.font";
+
+ /**
+ * @generated
+ */
+ public static final String USAGE_PREF_FONT_COLOR = "Usage.font.color";
+
+ /**
+ * @generated
+ */
+ public static final String USAGE_PREF_JUMPLINK_REVERSE = "Usage.jumplink.reverse";
+
+ /**
+ * @generated
+ */
+ public static final String USAGE_PREF_JUMPLINK_STATUS = "Usage.jumplink.status";
+
+ /**
+ * @generated
+ */
+ public static final String USAGE_PREF_JUMPLINK_TYPE = "Usage.jumplink.type";
+
+ /**
+ * @generated
+ */
+ public static final String USAGE_PREF_LINE_COLOR = "Usage.line.color";
+
+ /**
+ * @generated
+ */
+ public static final String USAGE_PREF_ROUTING_DISTANCE_POLICY = "Usage.routing.distance.policy";
+
+ /**
+ * @generated
+ */
+ public static final String USAGE_PREF_ROUTING_OBSTRUCTION_POLICY = "Usage.routing.obstruction.policy";
+
+ /**
+ * @generated
+ */
+ public static final String USAGE_PREF_ROUTING_STYLE = "Usage.routing.style";
+
+ /**
+ * @generated
+ */
+ public static final String USAGE_PREF_SMOOTHNESS = "Usage.smoothness";
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/InstanceSpecification_2001PreferencePage.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/InstanceSpecification_2001PreferencePage.java
new file mode 100644
index 00000000000..96076200c6b
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/InstanceSpecification_2001PreferencePage.java
@@ -0,0 +1,71 @@
+/****************************************************************************
+ * Copyright (c) 2008 Atos Origin.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thibault Landre (Atos Origin) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.preferences.pages.AbstractPapyrusNodePreferencePage;
+
+/**
+ * @generated
+ */
+public class InstanceSpecification_2001PreferencePage extends AbstractPapyrusNodePreferencePage {
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(IPreferenceStore store) {
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.getInstance().ID;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFillColorPreferenceName() {
+ return IPapyrusPreferencesConstant.INSTANCESPECIFICATION_2001_PREF_FILL_COLOR;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontColorPreferenceName() {
+ return IPapyrusPreferencesConstant.INSTANCESPECIFICATION_2001_PREF_FONT_COLOR;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontPreferenceName() {
+ return IPapyrusPreferencesConstant.INSTANCESPECIFICATION_2001_PREF_FONT;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getLineColorPreferenceName() {
+ return IPapyrusPreferencesConstant.INSTANCESPECIFICATION_2001_PREF_LINE_COLOR;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/InterfaceRealizationPreferencePage.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/InterfaceRealizationPreferencePage.java
new file mode 100644
index 00000000000..082c5e528e9
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/InterfaceRealizationPreferencePage.java
@@ -0,0 +1,119 @@
+/****************************************************************************
+ * Copyright (c) 2008 Atos Origin.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thibault Landre (Atos Origin) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.preferences.pages.AbstractPapyrusLinkPreferencePage;
+
+/**
+ * @generated
+ */
+public class InterfaceRealizationPreferencePage extends AbstractPapyrusLinkPreferencePage {
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(IPreferenceStore store) {
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.getInstance().ID;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontColorPreferenceName() {
+ return IPapyrusPreferencesConstant.INTERFACEREALIZATION_PREF_SMOOTHNESS;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontPreferenceName() {
+ return IPapyrusPreferencesConstant.INTERFACEREALIZATION_PREF_FONT;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getJumpLinkReversePreferenceName() {
+ return IPapyrusPreferencesConstant.INTERFACEREALIZATION_PREF_JUMPLINK_REVERSE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getJumpLinkStatusPreferenceName() {
+ return IPapyrusPreferencesConstant.INTERFACEREALIZATION_PREF_JUMPLINK_STATUS;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getJumpLinkTypePreferenceName() {
+ return IPapyrusPreferencesConstant.INTERFACEREALIZATION_PREF_JUMPLINK_TYPE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getLineColorPreferenceName() {
+ return IPapyrusPreferencesConstant.INTERFACEREALIZATION_PREF_LINE_COLOR;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getRoutingDistancePolicyPreferenceName() {
+ return IPapyrusPreferencesConstant.INTERFACEREALIZATION_PREF_ROUTING_DISTANCE_POLICY;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getRoutingObstructionPolicyPreferenceName() {
+ return IPapyrusPreferencesConstant.INTERFACEREALIZATION_PREF_ROUTING_OBSTRUCTION_POLICY;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getRoutingStylePreferenceName() {
+ return IPapyrusPreferencesConstant.INTERFACEREALIZATION_PREF_ROUTING_STYLE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getSmoothnessPreferenceName() {
+ return IPapyrusPreferencesConstant.INTERFACEREALIZATION_PREF_SMOOTHNESS;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/Interface_2004PreferencePage.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/Interface_2004PreferencePage.java
new file mode 100644
index 00000000000..89dc42073c4
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/Interface_2004PreferencePage.java
@@ -0,0 +1,71 @@
+/****************************************************************************
+ * Copyright (c) 2008 Atos Origin.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thibault Landre (Atos Origin) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.preferences.pages.AbstractPapyrusNodePreferencePage;
+
+/**
+ * @generated
+ */
+public class Interface_2004PreferencePage extends AbstractPapyrusNodePreferencePage {
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(IPreferenceStore store) {
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.getInstance().ID;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFillColorPreferenceName() {
+ return IPapyrusPreferencesConstant.INTERFACE_2004_PREF_FILL_COLOR;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontColorPreferenceName() {
+ return IPapyrusPreferencesConstant.INTERFACE_2004_PREF_FONT_COLOR;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontPreferenceName() {
+ return IPapyrusPreferencesConstant.INTERFACE_2004_PREF_FONT;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getLineColorPreferenceName() {
+ return IPapyrusPreferencesConstant.INTERFACE_2004_PREF_LINE_COLOR;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/Model_2005PreferencePage.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/Model_2005PreferencePage.java
new file mode 100644
index 00000000000..cfe5fcab8ac
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/Model_2005PreferencePage.java
@@ -0,0 +1,71 @@
+/****************************************************************************
+ * Copyright (c) 2008 Atos Origin.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thibault Landre (Atos Origin) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.preferences.pages.AbstractPapyrusNodePreferencePage;
+
+/**
+ * @generated
+ */
+public class Model_2005PreferencePage extends AbstractPapyrusNodePreferencePage {
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(IPreferenceStore store) {
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.getInstance().ID;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFillColorPreferenceName() {
+ return IPapyrusPreferencesConstant.MODEL_2005_PREF_FILL_COLOR;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontColorPreferenceName() {
+ return IPapyrusPreferencesConstant.MODEL_2005_PREF_FONT_COLOR;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontPreferenceName() {
+ return IPapyrusPreferencesConstant.MODEL_2005_PREF_FONT;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getLineColorPreferenceName() {
+ return IPapyrusPreferencesConstant.MODEL_2005_PREF_LINE_COLOR;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/PackageImportPreferencePage.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/PackageImportPreferencePage.java
new file mode 100644
index 00000000000..bfdc49f575a
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/PackageImportPreferencePage.java
@@ -0,0 +1,119 @@
+/****************************************************************************
+ * Copyright (c) 2008 Atos Origin.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thibault Landre (Atos Origin) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.preferences.pages.AbstractPapyrusLinkPreferencePage;
+
+/**
+ * @generated
+ */
+public class PackageImportPreferencePage extends AbstractPapyrusLinkPreferencePage {
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(IPreferenceStore store) {
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.getInstance().ID;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontColorPreferenceName() {
+ return IPapyrusPreferencesConstant.PACKAGEIMPORT_PREF_SMOOTHNESS;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontPreferenceName() {
+ return IPapyrusPreferencesConstant.PACKAGEIMPORT_PREF_FONT;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getJumpLinkReversePreferenceName() {
+ return IPapyrusPreferencesConstant.PACKAGEIMPORT_PREF_JUMPLINK_REVERSE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getJumpLinkStatusPreferenceName() {
+ return IPapyrusPreferencesConstant.PACKAGEIMPORT_PREF_JUMPLINK_STATUS;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getJumpLinkTypePreferenceName() {
+ return IPapyrusPreferencesConstant.PACKAGEIMPORT_PREF_JUMPLINK_TYPE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getLineColorPreferenceName() {
+ return IPapyrusPreferencesConstant.PACKAGEIMPORT_PREF_LINE_COLOR;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getRoutingDistancePolicyPreferenceName() {
+ return IPapyrusPreferencesConstant.PACKAGEIMPORT_PREF_ROUTING_DISTANCE_POLICY;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getRoutingObstructionPolicyPreferenceName() {
+ return IPapyrusPreferencesConstant.PACKAGEIMPORT_PREF_ROUTING_OBSTRUCTION_POLICY;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getRoutingStylePreferenceName() {
+ return IPapyrusPreferencesConstant.PACKAGEIMPORT_PREF_ROUTING_STYLE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getSmoothnessPreferenceName() {
+ return IPapyrusPreferencesConstant.PACKAGEIMPORT_PREF_SMOOTHNESS;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/PackageMergePreferencePage.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/PackageMergePreferencePage.java
new file mode 100644
index 00000000000..176ea703202
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/PackageMergePreferencePage.java
@@ -0,0 +1,119 @@
+/****************************************************************************
+ * Copyright (c) 2008 Atos Origin.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thibault Landre (Atos Origin) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.preferences.pages.AbstractPapyrusLinkPreferencePage;
+
+/**
+ * @generated
+ */
+public class PackageMergePreferencePage extends AbstractPapyrusLinkPreferencePage {
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(IPreferenceStore store) {
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.getInstance().ID;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontColorPreferenceName() {
+ return IPapyrusPreferencesConstant.PACKAGEMERGE_PREF_SMOOTHNESS;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontPreferenceName() {
+ return IPapyrusPreferencesConstant.PACKAGEMERGE_PREF_FONT;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getJumpLinkReversePreferenceName() {
+ return IPapyrusPreferencesConstant.PACKAGEMERGE_PREF_JUMPLINK_REVERSE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getJumpLinkStatusPreferenceName() {
+ return IPapyrusPreferencesConstant.PACKAGEMERGE_PREF_JUMPLINK_STATUS;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getJumpLinkTypePreferenceName() {
+ return IPapyrusPreferencesConstant.PACKAGEMERGE_PREF_JUMPLINK_TYPE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getLineColorPreferenceName() {
+ return IPapyrusPreferencesConstant.PACKAGEMERGE_PREF_LINE_COLOR;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getRoutingDistancePolicyPreferenceName() {
+ return IPapyrusPreferencesConstant.PACKAGEMERGE_PREF_ROUTING_DISTANCE_POLICY;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getRoutingObstructionPolicyPreferenceName() {
+ return IPapyrusPreferencesConstant.PACKAGEMERGE_PREF_ROUTING_OBSTRUCTION_POLICY;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getRoutingStylePreferenceName() {
+ return IPapyrusPreferencesConstant.PACKAGEMERGE_PREF_ROUTING_STYLE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getSmoothnessPreferenceName() {
+ return IPapyrusPreferencesConstant.PACKAGEMERGE_PREF_SMOOTHNESS;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/Package_2007PreferencePage.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/Package_2007PreferencePage.java
new file mode 100644
index 00000000000..a9bc84c6add
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/Package_2007PreferencePage.java
@@ -0,0 +1,71 @@
+/****************************************************************************
+ * Copyright (c) 2008 Atos Origin.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thibault Landre (Atos Origin) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.preferences.pages.AbstractPapyrusNodePreferencePage;
+
+/**
+ * @generated
+ */
+public class Package_2007PreferencePage extends AbstractPapyrusNodePreferencePage {
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(IPreferenceStore store) {
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.getInstance().ID;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFillColorPreferenceName() {
+ return IPapyrusPreferencesConstant.PACKAGE_2007_PREF_FILL_COLOR;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontColorPreferenceName() {
+ return IPapyrusPreferencesConstant.PACKAGE_2007_PREF_FONT_COLOR;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontPreferenceName() {
+ return IPapyrusPreferencesConstant.PACKAGE_2007_PREF_FONT;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getLineColorPreferenceName() {
+ return IPapyrusPreferencesConstant.PACKAGE_2007_PREF_LINE_COLOR;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/PrimitiveType_2009PreferencePage.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/PrimitiveType_2009PreferencePage.java
new file mode 100644
index 00000000000..f3bd6ddeb70
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/PrimitiveType_2009PreferencePage.java
@@ -0,0 +1,71 @@
+/****************************************************************************
+ * Copyright (c) 2008 Atos Origin.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thibault Landre (Atos Origin) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.preferences.pages.AbstractPapyrusNodePreferencePage;
+
+/**
+ * @generated
+ */
+public class PrimitiveType_2009PreferencePage extends AbstractPapyrusNodePreferencePage {
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(IPreferenceStore store) {
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.getInstance().ID;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFillColorPreferenceName() {
+ return IPapyrusPreferencesConstant.PRIMITIVETYPE_2009_PREF_FILL_COLOR;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontColorPreferenceName() {
+ return IPapyrusPreferencesConstant.PRIMITIVETYPE_2009_PREF_FONT_COLOR;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontPreferenceName() {
+ return IPapyrusPreferencesConstant.PRIMITIVETYPE_2009_PREF_FONT;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getLineColorPreferenceName() {
+ return IPapyrusPreferencesConstant.PRIMITIVETYPE_2009_PREF_LINE_COLOR;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/ProfileApplicationPreferencePage.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/ProfileApplicationPreferencePage.java
new file mode 100644
index 00000000000..1ffd6c9ca7d
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/ProfileApplicationPreferencePage.java
@@ -0,0 +1,119 @@
+/****************************************************************************
+ * Copyright (c) 2008 Atos Origin.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thibault Landre (Atos Origin) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.preferences.pages.AbstractPapyrusLinkPreferencePage;
+
+/**
+ * @generated
+ */
+public class ProfileApplicationPreferencePage extends AbstractPapyrusLinkPreferencePage {
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(IPreferenceStore store) {
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.getInstance().ID;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontColorPreferenceName() {
+ return IPapyrusPreferencesConstant.PROFILEAPPLICATION_PREF_SMOOTHNESS;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontPreferenceName() {
+ return IPapyrusPreferencesConstant.PROFILEAPPLICATION_PREF_FONT;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getJumpLinkReversePreferenceName() {
+ return IPapyrusPreferencesConstant.PROFILEAPPLICATION_PREF_JUMPLINK_REVERSE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getJumpLinkStatusPreferenceName() {
+ return IPapyrusPreferencesConstant.PROFILEAPPLICATION_PREF_JUMPLINK_STATUS;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getJumpLinkTypePreferenceName() {
+ return IPapyrusPreferencesConstant.PROFILEAPPLICATION_PREF_JUMPLINK_TYPE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getLineColorPreferenceName() {
+ return IPapyrusPreferencesConstant.PROFILEAPPLICATION_PREF_LINE_COLOR;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getRoutingDistancePolicyPreferenceName() {
+ return IPapyrusPreferencesConstant.PROFILEAPPLICATION_PREF_ROUTING_DISTANCE_POLICY;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getRoutingObstructionPolicyPreferenceName() {
+ return IPapyrusPreferencesConstant.PROFILEAPPLICATION_PREF_ROUTING_OBSTRUCTION_POLICY;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getRoutingStylePreferenceName() {
+ return IPapyrusPreferencesConstant.PROFILEAPPLICATION_PREF_ROUTING_STYLE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getSmoothnessPreferenceName() {
+ return IPapyrusPreferencesConstant.PROFILEAPPLICATION_PREF_SMOOTHNESS;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/RealizationPreferencePage.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/RealizationPreferencePage.java
new file mode 100644
index 00000000000..aceceffa4a4
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/RealizationPreferencePage.java
@@ -0,0 +1,119 @@
+/****************************************************************************
+ * Copyright (c) 2008 Atos Origin.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thibault Landre (Atos Origin) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.preferences.pages.AbstractPapyrusLinkPreferencePage;
+
+/**
+ * @generated
+ */
+public class RealizationPreferencePage extends AbstractPapyrusLinkPreferencePage {
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(IPreferenceStore store) {
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.getInstance().ID;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontColorPreferenceName() {
+ return IPapyrusPreferencesConstant.REALIZATION_PREF_SMOOTHNESS;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontPreferenceName() {
+ return IPapyrusPreferencesConstant.REALIZATION_PREF_FONT;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getJumpLinkReversePreferenceName() {
+ return IPapyrusPreferencesConstant.REALIZATION_PREF_JUMPLINK_REVERSE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getJumpLinkStatusPreferenceName() {
+ return IPapyrusPreferencesConstant.REALIZATION_PREF_JUMPLINK_STATUS;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getJumpLinkTypePreferenceName() {
+ return IPapyrusPreferencesConstant.REALIZATION_PREF_JUMPLINK_TYPE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getLineColorPreferenceName() {
+ return IPapyrusPreferencesConstant.REALIZATION_PREF_LINE_COLOR;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getRoutingDistancePolicyPreferenceName() {
+ return IPapyrusPreferencesConstant.REALIZATION_PREF_ROUTING_DISTANCE_POLICY;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getRoutingObstructionPolicyPreferenceName() {
+ return IPapyrusPreferencesConstant.REALIZATION_PREF_ROUTING_OBSTRUCTION_POLICY;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getRoutingStylePreferenceName() {
+ return IPapyrusPreferencesConstant.REALIZATION_PREF_ROUTING_STYLE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getSmoothnessPreferenceName() {
+ return IPapyrusPreferencesConstant.REALIZATION_PREF_SMOOTHNESS;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/Signal_2003PreferencePage.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/Signal_2003PreferencePage.java
new file mode 100644
index 00000000000..b374f6e0ae7
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/Signal_2003PreferencePage.java
@@ -0,0 +1,71 @@
+/****************************************************************************
+ * Copyright (c) 2008 Atos Origin.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thibault Landre (Atos Origin) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.preferences.pages.AbstractPapyrusNodePreferencePage;
+
+/**
+ * @generated
+ */
+public class Signal_2003PreferencePage extends AbstractPapyrusNodePreferencePage {
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(IPreferenceStore store) {
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.getInstance().ID;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFillColorPreferenceName() {
+ return IPapyrusPreferencesConstant.SIGNAL_2003_PREF_FILL_COLOR;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontColorPreferenceName() {
+ return IPapyrusPreferencesConstant.SIGNAL_2003_PREF_FONT_COLOR;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontPreferenceName() {
+ return IPapyrusPreferencesConstant.SIGNAL_2003_PREF_FONT;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getLineColorPreferenceName() {
+ return IPapyrusPreferencesConstant.SIGNAL_2003_PREF_LINE_COLOR;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/SubstitutionPreferencePage.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/SubstitutionPreferencePage.java
new file mode 100644
index 00000000000..b2cc03bebfc
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/SubstitutionPreferencePage.java
@@ -0,0 +1,119 @@
+/****************************************************************************
+ * Copyright (c) 2008 Atos Origin.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thibault Landre (Atos Origin) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.preferences.pages.AbstractPapyrusLinkPreferencePage;
+
+/**
+ * @generated
+ */
+public class SubstitutionPreferencePage extends AbstractPapyrusLinkPreferencePage {
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(IPreferenceStore store) {
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.getInstance().ID;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontColorPreferenceName() {
+ return IPapyrusPreferencesConstant.SUBSTITUTION_PREF_SMOOTHNESS;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontPreferenceName() {
+ return IPapyrusPreferencesConstant.SUBSTITUTION_PREF_FONT;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getJumpLinkReversePreferenceName() {
+ return IPapyrusPreferencesConstant.SUBSTITUTION_PREF_JUMPLINK_REVERSE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getJumpLinkStatusPreferenceName() {
+ return IPapyrusPreferencesConstant.SUBSTITUTION_PREF_JUMPLINK_STATUS;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getJumpLinkTypePreferenceName() {
+ return IPapyrusPreferencesConstant.SUBSTITUTION_PREF_JUMPLINK_TYPE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getLineColorPreferenceName() {
+ return IPapyrusPreferencesConstant.SUBSTITUTION_PREF_LINE_COLOR;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getRoutingDistancePolicyPreferenceName() {
+ return IPapyrusPreferencesConstant.SUBSTITUTION_PREF_ROUTING_DISTANCE_POLICY;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getRoutingObstructionPolicyPreferenceName() {
+ return IPapyrusPreferencesConstant.SUBSTITUTION_PREF_ROUTING_OBSTRUCTION_POLICY;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getRoutingStylePreferenceName() {
+ return IPapyrusPreferencesConstant.SUBSTITUTION_PREF_ROUTING_STYLE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getSmoothnessPreferenceName() {
+ return IPapyrusPreferencesConstant.SUBSTITUTION_PREF_SMOOTHNESS;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/TemplateBindingPreferencePage.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/TemplateBindingPreferencePage.java
new file mode 100644
index 00000000000..e3147abb99d
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/TemplateBindingPreferencePage.java
@@ -0,0 +1,119 @@
+/****************************************************************************
+ * Copyright (c) 2008 Atos Origin.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thibault Landre (Atos Origin) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.preferences.pages.AbstractPapyrusLinkPreferencePage;
+
+/**
+ * @generated
+ */
+public class TemplateBindingPreferencePage extends AbstractPapyrusLinkPreferencePage {
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(IPreferenceStore store) {
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.getInstance().ID;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontColorPreferenceName() {
+ return IPapyrusPreferencesConstant.TEMPLATEBINDING_PREF_SMOOTHNESS;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontPreferenceName() {
+ return IPapyrusPreferencesConstant.TEMPLATEBINDING_PREF_FONT;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getJumpLinkReversePreferenceName() {
+ return IPapyrusPreferencesConstant.TEMPLATEBINDING_PREF_JUMPLINK_REVERSE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getJumpLinkStatusPreferenceName() {
+ return IPapyrusPreferencesConstant.TEMPLATEBINDING_PREF_JUMPLINK_STATUS;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getJumpLinkTypePreferenceName() {
+ return IPapyrusPreferencesConstant.TEMPLATEBINDING_PREF_JUMPLINK_TYPE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getLineColorPreferenceName() {
+ return IPapyrusPreferencesConstant.TEMPLATEBINDING_PREF_LINE_COLOR;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getRoutingDistancePolicyPreferenceName() {
+ return IPapyrusPreferencesConstant.TEMPLATEBINDING_PREF_ROUTING_DISTANCE_POLICY;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getRoutingObstructionPolicyPreferenceName() {
+ return IPapyrusPreferencesConstant.TEMPLATEBINDING_PREF_ROUTING_OBSTRUCTION_POLICY;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getRoutingStylePreferenceName() {
+ return IPapyrusPreferencesConstant.TEMPLATEBINDING_PREF_ROUTING_STYLE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getSmoothnessPreferenceName() {
+ return IPapyrusPreferencesConstant.TEMPLATEBINDING_PREF_SMOOTHNESS;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/UsagePreferencePage.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/UsagePreferencePage.java
new file mode 100644
index 00000000000..17341db9045
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/preferences/UsagePreferencePage.java
@@ -0,0 +1,119 @@
+/****************************************************************************
+ * Copyright (c) 2008 Atos Origin.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thibault Landre (Atos Origin) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.preferences.pages.AbstractPapyrusLinkPreferencePage;
+
+/**
+ * @generated
+ */
+public class UsagePreferencePage extends AbstractPapyrusLinkPreferencePage {
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(IPreferenceStore store) {
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.getInstance().ID;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontColorPreferenceName() {
+ return IPapyrusPreferencesConstant.USAGE_PREF_SMOOTHNESS;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getFontPreferenceName() {
+ return IPapyrusPreferencesConstant.USAGE_PREF_FONT;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getJumpLinkReversePreferenceName() {
+ return IPapyrusPreferencesConstant.USAGE_PREF_JUMPLINK_REVERSE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getJumpLinkStatusPreferenceName() {
+ return IPapyrusPreferencesConstant.USAGE_PREF_JUMPLINK_STATUS;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getJumpLinkTypePreferenceName() {
+ return IPapyrusPreferencesConstant.USAGE_PREF_JUMPLINK_TYPE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getLineColorPreferenceName() {
+ return IPapyrusPreferencesConstant.USAGE_PREF_LINE_COLOR;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getRoutingDistancePolicyPreferenceName() {
+ return IPapyrusPreferencesConstant.USAGE_PREF_ROUTING_DISTANCE_POLICY;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getRoutingObstructionPolicyPreferenceName() {
+ return IPapyrusPreferencesConstant.USAGE_PREF_ROUTING_OBSTRUCTION_POLICY;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getRoutingStylePreferenceName() {
+ return IPapyrusPreferencesConstant.USAGE_PREF_ROUTING_STYLE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getSmoothnessPreferenceName() {
+ return IPapyrusPreferencesConstant.USAGE_PREF_SMOOTHNESS;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/providers/ElementInitializers.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/providers/ElementInitializers.java
new file mode 100644
index 00000000000..2b75eeeefb1
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/providers/ElementInitializers.java
@@ -0,0 +1,1009 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.providers;
+
+import org.eclipse.papyrus.diagram.clazz.custom.helper.NamedElementHelper;
+import org.eclipse.papyrus.diagram.clazz.expressions.UMLOCLFactory;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+import org.eclipse.uml2.uml.Abstraction;
+import org.eclipse.uml2.uml.Association;
+import org.eclipse.uml2.uml.AssociationClass;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Comment;
+import org.eclipse.uml2.uml.Component;
+import org.eclipse.uml2.uml.Constraint;
+import org.eclipse.uml2.uml.DataType;
+import org.eclipse.uml2.uml.Dependency;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.ElementImport;
+import org.eclipse.uml2.uml.Enumeration;
+import org.eclipse.uml2.uml.EnumerationLiteral;
+import org.eclipse.uml2.uml.InstanceSpecification;
+import org.eclipse.uml2.uml.Interface;
+import org.eclipse.uml2.uml.InterfaceRealization;
+import org.eclipse.uml2.uml.Model;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.Operation;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.PrimitiveType;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.Realization;
+import org.eclipse.uml2.uml.Reception;
+import org.eclipse.uml2.uml.Signal;
+import org.eclipse.uml2.uml.Substitution;
+import org.eclipse.uml2.uml.UMLPackage;
+import org.eclipse.uml2.uml.Usage;
+
+/**
+ * @generated
+ */
+public class ElementInitializers {
+
+ /**
+ * @generated-not
+ */
+
+ /**
+ * @generated-not
+ */
+ private static String alias_ElementImport_4009(ElementImport self) {
+ if (self.getImportedElement() != null) {
+ return (self.getImportedElement().getLabel());
+ }
+ return "elementimport";
+ }
+
+ /**
+ * method used to find the good name of an element
+ *
+ * @param element
+ * the namedElement for wich we look for a name
+ * @return a new name
+ */
+ private static String getName(NamedElement element) {
+ if (element != null && element.getOwner() != null) {
+ return NamedElementHelper.EINSTANCE.getNewUMLElementName((Element) element.getOwner(), element.eClass());
+ }
+ return "";
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_Abstraction_4006(Abstraction instance) {
+ try {
+ Object value_0 = name_Abstraction_4006(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_Association_4001(Association instance) {
+ try {
+ Object value_0 = name_Association_4001(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_AssociationClass_2013(AssociationClass instance) {
+ try {
+ Object value_0 = name_AssociationClass_2013(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_AssociationClass_4017(AssociationClass instance) {
+ try {
+ Object value_0 = name_AssociationClass_4017(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_Class_2008(Class instance) {
+ try {
+ Object value_0 = name_Class_2008(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_Class_3004(Class instance) {
+ try {
+ Object value_0 = name_Class_3004(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_Class_3008(Class instance) {
+ try {
+ Object value_0 = name_Class_3008(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_Class_3010(Class instance) {
+ try {
+ Object value_0 = name_Class_3010(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_Class_3014(Class instance) {
+ try {
+ Object value_0 = name_Class_3014(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated-not
+ */
+ public static void init_Comment_1012(Comment instance) {
+ try {
+ Object value0 = UMLOCLFactory.getExpression("' '", UMLPackage.eINSTANCE.getComment()).evaluate(instance);
+ instance.setBody((String) value0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_Comment_2012(Comment instance) {
+ try {
+ Object value_0 = UMLOCLFactory.getExpression("\' \'", UMLPackage.eINSTANCE.getComment()).evaluate(instance);
+ instance.setBody((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_Comment_3028(Comment instance) {
+ try {
+ Object value_0 = UMLOCLFactory.getExpression("\' \'", UMLPackage.eINSTANCE.getComment()).evaluate(instance);
+ instance.setBody((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_Component_2002(Component instance) {
+ try {
+ Object value_0 = name_Component_2002(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_Component_3021(Component instance) {
+ try {
+ Object value_0 = name_Component_3021(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_Constraint_2011(Constraint instance) {
+ try {
+ Object value_0 = name_Constraint_2011(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_Constraint_3029(Constraint instance) {
+ try {
+ Object value_0 = name_Constraint_3029(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_DataType_2010(DataType instance) {
+ try {
+ Object value_0 = name_DataType_2010(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_DataType_3027(DataType instance) {
+ try {
+ Object value_0 = name_DataType_3027(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_ElementImport_4009(ElementImport instance) {
+ try {
+ Object value_0 = alias_ElementImport_4009(instance);
+ instance.setAlias((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_Enumeration_2006(Enumeration instance) {
+ try {
+ Object value_0 = name_Enumeration_2006(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_Enumeration_3025(Enumeration instance) {
+ try {
+ Object value_0 = name_Enumeration_3025(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_EnumerationLiteral_3017(EnumerationLiteral instance) {
+ try {
+ Object value_0 = name_EnumerationLiteral_3017(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_InstanceSpecification_2001(InstanceSpecification instance) {
+ try {
+ Object value_0 = name_InstanceSpecification_2001(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_InstanceSpecification_3020(InstanceSpecification instance) {
+ try {
+ Object value_0 = name_InstanceSpecification_3020(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_Interface_2004(Interface instance) {
+ try {
+ Object value_0 = name_Interface_2004(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_Interface_3023(Interface instance) {
+ try {
+ Object value_0 = name_Interface_3023(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_InterfaceRealization_4003(InterfaceRealization instance) {
+ try {
+ Object value_0 = name_InterfaceRealization_4003(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_Model_2005(Model instance) {
+ try {
+ Object value_0 = name_Model_2005(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_Model_3024(Model instance) {
+ try {
+ Object value_0 = name_Model_3024(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_Operation_3003(Operation instance) {
+ try {
+ Object value_0 = name_Operation_3003(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_Operation_3007(Operation instance) {
+ try {
+ Object value_0 = name_Operation_3007(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_Operation_3013(Operation instance) {
+ try {
+ Object value_0 = name_Operation_3013(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_Operation_3019(Operation instance) {
+ try {
+ Object value_0 = name_Operation_3019(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_Package_2007(Package instance) {
+ try {
+ Object value_0 = name_Package_2007(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_Package_3009(Package instance) {
+ try {
+ Object value_0 = name_Package_3009(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_PrimitiveType_2009(PrimitiveType instance) {
+ try {
+ Object value_0 = name_PrimitiveType_2009(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_PrimitiveType_3026(PrimitiveType instance) {
+ try {
+ Object value_0 = name_PrimitiveType_3026(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_Property_3002(Property instance) {
+ try {
+ Object value_0 = name_Property_3002(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_Property_3005(Property instance) {
+ try {
+ Object value_0 = name_Property_3005(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_Property_3006(Property instance) {
+ try {
+ Object value_0 = name_Property_3006(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_Property_3012(Property instance) {
+ try {
+ Object value_0 = name_Property_3012(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_Property_3018(Property instance) {
+ try {
+ Object value_0 = name_Property_3018(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_Realization_4005(Realization instance) {
+ try {
+ Object value_0 = name_Realization_4005(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_Reception_3011(Reception instance) {
+ try {
+ Object value_0 = name_Reception_3011(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_Signal_2003(Signal instance) {
+ try {
+ Object value_0 = name_Signal_2003(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_Signal_3022(Signal instance) {
+ try {
+ Object value_0 = name_Signal_3022(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_Substitution_4004(Substitution instance) {
+ try {
+ Object value_0 = name_Substitution_4004(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_Usage_4007(Usage instance) {
+ try {
+ Object value_0 = name_Usage_4007(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_Dependency_4008(Dependency instance) {
+ try {
+ Object value_0 = name_Dependency_4008(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void init_Dependency_4018(Dependency instance) {
+ try {
+ Object value_0 = name_Dependency_4018(instance);
+ instance.setName((String) value_0);
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated-not
+ */
+ private static String name_Abstraction_4006(Abstraction self) {
+ return getName(self);
+ }
+
+ /**
+ * @generated-not
+ */
+ private static String name_Association_4001(Association self) {
+ return getName(self);
+ }
+
+ /**
+ * @generated-not
+ */
+ private static String name_AssociationClass_2013(AssociationClass self) {
+ return getName(self);
+ }
+
+ /**
+ * @generated-not
+ */
+ private static String name_AssociationClass_4017(AssociationClass self) {
+ return getName(self);
+ }
+
+ /**
+ * @generated-not
+ */
+ private static String name_Class_2008(Class self) {
+ return getName(self);
+ }
+
+ /**
+ * @generated-not
+ */
+ private static String name_Class_3004(Class self) {
+ return getName(self);
+ }
+
+ /**
+ * @generated-not
+ */
+ private static String name_Class_3008(Class self) {
+ return getName(self);
+ }
+
+ /**
+ * @generated-not
+ */
+ private static String name_Class_3010(Class self) {
+ return getName(self);
+ }
+
+ /**
+ * @generated-not
+ */
+ private static String name_Class_3014(Class self) {
+ return getName(self);
+ }
+
+ /**
+ * @generated-not
+ */
+ private static String name_Component_2002(Component self) {
+ return getName(self);
+ }
+
+ /**
+ * @generated-not
+ */
+ private static String name_Component_3021(Component self) {
+ return getName(self);
+ }
+
+ /**
+ * @generated-not
+ */
+ private static String name_Constraint_2011(Constraint self) {
+ return getName(self);
+ }
+
+ /**
+ * @generated-not
+ */
+ private static String name_Constraint_3029(Constraint self) {
+ return getName(self);
+ }
+
+ /**
+ * @generated-not
+ */
+ private static String name_DataType_2010(DataType self) {
+ return getName(self);
+ }
+
+ /**
+ * @generated-not
+ */
+ private static String name_DataType_3027(DataType self) {
+ return getName(self);
+ }
+
+ /**
+ * @generated-not
+ */
+ private static String name_Dependency_4018(Dependency self) {
+ return getName(self);
+ }
+
+ /**
+ * @generated-not
+ */
+ private static String name_Enumeration_2006(Enumeration self) {
+ return getName(self);
+ }
+
+ /**
+ * @generated-not
+ */
+ private static String name_Enumeration_3025(Enumeration self) {
+ return getName(self);
+ }
+
+ /**
+ * @generated-not
+ */
+ private static String name_EnumerationLiteral_3017(EnumerationLiteral self) {
+ return getName(self);
+ }
+
+ /**
+ * @generated-not
+ */
+ private static String name_InstanceSpecification_2001(InstanceSpecification self) {
+ return getName(self);
+ }
+
+ /**
+ * @generated
+ */
+ private static String name_InstanceSpecification_3020(InstanceSpecification self) {
+ // TODO: implement this method to return value
+ // for org.eclipse.uml2.uml.UMLPackage.eINSTANCE.getNamedElement_Name()
+ // Ensure that you remove @generated or mark it @generated NOT
+ throw new UnsupportedOperationException("No user java implementation provided in 'name_InstanceSpecification_3020' operation");//$NON-NLS-1$
+ }
+
+ /**
+ * @generated-not
+ */
+ private static String name_Interface_2004(Interface self) {
+ return getName(self);
+ }
+
+ /**
+ * @generated-not
+ */
+ private static String name_Interface_3023(Interface self) {
+ return getName(self);
+ }
+
+ /**
+ * @generated-not
+ */
+ private static String name_InterfaceRealization_4003(InterfaceRealization self) {
+ return getName(self);
+ }
+
+ /**
+ * @generated-not
+ */
+ private static String name_Model_2005(Model self) {
+ return getName(self);
+ }
+
+ /**
+ * @generated-not
+ */
+ private static String name_Model_3024(Model self) {
+ return getName(self);
+ }
+
+ /**
+ * @generated-not
+ */
+ private static String name_Operation_3003(Operation self) {
+ return getName(self);
+ }
+
+ /**
+ * @generated-not
+ */
+ private static String name_Operation_3007(Operation self) {
+ return getName(self);
+ }
+
+ /**
+ * @generated-not
+ */
+ private static String name_Operation_3013(Operation self) {
+ return getName(self);
+ }
+
+ /**
+ * @generated-not
+ */
+ private static String name_Operation_3019(Operation self) {
+ return getName(self);
+ }
+
+ /**
+ * @generated-not
+ */
+ private static String name_Package_2007(Package self) {
+ return getName(self);
+ }
+
+ /**
+ * @generated-not
+ */
+ private static String name_Package_3009(Package self) {
+ return getName(self);
+ }
+
+ /**
+ * @generated-not
+ */
+ private static String name_PrimitiveType_2009(PrimitiveType self) {
+ return getName(self);
+ }
+
+ /**
+ * @generated-not
+ */
+ private static String name_PrimitiveType_3026(PrimitiveType self) {
+ return getName(self);
+ }
+
+ /**
+ * @generated-not
+ */
+ private static String name_Property_3002(Property self) {
+ return getName(self);
+ }
+
+ /**
+ * @generated-not
+ */
+ private static String name_Property_3005(Property self) {
+ return getName(self);
+ }
+
+ /**
+ * @generated-not
+ */
+ private static String name_Property_3006(Property self) {
+ return getName(self);
+ }
+
+ /**
+ * @generated-not
+ */
+ private static String name_Property_3012(Property self) {
+ return getName(self);
+ }
+
+ /**
+ * @generated-not
+ */
+ private static String name_Property_3018(Property self) {
+ return getName(self);
+ }
+
+ /**
+ * @generated-not
+ */
+ private static String name_Realization_4005(Realization self) {
+ return getName(self);
+ }
+
+ /**
+ * @generated-not
+ */
+ private static String name_Reception_3011(Reception self) {
+ return getName(self);
+ }
+
+ /**
+ * @generated-not
+ */
+ private static String name_Signal_2003(Signal self) {
+ return getName(self);
+ }
+
+ /**
+ * @generated-not
+ */
+ private static String name_Signal_3022(Signal self) {
+ return getName(self);
+ }
+
+ /**
+ * @generated-not
+ */
+ private static String name_Substitution_4004(Substitution self) {
+ return getName(self);
+ }
+
+ /**
+ * @generated-not
+ */
+ private static String name_Usage_4007(Usage self) {
+ return getName(self);
+ }
+
+ /**
+ * @generated
+ */
+ private static String name_Dependency_4008(Dependency self) {
+ // TODO: implement this method to return value
+ // for org.eclipse.uml2.uml.UMLPackage.eINSTANCE.getNamedElement_Name()
+ // Ensure that you remove @generated or mark it @generated NOT
+ throw new UnsupportedOperationException("No user java implementation provided in 'name_Dependency_4008' operation");//$NON-NLS-1$
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/providers/UMLEditPartProvider.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/providers/UMLEditPartProvider.java
new file mode 100644
index 00000000000..248596ddd31
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/providers/UMLEditPartProvider.java
@@ -0,0 +1,154 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.providers;
+
+import java.lang.ref.WeakReference;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartFactory;
+import org.eclipse.gmf.runtime.common.core.service.IOperation;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.services.editpart.AbstractEditPartProvider;
+import org.eclipse.gmf.runtime.diagram.ui.services.editpart.CreateGraphicEditPartOperation;
+import org.eclipse.gmf.runtime.diagram.ui.services.editpart.IEditPartOperation;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UMLEditPartFactory;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class UMLEditPartProvider extends AbstractEditPartProvider {
+
+ /**
+ * @generated
+ */
+ private EditPartFactory factory;
+
+ /**
+ * @generated
+ */
+ private boolean allowCaching;
+
+ /**
+ * @generated
+ */
+ private WeakReference cachedPart;
+
+ /**
+ * @generated
+ */
+ private WeakReference cachedView;
+
+ /**
+ * @generated
+ */
+ public UMLEditPartProvider() {
+ setFactory(new UMLEditPartFactory());
+ setAllowCaching(true);
+ }
+
+ /**
+ * @generated
+ */
+ public final EditPartFactory getFactory() {
+ return factory;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFactory(EditPartFactory factory) {
+ this.factory = factory;
+ }
+
+ /**
+ * @generated
+ */
+ public final boolean isAllowCaching() {
+ return allowCaching;
+ }
+
+ /**
+ * @generated
+ */
+ protected synchronized void setAllowCaching(boolean allowCaching) {
+ this.allowCaching = allowCaching;
+ if (!allowCaching) {
+ cachedPart = null;
+ cachedView = null;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected IGraphicalEditPart createEditPart(View view) {
+ EditPart part = factory.createEditPart(null, view);
+ if (part instanceof IGraphicalEditPart) {
+ return (IGraphicalEditPart) part;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected IGraphicalEditPart getCachedPart(View view) {
+ if (cachedView != null && cachedView.get() == view) {
+ return (IGraphicalEditPart) cachedPart.get();
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public synchronized IGraphicalEditPart createGraphicEditPart(View view) {
+ if (isAllowCaching()) {
+ IGraphicalEditPart part = getCachedPart(view);
+ cachedPart = null;
+ cachedView = null;
+ if (part != null) {
+ return part;
+ }
+ }
+ return createEditPart(view);
+ }
+
+ /**
+ * @generated
+ */
+ public synchronized boolean provides(IOperation operation) {
+ if (operation instanceof CreateGraphicEditPartOperation) {
+ View view = ((IEditPartOperation) operation).getView();
+ if (!ModelEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(view))) {
+ return false;
+ }
+ if (isAllowCaching() && getCachedPart(view) != null) {
+ return true;
+ }
+ IGraphicalEditPart part = createEditPart(view);
+ if (part != null) {
+ if (isAllowCaching()) {
+ cachedPart = new WeakReference(part);
+ cachedView = new WeakReference(view);
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/providers/UMLElementTypes.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/providers/UMLElementTypes.java
new file mode 100644
index 00000000000..ef15101619c
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/providers/UMLElementTypes.java
@@ -0,0 +1,696 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.providers;
+
+import java.util.HashSet;
+import java.util.IdentityHashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.ENamedElement;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class UMLElementTypes extends ElementInitializers {
+
+ /**
+ * @generated
+ */
+ private UMLElementTypes() {
+ }
+
+ /**
+ * @generated
+ */
+ private static Map elements;
+
+ /**
+ * @generated
+ */
+ private static ImageRegistry imageRegistry;
+
+ /**
+ * @generated
+ */
+ private static Set KNOWN_ELEMENT_TYPES;
+
+ /**
+ * @generated
+ */
+ public static final IElementType Package_1000 = getElementType("org.eclipse.papyrus.diagram.clazz.Package_1000"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Dependency_2014 = getElementType("org.eclipse.papyrus.diagram.clazz.Dependency_2014"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType InstanceSpecification_2001 = getElementType("org.eclipse.papyrus.diagram.clazz.InstanceSpecification_2001"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Component_2002 = getElementType("org.eclipse.papyrus.diagram.clazz.Component_2002"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Signal_2003 = getElementType("org.eclipse.papyrus.diagram.clazz.Signal_2003"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Interface_2004 = getElementType("org.eclipse.papyrus.diagram.clazz.Interface_2004"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Model_2005 = getElementType("org.eclipse.papyrus.diagram.clazz.Model_2005"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Enumeration_2006 = getElementType("org.eclipse.papyrus.diagram.clazz.Enumeration_2006"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Package_2007 = getElementType("org.eclipse.papyrus.diagram.clazz.Package_2007"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Class_2008 = getElementType("org.eclipse.papyrus.diagram.clazz.Class_2008"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType PrimitiveType_2009 = getElementType("org.eclipse.papyrus.diagram.clazz.PrimitiveType_2009"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType DataType_2010 = getElementType("org.eclipse.papyrus.diagram.clazz.DataType_2010"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Constraint_2011 = getElementType("org.eclipse.papyrus.diagram.clazz.Constraint_2011"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Comment_2012 = getElementType("org.eclipse.papyrus.diagram.clazz.Comment_2012"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType AssociationClass_2013 = getElementType("org.eclipse.papyrus.diagram.clazz.AssociationClass_2013"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Association_2015 = getElementType("org.eclipse.papyrus.diagram.clazz.Association_2015"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Slot_3001 = getElementType("org.eclipse.papyrus.diagram.clazz.Slot_3001"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Property_3002 = getElementType("org.eclipse.papyrus.diagram.clazz.Property_3002"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Operation_3003 = getElementType("org.eclipse.papyrus.diagram.clazz.Operation_3003"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Class_3004 = getElementType("org.eclipse.papyrus.diagram.clazz.Class_3004"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Property_3005 = getElementType("org.eclipse.papyrus.diagram.clazz.Property_3005"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Property_3006 = getElementType("org.eclipse.papyrus.diagram.clazz.Property_3006"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Operation_3007 = getElementType("org.eclipse.papyrus.diagram.clazz.Operation_3007"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Class_3008 = getElementType("org.eclipse.papyrus.diagram.clazz.Class_3008"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Package_3009 = getElementType("org.eclipse.papyrus.diagram.clazz.Package_3009"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType InstanceSpecification_3020 = getElementType("org.eclipse.papyrus.diagram.clazz.InstanceSpecification_3020"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Component_3021 = getElementType("org.eclipse.papyrus.diagram.clazz.Component_3021"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Signal_3022 = getElementType("org.eclipse.papyrus.diagram.clazz.Signal_3022"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Interface_3023 = getElementType("org.eclipse.papyrus.diagram.clazz.Interface_3023"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Model_3024 = getElementType("org.eclipse.papyrus.diagram.clazz.Model_3024"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Class_3010 = getElementType("org.eclipse.papyrus.diagram.clazz.Class_3010"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Reception_3011 = getElementType("org.eclipse.papyrus.diagram.clazz.Reception_3011"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Property_3012 = getElementType("org.eclipse.papyrus.diagram.clazz.Property_3012"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Operation_3013 = getElementType("org.eclipse.papyrus.diagram.clazz.Operation_3013"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Class_3014 = getElementType("org.eclipse.papyrus.diagram.clazz.Class_3014"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType RedefinableTemplateSignature_3015 = getElementType("org.eclipse.papyrus.diagram.clazz.RedefinableTemplateSignature_3015"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType TemplateParameter_3016 = getElementType("org.eclipse.papyrus.diagram.clazz.TemplateParameter_3016"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Enumeration_3025 = getElementType("org.eclipse.papyrus.diagram.clazz.Enumeration_3025"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType EnumerationLiteral_3017 = getElementType("org.eclipse.papyrus.diagram.clazz.EnumerationLiteral_3017"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType PrimitiveType_3026 = getElementType("org.eclipse.papyrus.diagram.clazz.PrimitiveType_3026"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType DataType_3027 = getElementType("org.eclipse.papyrus.diagram.clazz.DataType_3027"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Property_3018 = getElementType("org.eclipse.papyrus.diagram.clazz.Property_3018"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Operation_3019 = getElementType("org.eclipse.papyrus.diagram.clazz.Operation_3019"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Comment_3028 = getElementType("org.eclipse.papyrus.diagram.clazz.Comment_3028"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Constraint_3029 = getElementType("org.eclipse.papyrus.diagram.clazz.Constraint_3029"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Link_4016 = getElementType("org.eclipse.papyrus.diagram.clazz.Link_4016"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType AssociationClass_4017 = getElementType("org.eclipse.papyrus.diagram.clazz.AssociationClass_4017"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Association_4001 = getElementType("org.eclipse.papyrus.diagram.clazz.Association_4001"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Association_4019 = getElementType("org.eclipse.papyrus.diagram.clazz.Association_4019"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Generalization_4002 = getElementType("org.eclipse.papyrus.diagram.clazz.Generalization_4002"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType InterfaceRealization_4003 = getElementType("org.eclipse.papyrus.diagram.clazz.InterfaceRealization_4003"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Substitution_4004 = getElementType("org.eclipse.papyrus.diagram.clazz.Substitution_4004"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Realization_4005 = getElementType("org.eclipse.papyrus.diagram.clazz.Realization_4005"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Abstraction_4006 = getElementType("org.eclipse.papyrus.diagram.clazz.Abstraction_4006"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Usage_4007 = getElementType("org.eclipse.papyrus.diagram.clazz.Usage_4007"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Dependency_4008 = getElementType("org.eclipse.papyrus.diagram.clazz.Dependency_4008"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Dependency_4018 = getElementType("org.eclipse.papyrus.diagram.clazz.Dependency_4018"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType ElementImport_4009 = getElementType("org.eclipse.papyrus.diagram.clazz.ElementImport_4009"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType PackageImport_4010 = getElementType("org.eclipse.papyrus.diagram.clazz.PackageImport_4010"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType PackageMerge_4011 = getElementType("org.eclipse.papyrus.diagram.clazz.PackageMerge_4011"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType ProfileApplication_4012 = getElementType("org.eclipse.papyrus.diagram.clazz.ProfileApplication_4012"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType CommentAnnotatedElement_4013 = getElementType("org.eclipse.papyrus.diagram.clazz.CommentAnnotatedElement_4013"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType ConstraintConstrainedElement_4014 = getElementType("org.eclipse.papyrus.diagram.clazz.ConstraintConstrainedElement_4014"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType TemplateBinding_4015 = getElementType("org.eclipse.papyrus.diagram.clazz.TemplateBinding_4015"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ private static ImageRegistry getImageRegistry() {
+ if (imageRegistry == null) {
+ imageRegistry = new ImageRegistry();
+ }
+ return imageRegistry;
+ }
+
+ /**
+ * @generated
+ */
+ private static String getImageRegistryKey(ENamedElement element) {
+ return element.getName();
+ }
+
+ /**
+ * @generated
+ */
+ private static ImageDescriptor getProvidedImageDescriptor(ENamedElement element) {
+ if (element instanceof EStructuralFeature) {
+ EStructuralFeature feature = ((EStructuralFeature) element);
+ EClass eContainingClass = feature.getEContainingClass();
+ EClassifier eType = feature.getEType();
+ if (eContainingClass != null && !eContainingClass.isAbstract()) {
+ element = eContainingClass;
+ } else if (eType instanceof EClass && !((EClass) eType).isAbstract()) {
+ element = eType;
+ }
+ }
+ if (element instanceof EClass) {
+ EClass eClass = (EClass) element;
+ if (!eClass.isAbstract()) {
+ return UMLDiagramEditorPlugin.getInstance().getItemImageDescriptor(eClass.getEPackage().getEFactoryInstance().create(eClass));
+ }
+ }
+ // TODO : support structural features
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public static ImageDescriptor getImageDescriptor(ENamedElement element) {
+ String key = getImageRegistryKey(element);
+ ImageDescriptor imageDescriptor = getImageRegistry().getDescriptor(key);
+ if (imageDescriptor == null) {
+ imageDescriptor = getProvidedImageDescriptor(element);
+ if (imageDescriptor == null) {
+ imageDescriptor = ImageDescriptor.getMissingImageDescriptor();
+ }
+ getImageRegistry().put(key, imageDescriptor);
+ }
+ return imageDescriptor;
+ }
+
+ /**
+ * @generated
+ */
+ public static Image getImage(ENamedElement element) {
+ String key = getImageRegistryKey(element);
+ Image image = getImageRegistry().get(key);
+ if (image == null) {
+ ImageDescriptor imageDescriptor = getProvidedImageDescriptor(element);
+ if (imageDescriptor == null) {
+ imageDescriptor = ImageDescriptor.getMissingImageDescriptor();
+ }
+ getImageRegistry().put(key, imageDescriptor);
+ image = getImageRegistry().get(key);
+ }
+ return image;
+ }
+
+ /**
+ * @generated
+ */
+ public static ImageDescriptor getImageDescriptor(IAdaptable hint) {
+ ENamedElement element = getElement(hint);
+ if (element == null) {
+ return null;
+ }
+ return getImageDescriptor(element);
+ }
+
+ /**
+ * @generated
+ */
+ public static Image getImage(IAdaptable hint) {
+ ENamedElement element = getElement(hint);
+ if (element == null) {
+ return null;
+ }
+ return getImage(element);
+ }
+
+ /**
+ * Returns 'type' of the ecore object associated with the hint.
+ *
+ * @generated
+ */
+ public static ENamedElement getElement(IAdaptable hint) {
+ Object type = hint.getAdapter(IElementType.class);
+ if (elements == null) {
+ elements = new IdentityHashMap();
+
+ elements.put(Package_1000, UMLPackage.eINSTANCE.getPackage());
+
+ elements.put(Dependency_2014, UMLPackage.eINSTANCE.getDependency());
+
+ elements.put(AssociationClass_2013, UMLPackage.eINSTANCE.getAssociationClass());
+
+ elements.put(Association_2015, UMLPackage.eINSTANCE.getAssociation());
+
+ elements.put(InstanceSpecification_2001, UMLPackage.eINSTANCE.getInstanceSpecification());
+
+ elements.put(Component_2002, UMLPackage.eINSTANCE.getComponent());
+
+ elements.put(Signal_2003, UMLPackage.eINSTANCE.getSignal());
+
+ elements.put(Interface_2004, UMLPackage.eINSTANCE.getInterface());
+
+ elements.put(Model_2005, UMLPackage.eINSTANCE.getModel());
+
+ elements.put(Enumeration_2006, UMLPackage.eINSTANCE.getEnumeration());
+
+ elements.put(Package_2007, UMLPackage.eINSTANCE.getPackage());
+
+ elements.put(Class_2008, UMLPackage.eINSTANCE.getClass_());
+
+ elements.put(PrimitiveType_2009, UMLPackage.eINSTANCE.getPrimitiveType());
+
+ elements.put(DataType_2010, UMLPackage.eINSTANCE.getDataType());
+
+ elements.put(Constraint_2011, UMLPackage.eINSTANCE.getConstraint());
+
+ elements.put(Comment_2012, UMLPackage.eINSTANCE.getComment());
+
+ elements.put(Property_3002, UMLPackage.eINSTANCE.getProperty());
+
+ elements.put(Slot_3001, UMLPackage.eINSTANCE.getSlot());
+
+ elements.put(Operation_3003, UMLPackage.eINSTANCE.getOperation());
+
+ elements.put(Class_3004, UMLPackage.eINSTANCE.getClass_());
+
+ elements.put(RedefinableTemplateSignature_3015, UMLPackage.eINSTANCE.getRedefinableTemplateSignature());
+
+ elements.put(TemplateParameter_3016, UMLPackage.eINSTANCE.getTemplateParameter());
+
+ elements.put(Property_3005, UMLPackage.eINSTANCE.getProperty());
+
+ elements.put(Property_3006, UMLPackage.eINSTANCE.getProperty());
+
+ elements.put(Operation_3007, UMLPackage.eINSTANCE.getOperation());
+
+ elements.put(Class_3008, UMLPackage.eINSTANCE.getClass_());
+
+ elements.put(InstanceSpecification_3020, UMLPackage.eINSTANCE.getInstanceSpecification());
+
+ elements.put(Component_3021, UMLPackage.eINSTANCE.getComponent());
+
+ elements.put(Signal_3022, UMLPackage.eINSTANCE.getSignal());
+
+ elements.put(Interface_3023, UMLPackage.eINSTANCE.getInterface());
+
+ elements.put(Model_3024, UMLPackage.eINSTANCE.getModel());
+
+ elements.put(Enumeration_3025, UMLPackage.eINSTANCE.getEnumeration());
+
+ elements.put(EnumerationLiteral_3017, UMLPackage.eINSTANCE.getEnumerationLiteral());
+
+ elements.put(Package_3009, UMLPackage.eINSTANCE.getPackage());
+
+ elements.put(Class_3010, UMLPackage.eINSTANCE.getClass_());
+
+ elements.put(Reception_3011, UMLPackage.eINSTANCE.getReception());
+
+ elements.put(Property_3012, UMLPackage.eINSTANCE.getProperty());
+
+ elements.put(Operation_3013, UMLPackage.eINSTANCE.getOperation());
+
+ elements.put(Class_3014, UMLPackage.eINSTANCE.getClass_());
+
+ elements.put(PrimitiveType_3026, UMLPackage.eINSTANCE.getPrimitiveType());
+
+ elements.put(DataType_3027, UMLPackage.eINSTANCE.getDataType());
+
+ elements.put(Property_3018, UMLPackage.eINSTANCE.getProperty());
+
+ elements.put(Operation_3019, UMLPackage.eINSTANCE.getOperation());
+
+ elements.put(Comment_3028, UMLPackage.eINSTANCE.getComment());
+
+ elements.put(Constraint_3029, UMLPackage.eINSTANCE.getConstraint());
+
+ elements.put(AssociationClass_4017, UMLPackage.eINSTANCE.getAssociationClass());
+
+ elements.put(Association_4001, UMLPackage.eINSTANCE.getAssociation());
+
+ elements.put(Association_4019, UMLPackage.eINSTANCE.getAssociation());
+
+ elements.put(Generalization_4002, UMLPackage.eINSTANCE.getGeneralization());
+
+ elements.put(InterfaceRealization_4003, UMLPackage.eINSTANCE.getInterfaceRealization());
+
+ elements.put(Substitution_4004, UMLPackage.eINSTANCE.getSubstitution());
+
+ elements.put(Realization_4005, UMLPackage.eINSTANCE.getRealization());
+
+ elements.put(Abstraction_4006, UMLPackage.eINSTANCE.getAbstraction());
+
+ elements.put(Usage_4007, UMLPackage.eINSTANCE.getUsage());
+
+ elements.put(Dependency_4008, UMLPackage.eINSTANCE.getDependency());
+
+ elements.put(Dependency_4018, UMLPackage.eINSTANCE.getDependency());
+
+ elements.put(ElementImport_4009, UMLPackage.eINSTANCE.getElementImport());
+
+ elements.put(PackageImport_4010, UMLPackage.eINSTANCE.getPackageImport());
+
+ elements.put(PackageMerge_4011, UMLPackage.eINSTANCE.getPackageMerge());
+
+ elements.put(ProfileApplication_4012, UMLPackage.eINSTANCE.getProfileApplication());
+
+ elements.put(CommentAnnotatedElement_4013, UMLPackage.eINSTANCE.getComment_AnnotatedElement());
+
+ elements.put(ConstraintConstrainedElement_4014, UMLPackage.eINSTANCE.getConstraint_ConstrainedElement());
+
+ elements.put(TemplateBinding_4015, UMLPackage.eINSTANCE.getTemplateBinding());
+ }
+ return (ENamedElement) elements.get(type);
+ }
+
+ /**
+ * @generated
+ */
+ private static IElementType getElementType(String id) {
+ return ElementTypeRegistry.getInstance().getType(id);
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean isKnownElementType(IElementType elementType) {
+ if (KNOWN_ELEMENT_TYPES == null) {
+ KNOWN_ELEMENT_TYPES = new HashSet();
+ KNOWN_ELEMENT_TYPES.add(Package_1000);
+ KNOWN_ELEMENT_TYPES.add(Dependency_2014);
+ KNOWN_ELEMENT_TYPES.add(AssociationClass_2013);
+ KNOWN_ELEMENT_TYPES.add(Association_2015);
+ KNOWN_ELEMENT_TYPES.add(InstanceSpecification_2001);
+ KNOWN_ELEMENT_TYPES.add(Component_2002);
+ KNOWN_ELEMENT_TYPES.add(Signal_2003);
+ KNOWN_ELEMENT_TYPES.add(Interface_2004);
+ KNOWN_ELEMENT_TYPES.add(Model_2005);
+ KNOWN_ELEMENT_TYPES.add(Enumeration_2006);
+ KNOWN_ELEMENT_TYPES.add(Package_2007);
+ KNOWN_ELEMENT_TYPES.add(Class_2008);
+ KNOWN_ELEMENT_TYPES.add(PrimitiveType_2009);
+ KNOWN_ELEMENT_TYPES.add(DataType_2010);
+ KNOWN_ELEMENT_TYPES.add(Constraint_2011);
+ KNOWN_ELEMENT_TYPES.add(Comment_2012);
+ KNOWN_ELEMENT_TYPES.add(Property_3002);
+ KNOWN_ELEMENT_TYPES.add(Slot_3001);
+ KNOWN_ELEMENT_TYPES.add(Operation_3003);
+ KNOWN_ELEMENT_TYPES.add(Class_3004);
+ KNOWN_ELEMENT_TYPES.add(RedefinableTemplateSignature_3015);
+ KNOWN_ELEMENT_TYPES.add(TemplateParameter_3016);
+ KNOWN_ELEMENT_TYPES.add(Property_3005);
+ KNOWN_ELEMENT_TYPES.add(Property_3006);
+ KNOWN_ELEMENT_TYPES.add(Operation_3007);
+ KNOWN_ELEMENT_TYPES.add(Class_3008);
+ KNOWN_ELEMENT_TYPES.add(InstanceSpecification_3020);
+ KNOWN_ELEMENT_TYPES.add(Component_3021);
+ KNOWN_ELEMENT_TYPES.add(Signal_3022);
+ KNOWN_ELEMENT_TYPES.add(Interface_3023);
+ KNOWN_ELEMENT_TYPES.add(Model_3024);
+ KNOWN_ELEMENT_TYPES.add(Enumeration_3025);
+ KNOWN_ELEMENT_TYPES.add(EnumerationLiteral_3017);
+ KNOWN_ELEMENT_TYPES.add(Package_3009);
+ KNOWN_ELEMENT_TYPES.add(Class_3010);
+ KNOWN_ELEMENT_TYPES.add(Reception_3011);
+ KNOWN_ELEMENT_TYPES.add(Property_3012);
+ KNOWN_ELEMENT_TYPES.add(Operation_3013);
+ KNOWN_ELEMENT_TYPES.add(Class_3014);
+ KNOWN_ELEMENT_TYPES.add(PrimitiveType_3026);
+ KNOWN_ELEMENT_TYPES.add(DataType_3027);
+ KNOWN_ELEMENT_TYPES.add(Property_3018);
+ KNOWN_ELEMENT_TYPES.add(Operation_3019);
+ KNOWN_ELEMENT_TYPES.add(Comment_3028);
+ KNOWN_ELEMENT_TYPES.add(Constraint_3029);
+ KNOWN_ELEMENT_TYPES.add(Link_4016);
+ KNOWN_ELEMENT_TYPES.add(AssociationClass_4017);
+ KNOWN_ELEMENT_TYPES.add(Association_4001);
+ KNOWN_ELEMENT_TYPES.add(Association_4019);
+ KNOWN_ELEMENT_TYPES.add(Generalization_4002);
+ KNOWN_ELEMENT_TYPES.add(InterfaceRealization_4003);
+ KNOWN_ELEMENT_TYPES.add(Substitution_4004);
+ KNOWN_ELEMENT_TYPES.add(Realization_4005);
+ KNOWN_ELEMENT_TYPES.add(Abstraction_4006);
+ KNOWN_ELEMENT_TYPES.add(Usage_4007);
+ KNOWN_ELEMENT_TYPES.add(Dependency_4008);
+ KNOWN_ELEMENT_TYPES.add(Dependency_4018);
+ KNOWN_ELEMENT_TYPES.add(ElementImport_4009);
+ KNOWN_ELEMENT_TYPES.add(PackageImport_4010);
+ KNOWN_ELEMENT_TYPES.add(PackageMerge_4011);
+ KNOWN_ELEMENT_TYPES.add(ProfileApplication_4012);
+ KNOWN_ELEMENT_TYPES.add(CommentAnnotatedElement_4013);
+ KNOWN_ELEMENT_TYPES.add(ConstraintConstrainedElement_4014);
+ KNOWN_ELEMENT_TYPES.add(TemplateBinding_4015);
+ }
+ return KNOWN_ELEMENT_TYPES.contains(elementType);
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/providers/UMLIconProvider.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/providers/UMLIconProvider.java
new file mode 100644
index 00000000000..e4d5f1c6634
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/providers/UMLIconProvider.java
@@ -0,0 +1,44 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.providers;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.common.core.service.AbstractProvider;
+import org.eclipse.gmf.runtime.common.core.service.IOperation;
+import org.eclipse.gmf.runtime.common.ui.services.icon.GetIconOperation;
+import org.eclipse.gmf.runtime.common.ui.services.icon.IIconProvider;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class UMLIconProvider extends AbstractProvider implements IIconProvider {
+
+ /**
+ * @generated
+ */
+ public Image getIcon(IAdaptable hint, int flags) {
+ return UMLElementTypes.getImage(hint);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean provides(IOperation operation) {
+ if (operation instanceof GetIconOperation) {
+ return ((GetIconOperation) operation).execute(this) != null;
+ }
+ return false;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/providers/UMLMarkerNavigationProvider.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/providers/UMLMarkerNavigationProvider.java
new file mode 100644
index 00000000000..affcac283da
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/providers/UMLMarkerNavigationProvider.java
@@ -0,0 +1,94 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.providers;
+
+import java.util.Arrays;
+import java.util.Map;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor;
+import org.eclipse.gmf.runtime.emf.ui.providers.marker.AbstractModelMarkerNavigationProvider;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorUtil;
+
+/**
+ * @generated
+ */
+public class UMLMarkerNavigationProvider extends AbstractModelMarkerNavigationProvider {
+
+ /**
+ * @generated
+ */
+ public static final String MARKER_TYPE = UMLDiagramEditorPlugin.ID + ".diagnostic"; //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ protected void doGotoMarker(IMarker marker) {
+ String elementId = marker.getAttribute(org.eclipse.gmf.runtime.common.core.resources.IMarker.ELEMENT_ID, null);
+ if (elementId == null || !(getEditor() instanceof DiagramEditor)) {
+ return;
+ }
+ DiagramEditor editor = (DiagramEditor) getEditor();
+ Map editPartRegistry = editor.getDiagramGraphicalViewer().getEditPartRegistry();
+ EObject targetView = editor.getDiagram().eResource().getEObject(elementId);
+ if (targetView == null) {
+ return;
+ }
+ EditPart targetEditPart = (EditPart) editPartRegistry.get(targetView);
+ if (targetEditPart != null) {
+ UMLDiagramEditorUtil.selectElementsInDiagram(editor, Arrays.asList(new EditPart[] { targetEditPart }));
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void deleteMarkers(IResource resource) {
+ try {
+ resource.deleteMarkers(MARKER_TYPE, true, IResource.DEPTH_ZERO);
+ } catch (CoreException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Failed to delete validation markers", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static IMarker addMarker(IFile file, String elementId, String location, String message, int statusSeverity) {
+ IMarker marker = null;
+ try {
+ marker = file.createMarker(MARKER_TYPE);
+ marker.setAttribute(IMarker.MESSAGE, message);
+ marker.setAttribute(IMarker.LOCATION, location);
+ marker.setAttribute(org.eclipse.gmf.runtime.common.ui.resources.IMarker.ELEMENT_ID, elementId);
+ int markerSeverity = IMarker.SEVERITY_INFO;
+ if (statusSeverity == IStatus.WARNING) {
+ markerSeverity = IMarker.SEVERITY_WARNING;
+ } else if (statusSeverity == IStatus.ERROR || statusSeverity == IStatus.CANCEL) {
+ markerSeverity = IMarker.SEVERITY_ERROR;
+ }
+ marker.setAttribute(IMarker.SEVERITY, markerSeverity);
+ } catch (CoreException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Failed to create validation marker", e); //$NON-NLS-1$
+ }
+ return marker;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/providers/UMLModelingAssistantProvider.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/providers/UMLModelingAssistantProvider.java
new file mode 100644
index 00000000000..d3b79c1bb45
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/providers/UMLModelingAssistantProvider.java
@@ -0,0 +1,549 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.providers;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.ui.services.modelingassistant.ModelingAssistantProvider;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationClassEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Class4EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Comment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Component2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Constraint2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataType2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataTypeEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Enumeration2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.EnumerationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InstanceSpecification2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InstanceSpecificationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Interface2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Model2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Model3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelPackageableElementCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelPackageableElementCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Package2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackagePackageableElementCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackagePackageableElementCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RedefinableTemplateSignatureEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Signal2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SignalEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.Messages;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.dialogs.ElementListSelectionDialog;
+
+/**
+ * @generated
+ */
+public class UMLModelingAssistantProvider extends ModelingAssistantProvider {
+
+ /**
+ * @generated
+ */
+ public List getTypesForPopupBar(IAdaptable host) {
+ IGraphicalEditPart editPart = (IGraphicalEditPart) host.getAdapter(IGraphicalEditPart.class);
+ if (editPart instanceof AssociationClassEditPart) {
+ List types = new ArrayList();
+ types.add(UMLElementTypes.Property_3002);
+ return types;
+ }
+ if (editPart instanceof InstanceSpecificationEditPart) {
+ List types = new ArrayList();
+ types.add(UMLElementTypes.Slot_3001);
+ return types;
+ }
+ if (editPart instanceof ComponentEditPart) {
+ List types = new ArrayList();
+ types.add(UMLElementTypes.RedefinableTemplateSignature_3015);
+ types.add(UMLElementTypes.Property_3002);
+ types.add(UMLElementTypes.Operation_3003);
+ types.add(UMLElementTypes.Class_3004);
+ return types;
+ }
+ if (editPart instanceof SignalEditPart) {
+ List types = new ArrayList();
+ types.add(UMLElementTypes.RedefinableTemplateSignature_3015);
+ types.add(UMLElementTypes.Property_3005);
+ return types;
+ }
+ if (editPart instanceof InterfaceEditPart) {
+ List types = new ArrayList();
+ types.add(UMLElementTypes.RedefinableTemplateSignature_3015);
+ types.add(UMLElementTypes.Property_3006);
+ types.add(UMLElementTypes.Operation_3007);
+ types.add(UMLElementTypes.Class_3008);
+ return types;
+ }
+ if (editPart instanceof Model2EditPart) {
+ List types = new ArrayList();
+ types.add(UMLElementTypes.RedefinableTemplateSignature_3015);
+ return types;
+ }
+ if (editPart instanceof EnumerationEditPart) {
+ List types = new ArrayList();
+ types.add(UMLElementTypes.EnumerationLiteral_3017);
+ return types;
+ }
+ if (editPart instanceof PackageEditPart) {
+ List types = new ArrayList();
+ types.add(UMLElementTypes.RedefinableTemplateSignature_3015);
+ return types;
+ }
+ if (editPart instanceof ClassEditPart) {
+ List types = new ArrayList();
+ types.add(UMLElementTypes.RedefinableTemplateSignature_3015);
+ types.add(UMLElementTypes.Property_3012);
+ types.add(UMLElementTypes.Reception_3011);
+ types.add(UMLElementTypes.Operation_3013);
+ types.add(UMLElementTypes.Class_3014);
+ return types;
+ }
+ if (editPart instanceof DataTypeEditPart) {
+ List types = new ArrayList();
+ types.add(UMLElementTypes.RedefinableTemplateSignature_3015);
+ types.add(UMLElementTypes.Property_3018);
+ types.add(UMLElementTypes.Operation_3019);
+ return types;
+ }
+ if (editPart instanceof RedefinableTemplateSignatureEditPart) {
+ List types = new ArrayList();
+ types.add(UMLElementTypes.TemplateParameter_3016);
+ return types;
+ }
+ if (editPart instanceof InstanceSpecification2EditPart) {
+ List types = new ArrayList();
+ types.add(UMLElementTypes.Slot_3001);
+ return types;
+ }
+ if (editPart instanceof Component2EditPart) {
+ List types = new ArrayList();
+ types.add(UMLElementTypes.RedefinableTemplateSignature_3015);
+ types.add(UMLElementTypes.Property_3002);
+ types.add(UMLElementTypes.Operation_3003);
+ types.add(UMLElementTypes.Class_3004);
+ return types;
+ }
+ if (editPart instanceof Signal2EditPart) {
+ List types = new ArrayList();
+ types.add(UMLElementTypes.RedefinableTemplateSignature_3015);
+ types.add(UMLElementTypes.Property_3005);
+ return types;
+ }
+ if (editPart instanceof Interface2EditPart) {
+ List types = new ArrayList();
+ types.add(UMLElementTypes.RedefinableTemplateSignature_3015);
+ types.add(UMLElementTypes.Property_3006);
+ types.add(UMLElementTypes.Operation_3007);
+ types.add(UMLElementTypes.Class_3008);
+ return types;
+ }
+ if (editPart instanceof Model3EditPart) {
+ List types = new ArrayList();
+ types.add(UMLElementTypes.RedefinableTemplateSignature_3015);
+ return types;
+ }
+ if (editPart instanceof Enumeration2EditPart) {
+ List types = new ArrayList();
+ types.add(UMLElementTypes.EnumerationLiteral_3017);
+ return types;
+ }
+ if (editPart instanceof Package2EditPart) {
+ List types = new ArrayList();
+ types.add(UMLElementTypes.RedefinableTemplateSignature_3015);
+ return types;
+ }
+ if (editPart instanceof Class4EditPart) {
+ List types = new ArrayList();
+ types.add(UMLElementTypes.RedefinableTemplateSignature_3015);
+ types.add(UMLElementTypes.Property_3012);
+ types.add(UMLElementTypes.Reception_3011);
+ types.add(UMLElementTypes.Operation_3013);
+ types.add(UMLElementTypes.Class_3014);
+ return types;
+ }
+ if (editPart instanceof DataType2EditPart) {
+ List types = new ArrayList();
+ types.add(UMLElementTypes.RedefinableTemplateSignature_3015);
+ types.add(UMLElementTypes.Property_3018);
+ types.add(UMLElementTypes.Operation_3019);
+ return types;
+ }
+ if (editPart instanceof ModelPackageableElementCompartmentEditPart) {
+ List types = new ArrayList();
+ types.add(UMLElementTypes.InstanceSpecification_3020);
+ types.add(UMLElementTypes.Component_3021);
+ types.add(UMLElementTypes.Signal_3022);
+ types.add(UMLElementTypes.Interface_3023);
+ types.add(UMLElementTypes.Model_3024);
+ types.add(UMLElementTypes.Enumeration_3025);
+ types.add(UMLElementTypes.Package_3009);
+ types.add(UMLElementTypes.Class_3010);
+ types.add(UMLElementTypes.PrimitiveType_3026);
+ types.add(UMLElementTypes.DataType_3027);
+ types.add(UMLElementTypes.Comment_3028);
+ types.add(UMLElementTypes.Constraint_3029);
+ return types;
+ }
+ if (editPart instanceof ModelPackageableElementCompartment2EditPart) {
+ List types = new ArrayList();
+ types.add(UMLElementTypes.InstanceSpecification_3020);
+ types.add(UMLElementTypes.Component_3021);
+ types.add(UMLElementTypes.Signal_3022);
+ types.add(UMLElementTypes.Interface_3023);
+ types.add(UMLElementTypes.Model_3024);
+ types.add(UMLElementTypes.Enumeration_3025);
+ types.add(UMLElementTypes.Package_3009);
+ types.add(UMLElementTypes.Class_3010);
+ types.add(UMLElementTypes.PrimitiveType_3026);
+ types.add(UMLElementTypes.DataType_3027);
+ types.add(UMLElementTypes.Comment_3028);
+ types.add(UMLElementTypes.Constraint_3029);
+ return types;
+ }
+ if (editPart instanceof PackagePackageableElementCompartmentEditPart) {
+ List types = new ArrayList();
+ types.add(UMLElementTypes.InstanceSpecification_3020);
+ types.add(UMLElementTypes.Component_3021);
+ types.add(UMLElementTypes.Signal_3022);
+ types.add(UMLElementTypes.Interface_3023);
+ types.add(UMLElementTypes.Model_3024);
+ types.add(UMLElementTypes.Enumeration_3025);
+ types.add(UMLElementTypes.Package_3009);
+ types.add(UMLElementTypes.Class_3010);
+ types.add(UMLElementTypes.PrimitiveType_3026);
+ types.add(UMLElementTypes.DataType_3027);
+ types.add(UMLElementTypes.Comment_3028);
+ types.add(UMLElementTypes.Constraint_3029);
+ return types;
+ }
+ if (editPart instanceof PackagePackageableElementCompartment2EditPart) {
+ List types = new ArrayList();
+ types.add(UMLElementTypes.InstanceSpecification_3020);
+ types.add(UMLElementTypes.Component_3021);
+ types.add(UMLElementTypes.Signal_3022);
+ types.add(UMLElementTypes.Interface_3023);
+ types.add(UMLElementTypes.Model_3024);
+ types.add(UMLElementTypes.Enumeration_3025);
+ types.add(UMLElementTypes.Package_3009);
+ types.add(UMLElementTypes.Class_3010);
+ types.add(UMLElementTypes.PrimitiveType_3026);
+ types.add(UMLElementTypes.DataType_3027);
+ types.add(UMLElementTypes.Comment_3028);
+ types.add(UMLElementTypes.Constraint_3029);
+ return types;
+ }
+ if (editPart instanceof ModelEditPart) {
+ List types = new ArrayList();
+ types.add(UMLElementTypes.Dependency_2014);
+ types.add(UMLElementTypes.AssociationClass_2013);
+ types.add(UMLElementTypes.Association_2015);
+ types.add(UMLElementTypes.InstanceSpecification_2001);
+ types.add(UMLElementTypes.Component_2002);
+ types.add(UMLElementTypes.Signal_2003);
+ types.add(UMLElementTypes.Interface_2004);
+ types.add(UMLElementTypes.Model_2005);
+ types.add(UMLElementTypes.Enumeration_2006);
+ types.add(UMLElementTypes.Package_2007);
+ types.add(UMLElementTypes.Class_2008);
+ types.add(UMLElementTypes.PrimitiveType_2009);
+ types.add(UMLElementTypes.DataType_2010);
+ types.add(UMLElementTypes.Constraint_2011);
+ types.add(UMLElementTypes.Comment_2012);
+ return types;
+ }
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public List getRelTypesOnSource(IAdaptable source) {
+ IGraphicalEditPart sourceEditPart = (IGraphicalEditPart) source.getAdapter(IGraphicalEditPart.class);
+ if (sourceEditPart instanceof PackageEditPart) {
+ List types = new ArrayList();
+ types.add(UMLElementTypes.PackageMerge_4011);
+ types.add(UMLElementTypes.ProfileApplication_4012);
+ return types;
+ }
+ if (sourceEditPart instanceof ConstraintEditPart) {
+ List types = new ArrayList();
+ types.add(UMLElementTypes.ConstraintConstrainedElement_4014);
+ return types;
+ }
+ if (sourceEditPart instanceof CommentEditPart) {
+ List types = new ArrayList();
+ types.add(UMLElementTypes.CommentAnnotatedElement_4013);
+ return types;
+ }
+ if (sourceEditPart instanceof Package2EditPart) {
+ List types = new ArrayList();
+ types.add(UMLElementTypes.PackageMerge_4011);
+ types.add(UMLElementTypes.ProfileApplication_4012);
+ return types;
+ }
+ if (sourceEditPart instanceof Comment2EditPart) {
+ List types = new ArrayList();
+ types.add(UMLElementTypes.CommentAnnotatedElement_4013);
+ return types;
+ }
+ if (sourceEditPart instanceof Constraint2EditPart) {
+ List types = new ArrayList();
+ types.add(UMLElementTypes.ConstraintConstrainedElement_4014);
+ return types;
+ }
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public List getRelTypesOnTarget(IAdaptable target) {
+ IGraphicalEditPart targetEditPart = (IGraphicalEditPart) target.getAdapter(IGraphicalEditPart.class);
+ if (targetEditPart instanceof InterfaceEditPart) {
+ List types = new ArrayList();
+ types.add(UMLElementTypes.InterfaceRealization_4003);
+ return types;
+ }
+ if (targetEditPart instanceof PackageEditPart) {
+ List types = new ArrayList();
+ types.add(UMLElementTypes.PackageImport_4010);
+ types.add(UMLElementTypes.PackageMerge_4011);
+ return types;
+ }
+ if (targetEditPart instanceof Interface2EditPart) {
+ List types = new ArrayList();
+ types.add(UMLElementTypes.InterfaceRealization_4003);
+ return types;
+ }
+ if (targetEditPart instanceof Package2EditPart) {
+ List types = new ArrayList();
+ types.add(UMLElementTypes.PackageImport_4010);
+ types.add(UMLElementTypes.PackageMerge_4011);
+ return types;
+ }
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public List getRelTypesOnSourceAndTarget(IAdaptable source, IAdaptable target) {
+ IGraphicalEditPart sourceEditPart = (IGraphicalEditPart) source.getAdapter(IGraphicalEditPart.class);
+ IGraphicalEditPart targetEditPart = (IGraphicalEditPart) target.getAdapter(IGraphicalEditPart.class);
+ if (sourceEditPart instanceof PackageEditPart) {
+ List types = new ArrayList();
+ if (targetEditPart instanceof PackageEditPart) {
+ types.add(UMLElementTypes.PackageMerge_4011);
+ }
+ if (targetEditPart instanceof Package2EditPart) {
+ types.add(UMLElementTypes.PackageMerge_4011);
+ }
+ return types;
+ }
+ if (sourceEditPart instanceof ConstraintEditPart) {
+ List types = new ArrayList();
+ return types;
+ }
+ if (sourceEditPart instanceof CommentEditPart) {
+ List types = new ArrayList();
+ return types;
+ }
+ if (sourceEditPart instanceof Package2EditPart) {
+ List types = new ArrayList();
+ if (targetEditPart instanceof PackageEditPart) {
+ types.add(UMLElementTypes.PackageMerge_4011);
+ }
+ if (targetEditPart instanceof Package2EditPart) {
+ types.add(UMLElementTypes.PackageMerge_4011);
+ }
+ return types;
+ }
+ if (sourceEditPart instanceof Comment2EditPart) {
+ List types = new ArrayList();
+ return types;
+ }
+ if (sourceEditPart instanceof Constraint2EditPart) {
+ List types = new ArrayList();
+ return types;
+ }
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public List getTypesForSource(IAdaptable target, IElementType relationshipType) {
+ IGraphicalEditPart targetEditPart = (IGraphicalEditPart) target.getAdapter(IGraphicalEditPart.class);
+ if (targetEditPart instanceof InterfaceEditPart) {
+ List types = new ArrayList();
+ return types;
+ }
+ if (targetEditPart instanceof PackageEditPart) {
+ List types = new ArrayList();
+ if (relationshipType == UMLElementTypes.PackageMerge_4011) {
+ types.add(UMLElementTypes.Package_2007);
+ }
+ if (relationshipType == UMLElementTypes.PackageMerge_4011) {
+ types.add(UMLElementTypes.Package_3009);
+ }
+ return types;
+ }
+ if (targetEditPart instanceof Interface2EditPart) {
+ List types = new ArrayList();
+ return types;
+ }
+ if (targetEditPart instanceof Package2EditPart) {
+ List types = new ArrayList();
+ if (relationshipType == UMLElementTypes.PackageMerge_4011) {
+ types.add(UMLElementTypes.Package_2007);
+ }
+ if (relationshipType == UMLElementTypes.PackageMerge_4011) {
+ types.add(UMLElementTypes.Package_3009);
+ }
+ return types;
+ }
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public List getTypesForTarget(IAdaptable source, IElementType relationshipType) {
+ IGraphicalEditPart sourceEditPart = (IGraphicalEditPart) source.getAdapter(IGraphicalEditPart.class);
+ if (sourceEditPart instanceof PackageEditPart) {
+ List types = new ArrayList();
+ if (relationshipType == UMLElementTypes.PackageMerge_4011) {
+ types.add(UMLElementTypes.Package_2007);
+ }
+ if (relationshipType == UMLElementTypes.PackageMerge_4011) {
+ types.add(UMLElementTypes.Package_3009);
+ }
+ return types;
+ }
+ if (sourceEditPart instanceof ConstraintEditPart) {
+ List types = new ArrayList();
+ return types;
+ }
+ if (sourceEditPart instanceof CommentEditPart) {
+ List types = new ArrayList();
+ return types;
+ }
+ if (sourceEditPart instanceof Package2EditPart) {
+ List types = new ArrayList();
+ if (relationshipType == UMLElementTypes.PackageMerge_4011) {
+ types.add(UMLElementTypes.Package_2007);
+ }
+ if (relationshipType == UMLElementTypes.PackageMerge_4011) {
+ types.add(UMLElementTypes.Package_3009);
+ }
+ return types;
+ }
+ if (sourceEditPart instanceof Comment2EditPart) {
+ List types = new ArrayList();
+ return types;
+ }
+ if (sourceEditPart instanceof Constraint2EditPart) {
+ List types = new ArrayList();
+ return types;
+ }
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public EObject selectExistingElementForSource(IAdaptable target, IElementType relationshipType) {
+ return selectExistingElement(target, getTypesForSource(target, relationshipType));
+ }
+
+ /**
+ * @generated
+ */
+ public EObject selectExistingElementForTarget(IAdaptable source, IElementType relationshipType) {
+ return selectExistingElement(source, getTypesForTarget(source, relationshipType));
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject selectExistingElement(IAdaptable host, Collection types) {
+ if (types.isEmpty()) {
+ return null;
+ }
+ IGraphicalEditPart editPart = (IGraphicalEditPart) host.getAdapter(IGraphicalEditPart.class);
+ if (editPart == null) {
+ return null;
+ }
+ Diagram diagram = (Diagram) editPart.getRoot().getContents().getModel();
+ Collection elements = new HashSet();
+ for (Iterator it = diagram.getElement().eAllContents(); it.hasNext();) {
+ EObject element = (EObject) it.next();
+ if (isApplicableElement(element, types)) {
+ elements.add(element);
+ }
+ }
+ if (elements.isEmpty()) {
+ return null;
+ }
+ return selectElement((EObject[]) elements.toArray(new EObject[elements.size()]));
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isApplicableElement(EObject element, Collection types) {
+ IElementType type = ElementTypeRegistry.getInstance().getElementType(element);
+ return types.contains(type);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject selectElement(EObject[] elements) {
+ Shell shell = Display.getCurrent().getActiveShell();
+ ILabelProvider labelProvider = new AdapterFactoryLabelProvider(UMLDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory());
+ ElementListSelectionDialog dialog = new ElementListSelectionDialog(shell, labelProvider);
+ dialog.setMessage(Messages.UMLModelingAssistantProviderMessage);
+ dialog.setTitle(Messages.UMLModelingAssistantProviderTitle);
+ dialog.setMultipleSelection(false);
+ dialog.setElements(elements);
+ EObject selected = null;
+ if (dialog.open() == Window.OK) {
+ selected = (EObject) dialog.getFirstResult();
+ }
+ return selected;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/providers/UMLParserProvider.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/providers/UMLParserProvider.java
new file mode 100644
index 00000000000..7832fda7bbc
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/providers/UMLParserProvider.java
@@ -0,0 +1,3053 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.providers;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.service.AbstractProvider;
+import org.eclipse.gmf.runtime.common.core.service.IOperation;
+import org.eclipse.gmf.runtime.common.ui.services.parser.GetParserOperation;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserProvider;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ParserHintAdapter;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.*;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationName3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationName4EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationName5EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationName6EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Class2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Class3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Class5EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassName3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassName4EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassQualifiedName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassQualifiedNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentBodyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentQualifiedNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataTypeName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataTypeNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataTypeQualifiedNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportAlias2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportAliasEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.EnumerationLiteralEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.EnumerationName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.EnumerationNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.EnumerationQualifiedNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.GeneralizationIsSubstitutableEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InstanceSpecificationName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InstanceSpecificationNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InstanceSpecificationQualifiedNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceQualifiedNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceRealizationName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceRealizationNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelQualifiedNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Operation2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Operation3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Operation4EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.OperationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageImportVisibilityEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageName3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageName4EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageQualifiedName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageQualifiedNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PrimitiveTypeName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PrimitiveTypeNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PrimitiveTypeQualifiedNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Property2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Property3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Property4EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Property5EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PropertyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ReceptionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SignalName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SignalNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SignalQualifiedNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SubstitutionName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SubstitutionNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.parsers.MessageFormatParser;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class UMLParserProvider extends AbstractProvider implements IParserProvider {
+
+ /**
+ * @generated
+ */
+ public static class HintAdapter extends ParserHintAdapter {
+
+ /**
+ * @generated
+ */
+ private final IElementType elementType;
+
+ /**
+ * @generated
+ */
+ public HintAdapter(IElementType type, EObject object, String parserHint) {
+ super(object, parserHint);
+ assert type != null;
+ elementType = type;
+ }
+
+ /**
+ * @generated
+ */
+ public Object getAdapter(Class adapter) {
+ if (IElementType.class.equals(adapter)) {
+ return elementType;
+ }
+ return super.getAdapter(adapter);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private IParser abstractionName_6014Parser;
+
+ /**
+ * @generated
+ */
+ private IParser abstractionName_6015Parser;
+
+ /**
+ * @generated
+ */
+ private IParser associationName_6001Parser;
+
+ /**
+ * @generated
+ */
+ private IParser associationName_6002Parser;
+
+ /**
+ * @generated
+ */
+ private IParser associationName_6003Parser;
+
+ /**
+ * @generated
+ */
+ private IParser associationName_6004Parser;
+
+ /**
+ * @generated
+ */
+ private IParser associationName_6005Parser;
+
+ /**
+ * @generated
+ */
+ private IParser associationName_6006Parser;
+
+ /**
+ * @generated
+ */
+ private IParser class_3004Parser;
+
+ /**
+ * @generated
+ */
+ private IParser class_3008Parser;
+
+ /**
+ * @generated
+ */
+ private IParser class_3014Parser;
+
+ /**
+ * @generated
+ */
+ private IParser className_5013Parser;
+
+ /**
+ * @generated
+ */
+ private IParser className_5014Parser;
+
+ /**
+ * @generated
+ */
+ private IParser className_5028Parser;
+
+ /**
+ * @generated
+ */
+ private IParser className_5029Parser;
+
+ /**
+ * @generated
+ */
+ private IParser classQualifiedName_5015Parser;
+
+ /**
+ * @generated
+ */
+ private IParser classQualifiedName_5030Parser;
+
+ /**
+ * @generated
+ */
+ private IParser commentBody_5038Parser;
+
+ /**
+ * @generated
+ */
+ private IParser componentName_5004Parser;
+
+ /**
+ * @generated
+ */
+ private IParser componentName_5005Parser;
+
+ /**
+ * @generated
+ */
+ private IParser componentQualifiedName_5006Parser;
+
+ /**
+ * @generated
+ */
+ private IParser constraintName_5037Parser;
+
+ /**
+ * @generated
+ */
+ private IParser dataTypeName_5034Parser;
+
+ /**
+ * @generated
+ */
+ private IParser dataTypeName_5035Parser;
+
+ /**
+ * @generated
+ */
+ private IParser dataTypeQualifiedName_5036Parser;
+
+ /**
+ * @generated
+ */
+ private IParser elementImportAlias_6020Parser;
+
+ /**
+ * @generated
+ */
+ private IParser elementImportAlias_6021Parser;
+
+ /**
+ * @generated
+ */
+ private IParser enumerationLiteral_3017Parser;
+
+ /**
+ * @generated
+ */
+ private IParser enumerationName_5022Parser;
+
+ /**
+ * @generated
+ */
+ private IParser enumerationName_5023Parser;
+
+ /**
+ * @generated
+ */
+ private IParser enumerationQualifiedName_5024Parser;
+
+ /**
+ * @generated
+ */
+ private IParser generalizationIsSubstitutable_6007Parser;
+
+ /**
+ * @generated
+ */
+ private IParser instanceSpecificationName_5001Parser;
+
+ /**
+ * @generated
+ */
+ private IParser instanceSpecificationName_5002Parser;
+
+ /**
+ * @generated
+ */
+ private IParser instanceSpecificationQualifiedName_5003Parser;
+
+ /**
+ * @generated
+ */
+ private IParser interfaceName_5010Parser;
+
+ /**
+ * @generated
+ */
+ private IParser interfaceName_5011Parser;
+
+ /**
+ * @generated
+ */
+ private IParser interfaceQualifiedName_5012Parser;
+
+ /**
+ * @generated
+ */
+ private IParser interfaceRealizationName_6008Parser;
+
+ /**
+ * @generated
+ */
+ private IParser interfaceRealizationName_6009Parser;
+
+ /**
+ * @generated
+ */
+ private IParser modelName_5019Parser;
+
+ /**
+ * @generated
+ */
+ private IParser modelName_5020Parser;
+
+ /**
+ * @generated
+ */
+ private IParser modelQualifiedName_5021Parser;
+
+ /**
+ * @generated
+ */
+ private IParser operation_3003Parser;
+
+ /**
+ * @generated
+ */
+ private IParser operation_3007Parser;
+
+ /**
+ * @generated
+ */
+ private IParser operation_3013Parser;
+
+ /**
+ * @generated
+ */
+ private IParser operation_3019Parser;
+
+ /**
+ * @generated
+ */
+ private IParser packageImportVisibility_6022Parser;
+
+ /**
+ * @generated
+ */
+ private IParser packageName_5016Parser;
+
+ /**
+ * @generated
+ */
+ private IParser packageName_5017Parser;
+
+ /**
+ * @generated
+ */
+ private IParser packageName_5025Parser;
+
+ /**
+ * @generated
+ */
+ private IParser packageName_5026Parser;
+
+ /**
+ * @generated
+ */
+ private IParser packageQualifiedName_5018Parser;
+
+ /**
+ * @generated
+ */
+ private IParser packageQualifiedName_5027Parser;
+
+ /**
+ * @generated
+ */
+ private IParser primitiveTypeName_5031Parser;
+
+ /**
+ * @generated
+ */
+ private IParser primitiveTypeName_5032Parser;
+
+ /**
+ * @generated
+ */
+ private IParser primitiveTypeQualifiedName_5033Parser;
+
+ /**
+ * @generated
+ */
+ private IParser property_3002Parser;
+
+ /**
+ * @generated
+ */
+ private IParser property_3005Parser;
+
+ /**
+ * @generated
+ */
+ private IParser property_3006Parser;
+
+ /**
+ * @generated
+ */
+ private IParser property_3012Parser;
+
+ /**
+ * @generated
+ */
+ private IParser property_3018Parser;
+
+ /**
+ * @generated
+ */
+ private IParser realizationName_6012Parser;
+
+ /**
+ * @generated
+ */
+ private IParser realizationName_6013Parser;
+
+ /**
+ * @generated
+ */
+ private IParser reception_3011Parser;
+
+ /**
+ * @generated
+ */
+ private IParser signalName_5007Parser;
+
+ /**
+ * @generated
+ */
+ private IParser signalName_5008Parser;
+
+ /**
+ * @generated
+ */
+ private IParser signalQualifiedName_5009Parser;
+
+ /**
+ * @generated
+ */
+ private IParser substitutionName_6010Parser;
+
+ /**
+ * @generated
+ */
+ private IParser substitutionName_6011Parser;
+
+ /**
+ * @generated
+ */
+ private IParser usageName_6016Parser;
+
+ /**
+ * @generated
+ */
+ private IParser usageName_6017Parser;
+
+ /**
+ * @generated
+ */
+ protected IParser createAbstractionName_6014Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createAbstractionName_6015Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("<<{0}>>");
+ parser.setEditorPattern("<<{0}>>");
+ parser.setEditPattern("<<{0}>>");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createAssociationName_6001Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("<<{0}>>");
+ parser.setEditorPattern("<<{0}>>");
+ parser.setEditPattern("<<{0}>>");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createAssociationName_6002Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createAssociationName_6003Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("srcRole{0}");
+ parser.setEditorPattern("srcRole{0}");
+ parser.setEditPattern("srcRole{0}");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createAssociationName_6004Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("srcMul{0}");
+ parser.setEditorPattern("srcMul{0}");
+ parser.setEditPattern("srcMul{0}");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createAssociationName_6005Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("targMul{0}");
+ parser.setEditorPattern("targMul{0}");
+ parser.setEditPattern("targMul{0}");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createAssociationName_6006Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("targRole{0}");
+ parser.setEditorPattern("targRole{0}");
+ parser.setEditPattern("targRole{0}");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createClass_3004Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createClass_3008Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createClass_3014Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser enumerationName_5054Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getEnumerationName_5054Parser() {
+ if (enumerationName_5054Parser == null) {
+ enumerationName_5054Parser = createEnumerationName_5054Parser();
+ }
+ return enumerationName_5054Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createEnumerationName_5054Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("<<{0}>>");
+ parser.setEditorPattern("<<{0}>>");
+ parser.setEditPattern("<<{0}>>");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser enumerationName_5055Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getEnumerationName_5055Parser() {
+ if (enumerationName_5055Parser == null) {
+ enumerationName_5055Parser = createEnumerationName_5055Parser();
+ }
+ return enumerationName_5055Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createEnumerationName_5055Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser enumerationQualifiedName_5056Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getEnumerationQualifiedName_5056Parser() {
+ if (enumerationQualifiedName_5056Parser == null) {
+ enumerationQualifiedName_5056Parser = createEnumerationQualifiedName_5056Parser();
+ }
+ return enumerationQualifiedName_5056Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createEnumerationQualifiedName_5056Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_QualifiedName(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("({0})");
+ parser.setEditorPattern("({0})");
+ parser.setEditPattern("({0})");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createClassName_5013Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("<<{0}>>");
+ parser.setEditorPattern("<<{0}>>");
+ parser.setEditPattern("<<{0}>>");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createClassName_5014Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createClassName_5028Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("<<{0}>>");
+ parser.setEditorPattern("<<{0}>>");
+ parser.setEditPattern("<<{0}>>");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createClassName_5029Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createClassQualifiedName_5015Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_QualifiedName(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createClassQualifiedName_5030Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_QualifiedName(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createCommentBody_5038Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getComment_Body(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser associationClassName_5065Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getAssociationClassName_5065Parser() {
+ if (associationClassName_5065Parser == null) {
+ associationClassName_5065Parser = createAssociationClassName_5065Parser();
+ }
+ return associationClassName_5065Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createAssociationClassName_5065Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("<<{0}>>");
+ parser.setEditorPattern("<<{0}>>");
+ parser.setEditPattern("<<{0}>>");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser associationClassName_5066Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getAssociationClassName_5066Parser() {
+ if (associationClassName_5066Parser == null) {
+ associationClassName_5066Parser = createAssociationClassName_5066Parser();
+ }
+ return associationClassName_5066Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createAssociationClassName_5066Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser associationClassQualifiedName_5067Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getAssociationClassQualifiedName_5067Parser() {
+ if (associationClassQualifiedName_5067Parser == null) {
+ associationClassQualifiedName_5067Parser = createAssociationClassQualifiedName_5067Parser();
+ }
+ return associationClassQualifiedName_5067Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createAssociationClassQualifiedName_5067Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_QualifiedName(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createComponentName_5004Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("<<{0}>>");
+ parser.setEditorPattern("<<{0}>>");
+ parser.setEditPattern("<<{0}>>");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createComponentName_5005Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createComponentQualifiedName_5006Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_QualifiedName(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createConstraintName_5037Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createDataTypeName_5034Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("<<{0}>>");
+ parser.setEditorPattern("<<{0}>>");
+ parser.setEditPattern("<<{0}>>");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createDataTypeName_5035Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createDataTypeQualifiedName_5036Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_QualifiedName(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("({0})");
+ parser.setEditorPattern("({0})");
+ parser.setEditPattern("({0})");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createElementImportAlias_6020Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getElementImport_Alias(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createElementImportAlias_6021Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getElementImport_Alias(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("<<{0}>>");
+ parser.setEditorPattern("<<{0}>>");
+ parser.setEditPattern("<<{0}>>");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createEnumerationLiteral_3017Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser primitiveTypeName_5057Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getPrimitiveTypeName_5057Parser() {
+ if (primitiveTypeName_5057Parser == null) {
+ primitiveTypeName_5057Parser = createPrimitiveTypeName_5057Parser();
+ }
+ return primitiveTypeName_5057Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createPrimitiveTypeName_5057Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("<<{0}>>");
+ parser.setEditorPattern("<<{0}>>");
+ parser.setEditPattern("<<{0}>>");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser primitiveTypeName_5058Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getPrimitiveTypeName_5058Parser() {
+ if (primitiveTypeName_5058Parser == null) {
+ primitiveTypeName_5058Parser = createPrimitiveTypeName_5058Parser();
+ }
+ return primitiveTypeName_5058Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createPrimitiveTypeName_5058Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser primitiveTypeQualifiedName_5059Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getPrimitiveTypeQualifiedName_5059Parser() {
+ if (primitiveTypeQualifiedName_5059Parser == null) {
+ primitiveTypeQualifiedName_5059Parser = createPrimitiveTypeQualifiedName_5059Parser();
+ }
+ return primitiveTypeQualifiedName_5059Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createPrimitiveTypeQualifiedName_5059Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_QualifiedName(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("({0})");
+ parser.setEditorPattern("({0})");
+ parser.setEditPattern("({0})");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser dataTypeName_5060Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getDataTypeName_5060Parser() {
+ if (dataTypeName_5060Parser == null) {
+ dataTypeName_5060Parser = createDataTypeName_5060Parser();
+ }
+ return dataTypeName_5060Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createDataTypeName_5060Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("<<{0}>>");
+ parser.setEditorPattern("<<{0}>>");
+ parser.setEditPattern("<<{0}>>");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser dataTypeName_5061Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getDataTypeName_5061Parser() {
+ if (dataTypeName_5061Parser == null) {
+ dataTypeName_5061Parser = createDataTypeName_5061Parser();
+ }
+ return dataTypeName_5061Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createDataTypeName_5061Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser dataTypeQualifiedName_5062Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getDataTypeQualifiedName_5062Parser() {
+ if (dataTypeQualifiedName_5062Parser == null) {
+ dataTypeQualifiedName_5062Parser = createDataTypeQualifiedName_5062Parser();
+ }
+ return dataTypeQualifiedName_5062Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createDataTypeQualifiedName_5062Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_QualifiedName(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("({0})");
+ parser.setEditorPattern("({0})");
+ parser.setEditPattern("({0})");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createEnumerationName_5022Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("<<{0}>>");
+ parser.setEditorPattern("<<{0}>>");
+ parser.setEditPattern("<<{0}>>");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createEnumerationName_5023Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createEnumerationQualifiedName_5024Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_QualifiedName(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("({0})");
+ parser.setEditorPattern("({0})");
+ parser.setEditPattern("({0})");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createGeneralizationIsSubstitutable_6007Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getGeneralization_IsSubstitutable(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("<<{0}>>");
+ parser.setEditorPattern("<<{0}>>");
+ parser.setEditPattern("<<{0}>>");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createInstanceSpecificationName_5001Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("<<{0}>>");
+ parser.setEditorPattern("<<{0}>>");
+ parser.setEditPattern("<<{0}>>");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createInstanceSpecificationName_5002Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createInstanceSpecificationQualifiedName_5003Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_QualifiedName(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("({0})");
+ parser.setEditorPattern("({0})");
+ parser.setEditPattern("({0})");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createInterfaceName_5010Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("<<{0}>>");
+ parser.setEditorPattern("<<{0}>>");
+ parser.setEditPattern("<<{0}>>");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createInterfaceName_5011Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createInterfaceQualifiedName_5012Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_QualifiedName(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createInterfaceRealizationName_6008Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("<<{0}>>");
+ parser.setEditorPattern("<<{0}>>");
+ parser.setEditPattern("<<{0}>>");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createInterfaceRealizationName_6009Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createModelName_5019Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("<<{0}>>");
+ parser.setEditorPattern("<<{0}>>");
+ parser.setEditPattern("<<{0}>>");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createModelName_5020Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createModelQualifiedName_5021Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_QualifiedName(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("({0})");
+ parser.setEditorPattern("({0})");
+ parser.setEditPattern("({0})");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createOperation_3003Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createOperation_3007Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createOperation_3013Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createOperation_3019Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser commentBody_5063Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getCommentBody_5063Parser() {
+ if (commentBody_5063Parser == null) {
+ commentBody_5063Parser = createCommentBody_5063Parser();
+ }
+ return commentBody_5063Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createCommentBody_5063Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getComment_Body(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser constraintName_5064Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getConstraintName_5064Parser() {
+ if (constraintName_5064Parser == null) {
+ constraintName_5064Parser = createConstraintName_5064Parser();
+ }
+ return constraintName_5064Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createConstraintName_5064Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createPackageImportVisibility_6022Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getPackageImport_Visibility(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("<<{0}>>");
+ parser.setEditorPattern("<<{0}>>");
+ parser.setEditPattern("<<{0}>>");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createPackageName_5016Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("<<{0}>>");
+ parser.setEditorPattern("<<{0}>>");
+ parser.setEditPattern("<<{0}>>");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createPackageName_5017Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createPackageName_5025Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("<<{0}>>");
+ parser.setEditorPattern("<<{0}>>");
+ parser.setEditPattern("<<{0}>>");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createPackageName_5026Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createPackageQualifiedName_5018Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_QualifiedName(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("({0})");
+ parser.setEditorPattern("({0})");
+ parser.setEditPattern("({0})");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser instanceSpecificationName_5039Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getInstanceSpecificationName_5039Parser() {
+ if (instanceSpecificationName_5039Parser == null) {
+ instanceSpecificationName_5039Parser = createInstanceSpecificationName_5039Parser();
+ }
+ return instanceSpecificationName_5039Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createInstanceSpecificationName_5039Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("<<{0}>>");
+ parser.setEditorPattern("<<{0}>>");
+ parser.setEditPattern("<<{0}>>");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser instanceSpecificationName_5040Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getInstanceSpecificationName_5040Parser() {
+ if (instanceSpecificationName_5040Parser == null) {
+ instanceSpecificationName_5040Parser = createInstanceSpecificationName_5040Parser();
+ }
+ return instanceSpecificationName_5040Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createInstanceSpecificationName_5040Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser instanceSpecificationQualifiedName_5041Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getInstanceSpecificationQualifiedName_5041Parser() {
+ if (instanceSpecificationQualifiedName_5041Parser == null) {
+ instanceSpecificationQualifiedName_5041Parser = createInstanceSpecificationQualifiedName_5041Parser();
+ }
+ return instanceSpecificationQualifiedName_5041Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createInstanceSpecificationQualifiedName_5041Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_QualifiedName(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("({0})");
+ parser.setEditorPattern("({0})");
+ parser.setEditPattern("({0})");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser componentName_5042Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getComponentName_5042Parser() {
+ if (componentName_5042Parser == null) {
+ componentName_5042Parser = createComponentName_5042Parser();
+ }
+ return componentName_5042Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createComponentName_5042Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("<<{0}>>");
+ parser.setEditorPattern("<<{0}>>");
+ parser.setEditPattern("<<{0}>>");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser componentName_5043Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getComponentName_5043Parser() {
+ if (componentName_5043Parser == null) {
+ componentName_5043Parser = createComponentName_5043Parser();
+ }
+ return componentName_5043Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createComponentName_5043Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser componentQualifiedName_5044Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getComponentQualifiedName_5044Parser() {
+ if (componentQualifiedName_5044Parser == null) {
+ componentQualifiedName_5044Parser = createComponentQualifiedName_5044Parser();
+ }
+ return componentQualifiedName_5044Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createComponentQualifiedName_5044Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_QualifiedName(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser signalName_5045Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getSignalName_5045Parser() {
+ if (signalName_5045Parser == null) {
+ signalName_5045Parser = createSignalName_5045Parser();
+ }
+ return signalName_5045Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createSignalName_5045Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("<<{0}>>");
+ parser.setEditorPattern("<<{0}>>");
+ parser.setEditPattern("<<{0}>>");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser signalName_5046Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getSignalName_5046Parser() {
+ if (signalName_5046Parser == null) {
+ signalName_5046Parser = createSignalName_5046Parser();
+ }
+ return signalName_5046Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createSignalName_5046Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser signalQualifiedName_5047Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getSignalQualifiedName_5047Parser() {
+ if (signalQualifiedName_5047Parser == null) {
+ signalQualifiedName_5047Parser = createSignalQualifiedName_5047Parser();
+ }
+ return signalQualifiedName_5047Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createSignalQualifiedName_5047Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_QualifiedName(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser interfaceName_5048Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getInterfaceName_5048Parser() {
+ if (interfaceName_5048Parser == null) {
+ interfaceName_5048Parser = createInterfaceName_5048Parser();
+ }
+ return interfaceName_5048Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createInterfaceName_5048Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("<<{0}>>");
+ parser.setEditorPattern("<<{0}>>");
+ parser.setEditPattern("<<{0}>>");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser interfaceName_5049Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getInterfaceName_5049Parser() {
+ if (interfaceName_5049Parser == null) {
+ interfaceName_5049Parser = createInterfaceName_5049Parser();
+ }
+ return interfaceName_5049Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createInterfaceName_5049Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser interfaceQualifiedName_5050Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getInterfaceQualifiedName_5050Parser() {
+ if (interfaceQualifiedName_5050Parser == null) {
+ interfaceQualifiedName_5050Parser = createInterfaceQualifiedName_5050Parser();
+ }
+ return interfaceQualifiedName_5050Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createInterfaceQualifiedName_5050Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_QualifiedName(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser modelName_5051Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getModelName_5051Parser() {
+ if (modelName_5051Parser == null) {
+ modelName_5051Parser = createModelName_5051Parser();
+ }
+ return modelName_5051Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createModelName_5051Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("<<{0}>>");
+ parser.setEditorPattern("<<{0}>>");
+ parser.setEditPattern("<<{0}>>");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser modelName_5052Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getModelName_5052Parser() {
+ if (modelName_5052Parser == null) {
+ modelName_5052Parser = createModelName_5052Parser();
+ }
+ return modelName_5052Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createModelName_5052Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser modelQualifiedName_5053Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getModelQualifiedName_5053Parser() {
+ if (modelQualifiedName_5053Parser == null) {
+ modelQualifiedName_5053Parser = createModelQualifiedName_5053Parser();
+ }
+ return modelQualifiedName_5053Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createModelQualifiedName_5053Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_QualifiedName(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("({0})");
+ parser.setEditorPattern("({0})");
+ parser.setEditPattern("({0})");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createPackageQualifiedName_5027Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_QualifiedName(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("({0})");
+ parser.setEditorPattern("({0})");
+ parser.setEditPattern("({0})");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createPrimitiveTypeName_5031Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("<<{0}>>");
+ parser.setEditorPattern("<<{0}>>");
+ parser.setEditPattern("<<{0}>>");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createPrimitiveTypeName_5032Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createPrimitiveTypeQualifiedName_5033Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_QualifiedName(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("({0})");
+ parser.setEditorPattern("({0})");
+ parser.setEditPattern("({0})");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createProperty_3002Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createProperty_3005Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createProperty_3006Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createProperty_3012Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createProperty_3018Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createRealizationName_6012Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("<<{0}>>");
+ parser.setEditorPattern("<<{0}>>");
+ parser.setEditPattern("<<{0}>>");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createRealizationName_6013Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createReception_3011Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createSignalName_5007Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("<<{0}>>");
+ parser.setEditorPattern("<<{0}>>");
+ parser.setEditPattern("<<{0}>>");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createSignalName_5008Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createSignalQualifiedName_5009Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_QualifiedName(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createSubstitutionName_6010Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("<<{0}>>");
+ parser.setEditorPattern("<<{0}>>");
+ parser.setEditPattern("<<{0}>>");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createSubstitutionName_6011Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createUsageName_6016Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createUsageName_6017Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("<<{0}>>");
+ parser.setEditorPattern("<<{0}>>");
+ parser.setEditPattern("<<{0}>>");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser dependencyName_6026Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getDependencyName_6026Parser() {
+ if (dependencyName_6026Parser == null) {
+ dependencyName_6026Parser = createDependencyName_6026Parser();
+ }
+ return dependencyName_6026Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createDependencyName_6026Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser dependencyName_6027Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getDependencyName_6027Parser() {
+ if (dependencyName_6027Parser == null) {
+ dependencyName_6027Parser = createDependencyName_6027Parser();
+ }
+ return dependencyName_6027Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createDependencyName_6027Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("<<{0}>>");
+ parser.setEditorPattern("<<{0}>>");
+ parser.setEditPattern("<<{0}>>");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser dependencyName_6028Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getDependencyName_6028Parser() {
+ if (dependencyName_6028Parser == null) {
+ dependencyName_6028Parser = createDependencyName_6028Parser();
+ }
+ return dependencyName_6028Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createDependencyName_6028Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser dependencyName_6029Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getDependencyName_6029Parser() {
+ if (dependencyName_6029Parser == null) {
+ dependencyName_6029Parser = createDependencyName_6029Parser();
+ }
+ return dependencyName_6029Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createDependencyName_6029Parser() {
+ EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("<<{0}>>");
+ parser.setEditorPattern("<<{0}>>");
+ parser.setEditPattern("<<{0}>>");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getAbstractionName_6014Parser() {
+ if (abstractionName_6014Parser == null) {
+ abstractionName_6014Parser = createAbstractionName_6014Parser();
+ }
+ return abstractionName_6014Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getAbstractionName_6015Parser() {
+ if (abstractionName_6015Parser == null) {
+ abstractionName_6015Parser = createAbstractionName_6015Parser();
+ }
+ return abstractionName_6015Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getAssociationName_6001Parser() {
+ if (associationName_6001Parser == null) {
+ associationName_6001Parser = createAssociationName_6001Parser();
+ }
+ return associationName_6001Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getAssociationName_6002Parser() {
+ if (associationName_6002Parser == null) {
+ associationName_6002Parser = createAssociationName_6002Parser();
+ }
+ return associationName_6002Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getAssociationName_6003Parser() {
+ if (associationName_6003Parser == null) {
+ associationName_6003Parser = createAssociationName_6003Parser();
+ }
+ return associationName_6003Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getAssociationName_6004Parser() {
+ if (associationName_6004Parser == null) {
+ associationName_6004Parser = createAssociationName_6004Parser();
+ }
+ return associationName_6004Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getAssociationName_6005Parser() {
+ if (associationName_6005Parser == null) {
+ associationName_6005Parser = createAssociationName_6005Parser();
+ }
+ return associationName_6005Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getAssociationName_6006Parser() {
+ if (associationName_6006Parser == null) {
+ associationName_6006Parser = createAssociationName_6006Parser();
+ }
+ return associationName_6006Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getClass_3004Parser() {
+ if (class_3004Parser == null) {
+ class_3004Parser = createClass_3004Parser();
+ }
+ return class_3004Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getClass_3008Parser() {
+ if (class_3008Parser == null) {
+ class_3008Parser = createClass_3008Parser();
+ }
+ return class_3008Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getClass_3014Parser() {
+ if (class_3014Parser == null) {
+ class_3014Parser = createClass_3014Parser();
+ }
+ return class_3014Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getClassName_5013Parser() {
+ if (className_5013Parser == null) {
+ className_5013Parser = createClassName_5013Parser();
+ }
+ return className_5013Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getClassName_5014Parser() {
+ if (className_5014Parser == null) {
+ className_5014Parser = createClassName_5014Parser();
+ }
+ return className_5014Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getClassName_5028Parser() {
+ if (className_5028Parser == null) {
+ className_5028Parser = createClassName_5028Parser();
+ }
+ return className_5028Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getClassName_5029Parser() {
+ if (className_5029Parser == null) {
+ className_5029Parser = createClassName_5029Parser();
+ }
+ return className_5029Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getClassQualifiedName_5015Parser() {
+ if (classQualifiedName_5015Parser == null) {
+ classQualifiedName_5015Parser = createClassQualifiedName_5015Parser();
+ }
+ return classQualifiedName_5015Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getClassQualifiedName_5030Parser() {
+ if (classQualifiedName_5030Parser == null) {
+ classQualifiedName_5030Parser = createClassQualifiedName_5030Parser();
+ }
+ return classQualifiedName_5030Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getCommentBody_5038Parser() {
+ if (commentBody_5038Parser == null) {
+ commentBody_5038Parser = createCommentBody_5038Parser();
+ }
+ return commentBody_5038Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getComponentName_5004Parser() {
+ if (componentName_5004Parser == null) {
+ componentName_5004Parser = createComponentName_5004Parser();
+ }
+ return componentName_5004Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getComponentName_5005Parser() {
+ if (componentName_5005Parser == null) {
+ componentName_5005Parser = createComponentName_5005Parser();
+ }
+ return componentName_5005Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getComponentQualifiedName_5006Parser() {
+ if (componentQualifiedName_5006Parser == null) {
+ componentQualifiedName_5006Parser = createComponentQualifiedName_5006Parser();
+ }
+ return componentQualifiedName_5006Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getConstraintName_5037Parser() {
+ if (constraintName_5037Parser == null) {
+ constraintName_5037Parser = createConstraintName_5037Parser();
+ }
+ return constraintName_5037Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getDataTypeName_5034Parser() {
+ if (dataTypeName_5034Parser == null) {
+ dataTypeName_5034Parser = createDataTypeName_5034Parser();
+ }
+ return dataTypeName_5034Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getDataTypeName_5035Parser() {
+ if (dataTypeName_5035Parser == null) {
+ dataTypeName_5035Parser = createDataTypeName_5035Parser();
+ }
+ return dataTypeName_5035Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getDataTypeQualifiedName_5036Parser() {
+ if (dataTypeQualifiedName_5036Parser == null) {
+ dataTypeQualifiedName_5036Parser = createDataTypeQualifiedName_5036Parser();
+ }
+ return dataTypeQualifiedName_5036Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getElementImportAlias_6020Parser() {
+ if (elementImportAlias_6020Parser == null) {
+ elementImportAlias_6020Parser = createElementImportAlias_6020Parser();
+ }
+ return elementImportAlias_6020Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getElementImportAlias_6021Parser() {
+ if (elementImportAlias_6021Parser == null) {
+ elementImportAlias_6021Parser = createElementImportAlias_6021Parser();
+ }
+ return elementImportAlias_6021Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getEnumerationLiteral_3017Parser() {
+ if (enumerationLiteral_3017Parser == null) {
+ enumerationLiteral_3017Parser = createEnumerationLiteral_3017Parser();
+ }
+ return enumerationLiteral_3017Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getEnumerationName_5022Parser() {
+ if (enumerationName_5022Parser == null) {
+ enumerationName_5022Parser = createEnumerationName_5022Parser();
+ }
+ return enumerationName_5022Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getEnumerationName_5023Parser() {
+ if (enumerationName_5023Parser == null) {
+ enumerationName_5023Parser = createEnumerationName_5023Parser();
+ }
+ return enumerationName_5023Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getEnumerationQualifiedName_5024Parser() {
+ if (enumerationQualifiedName_5024Parser == null) {
+ enumerationQualifiedName_5024Parser = createEnumerationQualifiedName_5024Parser();
+ }
+ return enumerationQualifiedName_5024Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getGeneralizationIsSubstitutable_6007Parser() {
+ if (generalizationIsSubstitutable_6007Parser == null) {
+ generalizationIsSubstitutable_6007Parser = createGeneralizationIsSubstitutable_6007Parser();
+ }
+ return generalizationIsSubstitutable_6007Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getInstanceSpecificationName_5001Parser() {
+ if (instanceSpecificationName_5001Parser == null) {
+ instanceSpecificationName_5001Parser = createInstanceSpecificationName_5001Parser();
+ }
+ return instanceSpecificationName_5001Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getInstanceSpecificationName_5002Parser() {
+ if (instanceSpecificationName_5002Parser == null) {
+ instanceSpecificationName_5002Parser = createInstanceSpecificationName_5002Parser();
+ }
+ return instanceSpecificationName_5002Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getInstanceSpecificationQualifiedName_5003Parser() {
+ if (instanceSpecificationQualifiedName_5003Parser == null) {
+ instanceSpecificationQualifiedName_5003Parser = createInstanceSpecificationQualifiedName_5003Parser();
+ }
+ return instanceSpecificationQualifiedName_5003Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getInterfaceName_5010Parser() {
+ if (interfaceName_5010Parser == null) {
+ interfaceName_5010Parser = createInterfaceName_5010Parser();
+ }
+ return interfaceName_5010Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getInterfaceName_5011Parser() {
+ if (interfaceName_5011Parser == null) {
+ interfaceName_5011Parser = createInterfaceName_5011Parser();
+ }
+ return interfaceName_5011Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getInterfaceQualifiedName_5012Parser() {
+ if (interfaceQualifiedName_5012Parser == null) {
+ interfaceQualifiedName_5012Parser = createInterfaceQualifiedName_5012Parser();
+ }
+ return interfaceQualifiedName_5012Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getInterfaceRealizationName_6008Parser() {
+ if (interfaceRealizationName_6008Parser == null) {
+ interfaceRealizationName_6008Parser = createInterfaceRealizationName_6008Parser();
+ }
+ return interfaceRealizationName_6008Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getInterfaceRealizationName_6009Parser() {
+ if (interfaceRealizationName_6009Parser == null) {
+ interfaceRealizationName_6009Parser = createInterfaceRealizationName_6009Parser();
+ }
+ return interfaceRealizationName_6009Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getModelName_5019Parser() {
+ if (modelName_5019Parser == null) {
+ modelName_5019Parser = createModelName_5019Parser();
+ }
+ return modelName_5019Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getModelName_5020Parser() {
+ if (modelName_5020Parser == null) {
+ modelName_5020Parser = createModelName_5020Parser();
+ }
+ return modelName_5020Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getModelQualifiedName_5021Parser() {
+ if (modelQualifiedName_5021Parser == null) {
+ modelQualifiedName_5021Parser = createModelQualifiedName_5021Parser();
+ }
+ return modelQualifiedName_5021Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getOperation_3003Parser() {
+ if (operation_3003Parser == null) {
+ operation_3003Parser = createOperation_3003Parser();
+ }
+ return operation_3003Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getOperation_3007Parser() {
+ if (operation_3007Parser == null) {
+ operation_3007Parser = createOperation_3007Parser();
+ }
+ return operation_3007Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getOperation_3013Parser() {
+ if (operation_3013Parser == null) {
+ operation_3013Parser = createOperation_3013Parser();
+ }
+ return operation_3013Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getOperation_3019Parser() {
+ if (operation_3019Parser == null) {
+ operation_3019Parser = createOperation_3019Parser();
+ }
+ return operation_3019Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getPackageImportVisibility_6022Parser() {
+ if (packageImportVisibility_6022Parser == null) {
+ packageImportVisibility_6022Parser = createPackageImportVisibility_6022Parser();
+ }
+ return packageImportVisibility_6022Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getPackageName_5016Parser() {
+ if (packageName_5016Parser == null) {
+ packageName_5016Parser = createPackageName_5016Parser();
+ }
+ return packageName_5016Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getPackageName_5017Parser() {
+ if (packageName_5017Parser == null) {
+ packageName_5017Parser = createPackageName_5017Parser();
+ }
+ return packageName_5017Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getPackageName_5025Parser() {
+ if (packageName_5025Parser == null) {
+ packageName_5025Parser = createPackageName_5025Parser();
+ }
+ return packageName_5025Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getPackageName_5026Parser() {
+ if (packageName_5026Parser == null) {
+ packageName_5026Parser = createPackageName_5026Parser();
+ }
+ return packageName_5026Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getPackageQualifiedName_5018Parser() {
+ if (packageQualifiedName_5018Parser == null) {
+ packageQualifiedName_5018Parser = createPackageQualifiedName_5018Parser();
+ }
+ return packageQualifiedName_5018Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getPackageQualifiedName_5027Parser() {
+ if (packageQualifiedName_5027Parser == null) {
+ packageQualifiedName_5027Parser = createPackageQualifiedName_5027Parser();
+ }
+ return packageQualifiedName_5027Parser;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser(IAdaptable hint) {
+ String vid = (String) hint.getAdapter(String.class);
+ if (vid != null) {
+ return getParser(UMLVisualIDRegistry.getVisualID(vid));
+ }
+ View view = (View) hint.getAdapter(View.class);
+ if (view != null) {
+ return getParser(UMLVisualIDRegistry.getVisualID(view));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser getParser(int visualID) {
+ switch (visualID) {
+ case AssociationClassNameEditPart.VISUAL_ID:
+ return getAssociationClassName_5065Parser();
+ case AssociationClassName2EditPart.VISUAL_ID:
+ return getAssociationClassName_5066Parser();
+ case AssociationClassQualifiedNameEditPart.VISUAL_ID:
+ return getAssociationClassQualifiedName_5067Parser();
+ case InstanceSpecificationNameEditPart.VISUAL_ID:
+ return getInstanceSpecificationName_5001Parser();
+ case InstanceSpecificationName2EditPart.VISUAL_ID:
+ return getInstanceSpecificationName_5002Parser();
+ case InstanceSpecificationQualifiedNameEditPart.VISUAL_ID:
+ return getInstanceSpecificationQualifiedName_5003Parser();
+ case ComponentNameEditPart.VISUAL_ID:
+ return getComponentName_5004Parser();
+ case ComponentName2EditPart.VISUAL_ID:
+ return getComponentName_5005Parser();
+ case ComponentQualifiedNameEditPart.VISUAL_ID:
+ return getComponentQualifiedName_5006Parser();
+ case SignalNameEditPart.VISUAL_ID:
+ return getSignalName_5007Parser();
+ case SignalName2EditPart.VISUAL_ID:
+ return getSignalName_5008Parser();
+ case SignalQualifiedNameEditPart.VISUAL_ID:
+ return getSignalQualifiedName_5009Parser();
+ case InterfaceNameEditPart.VISUAL_ID:
+ return getInterfaceName_5010Parser();
+ case InterfaceName2EditPart.VISUAL_ID:
+ return getInterfaceName_5011Parser();
+ case InterfaceQualifiedNameEditPart.VISUAL_ID:
+ return getInterfaceQualifiedName_5012Parser();
+ case ModelNameEditPart.VISUAL_ID:
+ return getModelName_5019Parser();
+ case ModelName2EditPart.VISUAL_ID:
+ return getModelName_5020Parser();
+ case ModelQualifiedNameEditPart.VISUAL_ID:
+ return getModelQualifiedName_5021Parser();
+ case EnumerationNameEditPart.VISUAL_ID:
+ return getEnumerationName_5022Parser();
+ case EnumerationName2EditPart.VISUAL_ID:
+ return getEnumerationName_5023Parser();
+ case EnumerationQualifiedNameEditPart.VISUAL_ID:
+ return getEnumerationQualifiedName_5024Parser();
+ case PackageNameEditPart.VISUAL_ID:
+ return getPackageName_5025Parser();
+ case PackageName2EditPart.VISUAL_ID:
+ return getPackageName_5026Parser();
+ case PackageQualifiedNameEditPart.VISUAL_ID:
+ return getPackageQualifiedName_5027Parser();
+ case ClassNameEditPart.VISUAL_ID:
+ return getClassName_5028Parser();
+ case ClassName2EditPart.VISUAL_ID:
+ return getClassName_5029Parser();
+ case ClassQualifiedNameEditPart.VISUAL_ID:
+ return getClassQualifiedName_5030Parser();
+ case PrimitiveTypeNameEditPart.VISUAL_ID:
+ return getPrimitiveTypeName_5031Parser();
+ case PrimitiveTypeName2EditPart.VISUAL_ID:
+ return getPrimitiveTypeName_5032Parser();
+ case PrimitiveTypeQualifiedNameEditPart.VISUAL_ID:
+ return getPrimitiveTypeQualifiedName_5033Parser();
+ case DataTypeNameEditPart.VISUAL_ID:
+ return getDataTypeName_5034Parser();
+ case DataTypeName2EditPart.VISUAL_ID:
+ return getDataTypeName_5035Parser();
+ case DataTypeQualifiedNameEditPart.VISUAL_ID:
+ return getDataTypeQualifiedName_5036Parser();
+ case ConstraintNameEditPart.VISUAL_ID:
+ return getConstraintName_5037Parser();
+ case CommentBodyEditPart.VISUAL_ID:
+ return getCommentBody_5038Parser();
+ case PropertyEditPart.VISUAL_ID:
+ return getProperty_3002Parser();
+ case OperationEditPart.VISUAL_ID:
+ return getOperation_3003Parser();
+ case Class2EditPart.VISUAL_ID:
+ return getClass_3004Parser();
+ case Property2EditPart.VISUAL_ID:
+ return getProperty_3005Parser();
+ case Property3EditPart.VISUAL_ID:
+ return getProperty_3006Parser();
+ case Operation2EditPart.VISUAL_ID:
+ return getOperation_3007Parser();
+ case Class3EditPart.VISUAL_ID:
+ return getClass_3008Parser();
+ case InstanceSpecificationName3EditPart.VISUAL_ID:
+ return getInstanceSpecificationName_5039Parser();
+ case InstanceSpecificationName4EditPart.VISUAL_ID:
+ return getInstanceSpecificationName_5040Parser();
+ case InstanceSpecificationQualifiedName2EditPart.VISUAL_ID:
+ return getInstanceSpecificationQualifiedName_5041Parser();
+ case ComponentName3EditPart.VISUAL_ID:
+ return getComponentName_5042Parser();
+ case ComponentName4EditPart.VISUAL_ID:
+ return getComponentName_5043Parser();
+ case ComponentQualifiedName2EditPart.VISUAL_ID:
+ return getComponentQualifiedName_5044Parser();
+ case SignalName3EditPart.VISUAL_ID:
+ return getSignalName_5045Parser();
+ case SignalName4EditPart.VISUAL_ID:
+ return getSignalName_5046Parser();
+ case SignalQualifiedName2EditPart.VISUAL_ID:
+ return getSignalQualifiedName_5047Parser();
+ case InterfaceName3EditPart.VISUAL_ID:
+ return getInterfaceName_5048Parser();
+ case InterfaceName4EditPart.VISUAL_ID:
+ return getInterfaceName_5049Parser();
+ case InterfaceQualifiedName2EditPart.VISUAL_ID:
+ return getInterfaceQualifiedName_5050Parser();
+ case ModelName3EditPart.VISUAL_ID:
+ return getModelName_5051Parser();
+ case ModelName4EditPart.VISUAL_ID:
+ return getModelName_5052Parser();
+ case ModelQualifiedName2EditPart.VISUAL_ID:
+ return getModelQualifiedName_5053Parser();
+ case EnumerationName3EditPart.VISUAL_ID:
+ return getEnumerationName_5054Parser();
+ case EnumerationName4EditPart.VISUAL_ID:
+ return getEnumerationName_5055Parser();
+ case EnumerationQualifiedName2EditPart.VISUAL_ID:
+ return getEnumerationQualifiedName_5056Parser();
+ case EnumerationLiteralEditPart.VISUAL_ID:
+ return getEnumerationLiteral_3017Parser();
+ case PackageName3EditPart.VISUAL_ID:
+ return getPackageName_5016Parser();
+ case PackageName4EditPart.VISUAL_ID:
+ return getPackageName_5017Parser();
+ case PackageQualifiedName2EditPart.VISUAL_ID:
+ return getPackageQualifiedName_5018Parser();
+ case ClassName3EditPart.VISUAL_ID:
+ return getClassName_5013Parser();
+ case ClassName4EditPart.VISUAL_ID:
+ return getClassName_5014Parser();
+ case ClassQualifiedName2EditPart.VISUAL_ID:
+ return getClassQualifiedName_5015Parser();
+ case ReceptionEditPart.VISUAL_ID:
+ return getReception_3011Parser();
+ case Property4EditPart.VISUAL_ID:
+ return getProperty_3012Parser();
+ case Operation3EditPart.VISUAL_ID:
+ return getOperation_3013Parser();
+ case Class5EditPart.VISUAL_ID:
+ return getClass_3014Parser();
+ case PrimitiveTypeName3EditPart.VISUAL_ID:
+ return getPrimitiveTypeName_5057Parser();
+ case PrimitiveTypeName4EditPart.VISUAL_ID:
+ return getPrimitiveTypeName_5058Parser();
+ case PrimitiveTypeQualifiedName2EditPart.VISUAL_ID:
+ return getPrimitiveTypeQualifiedName_5059Parser();
+ case DataTypeName3EditPart.VISUAL_ID:
+ return getDataTypeName_5060Parser();
+ case DataTypeName4EditPart.VISUAL_ID:
+ return getDataTypeName_5061Parser();
+ case DataTypeQualifiedName2EditPart.VISUAL_ID:
+ return getDataTypeQualifiedName_5062Parser();
+ case Property5EditPart.VISUAL_ID:
+ return getProperty_3018Parser();
+ case Operation4EditPart.VISUAL_ID:
+ return getOperation_3019Parser();
+ case CommentBody2EditPart.VISUAL_ID:
+ return getCommentBody_5063Parser();
+ case ConstraintName2EditPart.VISUAL_ID:
+ return getConstraintName_5064Parser();
+ case AssociationNameEditPart.VISUAL_ID:
+ return getAssociationName_6001Parser();
+ case AssociationName2EditPart.VISUAL_ID:
+ return getAssociationName_6002Parser();
+ case AssociationName3EditPart.VISUAL_ID:
+ return getAssociationName_6003Parser();
+ case AssociationName4EditPart.VISUAL_ID:
+ return getAssociationName_6004Parser();
+ case AssociationName5EditPart.VISUAL_ID:
+ return getAssociationName_6005Parser();
+ case AssociationName6EditPart.VISUAL_ID:
+ return getAssociationName_6006Parser();
+ case GeneralizationIsSubstitutableEditPart.VISUAL_ID:
+ return getGeneralizationIsSubstitutable_6007Parser();
+ case InterfaceRealizationNameEditPart.VISUAL_ID:
+ return getInterfaceRealizationName_6008Parser();
+ case InterfaceRealizationName2EditPart.VISUAL_ID:
+ return getInterfaceRealizationName_6009Parser();
+ case SubstitutionNameEditPart.VISUAL_ID:
+ return getSubstitutionName_6010Parser();
+ case SubstitutionName2EditPart.VISUAL_ID:
+ return getSubstitutionName_6011Parser();
+ case RealizationNameEditPart.VISUAL_ID:
+ return getRealizationName_6012Parser();
+ case RealizationName2EditPart.VISUAL_ID:
+ return getRealizationName_6013Parser();
+ case AbstractionNameEditPart.VISUAL_ID:
+ return getAbstractionName_6014Parser();
+ case AbstractionName2EditPart.VISUAL_ID:
+ return getAbstractionName_6015Parser();
+ case UsageNameEditPart.VISUAL_ID:
+ return getUsageName_6016Parser();
+ case UsageName2EditPart.VISUAL_ID:
+ return getUsageName_6017Parser();
+ case DependencyNameEditPart.VISUAL_ID:
+ return getDependencyName_6026Parser();
+ case DependencyName2EditPart.VISUAL_ID:
+ return getDependencyName_6027Parser();
+ case DependencyName3EditPart.VISUAL_ID:
+ return getDependencyName_6028Parser();
+ case DependencyName4EditPart.VISUAL_ID:
+ return getDependencyName_6029Parser();
+ case ElementImportAliasEditPart.VISUAL_ID:
+ return getElementImportAlias_6020Parser();
+ case ElementImportAlias2EditPart.VISUAL_ID:
+ return getElementImportAlias_6021Parser();
+ case PackageImportVisibilityEditPart.VISUAL_ID:
+ return getPackageImportVisibility_6022Parser();
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getPrimitiveTypeName_5031Parser() {
+ if (primitiveTypeName_5031Parser == null) {
+ primitiveTypeName_5031Parser = createPrimitiveTypeName_5031Parser();
+ }
+ return primitiveTypeName_5031Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getPrimitiveTypeName_5032Parser() {
+ if (primitiveTypeName_5032Parser == null) {
+ primitiveTypeName_5032Parser = createPrimitiveTypeName_5032Parser();
+ }
+ return primitiveTypeName_5032Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getPrimitiveTypeQualifiedName_5033Parser() {
+ if (primitiveTypeQualifiedName_5033Parser == null) {
+ primitiveTypeQualifiedName_5033Parser = createPrimitiveTypeQualifiedName_5033Parser();
+ }
+ return primitiveTypeQualifiedName_5033Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getProperty_3002Parser() {
+ if (property_3002Parser == null) {
+ property_3002Parser = createProperty_3002Parser();
+ }
+ return property_3002Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getProperty_3005Parser() {
+ if (property_3005Parser == null) {
+ property_3005Parser = createProperty_3005Parser();
+ }
+ return property_3005Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getProperty_3006Parser() {
+ if (property_3006Parser == null) {
+ property_3006Parser = createProperty_3006Parser();
+ }
+ return property_3006Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getProperty_3012Parser() {
+ if (property_3012Parser == null) {
+ property_3012Parser = createProperty_3012Parser();
+ }
+ return property_3012Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getProperty_3018Parser() {
+ if (property_3018Parser == null) {
+ property_3018Parser = createProperty_3018Parser();
+ }
+ return property_3018Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getRealizationName_6012Parser() {
+ if (realizationName_6012Parser == null) {
+ realizationName_6012Parser = createRealizationName_6012Parser();
+ }
+ return realizationName_6012Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getRealizationName_6013Parser() {
+ if (realizationName_6013Parser == null) {
+ realizationName_6013Parser = createRealizationName_6013Parser();
+ }
+ return realizationName_6013Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getReception_3011Parser() {
+ if (reception_3011Parser == null) {
+ reception_3011Parser = createReception_3011Parser();
+ }
+ return reception_3011Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getSignalName_5007Parser() {
+ if (signalName_5007Parser == null) {
+ signalName_5007Parser = createSignalName_5007Parser();
+ }
+ return signalName_5007Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getSignalName_5008Parser() {
+ if (signalName_5008Parser == null) {
+ signalName_5008Parser = createSignalName_5008Parser();
+ }
+ return signalName_5008Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getSignalQualifiedName_5009Parser() {
+ if (signalQualifiedName_5009Parser == null) {
+ signalQualifiedName_5009Parser = createSignalQualifiedName_5009Parser();
+ }
+ return signalQualifiedName_5009Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getSubstitutionName_6010Parser() {
+ if (substitutionName_6010Parser == null) {
+ substitutionName_6010Parser = createSubstitutionName_6010Parser();
+ }
+ return substitutionName_6010Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getSubstitutionName_6011Parser() {
+ if (substitutionName_6011Parser == null) {
+ substitutionName_6011Parser = createSubstitutionName_6011Parser();
+ }
+ return substitutionName_6011Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getUsageName_6016Parser() {
+ if (usageName_6016Parser == null) {
+ usageName_6016Parser = createUsageName_6016Parser();
+ }
+ return usageName_6016Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser getUsageName_6017Parser() {
+ if (usageName_6017Parser == null) {
+ usageName_6017Parser = createUsageName_6017Parser();
+ }
+ return usageName_6017Parser;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean provides(IOperation operation) {
+ if (operation instanceof GetParserOperation) {
+ IAdaptable hint = ((GetParserOperation) operation).getHint();
+ if (UMLElementTypes.getElement(hint) == null) {
+ return false;
+ }
+ return getParser(hint) != null;
+ }
+ return false;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/providers/UMLValidationProvider.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/providers/UMLValidationProvider.java
new file mode 100644
index 00000000000..6615209132d
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/providers/UMLValidationProvider.java
@@ -0,0 +1,93 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.providers;
+
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.AbstractContributionItemProvider;
+import org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.part.ValidateAction;
+
+/**
+ * @generated
+ */
+public class UMLValidationProvider extends AbstractContributionItemProvider {
+
+ /**
+ * @generated
+ */
+ private static boolean constraintsActive = false;
+
+ /**
+ * @generated
+ */
+ public static boolean shouldConstraintsBePrivate() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public static void runWithConstraints(TransactionalEditingDomain editingDomain, Runnable operation) {
+ final Runnable op = operation;
+ Runnable task = new Runnable() {
+
+ public void run() {
+ try {
+ constraintsActive = true;
+ op.run();
+ } finally {
+ constraintsActive = false;
+ }
+ }
+ };
+ if (editingDomain != null) {
+ try {
+ editingDomain.runExclusive(task);
+ } catch (Exception e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Validation failed", e); //$NON-NLS-1$
+ }
+ } else {
+ task.run();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected IAction createAction(String actionId, IWorkbenchPartDescriptor partDescriptor) {
+ if (ValidateAction.VALIDATE_ACTION_KEY.equals(actionId)) {
+ return new ValidateAction(partDescriptor);
+ }
+ return super.createAction(actionId, partDescriptor);
+ }
+
+ /**
+ * @generated
+ */
+ static boolean isInDefaultEditorContext(Object object) {
+ if (shouldConstraintsBePrivate() && !constraintsActive) {
+ return false;
+ }
+ if (object instanceof View) {
+ return constraintsActive && ModelEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID((View) object));
+ }
+ return true;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/providers/UMLViewProvider.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/providers/UMLViewProvider.java
new file mode 100644
index 00000000000..342be35a4d0
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/providers/UMLViewProvider.java
@@ -0,0 +1,851 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.providers;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.diagram.core.providers.AbstractViewProvider;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.*;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.clazz.view.factories.*;
+
+/**
+ * @generated
+ */
+public class UMLViewProvider extends AbstractViewProvider {
+
+ /**
+ * @generated
+ */
+ protected Class getDiagramViewClass(IAdaptable semanticAdapter, String diagramKind) {
+ EObject semanticElement = getSemanticElement(semanticAdapter);
+ if (ModelEditPart.MODEL_ID.equals(diagramKind) && UMLVisualIDRegistry.getDiagramVisualID(semanticElement) != -1) {
+ return ModelViewFactory.class;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Class getNodeViewClass(IAdaptable semanticAdapter, View containerView, String semanticHint) {
+ if (containerView == null) {
+ return null;
+ }
+ IElementType elementType = getSemanticElementType(semanticAdapter);
+ EObject domainElement = getSemanticElement(semanticAdapter);
+ int visualID;
+ if (semanticHint == null) {
+ // Semantic hint is not specified. Can be a result of call from CanonicalEditPolicy.
+ // In this situation there should be NO elementType, visualID will be determined
+ // by VisualIDRegistry.getNodeVisualID() for domainElement.
+ if (elementType != null || domainElement == null) {
+ return null;
+ }
+ visualID = UMLVisualIDRegistry.getNodeVisualID(containerView, domainElement);
+ } else {
+ visualID = UMLVisualIDRegistry.getVisualID(semanticHint);
+ if (elementType != null) {
+ // Semantic hint is specified together with element type.
+ // Both parameters should describe exactly the same diagram element.
+ // In addition we check that visualID returned by VisualIDRegistry.getNodeVisualID() for
+ // domainElement (if specified) is the same as in element type.
+ if (!UMLElementTypes.isKnownElementType(elementType) || (!(elementType instanceof IHintedType))) {
+ return null; // foreign element type
+ }
+ String elementTypeHint = ((IHintedType) elementType).getSemanticHint();
+ if (!semanticHint.equals(elementTypeHint)) {
+ return null; // if semantic hint is specified it should be the same as in element type
+ }
+ if (domainElement != null && visualID != UMLVisualIDRegistry.getNodeVisualID(containerView, domainElement)) {
+ return null; // visual id for node EClass should match visual id from element type
+ }
+ } else {
+ // Element type is not specified. Domain element should be present (except pure design elements).
+ // This method is called with EObjectAdapter as parameter from:
+ // - ViewService.createNode(View container, EObject eObject, String type, PreferencesHint preferencesHint)
+ // - generated ViewFactory.decorateView() for parent element
+ if (!ModelEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
+ return null; // foreign diagram
+ }
+ switch (visualID) {
+ case Dependency2EditPart.VISUAL_ID:
+ case AssociationClassEditPart.VISUAL_ID:
+ case Association2EditPart.VISUAL_ID:
+ case InstanceSpecificationEditPart.VISUAL_ID:
+ case ComponentEditPart.VISUAL_ID:
+ case SignalEditPart.VISUAL_ID:
+ case InterfaceEditPart.VISUAL_ID:
+ case Model2EditPart.VISUAL_ID:
+ case PropertyEditPart.VISUAL_ID:
+ case SlotEditPart.VISUAL_ID:
+ case OperationEditPart.VISUAL_ID:
+ case Class2EditPart.VISUAL_ID:
+ case RedefinableTemplateSignatureEditPart.VISUAL_ID:
+ case TemplateParameterEditPart.VISUAL_ID:
+ case Enumeration2EditPart.VISUAL_ID:
+ case EnumerationLiteralEditPart.VISUAL_ID:
+ case ReceptionEditPart.VISUAL_ID:
+ case PrimitiveType2EditPart.VISUAL_ID:
+ case DataType2EditPart.VISUAL_ID:
+ case Comment2EditPart.VISUAL_ID:
+ case Constraint2EditPart.VISUAL_ID:
+ case EnumerationEditPart.VISUAL_ID:
+ case PackageEditPart.VISUAL_ID:
+ case ClassEditPart.VISUAL_ID:
+ case PrimitiveTypeEditPart.VISUAL_ID:
+ case DataTypeEditPart.VISUAL_ID:
+ case ConstraintEditPart.VISUAL_ID:
+ case CommentEditPart.VISUAL_ID:
+ case Property2EditPart.VISUAL_ID:
+ case Property3EditPart.VISUAL_ID:
+ case Operation2EditPart.VISUAL_ID:
+ case Class3EditPart.VISUAL_ID:
+ case InstanceSpecification2EditPart.VISUAL_ID:
+ case Component2EditPart.VISUAL_ID:
+ case Signal2EditPart.VISUAL_ID:
+ case Interface2EditPart.VISUAL_ID:
+ case Model3EditPart.VISUAL_ID:
+ case Package2EditPart.VISUAL_ID:
+ case Class4EditPart.VISUAL_ID:
+ case Property4EditPart.VISUAL_ID:
+ case Operation3EditPart.VISUAL_ID:
+ case Class5EditPart.VISUAL_ID:
+ case Property5EditPart.VISUAL_ID:
+ case Operation4EditPart.VISUAL_ID:
+ if (domainElement == null || visualID != UMLVisualIDRegistry.getNodeVisualID(containerView, domainElement)) {
+ return null; // visual id in semantic hint should match visual id for domain element
+ }
+ break;
+ case AssociationClassNameEditPart.VISUAL_ID:
+ case AssociationClassName2EditPart.VISUAL_ID:
+ case AssociationClassQualifiedNameEditPart.VISUAL_ID:
+ case AssociationClassAttributeCompartmentEditPart.VISUAL_ID:
+ if (AssociationClassEditPart.VISUAL_ID != UMLVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ case InstanceSpecificationNameEditPart.VISUAL_ID:
+ case InstanceSpecificationName2EditPart.VISUAL_ID:
+ case InstanceSpecificationQualifiedNameEditPart.VISUAL_ID:
+ case InstanceSpecificationSlotCompartmentEditPart.VISUAL_ID:
+ if (InstanceSpecificationEditPart.VISUAL_ID != UMLVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ case ComponentNameEditPart.VISUAL_ID:
+ case ComponentName2EditPart.VISUAL_ID:
+ case ComponentQualifiedNameEditPart.VISUAL_ID:
+ case ComponentAttributeCompartmentEditPart.VISUAL_ID:
+ case ComponentOperationCompartmentEditPart.VISUAL_ID:
+ case ComponentNestedClassifierCompartmentEditPart.VISUAL_ID:
+ if (ComponentEditPart.VISUAL_ID != UMLVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ case SignalNameEditPart.VISUAL_ID:
+ case SignalName2EditPart.VISUAL_ID:
+ case SignalQualifiedNameEditPart.VISUAL_ID:
+ case SignalAttributeCompartmentEditPart.VISUAL_ID:
+ if (SignalEditPart.VISUAL_ID != UMLVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ case InterfaceNameEditPart.VISUAL_ID:
+ case InterfaceName2EditPart.VISUAL_ID:
+ case InterfaceQualifiedNameEditPart.VISUAL_ID:
+ case InterfaceAttributeCompartmentEditPart.VISUAL_ID:
+ case InterfaceOperationCompartmentEditPart.VISUAL_ID:
+ case InterfaceNestedClassifierCompartmentEditPart.VISUAL_ID:
+ if (InterfaceEditPart.VISUAL_ID != UMLVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ case ModelNameEditPart.VISUAL_ID:
+ case ModelName2EditPart.VISUAL_ID:
+ case ModelQualifiedNameEditPart.VISUAL_ID:
+ case ModelPackageableElementCompartmentEditPart.VISUAL_ID:
+ if (Model2EditPart.VISUAL_ID != UMLVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ case EnumerationNameEditPart.VISUAL_ID:
+ case EnumerationName2EditPart.VISUAL_ID:
+ case EnumerationQualifiedNameEditPart.VISUAL_ID:
+ case EnumerationEnumerationLiteralCompartmentEditPart.VISUAL_ID:
+ if (EnumerationEditPart.VISUAL_ID != UMLVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ case PackageNameEditPart.VISUAL_ID:
+ case PackageName2EditPart.VISUAL_ID:
+ case PackageQualifiedNameEditPart.VISUAL_ID:
+ case PackagePackageableElementCompartment2EditPart.VISUAL_ID:
+ if (PackageEditPart.VISUAL_ID != UMLVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ case ClassNameEditPart.VISUAL_ID:
+ case ClassName2EditPart.VISUAL_ID:
+ case ClassQualifiedNameEditPart.VISUAL_ID:
+ case ClassAttributeCompartment2EditPart.VISUAL_ID:
+ case ClassOperationCompartment2EditPart.VISUAL_ID:
+ case ClassNestedClassifierCompartment2EditPart.VISUAL_ID:
+ if (ClassEditPart.VISUAL_ID != UMLVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ case PrimitiveTypeNameEditPart.VISUAL_ID:
+ case PrimitiveTypeName2EditPart.VISUAL_ID:
+ case PrimitiveTypeQualifiedNameEditPart.VISUAL_ID:
+ if (PrimitiveTypeEditPart.VISUAL_ID != UMLVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ case DataTypeNameEditPart.VISUAL_ID:
+ case DataTypeName2EditPart.VISUAL_ID:
+ case DataTypeQualifiedNameEditPart.VISUAL_ID:
+ case DataTypeAttributeCompartmentEditPart.VISUAL_ID:
+ case DataTypeOperationCompartmentEditPart.VISUAL_ID:
+ if (DataTypeEditPart.VISUAL_ID != UMLVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ case ConstraintNameEditPart.VISUAL_ID:
+ if (ConstraintEditPart.VISUAL_ID != UMLVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ case CommentBodyEditPart.VISUAL_ID:
+ if (CommentEditPart.VISUAL_ID != UMLVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ case RedefinableTemplateSignatureTemplateParameterCompartmentEditPart.VISUAL_ID:
+ if (RedefinableTemplateSignatureEditPart.VISUAL_ID != UMLVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ case InstanceSpecificationName3EditPart.VISUAL_ID:
+ case InstanceSpecificationName4EditPart.VISUAL_ID:
+ case InstanceSpecificationQualifiedName2EditPart.VISUAL_ID:
+ case InstanceSpecificationSlotCompartment2EditPart.VISUAL_ID:
+ if (InstanceSpecification2EditPart.VISUAL_ID != UMLVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ case ComponentName3EditPart.VISUAL_ID:
+ case ComponentName4EditPart.VISUAL_ID:
+ case ComponentQualifiedName2EditPart.VISUAL_ID:
+ case ComponentAttributeCompartment2EditPart.VISUAL_ID:
+ case ComponentOperationCompartment2EditPart.VISUAL_ID:
+ case ComponentNestedClassifierCompartment2EditPart.VISUAL_ID:
+ if (Component2EditPart.VISUAL_ID != UMLVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ case SignalName3EditPart.VISUAL_ID:
+ case SignalName4EditPart.VISUAL_ID:
+ case SignalQualifiedName2EditPart.VISUAL_ID:
+ case SignalAttributeCompartment2EditPart.VISUAL_ID:
+ if (Signal2EditPart.VISUAL_ID != UMLVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ case InterfaceName3EditPart.VISUAL_ID:
+ case InterfaceName4EditPart.VISUAL_ID:
+ case InterfaceQualifiedName2EditPart.VISUAL_ID:
+ case InterfaceAttributeCompartment2EditPart.VISUAL_ID:
+ case InterfaceOperationCompartment2EditPart.VISUAL_ID:
+ case InterfaceNestedClassifierCompartment2EditPart.VISUAL_ID:
+ if (Interface2EditPart.VISUAL_ID != UMLVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ case ModelName3EditPart.VISUAL_ID:
+ case ModelName4EditPart.VISUAL_ID:
+ case ModelQualifiedName2EditPart.VISUAL_ID:
+ case ModelPackageableElementCompartment2EditPart.VISUAL_ID:
+ if (Model3EditPart.VISUAL_ID != UMLVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ case EnumerationName3EditPart.VISUAL_ID:
+ case EnumerationName4EditPart.VISUAL_ID:
+ case EnumerationQualifiedName2EditPart.VISUAL_ID:
+ case EnumerationEnumerationLiteralCompartment2EditPart.VISUAL_ID:
+ if (Enumeration2EditPart.VISUAL_ID != UMLVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ case PackageName3EditPart.VISUAL_ID:
+ case PackageName4EditPart.VISUAL_ID:
+ case PackageQualifiedName2EditPart.VISUAL_ID:
+ case PackagePackageableElementCompartmentEditPart.VISUAL_ID:
+ if (Package2EditPart.VISUAL_ID != UMLVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ case ClassName3EditPart.VISUAL_ID:
+ case ClassName4EditPart.VISUAL_ID:
+ case ClassQualifiedName2EditPart.VISUAL_ID:
+ case ClassAttributeCompartmentEditPart.VISUAL_ID:
+ case ClassOperationCompartmentEditPart.VISUAL_ID:
+ case ClassNestedClassifierCompartmentEditPart.VISUAL_ID:
+ if (Class4EditPart.VISUAL_ID != UMLVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ case PrimitiveTypeName3EditPart.VISUAL_ID:
+ case PrimitiveTypeName4EditPart.VISUAL_ID:
+ case PrimitiveTypeQualifiedName2EditPart.VISUAL_ID:
+ if (PrimitiveType2EditPart.VISUAL_ID != UMLVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ case DataTypeName3EditPart.VISUAL_ID:
+ case DataTypeName4EditPart.VISUAL_ID:
+ case DataTypeQualifiedName2EditPart.VISUAL_ID:
+ case DataTypeAttributeCompartment2EditPart.VISUAL_ID:
+ case DataTypeOperationCompartment2EditPart.VISUAL_ID:
+ if (DataType2EditPart.VISUAL_ID != UMLVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ case CommentBody2EditPart.VISUAL_ID:
+ if (Comment2EditPart.VISUAL_ID != UMLVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ case ConstraintName2EditPart.VISUAL_ID:
+ if (Constraint2EditPart.VISUAL_ID != UMLVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ case AssociationNameEditPart.VISUAL_ID:
+ case AssociationName2EditPart.VISUAL_ID:
+ case AssociationName3EditPart.VISUAL_ID:
+ case AssociationName4EditPart.VISUAL_ID:
+ case AssociationName5EditPart.VISUAL_ID:
+ case AssociationName6EditPart.VISUAL_ID:
+ if (AssociationEditPart.VISUAL_ID != UMLVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ case GeneralizationIsSubstitutableEditPart.VISUAL_ID:
+ if (GeneralizationEditPart.VISUAL_ID != UMLVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ case InterfaceRealizationNameEditPart.VISUAL_ID:
+ case InterfaceRealizationName2EditPart.VISUAL_ID:
+ if (InterfaceRealizationEditPart.VISUAL_ID != UMLVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ case SubstitutionNameEditPart.VISUAL_ID:
+ case SubstitutionName2EditPart.VISUAL_ID:
+ if (SubstitutionEditPart.VISUAL_ID != UMLVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ case RealizationNameEditPart.VISUAL_ID:
+ case RealizationName2EditPart.VISUAL_ID:
+ if (RealizationEditPart.VISUAL_ID != UMLVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ case AbstractionNameEditPart.VISUAL_ID:
+ case AbstractionName2EditPart.VISUAL_ID:
+ if (AbstractionEditPart.VISUAL_ID != UMLVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ case UsageNameEditPart.VISUAL_ID:
+ case UsageName2EditPart.VISUAL_ID:
+ if (UsageEditPart.VISUAL_ID != UMLVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ case DependencyNameEditPart.VISUAL_ID:
+ case DependencyName2EditPart.VISUAL_ID:
+ if (DependencyEditPart.VISUAL_ID != UMLVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ case DependencyName3EditPart.VISUAL_ID:
+ case DependencyName4EditPart.VISUAL_ID:
+ if (Dependency3EditPart.VISUAL_ID != UMLVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ case ElementImportAliasEditPart.VISUAL_ID:
+ case ElementImportAlias2EditPart.VISUAL_ID:
+ if (ElementImportEditPart.VISUAL_ID != UMLVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ case PackageImportVisibilityEditPart.VISUAL_ID:
+ if (PackageImportEditPart.VISUAL_ID != UMLVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ case WrappingLabelEditPart.VISUAL_ID:
+ if (TemplateBindingEditPart.VISUAL_ID != UMLVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ default:
+ return null;
+ }
+ }
+ }
+ return getNodeViewClass(containerView, visualID);
+ }
+
+ /**
+ * @generated
+ */
+ protected Class getNodeViewClass(View containerView, int visualID) {
+ if (containerView == null || !UMLVisualIDRegistry.canCreateNode(containerView, visualID)) {
+ return null;
+ }
+ switch (visualID) {
+ case Dependency2EditPart.VISUAL_ID:
+ return Dependency2ViewFactory.class;
+ case AssociationClassEditPart.VISUAL_ID:
+ return AssociationClassViewFactory.class;
+ case AssociationClassNameEditPart.VISUAL_ID:
+ return AssociationClassNameViewFactory.class;
+ case AssociationClassName2EditPart.VISUAL_ID:
+ return AssociationClassName2ViewFactory.class;
+ case AssociationClassQualifiedNameEditPart.VISUAL_ID:
+ return AssociationClassQualifiedNameViewFactory.class;
+ case Association2EditPart.VISUAL_ID:
+ return Association2ViewFactory.class;
+ case InstanceSpecificationEditPart.VISUAL_ID:
+ return InstanceSpecificationViewFactory.class;
+ case InstanceSpecificationNameEditPart.VISUAL_ID:
+ return InstanceSpecificationNameViewFactory.class;
+ case InstanceSpecificationName2EditPart.VISUAL_ID:
+ return InstanceSpecificationName2ViewFactory.class;
+ case InstanceSpecificationQualifiedNameEditPart.VISUAL_ID:
+ return InstanceSpecificationQualifiedNameViewFactory.class;
+ case ComponentEditPart.VISUAL_ID:
+ return ComponentViewFactory.class;
+ case ComponentNameEditPart.VISUAL_ID:
+ return ComponentNameViewFactory.class;
+ case ComponentName2EditPart.VISUAL_ID:
+ return ComponentName2ViewFactory.class;
+ case ComponentQualifiedNameEditPart.VISUAL_ID:
+ return ComponentQualifiedNameViewFactory.class;
+ case SignalEditPart.VISUAL_ID:
+ return SignalViewFactory.class;
+ case SignalNameEditPart.VISUAL_ID:
+ return SignalNameViewFactory.class;
+ case SignalName2EditPart.VISUAL_ID:
+ return SignalName2ViewFactory.class;
+ case SignalQualifiedNameEditPart.VISUAL_ID:
+ return SignalQualifiedNameViewFactory.class;
+ case InterfaceEditPart.VISUAL_ID:
+ return InterfaceViewFactory.class;
+ case InterfaceNameEditPart.VISUAL_ID:
+ return InterfaceNameViewFactory.class;
+ case InterfaceName2EditPart.VISUAL_ID:
+ return InterfaceName2ViewFactory.class;
+ case InterfaceQualifiedNameEditPart.VISUAL_ID:
+ return InterfaceQualifiedNameViewFactory.class;
+ case Model2EditPart.VISUAL_ID:
+ return Model2ViewFactory.class;
+ case ModelNameEditPart.VISUAL_ID:
+ return ModelNameViewFactory.class;
+ case ModelName2EditPart.VISUAL_ID:
+ return ModelName2ViewFactory.class;
+ case ModelQualifiedNameEditPart.VISUAL_ID:
+ return ModelQualifiedNameViewFactory.class;
+ case EnumerationEditPart.VISUAL_ID:
+ return EnumerationViewFactory.class;
+ case EnumerationNameEditPart.VISUAL_ID:
+ return EnumerationNameViewFactory.class;
+ case EnumerationName2EditPart.VISUAL_ID:
+ return EnumerationName2ViewFactory.class;
+ case EnumerationQualifiedNameEditPart.VISUAL_ID:
+ return EnumerationQualifiedNameViewFactory.class;
+ case PackageEditPart.VISUAL_ID:
+ return PackageViewFactory.class;
+ case PackageNameEditPart.VISUAL_ID:
+ return PackageNameViewFactory.class;
+ case PackageName2EditPart.VISUAL_ID:
+ return PackageName2ViewFactory.class;
+ case PackageQualifiedNameEditPart.VISUAL_ID:
+ return PackageQualifiedNameViewFactory.class;
+ case ClassEditPart.VISUAL_ID:
+ return ClassViewFactory.class;
+ case ClassNameEditPart.VISUAL_ID:
+ return ClassNameViewFactory.class;
+ case ClassName2EditPart.VISUAL_ID:
+ return ClassName2ViewFactory.class;
+ case ClassQualifiedNameEditPart.VISUAL_ID:
+ return ClassQualifiedNameViewFactory.class;
+ case PrimitiveTypeEditPart.VISUAL_ID:
+ return PrimitiveTypeViewFactory.class;
+ case PrimitiveTypeNameEditPart.VISUAL_ID:
+ return PrimitiveTypeNameViewFactory.class;
+ case PrimitiveTypeName2EditPart.VISUAL_ID:
+ return PrimitiveTypeName2ViewFactory.class;
+ case PrimitiveTypeQualifiedNameEditPart.VISUAL_ID:
+ return PrimitiveTypeQualifiedNameViewFactory.class;
+ case DataTypeEditPart.VISUAL_ID:
+ return DataTypeViewFactory.class;
+ case DataTypeNameEditPart.VISUAL_ID:
+ return DataTypeNameViewFactory.class;
+ case DataTypeName2EditPart.VISUAL_ID:
+ return DataTypeName2ViewFactory.class;
+ case DataTypeQualifiedNameEditPart.VISUAL_ID:
+ return DataTypeQualifiedNameViewFactory.class;
+ case ConstraintEditPart.VISUAL_ID:
+ return ConstraintViewFactory.class;
+ case ConstraintNameEditPart.VISUAL_ID:
+ return ConstraintNameViewFactory.class;
+ case CommentEditPart.VISUAL_ID:
+ return CommentViewFactory.class;
+ case CommentBodyEditPart.VISUAL_ID:
+ return CommentBodyViewFactory.class;
+ case PropertyEditPart.VISUAL_ID:
+ return PropertyViewFactory.class;
+ case SlotEditPart.VISUAL_ID:
+ return SlotViewFactory.class;
+ case OperationEditPart.VISUAL_ID:
+ return OperationViewFactory.class;
+ case Class2EditPart.VISUAL_ID:
+ return Class2ViewFactory.class;
+ case RedefinableTemplateSignatureEditPart.VISUAL_ID:
+ return RedefinableTemplateSignatureViewFactory.class;
+ case TemplateParameterEditPart.VISUAL_ID:
+ return TemplateParameterViewFactory.class;
+ case Property2EditPart.VISUAL_ID:
+ return Property2ViewFactory.class;
+ case Property3EditPart.VISUAL_ID:
+ return Property3ViewFactory.class;
+ case Operation2EditPart.VISUAL_ID:
+ return Operation2ViewFactory.class;
+ case Class3EditPart.VISUAL_ID:
+ return Class3ViewFactory.class;
+ case InstanceSpecification2EditPart.VISUAL_ID:
+ return InstanceSpecification2ViewFactory.class;
+ case InstanceSpecificationName3EditPart.VISUAL_ID:
+ return InstanceSpecificationName3ViewFactory.class;
+ case InstanceSpecificationName4EditPart.VISUAL_ID:
+ return InstanceSpecificationName4ViewFactory.class;
+ case InstanceSpecificationQualifiedName2EditPart.VISUAL_ID:
+ return InstanceSpecificationQualifiedName2ViewFactory.class;
+ case Component2EditPart.VISUAL_ID:
+ return Component2ViewFactory.class;
+ case ComponentName3EditPart.VISUAL_ID:
+ return ComponentName3ViewFactory.class;
+ case ComponentName4EditPart.VISUAL_ID:
+ return ComponentName4ViewFactory.class;
+ case ComponentQualifiedName2EditPart.VISUAL_ID:
+ return ComponentQualifiedName2ViewFactory.class;
+ case Signal2EditPart.VISUAL_ID:
+ return Signal2ViewFactory.class;
+ case SignalName3EditPart.VISUAL_ID:
+ return SignalName3ViewFactory.class;
+ case SignalName4EditPart.VISUAL_ID:
+ return SignalName4ViewFactory.class;
+ case SignalQualifiedName2EditPart.VISUAL_ID:
+ return SignalQualifiedName2ViewFactory.class;
+ case Interface2EditPart.VISUAL_ID:
+ return Interface2ViewFactory.class;
+ case InterfaceName3EditPart.VISUAL_ID:
+ return InterfaceName3ViewFactory.class;
+ case InterfaceName4EditPart.VISUAL_ID:
+ return InterfaceName4ViewFactory.class;
+ case InterfaceQualifiedName2EditPart.VISUAL_ID:
+ return InterfaceQualifiedName2ViewFactory.class;
+ case Model3EditPart.VISUAL_ID:
+ return Model3ViewFactory.class;
+ case ModelName3EditPart.VISUAL_ID:
+ return ModelName3ViewFactory.class;
+ case ModelName4EditPart.VISUAL_ID:
+ return ModelName4ViewFactory.class;
+ case ModelQualifiedName2EditPart.VISUAL_ID:
+ return ModelQualifiedName2ViewFactory.class;
+ case Enumeration2EditPart.VISUAL_ID:
+ return Enumeration2ViewFactory.class;
+ case EnumerationName3EditPart.VISUAL_ID:
+ return EnumerationName3ViewFactory.class;
+ case EnumerationName4EditPart.VISUAL_ID:
+ return EnumerationName4ViewFactory.class;
+ case EnumerationQualifiedName2EditPart.VISUAL_ID:
+ return EnumerationQualifiedName2ViewFactory.class;
+ case EnumerationLiteralEditPart.VISUAL_ID:
+ return EnumerationLiteralViewFactory.class;
+ case Package2EditPart.VISUAL_ID:
+ return Package2ViewFactory.class;
+ case PackageName3EditPart.VISUAL_ID:
+ return PackageName3ViewFactory.class;
+ case PackageName4EditPart.VISUAL_ID:
+ return PackageName4ViewFactory.class;
+ case PackageQualifiedName2EditPart.VISUAL_ID:
+ return PackageQualifiedName2ViewFactory.class;
+ case Class4EditPart.VISUAL_ID:
+ return Class4ViewFactory.class;
+ case ClassName3EditPart.VISUAL_ID:
+ return ClassName3ViewFactory.class;
+ case ClassName4EditPart.VISUAL_ID:
+ return ClassName4ViewFactory.class;
+ case ClassQualifiedName2EditPart.VISUAL_ID:
+ return ClassQualifiedName2ViewFactory.class;
+ case ReceptionEditPart.VISUAL_ID:
+ return ReceptionViewFactory.class;
+ case Property4EditPart.VISUAL_ID:
+ return Property4ViewFactory.class;
+ case Operation3EditPart.VISUAL_ID:
+ return Operation3ViewFactory.class;
+ case Class5EditPart.VISUAL_ID:
+ return Class5ViewFactory.class;
+ case PrimitiveType2EditPart.VISUAL_ID:
+ return PrimitiveType2ViewFactory.class;
+ case PrimitiveTypeName3EditPart.VISUAL_ID:
+ return PrimitiveTypeName3ViewFactory.class;
+ case PrimitiveTypeName4EditPart.VISUAL_ID:
+ return PrimitiveTypeName4ViewFactory.class;
+ case PrimitiveTypeQualifiedName2EditPart.VISUAL_ID:
+ return PrimitiveTypeQualifiedName2ViewFactory.class;
+ case DataType2EditPart.VISUAL_ID:
+ return DataType2ViewFactory.class;
+ case DataTypeName3EditPart.VISUAL_ID:
+ return DataTypeName3ViewFactory.class;
+ case DataTypeName4EditPart.VISUAL_ID:
+ return DataTypeName4ViewFactory.class;
+ case DataTypeQualifiedName2EditPart.VISUAL_ID:
+ return DataTypeQualifiedName2ViewFactory.class;
+ case Property5EditPart.VISUAL_ID:
+ return Property5ViewFactory.class;
+ case Operation4EditPart.VISUAL_ID:
+ return Operation4ViewFactory.class;
+ case Comment2EditPart.VISUAL_ID:
+ return Comment2ViewFactory.class;
+ case CommentBody2EditPart.VISUAL_ID:
+ return CommentBody2ViewFactory.class;
+ case Constraint2EditPart.VISUAL_ID:
+ return Constraint2ViewFactory.class;
+ case ConstraintName2EditPart.VISUAL_ID:
+ return ConstraintName2ViewFactory.class;
+ case AssociationClassAttributeCompartmentEditPart.VISUAL_ID:
+ return AssociationClassAttributeCompartmentViewFactory.class;
+ case InstanceSpecificationSlotCompartmentEditPart.VISUAL_ID:
+ return InstanceSpecificationSlotCompartmentViewFactory.class;
+ case ComponentAttributeCompartmentEditPart.VISUAL_ID:
+ return ComponentAttributeCompartmentViewFactory.class;
+ case ComponentOperationCompartmentEditPart.VISUAL_ID:
+ return ComponentOperationCompartmentViewFactory.class;
+ case ComponentNestedClassifierCompartmentEditPart.VISUAL_ID:
+ return ComponentNestedClassifierCompartmentViewFactory.class;
+ case RedefinableTemplateSignatureTemplateParameterCompartmentEditPart.VISUAL_ID:
+ return RedefinableTemplateSignatureTemplateParameterCompartmentViewFactory.class;
+ case SignalAttributeCompartmentEditPart.VISUAL_ID:
+ return SignalAttributeCompartmentViewFactory.class;
+ case InterfaceAttributeCompartmentEditPart.VISUAL_ID:
+ return InterfaceAttributeCompartmentViewFactory.class;
+ case InterfaceOperationCompartmentEditPart.VISUAL_ID:
+ return InterfaceOperationCompartmentViewFactory.class;
+ case InterfaceNestedClassifierCompartmentEditPart.VISUAL_ID:
+ return InterfaceNestedClassifierCompartmentViewFactory.class;
+ case ModelPackageableElementCompartmentEditPart.VISUAL_ID:
+ return ModelPackageableElementCompartmentViewFactory.class;
+ case InstanceSpecificationSlotCompartment2EditPart.VISUAL_ID:
+ return InstanceSpecificationSlotCompartment2ViewFactory.class;
+ case ComponentAttributeCompartment2EditPart.VISUAL_ID:
+ return ComponentAttributeCompartment2ViewFactory.class;
+ case ComponentOperationCompartment2EditPart.VISUAL_ID:
+ return ComponentOperationCompartment2ViewFactory.class;
+ case ComponentNestedClassifierCompartment2EditPart.VISUAL_ID:
+ return ComponentNestedClassifierCompartment2ViewFactory.class;
+ case SignalAttributeCompartment2EditPart.VISUAL_ID:
+ return SignalAttributeCompartment2ViewFactory.class;
+ case InterfaceAttributeCompartment2EditPart.VISUAL_ID:
+ return InterfaceAttributeCompartment2ViewFactory.class;
+ case InterfaceOperationCompartment2EditPart.VISUAL_ID:
+ return InterfaceOperationCompartment2ViewFactory.class;
+ case InterfaceNestedClassifierCompartment2EditPart.VISUAL_ID:
+ return InterfaceNestedClassifierCompartment2ViewFactory.class;
+ case ModelPackageableElementCompartment2EditPart.VISUAL_ID:
+ return ModelPackageableElementCompartment2ViewFactory.class;
+ case EnumerationEnumerationLiteralCompartment2EditPart.VISUAL_ID:
+ return EnumerationEnumerationLiteralCompartment2ViewFactory.class;
+ case PackagePackageableElementCompartmentEditPart.VISUAL_ID:
+ return PackagePackageableElementCompartmentViewFactory.class;
+ case ClassAttributeCompartmentEditPart.VISUAL_ID:
+ return ClassAttributeCompartmentViewFactory.class;
+ case ClassOperationCompartmentEditPart.VISUAL_ID:
+ return ClassOperationCompartmentViewFactory.class;
+ case ClassNestedClassifierCompartmentEditPart.VISUAL_ID:
+ return ClassNestedClassifierCompartmentViewFactory.class;
+ case DataTypeAttributeCompartment2EditPart.VISUAL_ID:
+ return DataTypeAttributeCompartment2ViewFactory.class;
+ case DataTypeOperationCompartment2EditPart.VISUAL_ID:
+ return DataTypeOperationCompartment2ViewFactory.class;
+ case EnumerationEnumerationLiteralCompartmentEditPart.VISUAL_ID:
+ return EnumerationEnumerationLiteralCompartmentViewFactory.class;
+ case PackagePackageableElementCompartment2EditPart.VISUAL_ID:
+ return PackagePackageableElementCompartment2ViewFactory.class;
+ case ClassAttributeCompartment2EditPart.VISUAL_ID:
+ return ClassAttributeCompartment2ViewFactory.class;
+ case ClassOperationCompartment2EditPart.VISUAL_ID:
+ return ClassOperationCompartment2ViewFactory.class;
+ case ClassNestedClassifierCompartment2EditPart.VISUAL_ID:
+ return ClassNestedClassifierCompartment2ViewFactory.class;
+ case DataTypeAttributeCompartmentEditPart.VISUAL_ID:
+ return DataTypeAttributeCompartmentViewFactory.class;
+ case DataTypeOperationCompartmentEditPart.VISUAL_ID:
+ return DataTypeOperationCompartmentViewFactory.class;
+ case AssociationNameEditPart.VISUAL_ID:
+ return AssociationNameViewFactory.class;
+ case AssociationName2EditPart.VISUAL_ID:
+ return AssociationName2ViewFactory.class;
+ case AssociationName3EditPart.VISUAL_ID:
+ return AssociationName3ViewFactory.class;
+ case AssociationName4EditPart.VISUAL_ID:
+ return AssociationName4ViewFactory.class;
+ case AssociationName5EditPart.VISUAL_ID:
+ return AssociationName5ViewFactory.class;
+ case AssociationName6EditPart.VISUAL_ID:
+ return AssociationName6ViewFactory.class;
+ case GeneralizationIsSubstitutableEditPart.VISUAL_ID:
+ return GeneralizationIsSubstitutableViewFactory.class;
+ case InterfaceRealizationNameEditPart.VISUAL_ID:
+ return InterfaceRealizationNameViewFactory.class;
+ case InterfaceRealizationName2EditPart.VISUAL_ID:
+ return InterfaceRealizationName2ViewFactory.class;
+ case SubstitutionNameEditPart.VISUAL_ID:
+ return SubstitutionNameViewFactory.class;
+ case SubstitutionName2EditPart.VISUAL_ID:
+ return SubstitutionName2ViewFactory.class;
+ case RealizationNameEditPart.VISUAL_ID:
+ return RealizationNameViewFactory.class;
+ case RealizationName2EditPart.VISUAL_ID:
+ return RealizationName2ViewFactory.class;
+ case AbstractionNameEditPart.VISUAL_ID:
+ return AbstractionNameViewFactory.class;
+ case AbstractionName2EditPart.VISUAL_ID:
+ return AbstractionName2ViewFactory.class;
+ case UsageNameEditPart.VISUAL_ID:
+ return UsageNameViewFactory.class;
+ case UsageName2EditPart.VISUAL_ID:
+ return UsageName2ViewFactory.class;
+ case DependencyNameEditPart.VISUAL_ID:
+ return DependencyNameViewFactory.class;
+ case DependencyName2EditPart.VISUAL_ID:
+ return DependencyName2ViewFactory.class;
+ case DependencyName3EditPart.VISUAL_ID:
+ return DependencyName3ViewFactory.class;
+ case DependencyName4EditPart.VISUAL_ID:
+ return DependencyName4ViewFactory.class;
+ case ElementImportAliasEditPart.VISUAL_ID:
+ return ElementImportAliasViewFactory.class;
+ case ElementImportAlias2EditPart.VISUAL_ID:
+ return ElementImportAlias2ViewFactory.class;
+ case PackageImportVisibilityEditPart.VISUAL_ID:
+ return PackageImportVisibilityViewFactory.class;
+ case WrappingLabelEditPart.VISUAL_ID:
+ return WrappingLabelViewFactory.class;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Class getEdgeViewClass(IAdaptable semanticAdapter, View containerView, String semanticHint) {
+ IElementType elementType = getSemanticElementType(semanticAdapter);
+ if (!UMLElementTypes.isKnownElementType(elementType) || (!(elementType instanceof IHintedType))) {
+ return null; // foreign element type
+ }
+ String elementTypeHint = ((IHintedType) elementType).getSemanticHint();
+ if (elementTypeHint == null) {
+ return null; // our hint is visual id and must be specified
+ }
+ if (semanticHint != null && !semanticHint.equals(elementTypeHint)) {
+ return null; // if semantic hint is specified it should be the same as in element type
+ }
+ int visualID = UMLVisualIDRegistry.getVisualID(elementTypeHint);
+ EObject domainElement = getSemanticElement(semanticAdapter);
+ if (domainElement != null && visualID != UMLVisualIDRegistry.getLinkWithClassVisualID(domainElement)) {
+ return null; // visual id for link EClass should match visual id from element type
+ }
+ return getEdgeViewClass(visualID);
+ }
+
+ /**
+ * @generated
+ */
+ protected Class getEdgeViewClass(int visualID) {
+ switch (visualID) {
+ case CommentLinkDescriptorEditPart.VISUAL_ID:
+ return CommentLinkDescriptorViewFactory.class;
+ case AssociationClass2EditPart.VISUAL_ID:
+ return AssociationClass2ViewFactory.class;
+ case AssociationEditPart.VISUAL_ID:
+ return AssociationViewFactory.class;
+ case Association3EditPart.VISUAL_ID:
+ return Association3ViewFactory.class;
+ case GeneralizationEditPart.VISUAL_ID:
+ return GeneralizationViewFactory.class;
+ case InterfaceRealizationEditPart.VISUAL_ID:
+ return InterfaceRealizationViewFactory.class;
+ case SubstitutionEditPart.VISUAL_ID:
+ return SubstitutionViewFactory.class;
+ case RealizationEditPart.VISUAL_ID:
+ return RealizationViewFactory.class;
+ case AbstractionEditPart.VISUAL_ID:
+ return AbstractionViewFactory.class;
+ case UsageEditPart.VISUAL_ID:
+ return UsageViewFactory.class;
+ case DependencyEditPart.VISUAL_ID:
+ return DependencyViewFactory.class;
+ case Dependency3EditPart.VISUAL_ID:
+ return Dependency3ViewFactory.class;
+ case ElementImportEditPart.VISUAL_ID:
+ return ElementImportViewFactory.class;
+ case PackageImportEditPart.VISUAL_ID:
+ return PackageImportViewFactory.class;
+ case PackageMergeEditPart.VISUAL_ID:
+ return PackageMergeViewFactory.class;
+ case ProfileApplicationEditPart.VISUAL_ID:
+ return ProfileApplicationViewFactory.class;
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return CommentAnnotatedElementViewFactory.class;
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return ConstraintConstrainedElementViewFactory.class;
+ case TemplateBindingEditPart.VISUAL_ID:
+ return TemplateBindingViewFactory.class;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ private IElementType getSemanticElementType(IAdaptable semanticAdapter) {
+ if (semanticAdapter == null) {
+ return null;
+ }
+ return (IElementType) semanticAdapter.getAdapter(IElementType.class);
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/sheet/UMLPropertySection.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/sheet/UMLPropertySection.java
new file mode 100644
index 00000000000..e091aa154c1
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/sheet/UMLPropertySection.java
@@ -0,0 +1,123 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.sheet;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.ui.provider.PropertySource;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.properties.sections.AdvancedPropertySection;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.eclipse.ui.views.properties.IPropertySourceProvider;
+
+/**
+ * @generated
+ */
+public class UMLPropertySection extends AdvancedPropertySection implements IPropertySourceProvider {
+
+ /**
+ * @generated
+ */
+ public IPropertySource getPropertySource(Object object) {
+ if (object instanceof IPropertySource) {
+ return (IPropertySource) object;
+ }
+ AdapterFactory af = getAdapterFactory(object);
+ if (af != null) {
+ IItemPropertySource ips = (IItemPropertySource) af.adapt(object, IItemPropertySource.class);
+ if (ips != null) {
+ return new PropertySource(object, ips);
+ }
+ }
+ if (object instanceof IAdaptable) {
+ return (IPropertySource) ((IAdaptable) object).getAdapter(IPropertySource.class);
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected IPropertySourceProvider getPropertySourceProvider() {
+ return this;
+ }
+
+ /**
+ * Modify/unwrap selection.
+ *
+ * @generated
+ */
+ protected Object transformSelection(Object selected) {
+
+ if (selected instanceof EditPart) {
+ Object model = ((EditPart) selected).getModel();
+ return model instanceof View ? ((View) model).getElement() : null;
+ }
+ if (selected instanceof View) {
+ return ((View) selected).getElement();
+ }
+ if (selected instanceof IAdaptable) {
+ View view = (View) ((IAdaptable) selected).getAdapter(View.class);
+ if (view != null) {
+ return view.getElement();
+ }
+ }
+ return selected;
+ }
+
+ /**
+ * @generated
+ */
+ public void setInput(IWorkbenchPart part, ISelection selection) {
+ if (selection.isEmpty() || false == selection instanceof StructuredSelection) {
+ super.setInput(part, selection);
+ return;
+ }
+ final StructuredSelection structuredSelection = ((StructuredSelection) selection);
+ ArrayList transformedSelection = new ArrayList(structuredSelection.size());
+ for (Iterator it = structuredSelection.iterator(); it.hasNext();) {
+ Object r = transformSelection(it.next());
+ if (r != null) {
+ transformedSelection.add(r);
+ }
+ }
+ super.setInput(part, new StructuredSelection(transformedSelection));
+ }
+
+ /**
+ * @generated
+ */
+ protected AdapterFactory getAdapterFactory(Object object) {
+ if (getEditingDomain() instanceof AdapterFactoryEditingDomain) {
+ return ((AdapterFactoryEditingDomain) getEditingDomain()).getAdapterFactory();
+ }
+ TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(object);
+ if (editingDomain != null) {
+ return ((AdapterFactoryEditingDomain) editingDomain).getAdapterFactory();
+ }
+ return null;
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/sheet/UMLSheetLabelProvider.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/sheet/UMLSheetLabelProvider.java
new file mode 100644
index 00000000000..95c4071bb98
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/sheet/UMLSheetLabelProvider.java
@@ -0,0 +1,92 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.sheet;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.viewers.DecoratingLabelProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.diagram.clazz.navigator.UMLNavigatorGroup;
+import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class UMLSheetLabelProvider extends DecoratingLabelProvider {
+
+ /**
+ * @generated
+ */
+ public UMLSheetLabelProvider() {
+ super(new AdapterFactoryLabelProvider(UMLDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory()), null);
+ }
+
+ /**
+ * @generated
+ */
+ public String getText(Object element) {
+ Object selected = unwrap(element);
+ if (selected instanceof UMLNavigatorGroup) {
+ return ((UMLNavigatorGroup) selected).getGroupName();
+ }
+ return super.getText(selected);
+ }
+
+ /**
+ * @generated
+ */
+ public Image getImage(Object element) {
+ return super.getImage(unwrap(element));
+ }
+
+ /**
+ * @generated
+ */
+ private Object unwrap(Object element) {
+ if (element instanceof IStructuredSelection) {
+ return unwrap(((IStructuredSelection) element).getFirstElement());
+ }
+ if (element instanceof EditPart) {
+ return unwrapEditPart((EditPart) element);
+ }
+ if (element instanceof IAdaptable) {
+ View view = (View) ((IAdaptable) element).getAdapter(View.class);
+ if (view != null) {
+ return unwrapView(view);
+ }
+ }
+ return element;
+ }
+
+ /**
+ * @generated
+ */
+ private Object unwrapEditPart(EditPart p) {
+ if (p.getModel() instanceof View) {
+ return unwrapView((View) p.getModel());
+ }
+ return p.getModel();
+ }
+
+ /**
+ * @generated
+ */
+ private Object unwrapView(View view) {
+ return view.getElement() == null ? view : view.getElement();
+ }
+
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AbstractionName2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AbstractionName2ViewFactory.java
new file mode 100644
index 00000000000..6b3ac2b71bd
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AbstractionName2ViewFactory.java
@@ -0,0 +1,52 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
+import org.eclipse.gmf.runtime.notation.Location;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class AbstractionName2ViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ public View createView(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Node view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
+ Location location = (Location) view.getLayoutConstraint();
+ IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView.getDiagram().getMeasurementUnit());
+ location.setX(mapMode.DPtoLP(0));
+ location.setY(mapMode.DPtoLP(60));
+ return view;
+ }
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AbstractionNameViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AbstractionNameViewFactory.java
new file mode 100644
index 00000000000..ae879e36349
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AbstractionNameViewFactory.java
@@ -0,0 +1,52 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
+import org.eclipse.gmf.runtime.notation.Location;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class AbstractionNameViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ public View createView(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Node view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
+ Location location = (Location) view.getLayoutConstraint();
+ IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView.getDiagram().getMeasurementUnit());
+ location.setX(mapMode.DPtoLP(0));
+ location.setY(mapMode.DPtoLP(40));
+ return view;
+ }
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AbstractionViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AbstractionViewFactory.java
new file mode 100644
index 00000000000..c3bd1114558
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AbstractionViewFactory.java
@@ -0,0 +1,63 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.ConnectionViewFactory;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AbstractionNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class AbstractionViewFactory extends ConnectionViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createRoutingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFontStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(AbstractionEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(AbstractionNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(AbstractionName2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Association2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Association2ViewFactory.java
new file mode 100644
index 00000000000..7e25095ec8b
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Association2ViewFactory.java
@@ -0,0 +1,51 @@
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
+import org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Association2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class Association2ViewFactory extends AbstractShapeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createShapeStyle());
+ {
+ HintedDiagramLinkStyle diagramFacet = NotationFactory.eINSTANCE.createHintedDiagramLinkStyle();
+ styles.add(diagramFacet);
+ }
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(Association2EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ if (!ModelEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
+ EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
+ shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
+ shortcutAnnotation.getDetails().put("modelID", ModelEditPart.MODEL_ID); //$NON-NLS-1$
+ view.getEAnnotations().add(shortcutAnnotation);
+ }
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Association3ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Association3ViewFactory.java
new file mode 100644
index 00000000000..8e72d928f46
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Association3ViewFactory.java
@@ -0,0 +1,38 @@
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.ConnectionViewFactory;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Association3EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class Association3ViewFactory extends ConnectionViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createRoutingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFontStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(Association3EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationClass2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationClass2ViewFactory.java
new file mode 100644
index 00000000000..b814783cec0
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationClass2ViewFactory.java
@@ -0,0 +1,51 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.ConnectionViewFactory;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationClass2EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class AssociationClass2ViewFactory extends ConnectionViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createRoutingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFontStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(AssociationClass2EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationClassAttributeCompartmentViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationClassAttributeCompartmentViewFactory.java
new file mode 100644
index 00000000000..c65fd0491d8
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationClassAttributeCompartmentViewFactory.java
@@ -0,0 +1,77 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.DrawerStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.TitleStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationClassAttributeCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class AssociationClassAttributeCompartmentViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createDrawerStyle());
+ styles.add(NotationFactory.eINSTANCE.createSortingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFilteringStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(AssociationClassAttributeCompartmentEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ setupCompartmentTitle(view);
+ setupCompartmentCollapsed(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentTitle(View view) {
+ TitleStyle titleStyle = (TitleStyle) view.getStyle(NotationPackage.eINSTANCE.getTitleStyle());
+ if (titleStyle != null) {
+ titleStyle.setShowTitle(true);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentCollapsed(View view) {
+ DrawerStyle drawerStyle = (DrawerStyle) view.getStyle(NotationPackage.eINSTANCE.getDrawerStyle());
+ if (drawerStyle != null) {
+ drawerStyle.setCollapsed(false);
+ }
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationClassName2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationClassName2ViewFactory.java
new file mode 100644
index 00000000000..95dbd5b3cc5
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationClassName2ViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class AssociationClassName2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationClassNameViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationClassNameViewFactory.java
new file mode 100644
index 00000000000..9e656336333
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationClassNameViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class AssociationClassNameViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationClassQualifiedNameViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationClassQualifiedNameViewFactory.java
new file mode 100644
index 00000000000..991b09d607b
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationClassQualifiedNameViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class AssociationClassQualifiedNameViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationClassViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationClassViewFactory.java
new file mode 100644
index 00000000000..543c7261079
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationClassViewFactory.java
@@ -0,0 +1,80 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationClassAttributeCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationClassEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationClassName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationClassNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationClassQualifiedNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class AssociationClassViewFactory extends AbstractShapeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createShapeStyle());
+ {
+ HintedDiagramLinkStyle diagramFacet = NotationFactory.eINSTANCE.createHintedDiagramLinkStyle();
+ styles.add(diagramFacet);
+ }
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(AssociationClassEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ if (!ModelEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
+ EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
+ shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
+ shortcutAnnotation.getDetails().put("modelID", ModelEditPart.MODEL_ID); //$NON-NLS-1$
+ view.getEAnnotations().add(shortcutAnnotation);
+ }
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(AssociationClassNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(AssociationClassName2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(AssociationClassQualifiedNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(AssociationClassAttributeCompartmentEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationName2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationName2ViewFactory.java
new file mode 100644
index 00000000000..8b5c4f913a4
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationName2ViewFactory.java
@@ -0,0 +1,52 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
+import org.eclipse.gmf.runtime.notation.Location;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class AssociationName2ViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ public View createView(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Node view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
+ Location location = (Location) view.getLayoutConstraint();
+ IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView.getDiagram().getMeasurementUnit());
+ location.setX(mapMode.DPtoLP(0));
+ location.setY(mapMode.DPtoLP(60));
+ return view;
+ }
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationName3ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationName3ViewFactory.java
new file mode 100644
index 00000000000..e5c723d18b2
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationName3ViewFactory.java
@@ -0,0 +1,52 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
+import org.eclipse.gmf.runtime.notation.Location;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class AssociationName3ViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ public View createView(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Node view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
+ Location location = (Location) view.getLayoutConstraint();
+ IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView.getDiagram().getMeasurementUnit());
+ location.setX(mapMode.DPtoLP(0));
+ location.setY(mapMode.DPtoLP(80));
+ return view;
+ }
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationName4ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationName4ViewFactory.java
new file mode 100644
index 00000000000..5d042af3e22
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationName4ViewFactory.java
@@ -0,0 +1,52 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
+import org.eclipse.gmf.runtime.notation.Location;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class AssociationName4ViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ public View createView(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Node view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
+ Location location = (Location) view.getLayoutConstraint();
+ IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView.getDiagram().getMeasurementUnit());
+ location.setX(mapMode.DPtoLP(0));
+ location.setY(mapMode.DPtoLP(100));
+ return view;
+ }
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationName5ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationName5ViewFactory.java
new file mode 100644
index 00000000000..36add675bdc
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationName5ViewFactory.java
@@ -0,0 +1,52 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
+import org.eclipse.gmf.runtime.notation.Location;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class AssociationName5ViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ public View createView(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Node view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
+ Location location = (Location) view.getLayoutConstraint();
+ IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView.getDiagram().getMeasurementUnit());
+ location.setX(mapMode.DPtoLP(0));
+ location.setY(mapMode.DPtoLP(120));
+ return view;
+ }
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationName6ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationName6ViewFactory.java
new file mode 100644
index 00000000000..d16df1dcf3a
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationName6ViewFactory.java
@@ -0,0 +1,52 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
+import org.eclipse.gmf.runtime.notation.Location;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class AssociationName6ViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ public View createView(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Node view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
+ Location location = (Location) view.getLayoutConstraint();
+ IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView.getDiagram().getMeasurementUnit());
+ location.setX(mapMode.DPtoLP(0));
+ location.setY(mapMode.DPtoLP(140));
+ return view;
+ }
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationNameViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationNameViewFactory.java
new file mode 100644
index 00000000000..6d9350bd041
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationNameViewFactory.java
@@ -0,0 +1,52 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
+import org.eclipse.gmf.runtime.notation.Location;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class AssociationNameViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ public View createView(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Node view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
+ Location location = (Location) view.getLayoutConstraint();
+ IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView.getDiagram().getMeasurementUnit());
+ location.setX(mapMode.DPtoLP(0));
+ location.setY(mapMode.DPtoLP(40));
+ return view;
+ }
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationViewFactory.java
new file mode 100644
index 00000000000..33847855ddf
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/AssociationViewFactory.java
@@ -0,0 +1,71 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.ConnectionViewFactory;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationName3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationName4EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationName5EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationName6EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class AssociationViewFactory extends ConnectionViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createRoutingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFontStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(AssociationEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(AssociationNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(AssociationName2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(AssociationName3EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(AssociationName4EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(AssociationName5EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(AssociationName6EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Class2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Class2ViewFactory.java
new file mode 100644
index 00000000000..cb733f6babb
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Class2ViewFactory.java
@@ -0,0 +1,48 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Class2EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class Class2ViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(Class2EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Class3ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Class3ViewFactory.java
new file mode 100644
index 00000000000..018f1ec3720
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Class3ViewFactory.java
@@ -0,0 +1,48 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Class3EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class Class3ViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(Class3EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Class4ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Class4ViewFactory.java
new file mode 100644
index 00000000000..ae5bf30ceba
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Class4ViewFactory.java
@@ -0,0 +1,75 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Class4EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassAttributeCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassName3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassName4EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassNestedClassifierCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassOperationCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassQualifiedName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class Class4ViewFactory extends AbstractShapeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createShapeStyle());
+ {
+ HintedDiagramLinkStyle diagramFacet = NotationFactory.eINSTANCE.createHintedDiagramLinkStyle();
+ styles.add(diagramFacet);
+ }
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(Class4EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(ClassName3EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(ClassName4EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(ClassQualifiedName2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(ClassAttributeCompartmentEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(ClassOperationCompartmentEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(ClassNestedClassifierCompartmentEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Class5ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Class5ViewFactory.java
new file mode 100644
index 00000000000..41d93a88d6d
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Class5ViewFactory.java
@@ -0,0 +1,48 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Class5EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class Class5ViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(Class5EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassAttributeCompartment2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassAttributeCompartment2ViewFactory.java
new file mode 100644
index 00000000000..691790594f4
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassAttributeCompartment2ViewFactory.java
@@ -0,0 +1,77 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.DrawerStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.TitleStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassAttributeCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class ClassAttributeCompartment2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createDrawerStyle());
+ styles.add(NotationFactory.eINSTANCE.createSortingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFilteringStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(ClassAttributeCompartment2EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ setupCompartmentTitle(view);
+ setupCompartmentCollapsed(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentTitle(View view) {
+ TitleStyle titleStyle = (TitleStyle) view.getStyle(NotationPackage.eINSTANCE.getTitleStyle());
+ if (titleStyle != null) {
+ titleStyle.setShowTitle(true);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentCollapsed(View view) {
+ DrawerStyle drawerStyle = (DrawerStyle) view.getStyle(NotationPackage.eINSTANCE.getDrawerStyle());
+ if (drawerStyle != null) {
+ drawerStyle.setCollapsed(false);
+ }
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassAttributeCompartmentViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassAttributeCompartmentViewFactory.java
new file mode 100644
index 00000000000..0c9f8ab125f
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassAttributeCompartmentViewFactory.java
@@ -0,0 +1,77 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.DrawerStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.TitleStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassAttributeCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class ClassAttributeCompartmentViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createDrawerStyle());
+ styles.add(NotationFactory.eINSTANCE.createSortingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFilteringStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(ClassAttributeCompartmentEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ setupCompartmentTitle(view);
+ setupCompartmentCollapsed(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentTitle(View view) {
+ TitleStyle titleStyle = (TitleStyle) view.getStyle(NotationPackage.eINSTANCE.getTitleStyle());
+ if (titleStyle != null) {
+ titleStyle.setShowTitle(true);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentCollapsed(View view) {
+ DrawerStyle drawerStyle = (DrawerStyle) view.getStyle(NotationPackage.eINSTANCE.getDrawerStyle());
+ if (drawerStyle != null) {
+ drawerStyle.setCollapsed(false);
+ }
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassName2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassName2ViewFactory.java
new file mode 100644
index 00000000000..372e439e25c
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassName2ViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class ClassName2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassName3ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassName3ViewFactory.java
new file mode 100644
index 00000000000..ee58ed89af9
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassName3ViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class ClassName3ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassName4ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassName4ViewFactory.java
new file mode 100644
index 00000000000..32ac36f0eea
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassName4ViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class ClassName4ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassNameViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassNameViewFactory.java
new file mode 100644
index 00000000000..2ee51472564
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassNameViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class ClassNameViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassNestedClassifierCompartment2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassNestedClassifierCompartment2ViewFactory.java
new file mode 100644
index 00000000000..8a7e7f4afbb
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassNestedClassifierCompartment2ViewFactory.java
@@ -0,0 +1,77 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.DrawerStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.TitleStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassNestedClassifierCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class ClassNestedClassifierCompartment2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createDrawerStyle());
+ styles.add(NotationFactory.eINSTANCE.createSortingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFilteringStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(ClassNestedClassifierCompartment2EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ setupCompartmentTitle(view);
+ setupCompartmentCollapsed(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentTitle(View view) {
+ TitleStyle titleStyle = (TitleStyle) view.getStyle(NotationPackage.eINSTANCE.getTitleStyle());
+ if (titleStyle != null) {
+ titleStyle.setShowTitle(true);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentCollapsed(View view) {
+ DrawerStyle drawerStyle = (DrawerStyle) view.getStyle(NotationPackage.eINSTANCE.getDrawerStyle());
+ if (drawerStyle != null) {
+ drawerStyle.setCollapsed(false);
+ }
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassNestedClassifierCompartmentViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassNestedClassifierCompartmentViewFactory.java
new file mode 100644
index 00000000000..eb73f0a9563
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassNestedClassifierCompartmentViewFactory.java
@@ -0,0 +1,77 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.DrawerStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.TitleStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassNestedClassifierCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class ClassNestedClassifierCompartmentViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createDrawerStyle());
+ styles.add(NotationFactory.eINSTANCE.createSortingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFilteringStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(ClassNestedClassifierCompartmentEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ setupCompartmentTitle(view);
+ setupCompartmentCollapsed(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentTitle(View view) {
+ TitleStyle titleStyle = (TitleStyle) view.getStyle(NotationPackage.eINSTANCE.getTitleStyle());
+ if (titleStyle != null) {
+ titleStyle.setShowTitle(true);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentCollapsed(View view) {
+ DrawerStyle drawerStyle = (DrawerStyle) view.getStyle(NotationPackage.eINSTANCE.getDrawerStyle());
+ if (drawerStyle != null) {
+ drawerStyle.setCollapsed(false);
+ }
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassOperationCompartment2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassOperationCompartment2ViewFactory.java
new file mode 100644
index 00000000000..dccd950491b
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassOperationCompartment2ViewFactory.java
@@ -0,0 +1,77 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.DrawerStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.TitleStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassOperationCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class ClassOperationCompartment2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createDrawerStyle());
+ styles.add(NotationFactory.eINSTANCE.createSortingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFilteringStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(ClassOperationCompartment2EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ setupCompartmentTitle(view);
+ setupCompartmentCollapsed(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentTitle(View view) {
+ TitleStyle titleStyle = (TitleStyle) view.getStyle(NotationPackage.eINSTANCE.getTitleStyle());
+ if (titleStyle != null) {
+ titleStyle.setShowTitle(true);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentCollapsed(View view) {
+ DrawerStyle drawerStyle = (DrawerStyle) view.getStyle(NotationPackage.eINSTANCE.getDrawerStyle());
+ if (drawerStyle != null) {
+ drawerStyle.setCollapsed(false);
+ }
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassOperationCompartmentViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassOperationCompartmentViewFactory.java
new file mode 100644
index 00000000000..736f125939a
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassOperationCompartmentViewFactory.java
@@ -0,0 +1,77 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.DrawerStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.TitleStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassOperationCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class ClassOperationCompartmentViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createDrawerStyle());
+ styles.add(NotationFactory.eINSTANCE.createSortingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFilteringStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(ClassOperationCompartmentEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ setupCompartmentTitle(view);
+ setupCompartmentCollapsed(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentTitle(View view) {
+ TitleStyle titleStyle = (TitleStyle) view.getStyle(NotationPackage.eINSTANCE.getTitleStyle());
+ if (titleStyle != null) {
+ titleStyle.setShowTitle(true);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentCollapsed(View view) {
+ DrawerStyle drawerStyle = (DrawerStyle) view.getStyle(NotationPackage.eINSTANCE.getDrawerStyle());
+ if (drawerStyle != null) {
+ drawerStyle.setCollapsed(false);
+ }
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassQualifiedName2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassQualifiedName2ViewFactory.java
new file mode 100644
index 00000000000..2b3d2c557ee
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassQualifiedName2ViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class ClassQualifiedName2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassQualifiedNameViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassQualifiedNameViewFactory.java
new file mode 100644
index 00000000000..9daa8587d4b
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassQualifiedNameViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class ClassQualifiedNameViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassViewFactory.java
new file mode 100644
index 00000000000..869f3663687
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassViewFactory.java
@@ -0,0 +1,84 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassAttributeCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassNestedClassifierCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassOperationCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassQualifiedNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class ClassViewFactory extends AbstractShapeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createShapeStyle());
+ {
+ HintedDiagramLinkStyle diagramFacet = NotationFactory.eINSTANCE.createHintedDiagramLinkStyle();
+ styles.add(diagramFacet);
+ }
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(ClassEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ if (!ModelEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
+ EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
+ shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
+ shortcutAnnotation.getDetails().put("modelID", ModelEditPart.MODEL_ID); //$NON-NLS-1$
+ view.getEAnnotations().add(shortcutAnnotation);
+ }
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(ClassNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(ClassName2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(ClassQualifiedNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(ClassAttributeCompartment2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(ClassOperationCompartment2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(ClassNestedClassifierCompartment2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Comment2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Comment2ViewFactory.java
new file mode 100644
index 00000000000..9695b0f36ae
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Comment2ViewFactory.java
@@ -0,0 +1,65 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Comment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentBody2EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class Comment2ViewFactory extends AbstractShapeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createShapeStyle());
+ {
+ HintedDiagramLinkStyle diagramFacet = NotationFactory.eINSTANCE.createHintedDiagramLinkStyle();
+ styles.add(diagramFacet);
+ }
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(Comment2EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(CommentBody2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/CommentAnnotatedElementViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/CommentAnnotatedElementViewFactory.java
new file mode 100644
index 00000000000..0e6b9b40814
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/CommentAnnotatedElementViewFactory.java
@@ -0,0 +1,51 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.ConnectionViewFactory;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class CommentAnnotatedElementViewFactory extends ConnectionViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createConnectorStyle());
+ styles.add(NotationFactory.eINSTANCE.createFontStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(CommentAnnotatedElementEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/CommentBody2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/CommentBody2ViewFactory.java
new file mode 100644
index 00000000000..5b38333f1ab
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/CommentBody2ViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class CommentBody2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/CommentBodyViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/CommentBodyViewFactory.java
new file mode 100644
index 00000000000..198e2b7c461
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/CommentBodyViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class CommentBodyViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/CommentLinkDescriptorViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/CommentLinkDescriptorViewFactory.java
new file mode 100644
index 00000000000..0a0c49031df
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/CommentLinkDescriptorViewFactory.java
@@ -0,0 +1,51 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.ConnectionViewFactory;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentLinkDescriptorEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class CommentLinkDescriptorViewFactory extends ConnectionViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createConnectorStyle());
+ styles.add(NotationFactory.eINSTANCE.createFontStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(CommentLinkDescriptorEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/CommentViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/CommentViewFactory.java
new file mode 100644
index 00000000000..3971d4fe85d
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/CommentViewFactory.java
@@ -0,0 +1,74 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentBodyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.CommentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class CommentViewFactory extends AbstractShapeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createShapeStyle());
+ {
+ HintedDiagramLinkStyle diagramFacet = NotationFactory.eINSTANCE.createHintedDiagramLinkStyle();
+ styles.add(diagramFacet);
+ }
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(CommentEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ if (!ModelEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
+ EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
+ shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
+ shortcutAnnotation.getDetails().put("modelID", ModelEditPart.MODEL_ID); //$NON-NLS-1$
+ view.getEAnnotations().add(shortcutAnnotation);
+ }
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(CommentBodyEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Component2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Component2ViewFactory.java
new file mode 100644
index 00000000000..dbfc0113bd2
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Component2ViewFactory.java
@@ -0,0 +1,75 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Component2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentAttributeCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentName3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentName4EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentNestedClassifierCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentOperationCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentQualifiedName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class Component2ViewFactory extends AbstractShapeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createShapeStyle());
+ {
+ HintedDiagramLinkStyle diagramFacet = NotationFactory.eINSTANCE.createHintedDiagramLinkStyle();
+ styles.add(diagramFacet);
+ }
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(Component2EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(ComponentName3EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(ComponentName4EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(ComponentQualifiedName2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(ComponentAttributeCompartment2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(ComponentOperationCompartment2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(ComponentNestedClassifierCompartment2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentAttributeCompartment2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentAttributeCompartment2ViewFactory.java
new file mode 100644
index 00000000000..20cd483453e
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentAttributeCompartment2ViewFactory.java
@@ -0,0 +1,77 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.DrawerStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.TitleStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentAttributeCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class ComponentAttributeCompartment2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createDrawerStyle());
+ styles.add(NotationFactory.eINSTANCE.createSortingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFilteringStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(ComponentAttributeCompartment2EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ setupCompartmentTitle(view);
+ setupCompartmentCollapsed(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentTitle(View view) {
+ TitleStyle titleStyle = (TitleStyle) view.getStyle(NotationPackage.eINSTANCE.getTitleStyle());
+ if (titleStyle != null) {
+ titleStyle.setShowTitle(true);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentCollapsed(View view) {
+ DrawerStyle drawerStyle = (DrawerStyle) view.getStyle(NotationPackage.eINSTANCE.getDrawerStyle());
+ if (drawerStyle != null) {
+ drawerStyle.setCollapsed(false);
+ }
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentAttributeCompartmentViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentAttributeCompartmentViewFactory.java
new file mode 100644
index 00000000000..26362c79262
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentAttributeCompartmentViewFactory.java
@@ -0,0 +1,77 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.DrawerStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.TitleStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentAttributeCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class ComponentAttributeCompartmentViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createDrawerStyle());
+ styles.add(NotationFactory.eINSTANCE.createSortingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFilteringStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(ComponentAttributeCompartmentEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ setupCompartmentTitle(view);
+ setupCompartmentCollapsed(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentTitle(View view) {
+ TitleStyle titleStyle = (TitleStyle) view.getStyle(NotationPackage.eINSTANCE.getTitleStyle());
+ if (titleStyle != null) {
+ titleStyle.setShowTitle(true);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentCollapsed(View view) {
+ DrawerStyle drawerStyle = (DrawerStyle) view.getStyle(NotationPackage.eINSTANCE.getDrawerStyle());
+ if (drawerStyle != null) {
+ drawerStyle.setCollapsed(false);
+ }
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentName2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentName2ViewFactory.java
new file mode 100644
index 00000000000..2fb0ed33d9c
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentName2ViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class ComponentName2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentName3ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentName3ViewFactory.java
new file mode 100644
index 00000000000..80866fe628e
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentName3ViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class ComponentName3ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentName4ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentName4ViewFactory.java
new file mode 100644
index 00000000000..7a62d84f9fc
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentName4ViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class ComponentName4ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentNameViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentNameViewFactory.java
new file mode 100644
index 00000000000..fd6d65bd9de
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentNameViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class ComponentNameViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentNestedClassifierCompartment2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentNestedClassifierCompartment2ViewFactory.java
new file mode 100644
index 00000000000..65c2783cba6
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentNestedClassifierCompartment2ViewFactory.java
@@ -0,0 +1,77 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.DrawerStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.TitleStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentNestedClassifierCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class ComponentNestedClassifierCompartment2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createDrawerStyle());
+ styles.add(NotationFactory.eINSTANCE.createSortingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFilteringStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(ComponentNestedClassifierCompartment2EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ setupCompartmentTitle(view);
+ setupCompartmentCollapsed(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentTitle(View view) {
+ TitleStyle titleStyle = (TitleStyle) view.getStyle(NotationPackage.eINSTANCE.getTitleStyle());
+ if (titleStyle != null) {
+ titleStyle.setShowTitle(true);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentCollapsed(View view) {
+ DrawerStyle drawerStyle = (DrawerStyle) view.getStyle(NotationPackage.eINSTANCE.getDrawerStyle());
+ if (drawerStyle != null) {
+ drawerStyle.setCollapsed(false);
+ }
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentNestedClassifierCompartmentViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentNestedClassifierCompartmentViewFactory.java
new file mode 100644
index 00000000000..17deb5fadd0
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentNestedClassifierCompartmentViewFactory.java
@@ -0,0 +1,77 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.DrawerStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.TitleStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentNestedClassifierCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class ComponentNestedClassifierCompartmentViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createDrawerStyle());
+ styles.add(NotationFactory.eINSTANCE.createSortingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFilteringStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(ComponentNestedClassifierCompartmentEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ setupCompartmentTitle(view);
+ setupCompartmentCollapsed(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentTitle(View view) {
+ TitleStyle titleStyle = (TitleStyle) view.getStyle(NotationPackage.eINSTANCE.getTitleStyle());
+ if (titleStyle != null) {
+ titleStyle.setShowTitle(true);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentCollapsed(View view) {
+ DrawerStyle drawerStyle = (DrawerStyle) view.getStyle(NotationPackage.eINSTANCE.getDrawerStyle());
+ if (drawerStyle != null) {
+ drawerStyle.setCollapsed(false);
+ }
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentOperationCompartment2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentOperationCompartment2ViewFactory.java
new file mode 100644
index 00000000000..7ed70f9e5d2
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentOperationCompartment2ViewFactory.java
@@ -0,0 +1,77 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.DrawerStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.TitleStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentOperationCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class ComponentOperationCompartment2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createDrawerStyle());
+ styles.add(NotationFactory.eINSTANCE.createSortingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFilteringStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(ComponentOperationCompartment2EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ setupCompartmentTitle(view);
+ setupCompartmentCollapsed(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentTitle(View view) {
+ TitleStyle titleStyle = (TitleStyle) view.getStyle(NotationPackage.eINSTANCE.getTitleStyle());
+ if (titleStyle != null) {
+ titleStyle.setShowTitle(true);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentCollapsed(View view) {
+ DrawerStyle drawerStyle = (DrawerStyle) view.getStyle(NotationPackage.eINSTANCE.getDrawerStyle());
+ if (drawerStyle != null) {
+ drawerStyle.setCollapsed(false);
+ }
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentOperationCompartmentViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentOperationCompartmentViewFactory.java
new file mode 100644
index 00000000000..9ede49176b6
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentOperationCompartmentViewFactory.java
@@ -0,0 +1,77 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.DrawerStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.TitleStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentOperationCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class ComponentOperationCompartmentViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createDrawerStyle());
+ styles.add(NotationFactory.eINSTANCE.createSortingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFilteringStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(ComponentOperationCompartmentEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ setupCompartmentTitle(view);
+ setupCompartmentCollapsed(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentTitle(View view) {
+ TitleStyle titleStyle = (TitleStyle) view.getStyle(NotationPackage.eINSTANCE.getTitleStyle());
+ if (titleStyle != null) {
+ titleStyle.setShowTitle(true);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentCollapsed(View view) {
+ DrawerStyle drawerStyle = (DrawerStyle) view.getStyle(NotationPackage.eINSTANCE.getDrawerStyle());
+ if (drawerStyle != null) {
+ drawerStyle.setCollapsed(false);
+ }
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentQualifiedName2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentQualifiedName2ViewFactory.java
new file mode 100644
index 00000000000..b1a17211e62
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentQualifiedName2ViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class ComponentQualifiedName2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentQualifiedNameViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentQualifiedNameViewFactory.java
new file mode 100644
index 00000000000..5e7d1e3d5b7
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentQualifiedNameViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class ComponentQualifiedNameViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentViewFactory.java
new file mode 100644
index 00000000000..f2224423541
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ComponentViewFactory.java
@@ -0,0 +1,84 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentAttributeCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentNestedClassifierCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentOperationCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ComponentQualifiedNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class ComponentViewFactory extends AbstractShapeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createShapeStyle());
+ {
+ HintedDiagramLinkStyle diagramFacet = NotationFactory.eINSTANCE.createHintedDiagramLinkStyle();
+ styles.add(diagramFacet);
+ }
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(ComponentEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ if (!ModelEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
+ EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
+ shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
+ shortcutAnnotation.getDetails().put("modelID", ModelEditPart.MODEL_ID); //$NON-NLS-1$
+ view.getEAnnotations().add(shortcutAnnotation);
+ }
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(ComponentNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(ComponentName2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(ComponentQualifiedNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(ComponentAttributeCompartmentEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(ComponentOperationCompartmentEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(ComponentNestedClassifierCompartmentEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Constraint2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Constraint2ViewFactory.java
new file mode 100644
index 00000000000..32223e1b472
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Constraint2ViewFactory.java
@@ -0,0 +1,65 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Constraint2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class Constraint2ViewFactory extends AbstractShapeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createShapeStyle());
+ {
+ HintedDiagramLinkStyle diagramFacet = NotationFactory.eINSTANCE.createHintedDiagramLinkStyle();
+ styles.add(diagramFacet);
+ }
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(Constraint2EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(ConstraintName2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ConstraintConstrainedElementViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ConstraintConstrainedElementViewFactory.java
new file mode 100644
index 00000000000..5267317c56c
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ConstraintConstrainedElementViewFactory.java
@@ -0,0 +1,51 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.ConnectionViewFactory;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class ConstraintConstrainedElementViewFactory extends ConnectionViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createConnectorStyle());
+ styles.add(NotationFactory.eINSTANCE.createFontStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(ConstraintConstrainedElementEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ConstraintName2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ConstraintName2ViewFactory.java
new file mode 100644
index 00000000000..1c6ae762d36
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ConstraintName2ViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class ConstraintName2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ConstraintNameViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ConstraintNameViewFactory.java
new file mode 100644
index 00000000000..39b1ed0542b
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ConstraintNameViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class ConstraintNameViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ConstraintViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ConstraintViewFactory.java
new file mode 100644
index 00000000000..90474ca03a7
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ConstraintViewFactory.java
@@ -0,0 +1,74 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ConstraintNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class ConstraintViewFactory extends AbstractShapeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createShapeStyle());
+ {
+ HintedDiagramLinkStyle diagramFacet = NotationFactory.eINSTANCE.createHintedDiagramLinkStyle();
+ styles.add(diagramFacet);
+ }
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(ConstraintEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ if (!ModelEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
+ EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
+ shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
+ shortcutAnnotation.getDetails().put("modelID", ModelEditPart.MODEL_ID); //$NON-NLS-1$
+ view.getEAnnotations().add(shortcutAnnotation);
+ }
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(ConstraintNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataType2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataType2ViewFactory.java
new file mode 100644
index 00000000000..32d3e4ddf2e
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataType2ViewFactory.java
@@ -0,0 +1,73 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataType2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataTypeAttributeCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataTypeName3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataTypeName4EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataTypeOperationCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataTypeQualifiedName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class DataType2ViewFactory extends AbstractShapeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createShapeStyle());
+ {
+ HintedDiagramLinkStyle diagramFacet = NotationFactory.eINSTANCE.createHintedDiagramLinkStyle();
+ styles.add(diagramFacet);
+ }
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(DataType2EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(DataTypeName3EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(DataTypeName4EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(DataTypeQualifiedName2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(DataTypeAttributeCompartment2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(DataTypeOperationCompartment2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataTypeAttributeCompartment2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataTypeAttributeCompartment2ViewFactory.java
new file mode 100644
index 00000000000..11d71f92790
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataTypeAttributeCompartment2ViewFactory.java
@@ -0,0 +1,77 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.DrawerStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.TitleStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataTypeAttributeCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class DataTypeAttributeCompartment2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createDrawerStyle());
+ styles.add(NotationFactory.eINSTANCE.createSortingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFilteringStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(DataTypeAttributeCompartment2EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ setupCompartmentTitle(view);
+ setupCompartmentCollapsed(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentTitle(View view) {
+ TitleStyle titleStyle = (TitleStyle) view.getStyle(NotationPackage.eINSTANCE.getTitleStyle());
+ if (titleStyle != null) {
+ titleStyle.setShowTitle(true);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentCollapsed(View view) {
+ DrawerStyle drawerStyle = (DrawerStyle) view.getStyle(NotationPackage.eINSTANCE.getDrawerStyle());
+ if (drawerStyle != null) {
+ drawerStyle.setCollapsed(false);
+ }
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataTypeAttributeCompartmentViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataTypeAttributeCompartmentViewFactory.java
new file mode 100644
index 00000000000..a531b0f9331
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataTypeAttributeCompartmentViewFactory.java
@@ -0,0 +1,77 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.DrawerStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.TitleStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataTypeAttributeCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class DataTypeAttributeCompartmentViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createDrawerStyle());
+ styles.add(NotationFactory.eINSTANCE.createSortingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFilteringStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(DataTypeAttributeCompartmentEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ setupCompartmentTitle(view);
+ setupCompartmentCollapsed(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentTitle(View view) {
+ TitleStyle titleStyle = (TitleStyle) view.getStyle(NotationPackage.eINSTANCE.getTitleStyle());
+ if (titleStyle != null) {
+ titleStyle.setShowTitle(true);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentCollapsed(View view) {
+ DrawerStyle drawerStyle = (DrawerStyle) view.getStyle(NotationPackage.eINSTANCE.getDrawerStyle());
+ if (drawerStyle != null) {
+ drawerStyle.setCollapsed(false);
+ }
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataTypeName2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataTypeName2ViewFactory.java
new file mode 100644
index 00000000000..0e04840a967
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataTypeName2ViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class DataTypeName2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataTypeName3ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataTypeName3ViewFactory.java
new file mode 100644
index 00000000000..149694b1b4d
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataTypeName3ViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class DataTypeName3ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataTypeName4ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataTypeName4ViewFactory.java
new file mode 100644
index 00000000000..b415ae823db
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataTypeName4ViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class DataTypeName4ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataTypeNameViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataTypeNameViewFactory.java
new file mode 100644
index 00000000000..fa37ba20646
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataTypeNameViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class DataTypeNameViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataTypeOperationCompartment2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataTypeOperationCompartment2ViewFactory.java
new file mode 100644
index 00000000000..06789568bed
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataTypeOperationCompartment2ViewFactory.java
@@ -0,0 +1,77 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.DrawerStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.TitleStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataTypeOperationCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class DataTypeOperationCompartment2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createDrawerStyle());
+ styles.add(NotationFactory.eINSTANCE.createSortingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFilteringStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(DataTypeOperationCompartment2EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ setupCompartmentTitle(view);
+ setupCompartmentCollapsed(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentTitle(View view) {
+ TitleStyle titleStyle = (TitleStyle) view.getStyle(NotationPackage.eINSTANCE.getTitleStyle());
+ if (titleStyle != null) {
+ titleStyle.setShowTitle(true);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentCollapsed(View view) {
+ DrawerStyle drawerStyle = (DrawerStyle) view.getStyle(NotationPackage.eINSTANCE.getDrawerStyle());
+ if (drawerStyle != null) {
+ drawerStyle.setCollapsed(false);
+ }
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataTypeOperationCompartmentViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataTypeOperationCompartmentViewFactory.java
new file mode 100644
index 00000000000..d50cabf78bf
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataTypeOperationCompartmentViewFactory.java
@@ -0,0 +1,77 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.DrawerStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.TitleStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataTypeOperationCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class DataTypeOperationCompartmentViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createDrawerStyle());
+ styles.add(NotationFactory.eINSTANCE.createSortingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFilteringStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(DataTypeOperationCompartmentEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ setupCompartmentTitle(view);
+ setupCompartmentCollapsed(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentTitle(View view) {
+ TitleStyle titleStyle = (TitleStyle) view.getStyle(NotationPackage.eINSTANCE.getTitleStyle());
+ if (titleStyle != null) {
+ titleStyle.setShowTitle(true);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentCollapsed(View view) {
+ DrawerStyle drawerStyle = (DrawerStyle) view.getStyle(NotationPackage.eINSTANCE.getDrawerStyle());
+ if (drawerStyle != null) {
+ drawerStyle.setCollapsed(false);
+ }
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataTypeQualifiedName2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataTypeQualifiedName2ViewFactory.java
new file mode 100644
index 00000000000..cf02e5690f3
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataTypeQualifiedName2ViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class DataTypeQualifiedName2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataTypeQualifiedNameViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataTypeQualifiedNameViewFactory.java
new file mode 100644
index 00000000000..f4783463384
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataTypeQualifiedNameViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class DataTypeQualifiedNameViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataTypeViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataTypeViewFactory.java
new file mode 100644
index 00000000000..274edb7e34d
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DataTypeViewFactory.java
@@ -0,0 +1,82 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataTypeAttributeCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataTypeEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataTypeName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataTypeNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataTypeOperationCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DataTypeQualifiedNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class DataTypeViewFactory extends AbstractShapeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createShapeStyle());
+ {
+ HintedDiagramLinkStyle diagramFacet = NotationFactory.eINSTANCE.createHintedDiagramLinkStyle();
+ styles.add(diagramFacet);
+ }
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(DataTypeEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ if (!ModelEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
+ EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
+ shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
+ shortcutAnnotation.getDetails().put("modelID", ModelEditPart.MODEL_ID); //$NON-NLS-1$
+ view.getEAnnotations().add(shortcutAnnotation);
+ }
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(DataTypeNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(DataTypeName2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(DataTypeQualifiedNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(DataTypeAttributeCompartmentEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(DataTypeOperationCompartmentEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Dependency2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Dependency2ViewFactory.java
new file mode 100644
index 00000000000..294b928791f
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Dependency2ViewFactory.java
@@ -0,0 +1,64 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
+import org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class Dependency2ViewFactory extends AbstractShapeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createShapeStyle());
+ {
+ HintedDiagramLinkStyle diagramFacet = NotationFactory.eINSTANCE.createHintedDiagramLinkStyle();
+ styles.add(diagramFacet);
+ }
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(Dependency2EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ if (!ModelEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
+ EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
+ shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
+ shortcutAnnotation.getDetails().put("modelID", ModelEditPart.MODEL_ID); //$NON-NLS-1$
+ view.getEAnnotations().add(shortcutAnnotation);
+ }
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Dependency3ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Dependency3ViewFactory.java
new file mode 100644
index 00000000000..e36e0efad1f
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Dependency3ViewFactory.java
@@ -0,0 +1,50 @@
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.ConnectionViewFactory;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Dependency3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyName3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyName4EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class Dependency3ViewFactory extends ConnectionViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createRoutingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFontStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(Dependency3EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(DependencyName3EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(DependencyName4EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DependencyName2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DependencyName2ViewFactory.java
new file mode 100644
index 00000000000..f7549b8110a
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DependencyName2ViewFactory.java
@@ -0,0 +1,52 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
+import org.eclipse.gmf.runtime.notation.Location;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class DependencyName2ViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ public View createView(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Node view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
+ Location location = (Location) view.getLayoutConstraint();
+ IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView.getDiagram().getMeasurementUnit());
+ location.setX(mapMode.DPtoLP(0));
+ location.setY(mapMode.DPtoLP(60));
+ return view;
+ }
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DependencyName3ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DependencyName3ViewFactory.java
new file mode 100644
index 00000000000..3b1e2e5f131
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DependencyName3ViewFactory.java
@@ -0,0 +1,39 @@
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
+import org.eclipse.gmf.runtime.notation.Location;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class DependencyName3ViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ public View createView(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Node view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
+ Location location = (Location) view.getLayoutConstraint();
+ IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView.getDiagram().getMeasurementUnit());
+ location.setX(mapMode.DPtoLP(0));
+ location.setY(mapMode.DPtoLP(40));
+ return view;
+ }
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DependencyName4ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DependencyName4ViewFactory.java
new file mode 100644
index 00000000000..2ac6ba41c3b
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DependencyName4ViewFactory.java
@@ -0,0 +1,39 @@
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
+import org.eclipse.gmf.runtime.notation.Location;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class DependencyName4ViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ public View createView(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Node view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
+ Location location = (Location) view.getLayoutConstraint();
+ IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView.getDiagram().getMeasurementUnit());
+ location.setX(mapMode.DPtoLP(0));
+ location.setY(mapMode.DPtoLP(60));
+ return view;
+ }
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DependencyNameViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DependencyNameViewFactory.java
new file mode 100644
index 00000000000..3847c98e4a9
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DependencyNameViewFactory.java
@@ -0,0 +1,52 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
+import org.eclipse.gmf.runtime.notation.Location;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class DependencyNameViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ public View createView(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Node view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
+ Location location = (Location) view.getLayoutConstraint();
+ IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView.getDiagram().getMeasurementUnit());
+ location.setX(mapMode.DPtoLP(0));
+ location.setY(mapMode.DPtoLP(40));
+ return view;
+ }
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DependencyViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DependencyViewFactory.java
new file mode 100644
index 00000000000..b8cbdb42e91
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/DependencyViewFactory.java
@@ -0,0 +1,63 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.ConnectionViewFactory;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class DependencyViewFactory extends ConnectionViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createRoutingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFontStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(DependencyEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(DependencyNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(DependencyName2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ElementImportAlias2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ElementImportAlias2ViewFactory.java
new file mode 100644
index 00000000000..fc9ae533813
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ElementImportAlias2ViewFactory.java
@@ -0,0 +1,52 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
+import org.eclipse.gmf.runtime.notation.Location;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class ElementImportAlias2ViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ public View createView(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Node view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
+ Location location = (Location) view.getLayoutConstraint();
+ IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView.getDiagram().getMeasurementUnit());
+ location.setX(mapMode.DPtoLP(0));
+ location.setY(mapMode.DPtoLP(60));
+ return view;
+ }
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ElementImportAliasViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ElementImportAliasViewFactory.java
new file mode 100644
index 00000000000..a5d1eb82240
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ElementImportAliasViewFactory.java
@@ -0,0 +1,52 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
+import org.eclipse.gmf.runtime.notation.Location;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class ElementImportAliasViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ public View createView(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Node view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
+ Location location = (Location) view.getLayoutConstraint();
+ IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView.getDiagram().getMeasurementUnit());
+ location.setX(mapMode.DPtoLP(0));
+ location.setY(mapMode.DPtoLP(40));
+ return view;
+ }
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ElementImportViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ElementImportViewFactory.java
new file mode 100644
index 00000000000..de53a5c291d
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ElementImportViewFactory.java
@@ -0,0 +1,63 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.ConnectionViewFactory;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportAlias2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportAliasEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ElementImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class ElementImportViewFactory extends ConnectionViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createRoutingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFontStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(ElementImportEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(ElementImportAliasEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(ElementImportAlias2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Enumeration2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Enumeration2ViewFactory.java
new file mode 100644
index 00000000000..48b9a7ce741
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Enumeration2ViewFactory.java
@@ -0,0 +1,71 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Enumeration2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.EnumerationEnumerationLiteralCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.EnumerationName3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.EnumerationName4EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.EnumerationQualifiedName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class Enumeration2ViewFactory extends AbstractShapeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createShapeStyle());
+ {
+ HintedDiagramLinkStyle diagramFacet = NotationFactory.eINSTANCE.createHintedDiagramLinkStyle();
+ styles.add(diagramFacet);
+ }
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(Enumeration2EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(EnumerationName3EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(EnumerationName4EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(EnumerationQualifiedName2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(EnumerationEnumerationLiteralCompartment2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/EnumerationEnumerationLiteralCompartment2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/EnumerationEnumerationLiteralCompartment2ViewFactory.java
new file mode 100644
index 00000000000..82332e5e84f
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/EnumerationEnumerationLiteralCompartment2ViewFactory.java
@@ -0,0 +1,77 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.DrawerStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.TitleStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.EnumerationEnumerationLiteralCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class EnumerationEnumerationLiteralCompartment2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createDrawerStyle());
+ styles.add(NotationFactory.eINSTANCE.createSortingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFilteringStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(EnumerationEnumerationLiteralCompartment2EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ setupCompartmentTitle(view);
+ setupCompartmentCollapsed(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentTitle(View view) {
+ TitleStyle titleStyle = (TitleStyle) view.getStyle(NotationPackage.eINSTANCE.getTitleStyle());
+ if (titleStyle != null) {
+ titleStyle.setShowTitle(true);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentCollapsed(View view) {
+ DrawerStyle drawerStyle = (DrawerStyle) view.getStyle(NotationPackage.eINSTANCE.getDrawerStyle());
+ if (drawerStyle != null) {
+ drawerStyle.setCollapsed(false);
+ }
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/EnumerationEnumerationLiteralCompartmentViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/EnumerationEnumerationLiteralCompartmentViewFactory.java
new file mode 100644
index 00000000000..ac1a6db63f4
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/EnumerationEnumerationLiteralCompartmentViewFactory.java
@@ -0,0 +1,77 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.DrawerStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.TitleStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.EnumerationEnumerationLiteralCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class EnumerationEnumerationLiteralCompartmentViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createDrawerStyle());
+ styles.add(NotationFactory.eINSTANCE.createSortingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFilteringStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(EnumerationEnumerationLiteralCompartmentEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ setupCompartmentTitle(view);
+ setupCompartmentCollapsed(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentTitle(View view) {
+ TitleStyle titleStyle = (TitleStyle) view.getStyle(NotationPackage.eINSTANCE.getTitleStyle());
+ if (titleStyle != null) {
+ titleStyle.setShowTitle(true);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentCollapsed(View view) {
+ DrawerStyle drawerStyle = (DrawerStyle) view.getStyle(NotationPackage.eINSTANCE.getDrawerStyle());
+ if (drawerStyle != null) {
+ drawerStyle.setCollapsed(false);
+ }
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/EnumerationLiteralViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/EnumerationLiteralViewFactory.java
new file mode 100644
index 00000000000..5c15773930f
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/EnumerationLiteralViewFactory.java
@@ -0,0 +1,48 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.EnumerationLiteralEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class EnumerationLiteralViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(EnumerationLiteralEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/EnumerationName2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/EnumerationName2ViewFactory.java
new file mode 100644
index 00000000000..7b0dd8a49e8
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/EnumerationName2ViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EnumerationName2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/EnumerationName3ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/EnumerationName3ViewFactory.java
new file mode 100644
index 00000000000..bc01413aad6
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/EnumerationName3ViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EnumerationName3ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/EnumerationName4ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/EnumerationName4ViewFactory.java
new file mode 100644
index 00000000000..f5d10cdb31e
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/EnumerationName4ViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EnumerationName4ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/EnumerationNameViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/EnumerationNameViewFactory.java
new file mode 100644
index 00000000000..f90877e561a
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/EnumerationNameViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EnumerationNameViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/EnumerationQualifiedName2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/EnumerationQualifiedName2ViewFactory.java
new file mode 100644
index 00000000000..6eddb6f1e39
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/EnumerationQualifiedName2ViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EnumerationQualifiedName2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/EnumerationQualifiedNameViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/EnumerationQualifiedNameViewFactory.java
new file mode 100644
index 00000000000..6e200c2e7ec
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/EnumerationQualifiedNameViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EnumerationQualifiedNameViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/EnumerationViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/EnumerationViewFactory.java
new file mode 100644
index 00000000000..3fdb6520661
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/EnumerationViewFactory.java
@@ -0,0 +1,80 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.EnumerationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.EnumerationEnumerationLiteralCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.EnumerationName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.EnumerationNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.EnumerationQualifiedNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class EnumerationViewFactory extends AbstractShapeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createShapeStyle());
+ {
+ HintedDiagramLinkStyle diagramFacet = NotationFactory.eINSTANCE.createHintedDiagramLinkStyle();
+ styles.add(diagramFacet);
+ }
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(EnumerationEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ if (!ModelEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
+ EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
+ shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
+ shortcutAnnotation.getDetails().put("modelID", ModelEditPart.MODEL_ID); //$NON-NLS-1$
+ view.getEAnnotations().add(shortcutAnnotation);
+ }
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(EnumerationNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(EnumerationName2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(EnumerationQualifiedNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(EnumerationEnumerationLiteralCompartmentEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/GeneralizationIsSubstitutableViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/GeneralizationIsSubstitutableViewFactory.java
new file mode 100644
index 00000000000..82f185e91a4
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/GeneralizationIsSubstitutableViewFactory.java
@@ -0,0 +1,52 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
+import org.eclipse.gmf.runtime.notation.Location;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class GeneralizationIsSubstitutableViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ public View createView(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Node view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
+ Location location = (Location) view.getLayoutConstraint();
+ IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView.getDiagram().getMeasurementUnit());
+ location.setX(mapMode.DPtoLP(0));
+ location.setY(mapMode.DPtoLP(40));
+ return view;
+ }
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/GeneralizationViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/GeneralizationViewFactory.java
new file mode 100644
index 00000000000..8ced1cc3aaf
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/GeneralizationViewFactory.java
@@ -0,0 +1,61 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.ConnectionViewFactory;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.GeneralizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.GeneralizationIsSubstitutableEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class GeneralizationViewFactory extends ConnectionViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createRoutingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFontStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(GeneralizationEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(GeneralizationIsSubstitutableEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InstanceSpecification2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InstanceSpecification2ViewFactory.java
new file mode 100644
index 00000000000..95426c2a52e
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InstanceSpecification2ViewFactory.java
@@ -0,0 +1,71 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InstanceSpecification2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InstanceSpecificationName3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InstanceSpecificationName4EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InstanceSpecificationQualifiedName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InstanceSpecificationSlotCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class InstanceSpecification2ViewFactory extends AbstractShapeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createShapeStyle());
+ {
+ HintedDiagramLinkStyle diagramFacet = NotationFactory.eINSTANCE.createHintedDiagramLinkStyle();
+ styles.add(diagramFacet);
+ }
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(InstanceSpecification2EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(InstanceSpecificationName3EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(InstanceSpecificationName4EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(InstanceSpecificationQualifiedName2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(InstanceSpecificationSlotCompartment2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InstanceSpecificationName2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InstanceSpecificationName2ViewFactory.java
new file mode 100644
index 00000000000..dd5bcbf25b0
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InstanceSpecificationName2ViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class InstanceSpecificationName2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InstanceSpecificationName3ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InstanceSpecificationName3ViewFactory.java
new file mode 100644
index 00000000000..a7bbb3f430a
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InstanceSpecificationName3ViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class InstanceSpecificationName3ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InstanceSpecificationName4ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InstanceSpecificationName4ViewFactory.java
new file mode 100644
index 00000000000..ff87a21d3f0
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InstanceSpecificationName4ViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class InstanceSpecificationName4ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InstanceSpecificationNameViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InstanceSpecificationNameViewFactory.java
new file mode 100644
index 00000000000..827c2a240f7
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InstanceSpecificationNameViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class InstanceSpecificationNameViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InstanceSpecificationQualifiedName2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InstanceSpecificationQualifiedName2ViewFactory.java
new file mode 100644
index 00000000000..dc44dfc867b
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InstanceSpecificationQualifiedName2ViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class InstanceSpecificationQualifiedName2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InstanceSpecificationQualifiedNameViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InstanceSpecificationQualifiedNameViewFactory.java
new file mode 100644
index 00000000000..cdb98f79ed8
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InstanceSpecificationQualifiedNameViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class InstanceSpecificationQualifiedNameViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InstanceSpecificationSlotCompartment2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InstanceSpecificationSlotCompartment2ViewFactory.java
new file mode 100644
index 00000000000..7a123b71874
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InstanceSpecificationSlotCompartment2ViewFactory.java
@@ -0,0 +1,77 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.DrawerStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.TitleStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InstanceSpecificationSlotCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class InstanceSpecificationSlotCompartment2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createDrawerStyle());
+ styles.add(NotationFactory.eINSTANCE.createSortingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFilteringStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(InstanceSpecificationSlotCompartment2EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ setupCompartmentTitle(view);
+ setupCompartmentCollapsed(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentTitle(View view) {
+ TitleStyle titleStyle = (TitleStyle) view.getStyle(NotationPackage.eINSTANCE.getTitleStyle());
+ if (titleStyle != null) {
+ titleStyle.setShowTitle(true);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentCollapsed(View view) {
+ DrawerStyle drawerStyle = (DrawerStyle) view.getStyle(NotationPackage.eINSTANCE.getDrawerStyle());
+ if (drawerStyle != null) {
+ drawerStyle.setCollapsed(false);
+ }
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InstanceSpecificationSlotCompartmentViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InstanceSpecificationSlotCompartmentViewFactory.java
new file mode 100644
index 00000000000..f7f4e5a9877
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InstanceSpecificationSlotCompartmentViewFactory.java
@@ -0,0 +1,77 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.DrawerStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.TitleStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InstanceSpecificationSlotCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class InstanceSpecificationSlotCompartmentViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createDrawerStyle());
+ styles.add(NotationFactory.eINSTANCE.createSortingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFilteringStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(InstanceSpecificationSlotCompartmentEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ setupCompartmentTitle(view);
+ setupCompartmentCollapsed(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentTitle(View view) {
+ TitleStyle titleStyle = (TitleStyle) view.getStyle(NotationPackage.eINSTANCE.getTitleStyle());
+ if (titleStyle != null) {
+ titleStyle.setShowTitle(true);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentCollapsed(View view) {
+ DrawerStyle drawerStyle = (DrawerStyle) view.getStyle(NotationPackage.eINSTANCE.getDrawerStyle());
+ if (drawerStyle != null) {
+ drawerStyle.setCollapsed(false);
+ }
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InstanceSpecificationViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InstanceSpecificationViewFactory.java
new file mode 100644
index 00000000000..17c11f90578
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InstanceSpecificationViewFactory.java
@@ -0,0 +1,80 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InstanceSpecificationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InstanceSpecificationName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InstanceSpecificationNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InstanceSpecificationQualifiedNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InstanceSpecificationSlotCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class InstanceSpecificationViewFactory extends AbstractShapeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createShapeStyle());
+ {
+ HintedDiagramLinkStyle diagramFacet = NotationFactory.eINSTANCE.createHintedDiagramLinkStyle();
+ styles.add(diagramFacet);
+ }
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(InstanceSpecificationEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ if (!ModelEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
+ EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
+ shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
+ shortcutAnnotation.getDetails().put("modelID", ModelEditPart.MODEL_ID); //$NON-NLS-1$
+ view.getEAnnotations().add(shortcutAnnotation);
+ }
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(InstanceSpecificationNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(InstanceSpecificationName2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(InstanceSpecificationQualifiedNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(InstanceSpecificationSlotCompartmentEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Interface2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Interface2ViewFactory.java
new file mode 100644
index 00000000000..dfe4342e50a
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Interface2ViewFactory.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Interface2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceAttributeCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceName3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceName4EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceNestedClassifierCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceOperationCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceQualifiedName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class Interface2ViewFactory extends AbstractShapeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createShapeStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(Interface2EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(InterfaceName3EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(InterfaceName4EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(InterfaceQualifiedName2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(InterfaceAttributeCompartment2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(InterfaceOperationCompartment2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(InterfaceNestedClassifierCompartment2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceAttributeCompartment2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceAttributeCompartment2ViewFactory.java
new file mode 100644
index 00000000000..20f1bc8ee36
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceAttributeCompartment2ViewFactory.java
@@ -0,0 +1,77 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.DrawerStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.TitleStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceAttributeCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class InterfaceAttributeCompartment2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createDrawerStyle());
+ styles.add(NotationFactory.eINSTANCE.createSortingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFilteringStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(InterfaceAttributeCompartment2EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ setupCompartmentTitle(view);
+ setupCompartmentCollapsed(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentTitle(View view) {
+ TitleStyle titleStyle = (TitleStyle) view.getStyle(NotationPackage.eINSTANCE.getTitleStyle());
+ if (titleStyle != null) {
+ titleStyle.setShowTitle(true);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentCollapsed(View view) {
+ DrawerStyle drawerStyle = (DrawerStyle) view.getStyle(NotationPackage.eINSTANCE.getDrawerStyle());
+ if (drawerStyle != null) {
+ drawerStyle.setCollapsed(false);
+ }
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceAttributeCompartmentViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceAttributeCompartmentViewFactory.java
new file mode 100644
index 00000000000..0bd30e2790f
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceAttributeCompartmentViewFactory.java
@@ -0,0 +1,77 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.DrawerStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.TitleStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceAttributeCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class InterfaceAttributeCompartmentViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createDrawerStyle());
+ styles.add(NotationFactory.eINSTANCE.createSortingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFilteringStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(InterfaceAttributeCompartmentEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ setupCompartmentTitle(view);
+ setupCompartmentCollapsed(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentTitle(View view) {
+ TitleStyle titleStyle = (TitleStyle) view.getStyle(NotationPackage.eINSTANCE.getTitleStyle());
+ if (titleStyle != null) {
+ titleStyle.setShowTitle(true);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentCollapsed(View view) {
+ DrawerStyle drawerStyle = (DrawerStyle) view.getStyle(NotationPackage.eINSTANCE.getDrawerStyle());
+ if (drawerStyle != null) {
+ drawerStyle.setCollapsed(false);
+ }
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceName2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceName2ViewFactory.java
new file mode 100644
index 00000000000..04e28d731fb
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceName2ViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class InterfaceName2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceName3ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceName3ViewFactory.java
new file mode 100644
index 00000000000..678f09c0006
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceName3ViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class InterfaceName3ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceName4ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceName4ViewFactory.java
new file mode 100644
index 00000000000..10a6c3564ba
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceName4ViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class InterfaceName4ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceNameViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceNameViewFactory.java
new file mode 100644
index 00000000000..69584507843
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceNameViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class InterfaceNameViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceNestedClassifierCompartment2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceNestedClassifierCompartment2ViewFactory.java
new file mode 100644
index 00000000000..5bdabb7be82
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceNestedClassifierCompartment2ViewFactory.java
@@ -0,0 +1,77 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.DrawerStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.TitleStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceNestedClassifierCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class InterfaceNestedClassifierCompartment2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createDrawerStyle());
+ styles.add(NotationFactory.eINSTANCE.createSortingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFilteringStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(InterfaceNestedClassifierCompartment2EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ setupCompartmentTitle(view);
+ setupCompartmentCollapsed(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentTitle(View view) {
+ TitleStyle titleStyle = (TitleStyle) view.getStyle(NotationPackage.eINSTANCE.getTitleStyle());
+ if (titleStyle != null) {
+ titleStyle.setShowTitle(true);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentCollapsed(View view) {
+ DrawerStyle drawerStyle = (DrawerStyle) view.getStyle(NotationPackage.eINSTANCE.getDrawerStyle());
+ if (drawerStyle != null) {
+ drawerStyle.setCollapsed(false);
+ }
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceNestedClassifierCompartmentViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceNestedClassifierCompartmentViewFactory.java
new file mode 100644
index 00000000000..5850c45dc7a
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceNestedClassifierCompartmentViewFactory.java
@@ -0,0 +1,77 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.DrawerStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.TitleStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceNestedClassifierCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class InterfaceNestedClassifierCompartmentViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createDrawerStyle());
+ styles.add(NotationFactory.eINSTANCE.createSortingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFilteringStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(InterfaceNestedClassifierCompartmentEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ setupCompartmentTitle(view);
+ setupCompartmentCollapsed(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentTitle(View view) {
+ TitleStyle titleStyle = (TitleStyle) view.getStyle(NotationPackage.eINSTANCE.getTitleStyle());
+ if (titleStyle != null) {
+ titleStyle.setShowTitle(true);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentCollapsed(View view) {
+ DrawerStyle drawerStyle = (DrawerStyle) view.getStyle(NotationPackage.eINSTANCE.getDrawerStyle());
+ if (drawerStyle != null) {
+ drawerStyle.setCollapsed(false);
+ }
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceOperationCompartment2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceOperationCompartment2ViewFactory.java
new file mode 100644
index 00000000000..727477524f7
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceOperationCompartment2ViewFactory.java
@@ -0,0 +1,77 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.DrawerStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.TitleStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceOperationCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class InterfaceOperationCompartment2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createDrawerStyle());
+ styles.add(NotationFactory.eINSTANCE.createSortingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFilteringStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(InterfaceOperationCompartment2EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ setupCompartmentTitle(view);
+ setupCompartmentCollapsed(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentTitle(View view) {
+ TitleStyle titleStyle = (TitleStyle) view.getStyle(NotationPackage.eINSTANCE.getTitleStyle());
+ if (titleStyle != null) {
+ titleStyle.setShowTitle(true);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentCollapsed(View view) {
+ DrawerStyle drawerStyle = (DrawerStyle) view.getStyle(NotationPackage.eINSTANCE.getDrawerStyle());
+ if (drawerStyle != null) {
+ drawerStyle.setCollapsed(false);
+ }
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceOperationCompartmentViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceOperationCompartmentViewFactory.java
new file mode 100644
index 00000000000..fd8c775ed4c
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceOperationCompartmentViewFactory.java
@@ -0,0 +1,77 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.DrawerStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.TitleStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceOperationCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class InterfaceOperationCompartmentViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createDrawerStyle());
+ styles.add(NotationFactory.eINSTANCE.createSortingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFilteringStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(InterfaceOperationCompartmentEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ setupCompartmentTitle(view);
+ setupCompartmentCollapsed(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentTitle(View view) {
+ TitleStyle titleStyle = (TitleStyle) view.getStyle(NotationPackage.eINSTANCE.getTitleStyle());
+ if (titleStyle != null) {
+ titleStyle.setShowTitle(true);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentCollapsed(View view) {
+ DrawerStyle drawerStyle = (DrawerStyle) view.getStyle(NotationPackage.eINSTANCE.getDrawerStyle());
+ if (drawerStyle != null) {
+ drawerStyle.setCollapsed(false);
+ }
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceQualifiedName2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceQualifiedName2ViewFactory.java
new file mode 100644
index 00000000000..684f32352ab
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceQualifiedName2ViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class InterfaceQualifiedName2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceQualifiedNameViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceQualifiedNameViewFactory.java
new file mode 100644
index 00000000000..9c22d1dd185
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceQualifiedNameViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class InterfaceQualifiedNameViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceRealizationName2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceRealizationName2ViewFactory.java
new file mode 100644
index 00000000000..5cb8b6e5155
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceRealizationName2ViewFactory.java
@@ -0,0 +1,52 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
+import org.eclipse.gmf.runtime.notation.Location;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class InterfaceRealizationName2ViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ public View createView(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Node view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
+ Location location = (Location) view.getLayoutConstraint();
+ IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView.getDiagram().getMeasurementUnit());
+ location.setX(mapMode.DPtoLP(0));
+ location.setY(mapMode.DPtoLP(60));
+ return view;
+ }
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceRealizationNameViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceRealizationNameViewFactory.java
new file mode 100644
index 00000000000..f4028a9ac4a
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceRealizationNameViewFactory.java
@@ -0,0 +1,52 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
+import org.eclipse.gmf.runtime.notation.Location;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class InterfaceRealizationNameViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ public View createView(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Node view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
+ Location location = (Location) view.getLayoutConstraint();
+ IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView.getDiagram().getMeasurementUnit());
+ location.setX(mapMode.DPtoLP(0));
+ location.setY(mapMode.DPtoLP(40));
+ return view;
+ }
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceRealizationViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceRealizationViewFactory.java
new file mode 100644
index 00000000000..ec2aeafb62e
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceRealizationViewFactory.java
@@ -0,0 +1,63 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.ConnectionViewFactory;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceRealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceRealizationName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceRealizationNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class InterfaceRealizationViewFactory extends ConnectionViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createRoutingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFontStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(InterfaceRealizationEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(InterfaceRealizationNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(InterfaceRealizationName2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceViewFactory.java
new file mode 100644
index 00000000000..d49212033e4
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/InterfaceViewFactory.java
@@ -0,0 +1,79 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceAttributeCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceNestedClassifierCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceOperationCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.InterfaceQualifiedNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class InterfaceViewFactory extends AbstractShapeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createShapeStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(InterfaceEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ if (!ModelEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
+ EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
+ shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
+ shortcutAnnotation.getDetails().put("modelID", ModelEditPart.MODEL_ID); //$NON-NLS-1$
+ view.getEAnnotations().add(shortcutAnnotation);
+ }
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(InterfaceNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(InterfaceName2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(InterfaceQualifiedNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(InterfaceAttributeCompartmentEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(InterfaceOperationCompartmentEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(InterfaceNestedClassifierCompartmentEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Model2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Model2ViewFactory.java
new file mode 100644
index 00000000000..8023e3044fe
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Model2ViewFactory.java
@@ -0,0 +1,80 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Model2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelPackageableElementCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelQualifiedNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class Model2ViewFactory extends AbstractShapeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createShapeStyle());
+ {
+ HintedDiagramLinkStyle diagramFacet = NotationFactory.eINSTANCE.createHintedDiagramLinkStyle();
+ styles.add(diagramFacet);
+ }
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(Model2EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ if (!ModelEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
+ EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
+ shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
+ shortcutAnnotation.getDetails().put("modelID", ModelEditPart.MODEL_ID); //$NON-NLS-1$
+ view.getEAnnotations().add(shortcutAnnotation);
+ }
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(ModelNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(ModelName2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(ModelQualifiedNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(ModelPackageableElementCompartmentEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Model3ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Model3ViewFactory.java
new file mode 100644
index 00000000000..96cad810f1d
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Model3ViewFactory.java
@@ -0,0 +1,71 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Model3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelName3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelName4EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelPackageableElementCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelQualifiedName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class Model3ViewFactory extends AbstractShapeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createShapeStyle());
+ {
+ HintedDiagramLinkStyle diagramFacet = NotationFactory.eINSTANCE.createHintedDiagramLinkStyle();
+ styles.add(diagramFacet);
+ }
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(Model3EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(ModelName3EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(ModelName4EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(ModelQualifiedName2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(ModelPackageableElementCompartment2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ModelName2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ModelName2ViewFactory.java
new file mode 100644
index 00000000000..64ecee8830f
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ModelName2ViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class ModelName2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ModelName3ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ModelName3ViewFactory.java
new file mode 100644
index 00000000000..4a66113d954
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ModelName3ViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class ModelName3ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ModelName4ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ModelName4ViewFactory.java
new file mode 100644
index 00000000000..846b4cc9f73
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ModelName4ViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class ModelName4ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ModelNameViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ModelNameViewFactory.java
new file mode 100644
index 00000000000..38f616efc93
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ModelNameViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class ModelNameViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ModelPackageableElementCompartment2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ModelPackageableElementCompartment2ViewFactory.java
new file mode 100644
index 00000000000..6fcfab8686c
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ModelPackageableElementCompartment2ViewFactory.java
@@ -0,0 +1,76 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.DrawerStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.TitleStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelPackageableElementCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class ModelPackageableElementCompartment2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createSortingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFilteringStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(ModelPackageableElementCompartment2EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ setupCompartmentTitle(view);
+ setupCompartmentCollapsed(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentTitle(View view) {
+ TitleStyle titleStyle = (TitleStyle) view.getStyle(NotationPackage.eINSTANCE.getTitleStyle());
+ if (titleStyle != null) {
+ titleStyle.setShowTitle(true);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentCollapsed(View view) {
+ DrawerStyle drawerStyle = (DrawerStyle) view.getStyle(NotationPackage.eINSTANCE.getDrawerStyle());
+ if (drawerStyle != null) {
+ drawerStyle.setCollapsed(false);
+ }
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ModelPackageableElementCompartmentViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ModelPackageableElementCompartmentViewFactory.java
new file mode 100644
index 00000000000..99018ca575f
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ModelPackageableElementCompartmentViewFactory.java
@@ -0,0 +1,76 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.DrawerStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.TitleStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelPackageableElementCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class ModelPackageableElementCompartmentViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createSortingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFilteringStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(ModelPackageableElementCompartmentEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ setupCompartmentTitle(view);
+ setupCompartmentCollapsed(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentTitle(View view) {
+ TitleStyle titleStyle = (TitleStyle) view.getStyle(NotationPackage.eINSTANCE.getTitleStyle());
+ if (titleStyle != null) {
+ titleStyle.setShowTitle(true);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentCollapsed(View view) {
+ DrawerStyle drawerStyle = (DrawerStyle) view.getStyle(NotationPackage.eINSTANCE.getDrawerStyle());
+ if (drawerStyle != null) {
+ drawerStyle.setCollapsed(false);
+ }
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ModelQualifiedName2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ModelQualifiedName2ViewFactory.java
new file mode 100644
index 00000000000..95cac0fba73
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ModelQualifiedName2ViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class ModelQualifiedName2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ModelQualifiedNameViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ModelQualifiedNameViewFactory.java
new file mode 100644
index 00000000000..547a7119460
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ModelQualifiedNameViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class ModelQualifiedNameViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ModelViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ModelViewFactory.java
new file mode 100644
index 00000000000..952e6e3f852
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ModelViewFactory.java
@@ -0,0 +1,44 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.DiagramViewFactory;
+import org.eclipse.gmf.runtime.notation.MeasurementUnit;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class ModelViewFactory extends DiagramViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createDiagramStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected MeasurementUnit getMeasurementUnit() {
+ return MeasurementUnit.PIXEL_LITERAL;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Operation2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Operation2ViewFactory.java
new file mode 100644
index 00000000000..0a7dc1b2fbe
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Operation2ViewFactory.java
@@ -0,0 +1,48 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Operation2EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class Operation2ViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(Operation2EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Operation3ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Operation3ViewFactory.java
new file mode 100644
index 00000000000..8d139197195
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Operation3ViewFactory.java
@@ -0,0 +1,48 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Operation3EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class Operation3ViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(Operation3EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Operation4ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Operation4ViewFactory.java
new file mode 100644
index 00000000000..56d3b1c5e52
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Operation4ViewFactory.java
@@ -0,0 +1,48 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Operation4EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class Operation4ViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(Operation4EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Operation5ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Operation5ViewFactory.java
new file mode 100644
index 00000000000..f55c1ee888b
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Operation5ViewFactory.java
@@ -0,0 +1,48 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Operation5EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class Operation5ViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(Operation5EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/OperationViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/OperationViewFactory.java
new file mode 100644
index 00000000000..95109fbbebc
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/OperationViewFactory.java
@@ -0,0 +1,48 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.OperationEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class OperationViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(OperationEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Package2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Package2ViewFactory.java
new file mode 100644
index 00000000000..529c077b61c
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Package2ViewFactory.java
@@ -0,0 +1,71 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Package2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageName3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageName4EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackagePackageableElementCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageQualifiedName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class Package2ViewFactory extends AbstractShapeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createShapeStyle());
+ {
+ HintedDiagramLinkStyle diagramFacet = NotationFactory.eINSTANCE.createHintedDiagramLinkStyle();
+ styles.add(diagramFacet);
+ }
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(Package2EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(PackageName3EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(PackageName4EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(PackageQualifiedName2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(PackagePackageableElementCompartmentEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackageImportViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackageImportViewFactory.java
new file mode 100644
index 00000000000..d57e08b630d
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackageImportViewFactory.java
@@ -0,0 +1,61 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.ConnectionViewFactory;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageImportEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageImportVisibilityEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class PackageImportViewFactory extends ConnectionViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createRoutingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFontStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(PackageImportEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(PackageImportVisibilityEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackageImportVisibilityViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackageImportVisibilityViewFactory.java
new file mode 100644
index 00000000000..24698d7aa08
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackageImportVisibilityViewFactory.java
@@ -0,0 +1,52 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
+import org.eclipse.gmf.runtime.notation.Location;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class PackageImportVisibilityViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ public View createView(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Node view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
+ Location location = (Location) view.getLayoutConstraint();
+ IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView.getDiagram().getMeasurementUnit());
+ location.setX(mapMode.DPtoLP(0));
+ location.setY(mapMode.DPtoLP(40));
+ return view;
+ }
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackageMergeViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackageMergeViewFactory.java
new file mode 100644
index 00000000000..0f208709f73
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackageMergeViewFactory.java
@@ -0,0 +1,51 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.ConnectionViewFactory;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageMergeEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class PackageMergeViewFactory extends ConnectionViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createRoutingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFontStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(PackageMergeEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackageName2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackageName2ViewFactory.java
new file mode 100644
index 00000000000..64ba21c8839
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackageName2ViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class PackageName2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackageName3ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackageName3ViewFactory.java
new file mode 100644
index 00000000000..0b1ba9ef465
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackageName3ViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class PackageName3ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackageName4ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackageName4ViewFactory.java
new file mode 100644
index 00000000000..68d54d21917
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackageName4ViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class PackageName4ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackageNameViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackageNameViewFactory.java
new file mode 100644
index 00000000000..e08e99127e2
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackageNameViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class PackageNameViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackagePackageableElementCompartment2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackagePackageableElementCompartment2ViewFactory.java
new file mode 100644
index 00000000000..aeb72ce19fa
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackagePackageableElementCompartment2ViewFactory.java
@@ -0,0 +1,76 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.DrawerStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.TitleStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackagePackageableElementCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class PackagePackageableElementCompartment2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createSortingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFilteringStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(PackagePackageableElementCompartment2EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ setupCompartmentTitle(view);
+ setupCompartmentCollapsed(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentTitle(View view) {
+ TitleStyle titleStyle = (TitleStyle) view.getStyle(NotationPackage.eINSTANCE.getTitleStyle());
+ if (titleStyle != null) {
+ titleStyle.setShowTitle(true);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentCollapsed(View view) {
+ DrawerStyle drawerStyle = (DrawerStyle) view.getStyle(NotationPackage.eINSTANCE.getDrawerStyle());
+ if (drawerStyle != null) {
+ drawerStyle.setCollapsed(false);
+ }
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackagePackageableElementCompartmentViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackagePackageableElementCompartmentViewFactory.java
new file mode 100644
index 00000000000..0bce1e61cbb
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackagePackageableElementCompartmentViewFactory.java
@@ -0,0 +1,76 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.DrawerStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.TitleStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackagePackageableElementCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class PackagePackageableElementCompartmentViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createSortingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFilteringStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(PackagePackageableElementCompartmentEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ setupCompartmentTitle(view);
+ setupCompartmentCollapsed(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentTitle(View view) {
+ TitleStyle titleStyle = (TitleStyle) view.getStyle(NotationPackage.eINSTANCE.getTitleStyle());
+ if (titleStyle != null) {
+ titleStyle.setShowTitle(true);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentCollapsed(View view) {
+ DrawerStyle drawerStyle = (DrawerStyle) view.getStyle(NotationPackage.eINSTANCE.getDrawerStyle());
+ if (drawerStyle != null) {
+ drawerStyle.setCollapsed(false);
+ }
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackageQualifiedName2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackageQualifiedName2ViewFactory.java
new file mode 100644
index 00000000000..4a4de5ab6d4
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackageQualifiedName2ViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class PackageQualifiedName2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackageQualifiedNameViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackageQualifiedNameViewFactory.java
new file mode 100644
index 00000000000..f2805b21b13
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackageQualifiedNameViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class PackageQualifiedNameViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackageViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackageViewFactory.java
new file mode 100644
index 00000000000..553a6a76258
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PackageViewFactory.java
@@ -0,0 +1,80 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackagePackageableElementCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PackageQualifiedNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class PackageViewFactory extends AbstractShapeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createShapeStyle());
+ {
+ HintedDiagramLinkStyle diagramFacet = NotationFactory.eINSTANCE.createHintedDiagramLinkStyle();
+ styles.add(diagramFacet);
+ }
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(PackageEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ if (!ModelEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
+ EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
+ shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
+ shortcutAnnotation.getDetails().put("modelID", ModelEditPart.MODEL_ID); //$NON-NLS-1$
+ view.getEAnnotations().add(shortcutAnnotation);
+ }
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(PackageNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(PackageName2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(PackageQualifiedNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(PackagePackageableElementCompartment2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PrimitiveType2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PrimitiveType2ViewFactory.java
new file mode 100644
index 00000000000..b72f417df5a
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PrimitiveType2ViewFactory.java
@@ -0,0 +1,69 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PrimitiveType2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PrimitiveTypeName3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PrimitiveTypeName4EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PrimitiveTypeQualifiedName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class PrimitiveType2ViewFactory extends AbstractShapeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createShapeStyle());
+ {
+ HintedDiagramLinkStyle diagramFacet = NotationFactory.eINSTANCE.createHintedDiagramLinkStyle();
+ styles.add(diagramFacet);
+ }
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(PrimitiveType2EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(PrimitiveTypeName3EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(PrimitiveTypeName4EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(PrimitiveTypeQualifiedName2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PrimitiveTypeName2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PrimitiveTypeName2ViewFactory.java
new file mode 100644
index 00000000000..30a45a19cea
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PrimitiveTypeName2ViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class PrimitiveTypeName2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PrimitiveTypeName3ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PrimitiveTypeName3ViewFactory.java
new file mode 100644
index 00000000000..0dfb10f98ce
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PrimitiveTypeName3ViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class PrimitiveTypeName3ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PrimitiveTypeName4ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PrimitiveTypeName4ViewFactory.java
new file mode 100644
index 00000000000..ed33a5a61dc
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PrimitiveTypeName4ViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class PrimitiveTypeName4ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PrimitiveTypeNameViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PrimitiveTypeNameViewFactory.java
new file mode 100644
index 00000000000..44d2a80df5e
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PrimitiveTypeNameViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class PrimitiveTypeNameViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PrimitiveTypeQualifiedName2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PrimitiveTypeQualifiedName2ViewFactory.java
new file mode 100644
index 00000000000..e5553c4e83b
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PrimitiveTypeQualifiedName2ViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class PrimitiveTypeQualifiedName2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PrimitiveTypeQualifiedNameViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PrimitiveTypeQualifiedNameViewFactory.java
new file mode 100644
index 00000000000..74014d4ead5
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PrimitiveTypeQualifiedNameViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class PrimitiveTypeQualifiedNameViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PrimitiveTypeViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PrimitiveTypeViewFactory.java
new file mode 100644
index 00000000000..51a98cdd7da
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PrimitiveTypeViewFactory.java
@@ -0,0 +1,78 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PrimitiveTypeEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PrimitiveTypeName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PrimitiveTypeNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PrimitiveTypeQualifiedNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class PrimitiveTypeViewFactory extends AbstractShapeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createShapeStyle());
+ {
+ HintedDiagramLinkStyle diagramFacet = NotationFactory.eINSTANCE.createHintedDiagramLinkStyle();
+ styles.add(diagramFacet);
+ }
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(PrimitiveTypeEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ if (!ModelEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
+ EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
+ shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
+ shortcutAnnotation.getDetails().put("modelID", ModelEditPart.MODEL_ID); //$NON-NLS-1$
+ view.getEAnnotations().add(shortcutAnnotation);
+ }
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(PrimitiveTypeNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(PrimitiveTypeName2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(PrimitiveTypeQualifiedNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ProfileApplicationViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ProfileApplicationViewFactory.java
new file mode 100644
index 00000000000..e1394d522a1
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ProfileApplicationViewFactory.java
@@ -0,0 +1,51 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.ConnectionViewFactory;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ProfileApplicationEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class ProfileApplicationViewFactory extends ConnectionViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createRoutingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFontStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(ProfileApplicationEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Property2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Property2ViewFactory.java
new file mode 100644
index 00000000000..204d6f03c92
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Property2ViewFactory.java
@@ -0,0 +1,48 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Property2EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class Property2ViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(Property2EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Property3ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Property3ViewFactory.java
new file mode 100644
index 00000000000..b881eee3f62
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Property3ViewFactory.java
@@ -0,0 +1,48 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Property3EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class Property3ViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(Property3EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Property4ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Property4ViewFactory.java
new file mode 100644
index 00000000000..20e61af5fda
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Property4ViewFactory.java
@@ -0,0 +1,48 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Property4EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class Property4ViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(Property4EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Property5ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Property5ViewFactory.java
new file mode 100644
index 00000000000..a4ce9c5e36e
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Property5ViewFactory.java
@@ -0,0 +1,48 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Property5EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class Property5ViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(Property5EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PropertyViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PropertyViewFactory.java
new file mode 100644
index 00000000000..ceef71e0a8a
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/PropertyViewFactory.java
@@ -0,0 +1,48 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.PropertyEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class PropertyViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(PropertyEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/RealizationName2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/RealizationName2ViewFactory.java
new file mode 100644
index 00000000000..8fd2c9d0ec8
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/RealizationName2ViewFactory.java
@@ -0,0 +1,52 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
+import org.eclipse.gmf.runtime.notation.Location;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class RealizationName2ViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ public View createView(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Node view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
+ Location location = (Location) view.getLayoutConstraint();
+ IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView.getDiagram().getMeasurementUnit());
+ location.setX(mapMode.DPtoLP(0));
+ location.setY(mapMode.DPtoLP(60));
+ return view;
+ }
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/RealizationNameViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/RealizationNameViewFactory.java
new file mode 100644
index 00000000000..54fa0aa2303
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/RealizationNameViewFactory.java
@@ -0,0 +1,52 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
+import org.eclipse.gmf.runtime.notation.Location;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class RealizationNameViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ public View createView(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Node view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
+ Location location = (Location) view.getLayoutConstraint();
+ IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView.getDiagram().getMeasurementUnit());
+ location.setX(mapMode.DPtoLP(0));
+ location.setY(mapMode.DPtoLP(40));
+ return view;
+ }
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/RealizationViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/RealizationViewFactory.java
new file mode 100644
index 00000000000..f94e58884cf
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/RealizationViewFactory.java
@@ -0,0 +1,63 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.ConnectionViewFactory;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RealizationNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class RealizationViewFactory extends ConnectionViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createRoutingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFontStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(RealizationEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(RealizationNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(RealizationName2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ReceptionViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ReceptionViewFactory.java
new file mode 100644
index 00000000000..269676b205c
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ReceptionViewFactory.java
@@ -0,0 +1,48 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ReceptionEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class ReceptionViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(ReceptionEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/RedefinableTemplateSignatureTemplateParameterCompartmentViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/RedefinableTemplateSignatureTemplateParameterCompartmentViewFactory.java
new file mode 100644
index 00000000000..eb09f24c70f
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/RedefinableTemplateSignatureTemplateParameterCompartmentViewFactory.java
@@ -0,0 +1,76 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.DrawerStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.TitleStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RedefinableTemplateSignatureTemplateParameterCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class RedefinableTemplateSignatureTemplateParameterCompartmentViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createSortingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFilteringStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(RedefinableTemplateSignatureTemplateParameterCompartmentEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ setupCompartmentTitle(view);
+ setupCompartmentCollapsed(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentTitle(View view) {
+ TitleStyle titleStyle = (TitleStyle) view.getStyle(NotationPackage.eINSTANCE.getTitleStyle());
+ if (titleStyle != null) {
+ titleStyle.setShowTitle(true);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentCollapsed(View view) {
+ DrawerStyle drawerStyle = (DrawerStyle) view.getStyle(NotationPackage.eINSTANCE.getDrawerStyle());
+ if (drawerStyle != null) {
+ drawerStyle.setCollapsed(false);
+ }
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/RedefinableTemplateSignatureViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/RedefinableTemplateSignatureViewFactory.java
new file mode 100644
index 00000000000..3fb45167e42
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/RedefinableTemplateSignatureViewFactory.java
@@ -0,0 +1,66 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RedefinableTemplateSignatureEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.RedefinableTemplateSignatureTemplateParameterCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class RedefinableTemplateSignatureViewFactory extends AbstractShapeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createShapeStyle());
+ {
+ HintedDiagramLinkStyle diagramFacet = NotationFactory.eINSTANCE.createHintedDiagramLinkStyle();
+ styles.add(diagramFacet);
+ }
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(RedefinableTemplateSignatureEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(RedefinableTemplateSignatureTemplateParameterCompartmentEditPart.VISUAL_ID), ViewUtil.APPEND, true,
+ getPreferencesHint());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Signal2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Signal2ViewFactory.java
new file mode 100644
index 00000000000..0e03009c884
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/Signal2ViewFactory.java
@@ -0,0 +1,71 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.Signal2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SignalAttributeCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SignalName3EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SignalName4EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SignalQualifiedName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class Signal2ViewFactory extends AbstractShapeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createShapeStyle());
+ {
+ HintedDiagramLinkStyle diagramFacet = NotationFactory.eINSTANCE.createHintedDiagramLinkStyle();
+ styles.add(diagramFacet);
+ }
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(Signal2EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(SignalName3EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(SignalName4EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(SignalQualifiedName2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(SignalAttributeCompartment2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SignalAttributeCompartment2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SignalAttributeCompartment2ViewFactory.java
new file mode 100644
index 00000000000..e469ef58350
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SignalAttributeCompartment2ViewFactory.java
@@ -0,0 +1,77 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.DrawerStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.TitleStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SignalAttributeCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class SignalAttributeCompartment2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createDrawerStyle());
+ styles.add(NotationFactory.eINSTANCE.createSortingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFilteringStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(SignalAttributeCompartment2EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ setupCompartmentTitle(view);
+ setupCompartmentCollapsed(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentTitle(View view) {
+ TitleStyle titleStyle = (TitleStyle) view.getStyle(NotationPackage.eINSTANCE.getTitleStyle());
+ if (titleStyle != null) {
+ titleStyle.setShowTitle(true);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentCollapsed(View view) {
+ DrawerStyle drawerStyle = (DrawerStyle) view.getStyle(NotationPackage.eINSTANCE.getDrawerStyle());
+ if (drawerStyle != null) {
+ drawerStyle.setCollapsed(false);
+ }
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SignalAttributeCompartmentViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SignalAttributeCompartmentViewFactory.java
new file mode 100644
index 00000000000..d5c0221c191
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SignalAttributeCompartmentViewFactory.java
@@ -0,0 +1,77 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.DrawerStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.TitleStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SignalAttributeCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class SignalAttributeCompartmentViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createDrawerStyle());
+ styles.add(NotationFactory.eINSTANCE.createSortingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFilteringStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(SignalAttributeCompartmentEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ setupCompartmentTitle(view);
+ setupCompartmentCollapsed(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentTitle(View view) {
+ TitleStyle titleStyle = (TitleStyle) view.getStyle(NotationPackage.eINSTANCE.getTitleStyle());
+ if (titleStyle != null) {
+ titleStyle.setShowTitle(true);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentCollapsed(View view) {
+ DrawerStyle drawerStyle = (DrawerStyle) view.getStyle(NotationPackage.eINSTANCE.getDrawerStyle());
+ if (drawerStyle != null) {
+ drawerStyle.setCollapsed(false);
+ }
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SignalName2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SignalName2ViewFactory.java
new file mode 100644
index 00000000000..294d62d3203
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SignalName2ViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class SignalName2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SignalName3ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SignalName3ViewFactory.java
new file mode 100644
index 00000000000..af33e974c81
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SignalName3ViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class SignalName3ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SignalName4ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SignalName4ViewFactory.java
new file mode 100644
index 00000000000..bdf213ee12c
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SignalName4ViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class SignalName4ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SignalNameViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SignalNameViewFactory.java
new file mode 100644
index 00000000000..b1f296a38dd
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SignalNameViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class SignalNameViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SignalQualifiedName2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SignalQualifiedName2ViewFactory.java
new file mode 100644
index 00000000000..a5506021705
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SignalQualifiedName2ViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class SignalQualifiedName2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SignalQualifiedNameViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SignalQualifiedNameViewFactory.java
new file mode 100644
index 00000000000..416c37c0ac3
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SignalQualifiedNameViewFactory.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class SignalQualifiedNameViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SignalViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SignalViewFactory.java
new file mode 100644
index 00000000000..a1477d0acfc
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SignalViewFactory.java
@@ -0,0 +1,80 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SignalAttributeCompartmentEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SignalEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SignalName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SignalNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SignalQualifiedNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class SignalViewFactory extends AbstractShapeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createShapeStyle());
+ {
+ HintedDiagramLinkStyle diagramFacet = NotationFactory.eINSTANCE.createHintedDiagramLinkStyle();
+ styles.add(diagramFacet);
+ }
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(SignalEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ if (!ModelEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
+ EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
+ shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
+ shortcutAnnotation.getDetails().put("modelID", ModelEditPart.MODEL_ID); //$NON-NLS-1$
+ view.getEAnnotations().add(shortcutAnnotation);
+ }
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(SignalNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(SignalName2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(SignalQualifiedNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(SignalAttributeCompartmentEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SlotViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SlotViewFactory.java
new file mode 100644
index 00000000000..42c6cde439d
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SlotViewFactory.java
@@ -0,0 +1,57 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
+import org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SlotEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class SlotViewFactory extends AbstractShapeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createDescriptionStyle());
+ styles.add(NotationFactory.eINSTANCE.createFillStyle());
+ styles.add(NotationFactory.eINSTANCE.createLineStyle());
+ {
+ HintedDiagramLinkStyle diagramFacet = NotationFactory.eINSTANCE.createHintedDiagramLinkStyle();
+ styles.add(diagramFacet);
+ }
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(SlotEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SubstitutionName2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SubstitutionName2ViewFactory.java
new file mode 100644
index 00000000000..ae7f1e803a1
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SubstitutionName2ViewFactory.java
@@ -0,0 +1,52 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
+import org.eclipse.gmf.runtime.notation.Location;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class SubstitutionName2ViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ public View createView(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Node view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
+ Location location = (Location) view.getLayoutConstraint();
+ IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView.getDiagram().getMeasurementUnit());
+ location.setX(mapMode.DPtoLP(0));
+ location.setY(mapMode.DPtoLP(60));
+ return view;
+ }
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SubstitutionNameViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SubstitutionNameViewFactory.java
new file mode 100644
index 00000000000..c13c54e7a1d
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SubstitutionNameViewFactory.java
@@ -0,0 +1,52 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
+import org.eclipse.gmf.runtime.notation.Location;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class SubstitutionNameViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ public View createView(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Node view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
+ Location location = (Location) view.getLayoutConstraint();
+ IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView.getDiagram().getMeasurementUnit());
+ location.setX(mapMode.DPtoLP(0));
+ location.setY(mapMode.DPtoLP(40));
+ return view;
+ }
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SubstitutionViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SubstitutionViewFactory.java
new file mode 100644
index 00000000000..436941697d2
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/SubstitutionViewFactory.java
@@ -0,0 +1,63 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.ConnectionViewFactory;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SubstitutionEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SubstitutionName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.SubstitutionNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class SubstitutionViewFactory extends ConnectionViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createRoutingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFontStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(SubstitutionEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(SubstitutionNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(SubstitutionName2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/TemplateBindingViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/TemplateBindingViewFactory.java
new file mode 100644
index 00000000000..85ecabdd221
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/TemplateBindingViewFactory.java
@@ -0,0 +1,61 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.ConnectionViewFactory;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateBindingEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.WrappingLabelEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class TemplateBindingViewFactory extends ConnectionViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createRoutingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFontStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(TemplateBindingEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(WrappingLabelEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/TemplateParameterViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/TemplateParameterViewFactory.java
new file mode 100644
index 00000000000..e48e8e9e26a
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/TemplateParameterViewFactory.java
@@ -0,0 +1,48 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.TemplateParameterEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class TemplateParameterViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(TemplateParameterEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/UsageName2ViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/UsageName2ViewFactory.java
new file mode 100644
index 00000000000..8346b623308
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/UsageName2ViewFactory.java
@@ -0,0 +1,52 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
+import org.eclipse.gmf.runtime.notation.Location;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class UsageName2ViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ public View createView(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Node view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
+ Location location = (Location) view.getLayoutConstraint();
+ IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView.getDiagram().getMeasurementUnit());
+ location.setX(mapMode.DPtoLP(0));
+ location.setY(mapMode.DPtoLP(60));
+ return view;
+ }
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/UsageNameViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/UsageNameViewFactory.java
new file mode 100644
index 00000000000..f73a8495145
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/UsageNameViewFactory.java
@@ -0,0 +1,52 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
+import org.eclipse.gmf.runtime.notation.Location;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class UsageNameViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ public View createView(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Node view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
+ Location location = (Location) view.getLayoutConstraint();
+ IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView.getDiagram().getMeasurementUnit());
+ location.setX(mapMode.DPtoLP(0));
+ location.setY(mapMode.DPtoLP(40));
+ return view;
+ }
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/UsageViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/UsageViewFactory.java
new file mode 100644
index 00000000000..09b2fae5f65
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/UsageViewFactory.java
@@ -0,0 +1,63 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.ConnectionViewFactory;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.UsageNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class UsageViewFactory extends ConnectionViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createRoutingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFontStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(UsageEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(UsageNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(UsageName2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/WrappingLabelViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/WrappingLabelViewFactory.java
new file mode 100644
index 00000000000..288269247a4
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/WrappingLabelViewFactory.java
@@ -0,0 +1,52 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
+import org.eclipse.gmf.runtime.notation.Location;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class WrappingLabelViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ public View createView(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Node view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
+ Location location = (Location) view.getLayoutConstraint();
+ IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView.getDiagram().getMeasurementUnit());
+ location.setX(mapMode.DPtoLP(0));
+ location.setY(mapMode.DPtoLP(40));
+ return view;
+ }
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}

Back to the top