Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrschnekenbu2013-07-29 16:47:25 +0000
committerrschnekenbu2013-07-29 16:47:25 +0000
commit23cac20a52852fcdc01bf52f69b594de1c94c18a (patch)
tree345fe565ed7e43dff6886cff1c3888550e944fc5 /plugins/sysml/diagram
parente03e83b41c3b36b37ffe02707ef1011763a443b4 (diff)
downloadorg.eclipse.papyrus-23cac20a52852fcdc01bf52f69b594de1c94c18a.tar.gz
org.eclipse.papyrus-23cac20a52852fcdc01bf52f69b594de1c94c18a.tar.xz
org.eclipse.papyrus-23cac20a52852fcdc01bf52f69b594de1c94c18a.zip
Apply patch from bug 297816: [SysML Parametric Diagram] Papyrus shall
provide a parametric diagram editor. https://bugs.eclipse.org/bugs/show_bug.cgi?id=297816
Diffstat (limited to 'plugins/sysml/diagram')
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/.classpath22
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/.project56
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/.settings/net.sf.jautodoc.prefs14
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/.settings/org.eclipse.jdt.core.prefs24
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/META-INF/MANIFEST.MF138
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/about.html56
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/build.properties22
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/model/SysML.ReusableParts.idgen269
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/model/UML.ReusableParts.idgen172
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/plugin.properties24
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/plugin.xml46
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/commands/CreateViewCommand.java124
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/commands/ISemanticHintAdapter.java54
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/commands/IdentityCommandWithNotification.java178
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/commands/SemanticElementAdapter.java174
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/compatibility/DiagramVersioningUtils.java124
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/compatibility/IDiagramVersionUpdater.java62
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/part/ITextAwareEditPart.java74
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/CommonDiagramDragDropEditPolicy.java742
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultContainerNodeEditPolicy.java144
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultCreationEditPolicy.java222
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultGraphicalNodeEditPolicy.java218
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultSemanticEditPolicy.java48
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultSnapBackEditPolicy.java216
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultXYLayoutEditPolicy.java174
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/ExternalLabelPrimaryDragRoleEditPolicy.java150
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/ILinkMappingHelper.java86
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/LabelDefaultSemanticEditPolicy.java168
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/LabelDirectEditPolicy.java218
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/LinkLabelDragEditPolicy.java78
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/TextNonResizableEditPolicy.java418
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/TextSelectionEditPolicy.java384
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/AbstractLabelViewFactory.java64
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/AffixedLabelViewFactory.java104
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/CompartmentListViewFactory.java66
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/CompartmentShapeViewFactory.java74
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/ConnectorLabelViewFactory.java104
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/ConnectorViewFactory.java124
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/InnerLabelViewFactory.java42
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/ShapeChildLabelViewFactory.java118
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/ShapeViewFactory.java118
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/figure/SelectableBorderedNodeFigure.java148
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/locator/CellEditorLocatorUtil.java72
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/locator/LabelCellEditorLocator.java104
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/locator/MultilineCellEditorLocator.java104
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/locator/TextCellEditorLocator.java112
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/parser/IMaskManagedSemanticParser.java68
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/AbstractViewProvider.java626
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/CustomAbstractEditPartProvider.java98
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/CustomAbstractViewProvider.java308
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/DiagramEditorUtil.java84
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/ElementTypeLabelProvider.java100
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/MarkerNavigationProvider.java182
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/ConstraintExtendedDirectEditionDialog.java16
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateActorPartWithTypeConfigureCommandFactory.java178
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateConstraintPropertyWithTypeConfigureCommandFactory.java154
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateFlowPortWithFlowSpecificationConfigureCommandFactory.java176
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreatePartWithTypeConfigureCommandFactory.java176
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateReferenceWithTypeConfigureCommandFactory.java176
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateValueWithTypeConfigureCommandFactory.java176
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectActorPartTypeDialog.java238
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectBlockPropertyTypeDialog.java242
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectConstraintPropertyTypeDialog.java122
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectNonAtomicFlowPortTypeDialog.java242
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectTypeDialog.java1210
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectValuePropertyTypeDialog.java568
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/ServiceEditContentProvider.java84
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/ConstraintBlockPropertyCompositeEditPart.java222
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/ConstraintPropertyChildLabelEditPart.java112
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/FlowPortAffixedLabelNameEditPart.java258
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/FlowPortChildLabelEditPart.java112
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/FlowPropertyChildLabelEditPart.java112
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/BlockPropertyStructureCompartmentSemanticEditPolicy.java6
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/CustomDuplicatePasteEditPolicy.java112
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/PartCompartmentSemanticEditPolicy.java5
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/PropertyCompartmentSemanticEditPolicy.java6
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/StructureCompartmentSemanticEditPolicy.java5
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/figure/AssociationFigure.java242
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/figure/FlowPortFigure.java68
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/messages/Messages.java298
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/messages/messages.properties16
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/FlowPortLabelParser.java502
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/FlowPropertyLabelParser.java264
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/RequirementLabelParser.java178
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/UnitLabelParser.java252
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/preferences/ILabelPreferenceConstants.java178
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/preferences/LabelPreferenceHelper.java100
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/dnd/helper/LinkMappingHelper.java312
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementBorderEditPart.java456
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementChildLabelEditPart.java1726
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementEditPart.java366
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementLabelEditPart.java1342
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementLinkEditPart.java490
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementNodeLabelEditPart.java1454
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractShapeCompartmentEditPart.java232
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AppliedStereotypeAffixedLabelEditPart.java254
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AppliedStereotypeLinkLabelEditPart.java160
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AssociationLinkLabelSourceMultiplicityEditPart.java182
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AssociationLinkLabelSourceRoleEditPart.java166
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AssociationLinkLabelTargetMultiplicityEditPart.java182
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AssociationLinkLabelTargetRoleEditPart.java166
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorLinkLabelEditPart.java106
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorLinkLabelSourceMultiplicityEditPart.java180
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorLinkLabelTargetMultiplicityEditPart.java180
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConstraintNodeLabelEditPart.java70
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/DefaultChildLabelEditPart.java70
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/NamedElementAffixedLabelNameEditPart.java242
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/NamedElementLinkLabelNameEditPart.java106
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/NamedElementNodeLabelNameEditPart.java98
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/PortAffixedLabelNameEditPart.java240
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/PropertyNodeLabelEditPart.java98
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/SlotChildLabelEditPart.java70
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/EncapsulatedClassifierResizableShapeEditPolicy.java252
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/MaskManagedLabelEditPolicy.java252
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/StructuredClassifierCreationEditPolicy.java280
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/figure/ConnectorEdgeFigure.java166
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/figure/EdgeDecorationType.java78
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/figure/GeneralizationFigure.java52
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/figure/InterfaceRealizationFigure.java48
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/figure/NamedElementEdgeFigure.java128
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/AssociationEndLabelParser.java338
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ConnectorLabelParser.java242
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ConstraintLabelParser.java414
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/DefaultParserHintAdapter.java86
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/MultiplicityElementLabelParser.java320
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/NamedElementLabelParser.java294
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/OperationLabelParser.java396
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ParameterLabelParser.java420
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/PropertyLabelParser.java484
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ReceptionLabelParser.java248
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/SlotLabelParser.java284
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/utils/AssociationViewUtils.java162
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/factory/ConstraintBlockPropertyCompositeClassifierViewFactory.java83
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/figure/ConstraintBlockPropertyCompositeFigure.java49
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/figure/SysMLDiagramFrameFigure.java151
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/utils/SysMLGraphicalTypes.java2
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorEditPart.java40
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/ConstraintParameterAffixedNodeEditPart.java201
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/factory/ConstraintPropertyAffixedNodeViewFactory.java (renamed from plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/DeleteElementAction.java)35
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/utils/UMLGraphicalTypes.java2
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/Activator.java612
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/commands/CreateSysMLModelCommand.java138
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/utils/SysMLSelectionTester.java286
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/.classpath16
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/.options7
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/.project56
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/.settings/Parametric.gmfgen.prefs8
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/.settings/org.eclipse.jdt.core.prefs15
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/.svnignore1
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/META-INF/MANIFEST.MF123
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/about.html56
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/build.properties26
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/CreateParametricDiagramCommand.java136
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/ParametricDiagramEditorFactory.java27
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/actions/RestoreRelatedLinksAction.java83
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/command/CreateConstraintPropertyCommand.java16
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/command/CreateParameterViewCommand.java123
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/command/RestoreRelatedLinksCommand.java335
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/CreateParameterEditPolicy.java56
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/CustomDiagramDragDropEditPolicy.java258
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/NoDeleteFromDiagramEditPolicy.java52
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/NoDeleteFromModelEditPolicy.java61
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/figures/CenteredWrappedLabel.java34
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/helper/ConnectorLinkMappingHelper.java90
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/helper/ModelValidationHelper.java150
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/helper/SelfCompartmentNotificationHelper.java223
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/locator/ParameterPositionLocator.java82
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/parsers/ConnectorLabelParser.java136
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/parsers/ConstraintLabelParser.java182
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/parsers/ConstraintPropertyLabelParser.java230
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/parsers/PropertyLabelParser.java223
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/providers/CustomEditPolicyProvider.java81
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/providers/ParametricDiagramContributionItemProvider.java39
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/providers/ParametricDiagramContributionPolicyClass.java46
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/texteditor/ConstraintPropertyConfiguration.java133
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/utils/PropertyLinkedToClassifier.java152
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/utils/PropertyLinkedToClassifierNode.java234
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/utils/Route.java102
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/icons/incomingLinksNavigatorGroup.gifbin709 -> 709 bytes
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/icons/linkSourceNavigatorGroup.gifbin709 -> 709 bytes
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/icons/linkTargetNavigatorGroup.gifbin709 -> 709 bytes
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/icons/linksNavigatorGroup.gifbin709 -> 709 bytes
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/icons/obj16/Diagram_Parametric.gifbin118 -> 118 bytes
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/icons/obj16/ResourceDiagramFile.gifbin339 -> 339 bytes
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/icons/outgoingLinksNavigatorGroup.gifbin709 -> 709 bytes
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/messages.properties133
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/model/Parametric.gmfgen559
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/model/Parametric.gmfgraph147
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/model/Parametric.gmfmap182
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/model/Parametric.gmftool56
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/model/Parametric.trace36
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/model/SysML.Parametric.idgen124
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/palettes/parametric.palette.xml41
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/plugin.properties69
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/plugin.xml1352
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/ParametricDiagramCreateCommand.java168
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/ParametricDiagramEditorFactory.java12
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/ParametricDiagramForMultiEditor.java (renamed from plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/ParametricDiagramForMultiEditor.java)217
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/ParametricDiagramEditPart.java31
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/edit/policy/DiagramSemanticEditPolicy.java43
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/edit/policy/ParametricDiagramDragDropEditPolicy.java38
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/factory/DiagramPaletteFactory.java62
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/factory/DiagramPaletteFactory.java.lost18
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/factory/ParametricDiagramViewFactory.java18
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/part/ParametricDiagramEditor.java51
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/BlockCompositePreferencePage.java83
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CommentAnnotatedElementPreferencePage.java30
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CommentPreferencePage.java31
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ConnectorPreferencePage.java61
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ConstraintConstrainedElementPreferencePage.java30
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ConstraintPreferencePage.java31
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/DependencyPreferencePage.java59
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/FlowPortPreferencePage.java60
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ParametricDiagramGeneralPreferencePage.java11
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ParametricDiagramLinkPreferencePage.java60
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ParametricDiagramNodePreferencePage.java106
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ParametricDiagramPreferenceInitializer.java28
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/PortPreferencePage.java60
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/CustomEditPartProvider.java120
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/CustomGraphicalTypeRegistry.java224
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/CustomGraphicalTypes.java13
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/CustomViewProvider.java87
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/ElementTypes.java52
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/GraphicalTypeRegistry.java195
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/IGraphicalTypeRegistry.java97
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/InheritedCompositeDiagramEditPartProvider.java54
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/InheritedCompositeDiagramViewProvider.java218
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/ParametricDiagramEditPartProvider.java37
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/ParametricDiagramEditPolicyProvider.java50
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/ParametricDiagramViewProvider.java31
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/utils/ParametricDiagramGraphicalTypes.java15
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/Activator.java105
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/CreateParametricDiagramWithNavigationHandler.java (renamed from plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/CreateParametricDiagramWithNavigationHandler.java)50
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/ParametricDiagramCondition.java (renamed from plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/ParametricDiagramCondition.java)84
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/CustomBindingConnectorCreateCommand.java113
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/commands/ConnectorCreateCommand.java174
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/commands/ConnectorReorientCommand.java190
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/commands/ConstraintPropertyCreateCommand.java138
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/commands/Property2CreateCommand.java141
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/commands/PropertyCreateCommand.java126
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/commands/SysmlReorientConnectionViewCommand.java80
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/helpers/ConnectorEditHelper.java20
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/helpers/ConstraintPropertyEditHelper.java20
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/helpers/ResourceEditHelper.java20
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/helpers/SysmlBaseEditHelper.java99
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomBlockCompositeEditPartTN.java69
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomBlockLabelNameEditPart.java17
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomBlockPropertyCompositeEditPart.java20
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomConstraintBlockPropertyCompositeEditPart.java21
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomConstraintParameterAffixedNodeEditPart.java19
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomPortAffixedNodeEditPart.java20
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/parts/ConnectorEditPart.java154
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/parts/ConnectorNameEditPart.java756
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/parts/ConstraintLabelEditPart.java767
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/parts/ConstraintPropertyEditPart.java496
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/parts/ConstraintPropertyNameEditPart.java792
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/parts/ParametricEditPart.java147
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/parts/Property2EditPart.java383
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/parts/PropertyEditPart.java427
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/parts/PropertyName2EditPart.java754
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/parts/PropertyNameEditPart.java800
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/parts/SysmlEditPartFactory.java228
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/ConnectorItemSemanticEditPolicy.java52
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/ConstraintPropertyCanonicalEditPolicy.java172
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/ConstraintPropertyItemSemanticEditPolicy.java115
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/OpenDiagramEditPolicy.java183
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/ParametricCanonicalEditPolicy.java352
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/ParametricItemSemanticEditPolicy.java80
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/Property2ItemSemanticEditPolicy.java111
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/PropertyItemSemanticEditPolicy.java111
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/SysmlBaseItemSemanticEditPolicy.java379
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/SysmlTextNonResizableEditPolicy.java236
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/SysmlTextSelectionEditPolicy.java220
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/figures/CustomBlockPropertyCompositeFigure.java24
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/figures/ParametricDiagramFrameFigure.java (renamed from plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/helpers/PropertyEditHelper.java)37
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/navigator/SysmlAbstractNavigatorItem.java71
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/navigator/SysmlDomainNavigatorContentProvider.java230
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/navigator/SysmlDomainNavigatorItem.java119
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/navigator/SysmlDomainNavigatorLabelProvider.java107
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/navigator/SysmlNavigatorActionProvider.java181
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/navigator/SysmlNavigatorContentProvider.java503
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/navigator/SysmlNavigatorGroup.java110
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/navigator/SysmlNavigatorItem.java97
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/navigator/SysmlNavigatorLabelProvider.java274
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/navigator/SysmlNavigatorLinkHelper.java128
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/navigator/SysmlNavigatorSorter.java40
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/parser/ParametricFrameParser.java22
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/parsers/AbstractParser.java431
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/parsers/MessageFormatParser.java202
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/DiagramEditorContextMenuProvider.java62
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/LoadResourceAction.java43
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/Messages.java367
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/ModelElementSelectionPage.java156
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlCreationWizard.java167
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlCreationWizardPage.java96
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlDiagramActionBarContributor.java60
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlDiagramEditor.java569
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlDiagramEditorPlugin.java333
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlDiagramEditorUtil.java377
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlDiagramUpdateCommand.java91
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlDiagramUpdater.java359
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlDocumentProvider.java988
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlInitDiagramFileAction.java99
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlLinkDescriptor.java105
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlMatchingStrategy.java47
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlNewDiagramFileWizard.java174
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlNodeDescriptor.java55
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlPaletteFactory.java111
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlUriEditorInputTester.java35
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlVisualIDRegistry.java283
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/ValidateAction.java264
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomDefaultSemanticEditPolicy.java94
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomDragDropEditPolicy.java277
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomParametricSemanticPolicy.java38
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/StructureClassifierDropEditPolicy.java139
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/BlockPropertyCompositePreferencePage.java42
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ConnectorPreferencePage.java88
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ConstraintParameterAsBorderItemPreferencePage.java302
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ConstraintPropertyPreferencePage.java64
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomBlockPropertyCompositePreferencePage.java327
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomConnectorPreferencePage.java464
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomConstraintPropertyCompositePreferencePage.java327
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomPreferenceInitializer.java80
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/DiagramAppearancePreferencePage.java31
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/DiagramConnectionsPreferencePage.java31
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/DiagramGeneralPreferencePage.java33
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/DiagramPreferenceInitializer.java45
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/DiagramPrintingPreferencePage.java31
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/DiagramRulersAndGridPreferencePage.java31
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/FlowPortAsBorderItemPreferencePage.java310
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/PortAsBorderItemPreferencePage.java301
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/PropertyPreferencePage.java64
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/provider/CustomEditPolicyProvider.java188
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/provider/ParserProvider.java107
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/providers/ElementInitializers.java38
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/providers/SysmlEditPartProvider.java154
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/providers/SysmlElementTypes.java252
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/providers/SysmlIconProvider.java44
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/providers/SysmlMarkerNavigationProvider.java94
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/providers/SysmlModelingAssistantProvider.java202
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/providers/SysmlParserProvider.java205
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/providers/SysmlValidationProvider.java166
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/providers/SysmlViewProvider.java489
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/sheet/SysmlPropertySection.java123
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/sheet/SysmlSheetLabelProvider.java91
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/utils/BlockDropHelper.java239
346 files changed, 22559 insertions, 38418 deletions
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/.classpath b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/.classpath
index 0fec5fb4af5..a93010f69d7 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/.classpath
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/.classpath
@@ -1,11 +1,11 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="src-gen"/>
- <classpathentry kind="src" path="src-common-sysml"/>
- <classpathentry kind="src" path="src-common-uml"/>
- <classpathentry kind="src" path="src-common-gmf"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="src-gen"/>
+ <classpathentry kind="src" path="src-common-sysml"/>
+ <classpathentry kind="src" path="src-common-uml"/>
+ <classpathentry kind="src" path="src-common-gmf"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/.project b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/.project
index cc9bf0a16f6..eac33086b37 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/.project
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/.project
@@ -1,28 +1,28 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.papyrus.sysml.diagram.common</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.sysml.diagram.common</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/.settings/net.sf.jautodoc.prefs b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/.settings/net.sf.jautodoc.prefs
index cf276e6a88f..f03f98026a8 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/.settings/net.sf.jautodoc.prefs
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/.settings/net.sf.jautodoc.prefs
@@ -1,7 +1,7 @@
-#Fri Aug 19 13:56:17 CEST 2011
-add_header=true
-eclipse.preferences.version=1
-header_text=/*****************************************************************************\r\n * Copyright (c) 2011 CEA LIST.\r\n *\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n *\r\n * Contributors\:\r\n *\t\t\r\n *\t\tCEA LIST - Initial API and implementation\r\n *\r\n *****************************************************************************/
-project_specific_settings=true
-replace_header=true
-replacements=<?xml version\="1.0" standalone\="yes"?>\n\n<replacements>\n<replacement key\="get" scope\="1" mode\="0">Gets the</replacement>\n<replacement key\="set" scope\="1" mode\="0">Sets the</replacement>\n<replacement key\="add" scope\="1" mode\="0">Adds the</replacement>\n<replacement key\="edit" scope\="1" mode\="0">Edits the</replacement>\n<replacement key\="remove" scope\="1" mode\="0">Removes the</replacement>\n<replacement key\="init" scope\="1" mode\="0">Inits the</replacement>\n<replacement key\="parse" scope\="1" mode\="0">Parses the</replacement>\n<replacement key\="create" scope\="1" mode\="0">Creates the</replacement>\n<replacement key\="build" scope\="1" mode\="0">Builds the</replacement>\n<replacement key\="is" scope\="1" mode\="0">Checks if is</replacement>\n<replacement key\="print" scope\="1" mode\="0">Prints the</replacement>\n<replacement key\="has" scope\="1" mode\="0">Checks for</replacement>\n</replacements>\n\n
+#Fri Aug 19 13:56:17 CEST 2011
+add_header=true
+eclipse.preferences.version=1
+header_text=/*****************************************************************************\r\n * Copyright (c) 2011 CEA LIST.\r\n *\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n *\r\n * Contributors\:\r\n *\t\t\r\n *\t\tCEA LIST - Initial API and implementation\r\n *\r\n *****************************************************************************/
+project_specific_settings=true
+replace_header=true
+replacements=<?xml version\="1.0" standalone\="yes"?>\n\n<replacements>\n<replacement key\="get" scope\="1" mode\="0">Gets the</replacement>\n<replacement key\="set" scope\="1" mode\="0">Sets the</replacement>\n<replacement key\="add" scope\="1" mode\="0">Adds the</replacement>\n<replacement key\="edit" scope\="1" mode\="0">Edits the</replacement>\n<replacement key\="remove" scope\="1" mode\="0">Removes the</replacement>\n<replacement key\="init" scope\="1" mode\="0">Inits the</replacement>\n<replacement key\="parse" scope\="1" mode\="0">Parses the</replacement>\n<replacement key\="create" scope\="1" mode\="0">Creates the</replacement>\n<replacement key\="build" scope\="1" mode\="0">Builds the</replacement>\n<replacement key\="is" scope\="1" mode\="0">Checks if is</replacement>\n<replacement key\="print" scope\="1" mode\="0">Prints the</replacement>\n<replacement key\="has" scope\="1" mode\="0">Checks for</replacement>\n</replacements>\n\n
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/.settings/org.eclipse.jdt.core.prefs b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/.settings/org.eclipse.jdt.core.prefs
index 35069b007a0..980d46758d6 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/.settings/org.eclipse.jdt.core.prefs
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/.settings/org.eclipse.jdt.core.prefs
@@ -1,12 +1,12 @@
-#Thu Apr 21 15:05:56 CEST 2011
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
+#Thu Apr 21 15:05:56 CEST 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/META-INF/MANIFEST.MF b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/META-INF/MANIFEST.MF
index 600341fe7a2..0e8dac95afe 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/META-INF/MANIFEST.MF
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/META-INF/MANIFEST.MF
@@ -1,69 +1,69 @@
-Manifest-Version: 1.0
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.papyrus.infra.core;bundle-version="0.10.1",
- org.eclipse.emf;bundle-version="2.6.0",
- org.eclipse.uml2.uml;bundle-version="3.1.0",
- org.eclipse.papyrus.sysml;bundle-version="0.10.1",
- org.eclipse.papyrus.uml.tools.utils;bundle-version="0.10.1",
- org.eclipse.core.expressions,
- org.eclipse.papyrus.uml.diagram.common;bundle-version="0.10.1",
- org.eclipse.papyrus.editor;bundle-version="0.10.1",
- org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="0.10.1",
- org.eclipse.papyrus.extensionpoints.editors;bundle-version="0.10.1",
- org.eclipse.papyrus.infra.services.edit;bundle-version="0.10.1",
- org.eclipse.papyrus.uml.service.types;bundle-version="0.10.1",
- org.eclipse.papyrus.sysml.service.types;bundle-version="0.10.1",
- org.eclipse.papyrus.infra.widgets.toolbox;bundle-version="0.10.1",
- org.eclipse.papyrus.infra.widgets;bundle-version="0.10.1",
- org.eclipse.papyrus.uml.modelexplorer.widgets;bundle-version="0.10.1",
- org.eclipse.draw2d;bundle-version="3.7.1",
- org.eclipse.gmf.runtime.diagram.core;bundle-version="1.4.1",
- org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.5.0",
- org.eclipse.papyrus.uml.tools;bundle-version="0.10.1",
- org.eclipse.papyrus.infra.emf;bundle-version="0.10.1",
- org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="0.10.1",
- org.eclipse.papyrus.infra.emf.appearance;bundle-version="0.10.1",
- org.eclipse.papyrus.uml.pastemanager;bundle-version="0.10.1",
- org.eclipse.papyrus.infra.core.log;bundle-version="0.10.1",
- org.eclipse.uml2.common.edit;bundle-version="1.6.0",
- org.eclipse.uml2.uml.edit;bundle-version="4.0.0",
- org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.1",
- org.eclipse.emf.edit.ui;bundle-version="2.8.0",
- org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.2.0",
- org.eclipse.papyrus.infra.services.labelprovider;bundle-version="0.10.1"
-Export-Package: org.eclipse.papyrus.gmf.diagram.common.commands,
- org.eclipse.papyrus.gmf.diagram.common.compatibility,
- org.eclipse.papyrus.gmf.diagram.common.edit.part,
- org.eclipse.papyrus.gmf.diagram.common.edit.policy,
- org.eclipse.papyrus.gmf.diagram.common.factory,
- org.eclipse.papyrus.gmf.diagram.common.locator,
- org.eclipse.papyrus.gmf.diagram.common.provider,
- org.eclipse.papyrus.sysml.diagram.common,
- org.eclipse.papyrus.sysml.diagram.common.commands,
- org.eclipse.papyrus.sysml.diagram.common.dialogs,
- org.eclipse.papyrus.sysml.diagram.common.edit.part,
- org.eclipse.papyrus.sysml.diagram.common.edit.policy,
- org.eclipse.papyrus.sysml.diagram.common.factory,
- org.eclipse.papyrus.sysml.diagram.common.figure,
- org.eclipse.papyrus.sysml.diagram.common.messages,
- org.eclipse.papyrus.sysml.diagram.common.parser,
- org.eclipse.papyrus.sysml.diagram.common.preferences,
- org.eclipse.papyrus.sysml.diagram.common.utils,
- org.eclipse.papyrus.uml.diagram.common.dnd.helper,
- org.eclipse.papyrus.uml.diagram.common.edit.part,
- org.eclipse.papyrus.uml.diagram.common.factory,
- org.eclipse.papyrus.uml.diagram.common.figure,
- org.eclipse.papyrus.uml.diagram.common.parser,
- org.eclipse.papyrus.uml.diagram.common.utils
-Bundle-Vendor: %providerName
-Bundle-ActivationPolicy: lazy
-Bundle-Version: 0.10.1.qualifier
-Bundle-Name: %pluginName
-Bundle-Localization: plugin
-Bundle-ManifestVersion: 2
-Bundle-Activator: org.eclipse.papyrus.sysml.diagram.common.Activator
-Bundle-SymbolicName: org.eclipse.papyrus.sysml.diagram.common;singleto
- n:=true
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-
+Manifest-Version: 1.0
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.papyrus.infra.core;bundle-version="0.10.1",
+ org.eclipse.emf;bundle-version="2.6.0",
+ org.eclipse.uml2.uml;bundle-version="3.1.0",
+ org.eclipse.papyrus.sysml;bundle-version="0.10.1",
+ org.eclipse.papyrus.uml.tools.utils;bundle-version="0.10.1",
+ org.eclipse.core.expressions,
+ org.eclipse.papyrus.uml.diagram.common;bundle-version="0.10.1",
+ org.eclipse.papyrus.editor;bundle-version="0.10.1",
+ org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="0.10.1",
+ org.eclipse.papyrus.extensionpoints.editors;bundle-version="0.10.1",
+ org.eclipse.papyrus.infra.services.edit;bundle-version="0.10.1",
+ org.eclipse.papyrus.uml.service.types;bundle-version="0.10.1",
+ org.eclipse.papyrus.sysml.service.types;bundle-version="0.10.1",
+ org.eclipse.papyrus.infra.widgets.toolbox;bundle-version="0.10.1",
+ org.eclipse.papyrus.infra.widgets;bundle-version="0.10.1",
+ org.eclipse.papyrus.uml.modelexplorer.widgets;bundle-version="0.10.1",
+ org.eclipse.draw2d;bundle-version="3.7.1",
+ org.eclipse.gmf.runtime.diagram.core;bundle-version="1.4.1",
+ org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.5.0",
+ org.eclipse.papyrus.uml.tools;bundle-version="0.10.1",
+ org.eclipse.papyrus.infra.emf;bundle-version="0.10.1",
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="0.10.1",
+ org.eclipse.papyrus.infra.emf.appearance;bundle-version="0.10.1",
+ org.eclipse.papyrus.uml.pastemanager;bundle-version="0.10.1",
+ org.eclipse.papyrus.infra.core.log;bundle-version="0.10.1",
+ org.eclipse.uml2.common.edit;bundle-version="1.6.0",
+ org.eclipse.uml2.uml.edit;bundle-version="4.0.0",
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.1",
+ org.eclipse.emf.edit.ui;bundle-version="2.8.0",
+ org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.2.0",
+ org.eclipse.papyrus.infra.services.labelprovider;bundle-version="0.10.1"
+Export-Package: org.eclipse.papyrus.gmf.diagram.common.commands,
+ org.eclipse.papyrus.gmf.diagram.common.compatibility,
+ org.eclipse.papyrus.gmf.diagram.common.edit.part,
+ org.eclipse.papyrus.gmf.diagram.common.edit.policy,
+ org.eclipse.papyrus.gmf.diagram.common.factory,
+ org.eclipse.papyrus.gmf.diagram.common.locator,
+ org.eclipse.papyrus.gmf.diagram.common.provider,
+ org.eclipse.papyrus.sysml.diagram.common,
+ org.eclipse.papyrus.sysml.diagram.common.commands,
+ org.eclipse.papyrus.sysml.diagram.common.dialogs,
+ org.eclipse.papyrus.sysml.diagram.common.edit.part,
+ org.eclipse.papyrus.sysml.diagram.common.edit.policy,
+ org.eclipse.papyrus.sysml.diagram.common.factory,
+ org.eclipse.papyrus.sysml.diagram.common.figure,
+ org.eclipse.papyrus.sysml.diagram.common.messages,
+ org.eclipse.papyrus.sysml.diagram.common.parser,
+ org.eclipse.papyrus.sysml.diagram.common.preferences,
+ org.eclipse.papyrus.sysml.diagram.common.utils,
+ org.eclipse.papyrus.uml.diagram.common.dnd.helper,
+ org.eclipse.papyrus.uml.diagram.common.edit.part,
+ org.eclipse.papyrus.uml.diagram.common.factory,
+ org.eclipse.papyrus.uml.diagram.common.figure,
+ org.eclipse.papyrus.uml.diagram.common.parser,
+ org.eclipse.papyrus.uml.diagram.common.utils
+Bundle-Vendor: %providerName
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 0.10.1.qualifier
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-ManifestVersion: 2
+Bundle-Activator: org.eclipse.papyrus.sysml.diagram.common.Activator
+Bundle-SymbolicName: org.eclipse.papyrus.sysml.diagram.common;singleto
+ n:=true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/about.html b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/about.html
index 82d49bf5f81..d35d5aed64c 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/about.html
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/about.html
@@ -1,28 +1,28 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
-<title>About</title>
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>June 5, 2007</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
-
-</body>
-</html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/build.properties b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/build.properties
index 86df25841da..58321663d25 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/build.properties
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/build.properties
@@ -1,11 +1,11 @@
-bin.includes = META-INF/,\
- .,\
- icons/,\
- about.html,\
- plugin.properties,\
- plugin.xml
-output..=bin/
-src.includes = icons/,\
- about.html
-source..=src/,src-gen/,src-common-uml/,src-common-sysml/,src-common-gmf/
-bin..=bin/
+bin.includes = META-INF/,\
+ .,\
+ icons/,\
+ about.html,\
+ plugin.properties,\
+ plugin.xml
+output..=bin/
+src.includes = icons/,\
+ about.html
+source..=src/,src-gen/,src-common-uml/,src-common-sysml/,src-common-gmf/
+bin..=bin/
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/model/SysML.ReusableParts.idgen b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/model/SysML.ReusableParts.idgen
index 7c5953d2b6b..bf9c0deaeee 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/model/SysML.ReusableParts.idgen
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/model/SysML.ReusableParts.idgen
@@ -1,131 +1,138 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<idgen:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:idgen="http://www.eclipse.org/papyrus/0.7.0/idgen" name="SysML Reusable Parts" type="" icon="" label="" language="" javaPackagePrefix="org.eclipse.papyrus.sysml.diagram.common" javaClassPrefix="SysML" createCommandLabel="">
- <customNodes xsi:type="idgen:CustomLabelNode" id="shape_sysml_constraintproperty_as_label" label="ConstraintProperty" editPart="org.eclipse.papyrus.sysml.diagram.common.edit.part.ConstraintPropertyChildLabelEditPart" semanticType="org.eclipse.papyrus.sysml.ConstraintProperty" labelMask="Visibility, Derive, Name, Type, Undefined_Type, Multiplicity, Default_Multiplicity, DefaultValue, Modifiers"/>
- <customNodes xsi:type="idgen:CustomLabelNode" id="shape_sysml_flowport_as_label" label="FlowPort" editPart="org.eclipse.papyrus.sysml.diagram.common.edit.part.FlowPortChildLabelEditPart" semanticType="org.eclipse.papyrus.sysml.FlowPort" labelMask="Direction, Visibility, Derive, Name, Type, Undefined_Type, Multiplicity, Default_Multiplicity, DefaultValue, Modifiers"/>
- <customNodes xsi:type="idgen:CustomLabelNode" id="shape_sysml_flowproperty_as_label" label="FlowProperty" editPart="org.eclipse.papyrus.sysml.diagram.common.edit.part.FlowPropertyChildLabelEditPart" semanticType="org.eclipse.papyrus.sysml.FlowProperty" labelMask="Direction, Visibility, Derive, Name, Type, Undefined_Type, Multiplicity, Default_Multiplicity, DefaultValue, Modifiers"/>
- <customNodes xsi:type="idgen:CustomLabelNode" id="shape_sysml_part_as_label" label="Part" semanticType="org.eclipse.papyrus.sysml.PartProperty" labelMask="Visibility, Derive, Name, Type, Undefined_Type, Multiplicity, Default_Multiplicity, DefaultValue, Modifiers">
- <editPart href="UML.ReusableParts.idgen#org.eclipse.papyrus.uml.diagram.common.edit.part.DefaultChildLabelEditPart"/>
- </customNodes>
- <customNodes xsi:type="idgen:CustomLabelNode" id="shape_sysml_reference_as_label" label="Reference" semanticType="org.eclipse.papyrus.sysml.ReferenceProperty" labelMask="Visibility, Derive, Name, Type, Undefined_Type, Multiplicity, Default_Multiplicity, DefaultValue, Modifiers">
- <editPart href="UML.ReusableParts.idgen#org.eclipse.papyrus.uml.diagram.common.edit.part.DefaultChildLabelEditPart"/>
- </customNodes>
- <customNodes xsi:type="idgen:CustomLabelNode" id="shape_sysml_value_as_label" label="Value" semanticType="org.eclipse.papyrus.sysml.ValueProperty" labelMask="Visibility, Derive, Name, Type, Undefined_Type, Multiplicity, Default_Multiplicity, DefaultValue, Modifiers">
- <editPart href="UML.ReusableParts.idgen#org.eclipse.papyrus.uml.diagram.common.edit.part.DefaultChildLabelEditPart"/>
- </customNodes>
- <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_sysml_block_as_classifier" label="Block" semanticPolicy="org.eclipse.papyrus.sysml.diagram.common.edit.policy.BlockCompositeSemanticEditPolicy" creationPolicy="org.eclipse.papyrus.uml.diagram.common.edit.policy.StructuredClassifierCreationEditPolicy" semanticType="org.eclipse.papyrus.sysml.Block" tag="block" labels="label_sysml_block_name">
- <affixedNodes href="#shape_sysml_flowport_as_affixed"/>
- <affixedNodes href="UML.ReusableParts.idgen#shape_uml_port_as_affixed"/>
- <borderedNodeFigure href="UML.ReusableParts.idgen#org.eclipse.papyrus.gmf.diagram.common.figure.SelectableBorderedNodeFigure"/>
- <compartments href="#compartment_sysml_property_as_list"/>
- <compartments href="#compartment_sysml_part_as_list"/>
- <compartments href="#compartment_sysml_reference_as_list"/>
- <compartments href="UML.ReusableParts.idgen#compartment_uml_port_as_list"/>
- <compartments href="#compartment_sysml_flowport_as_list"/>
- <compartments href="UML.ReusableParts.idgen#compartment_uml_operation_as_list"/>
- <compartments href="#compartment_sysml_constraint_as_list"/>
- <compartments href="#compartment_sysml_value_as_list"/>
- <visibleCompartments href="#compartment_sysml_property_as_list"/>
- <visibleCompartments href="UML.ReusableParts.idgen#compartment_uml_operation_as_list"/>
- <visibleCompartments href="#compartment_sysml_constraint_as_list"/>
- </customNodes>
- <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_sysml_block_as_composite" label="BlockComposite" semanticPolicy="org.eclipse.papyrus.sysml.diagram.common.edit.policy.BlockCompositeSemanticEditPolicy" creationPolicy="org.eclipse.papyrus.uml.diagram.common.edit.policy.StructuredClassifierCreationEditPolicy" semanticType="org.eclipse.papyrus.sysml.Block" tag="block" labels="label_sysml_block_name" compartments="compartment_sysml_structure" visibleCompartments="compartment_sysml_structure">
- <affixedNodes href="#shape_sysml_flowport_as_affixed"/>
- <affixedNodes href="UML.ReusableParts.idgen#shape_uml_port_as_affixed"/>
- <borderedNodeFigure href="UML.ReusableParts.idgen#org.eclipse.papyrus.gmf.diagram.common.figure.SelectableBorderedNodeFigure"/>
- </customNodes>
- <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_sysml_blockproperty_as_composite" label="BlockPropertyComposite" editPart="org.eclipse.papyrus.sysml.diagram.common.edit.part.BlockPropertyCompositeEditPart" semanticType="org.eclipse.papyrus.sysml.PartProperty" altSemanticTypes="org.eclipse.papyrus.sysml.ReferenceProperty" tag="[#runtime-defined]" compartments="compartment_sysml_blockproperty_structure" visibleCompartments="compartment_sysml_blockproperty_structure">
- <labels href="UML.ReusableParts.idgen#label_uml_property_label"/>
- <affixedNodes href="#shape_sysml_flowport_as_affixed"/>
- <affixedNodes href="UML.ReusableParts.idgen#shape_uml_port_as_affixed"/>
- <borderedNodeFigure href="UML.ReusableParts.idgen#org.eclipse.papyrus.gmf.diagram.common.figure.SelectableBorderedNodeFigure"/>
- </customNodes>
- <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_sysml_dimension_as_classifier" label="Dimension" semanticType="org.eclipse.papyrus.sysml.Dimension" tag="dimension" labels="label_sysml_dimension_name"/>
- <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_sysml_constraintblock_as_classifier" label="ConstraintBlock" semanticType="org.eclipse.papyrus.sysml.ConstraintBlock" tag="constraint" labels="label_sysml_constraintblock_name" compartments="compartment_sysml_parameter_as_list compartment_sysml_constraint_as_list" visibleCompartments="compartment_sysml_parameter_as_list compartment_sysml_constraint_as_list"/>
- <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_sysml_flowspecification_as_classifier" label="FlowSpecification" semanticType="org.eclipse.papyrus.sysml.FlowSpecification" tag="flowSpecification" labels="label_sysml_flowspecification_name" compartments="compartment_sysml_flowproperty_as_list" visibleCompartments="compartment_sysml_flowproperty_as_list"/>
- <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_sysml_unit_as_classifier" label="Unit" semanticType="org.eclipse.papyrus.sysml.Unit" labelMask="Name, Dimension" tag="unit" labels="label_sysml_unit_name"/>
- <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_sysml_valuetype_as_classifier" label="ValueType" semanticType="org.eclipse.papyrus.sysml.ValueType" tag="valuetype" labels="label_sysml_valuetype_name">
- <compartments href="UML.ReusableParts.idgen#compartment_uml_property_as_list"/>
- <compartments href="UML.ReusableParts.idgen#compartment_uml_operation_as_list"/>
- <visibleCompartments href="UML.ReusableParts.idgen#compartment_uml_property_as_list"/>
- <visibleCompartments href="UML.ReusableParts.idgen#compartment_uml_operation_as_list"/>
- </customNodes>
- <customNodes xsi:type="idgen:CustomAffixedNode" id="shape_sysml_flowport_as_affixed" label="FlowPort" editPart="org.eclipse.papyrus.sysml.diagram.common.edit.part.FlowPortAffixedNodeEditPart" semanticType="org.eclipse.papyrus.sysml.FlowPort" altSemanticTypes="org.eclipse.papyrus.sysml.FlowPort_In org.eclipse.papyrus.sysml.FlowPort_Out org.eclipse.papyrus.sysml.FlowPort_InOut">
- <affixedLabels href="#affixedlabel_sysml_flowport_label"/>
- <affixedLabels href="UML.ReusableParts.idgen#affixedlabel_uml_appliedstereotype"/>
- <locator href="UML.ReusableParts.idgen#org.eclipse.papyrus.uml.diagram.common.locator.PortPositionLocator"/>
- </customNodes>
- <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_sysml_nestedblockproperty_as_composite" label="NestedBlockPropertyComposite" editPart="org.eclipse.papyrus.sysml.diagram.common.edit.part.NestedBlockPropertyCompositeEditPart" semanticType="org.eclipse.papyrus.sysml.PartProperty" altSemanticTypes="org.eclipse.papyrus.sysml.ReferenceProperty" tag="[#runtime-defined]">
- <labels href="UML.ReusableParts.idgen#label_uml_property_label"/>
- <affixedNodes href="#shape_sysml_flowport_as_affixed"/>
- <affixedNodes href="UML.ReusableParts.idgen#shape_uml_port_as_affixed"/>
- <borderedNodeFigure href="UML.ReusableParts.idgen#org.eclipse.papyrus.gmf.diagram.common.figure.SelectableBorderedNodeFigure"/>
- </customNodes>
- <customEdges xsi:type="idgen:CustomLink" id="link_sysml_association" label="Association" editPart="org.eclipse.papyrus.sysml.diagram.common.edit.part.AssociationEditPart" semanticType="org.eclipse.papyrus.sysml.Association" altSemanticTypes="org.eclipse.papyrus.sysml.AssociationComposite org.eclipse.papyrus.sysml.AssociationCompositeDirected org.eclipse.papyrus.sysml.AssociationNone org.eclipse.papyrus.sysml.AssociationNoneDirected org.eclipse.papyrus.sysml.AssociationShared org.eclipse.papyrus.sysml.AssociationSharedDirected" figure="org.eclipse.papyrus.sysml.diagram.common.figure.AssociationFigure">
- <viewFactory href="UML.ReusableParts.idgen#org.eclipse.papyrus.uml.diagram.common.factory.AssociationLinkViewFactory"/>
- <labels href="UML.ReusableParts.idgen#linklabel_uml_namedelement_name"/>
- <labels href="UML.ReusableParts.idgen#linklabel_uml_association_source_role"/>
- <labels href="UML.ReusableParts.idgen#linklabel_uml_association_source_multiplicity"/>
- <labels href="UML.ReusableParts.idgen#linklabel_uml_association_target_role"/>
- <labels href="UML.ReusableParts.idgen#linklabel_uml_association_target_multiplicity"/>
- </customEdges>
- <customDecorations xsi:type="idgen:CustomCompartment" id="compartment_sysml_constraint_as_list" label="BlockConstraint" title="constraints"/>
- <customDecorations xsi:type="idgen:CustomCompartment" id="compartment_sysml_flowport_as_list" label="FlowPort" semanticPolicy="org.eclipse.papyrus.sysml.diagram.common.edit.policy.FlowPortCompartmentSemanticEditPolicy" title="flow ports"/>
- <customDecorations xsi:type="idgen:CustomCompartment" id="compartment_sysml_flowproperty_as_list" label="FlowProperty" title="flow properties"/>
- <customDecorations xsi:type="idgen:CustomCompartment" id="compartment_sysml_parameter_as_list" label="Parameter" semanticPolicy="org.eclipse.papyrus.sysml.diagram.common.edit.policy.ConstraintParameterCompartmentSemanticEditPolicy" title="parameters"/>
- <customDecorations xsi:type="idgen:CustomCompartment" id="compartment_sysml_part_as_list" label="PartProperty" semanticPolicy="org.eclipse.papyrus.sysml.diagram.common.edit.policy.PartCompartmentSemanticEditPolicy" title="parts"/>
- <customDecorations xsi:type="idgen:CustomCompartment" id="compartment_sysml_property_as_list" label="BlockProperty" semanticPolicy="org.eclipse.papyrus.sysml.diagram.common.edit.policy.PropertyCompartmentSemanticEditPolicy" title="properties"/>
- <customDecorations xsi:type="idgen:CustomCompartment" id="compartment_sysml_reference_as_list" label="ReferenceProperty" semanticPolicy="org.eclipse.papyrus.sysml.diagram.common.edit.policy.ReferenceCompartmentSemanticEditPolicy" title="references"/>
- <customDecorations xsi:type="idgen:CustomCompartment" id="compartment_sysml_structure" label="Structure" semanticPolicy="org.eclipse.papyrus.sysml.diagram.common.edit.policy.StructureCompartmentSemanticEditPolicy" title="structure" list="false"/>
- <customDecorations xsi:type="idgen:CustomCompartment" id="compartment_sysml_blockproperty_structure" label="BlockPropertyStructure" semanticPolicy="org.eclipse.papyrus.sysml.diagram.common.edit.policy.BlockPropertyStructureCompartmentSemanticEditPolicy" title="structure" list="false"/>
- <customDecorations xsi:type="idgen:CustomCompartment" id="compartment_sysml_value_as_list" label="ValueProperty" semanticPolicy="org.eclipse.papyrus.sysml.diagram.common.edit.policy.ValueCompartmentSemanticEditPolicy" title="values"/>
- <customDecorations xsi:type="idgen:CustomAffixedLabel" id="affixedlabel_sysml_flowport_label" label="FlowPortAffixedLabel" editPart="org.eclipse.papyrus.sysml.diagram.common.edit.part.FlowPortAffixedLabelNameEditPart" role="Label">
- <locator href="UML.ReusableParts.idgen#org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator"/>
- </customDecorations>
- <customDecorations xsi:type="idgen:CustomClassifierInnerLabel" id="label_sysml_block_name" label="BlockLabelName" specificIconKey=""/>
- <customDecorations xsi:type="idgen:CustomClassifierInnerLabel" id="label_sysml_constraintblock_name" label="ConstraintBlockLabelName" specificIconKey=""/>
- <customDecorations xsi:type="idgen:CustomClassifierInnerLabel" id="label_sysml_dimension_name" label="DimensionLabelName" specificIconKey=""/>
- <customDecorations xsi:type="idgen:CustomClassifierInnerLabel" id="label_sysml_flowspecification_name" label="FlowSpecificationLabelName" specificIconKey=""/>
- <customDecorations xsi:type="idgen:CustomClassifierInnerLabel" id="label_sysml_unit_name" label="UnitLabelName" specificIconKey=""/>
- <customDecorations xsi:type="idgen:CustomClassifierInnerLabel" id="label_sysml_valuetype_name" label="ValueTypeLabelName" specificIconKey=""/>
- <semanticTypes id="org.eclipse.papyrus.sysml.Block" name="Block" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.papyrus.sysml/icons/blocks/Block.gif"/>
- <semanticTypes id="org.eclipse.papyrus.sysml.ConstraintBlock" name="ConstraintBlock" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.papyrus.sysml/icons/constraints/ConstraintBlock.gif"/>
- <semanticTypes id="org.eclipse.papyrus.sysml.ConstraintProperty" name="ConstraintProperty" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.papyrus.sysml/icons/constraints/ConstraintProperty.gif"/>
- <semanticTypes id="org.eclipse.papyrus.sysml.Dimension" name="Dimension" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.papyrus.sysml/icons/blocks/Dimension.gif"/>
- <semanticTypes id="org.eclipse.papyrus.sysml.FlowPort" name="FlowPort" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.papyrus.sysml/icons/portandflows/FlowPort.gif"/>
- <semanticTypes id="org.eclipse.papyrus.sysml.FlowPort_In" name="FlowPort_In" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.papyrus.sysml/icons/portandflows/FlowPort.gif"/>
- <semanticTypes id="org.eclipse.papyrus.sysml.FlowPort_Out" name="FlowPort_Out" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.papyrus.sysml/icons/portandflows/FlowPort.gif"/>
- <semanticTypes id="org.eclipse.papyrus.sysml.FlowPort_InOut" name="FlowPort_InOut" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.papyrus.sysml/icons/portandflows/FlowPort.gif"/>
- <semanticTypes id="org.eclipse.papyrus.sysml.FlowProperty" name="FlowProperty" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.papyrus.sysml/icons/portandflows/FlowProperty.gif"/>
- <semanticTypes id="org.eclipse.papyrus.sysml.FlowSpecification" name="FlowSpecification" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.papyrus.sysml/icons/portandflows/FlowSpecification.gif"/>
- <semanticTypes id="org.eclipse.papyrus.sysml.PartProperty" name="PartProperty" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Property.gif"/>
- <semanticTypes id="org.eclipse.papyrus.sysml.ReferenceProperty" name="ReferenceProperty" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Property.gif"/>
- <semanticTypes id="org.eclipse.papyrus.sysml.Unit" name="Unit" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.papyrus.sysml/icons/blocks/Unit.gif"/>
- <semanticTypes id="org.eclipse.papyrus.sysml.ValueProperty" name="ValueProperty" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Property.gif"/>
- <semanticTypes id="org.eclipse.papyrus.sysml.ValueType" name="ValueType" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.papyrus.sysml/icons/blocks/ValueType.gif"/>
- <semanticTypes id="org.eclipse.papyrus.sysml.Association" name="Association" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Association.gif"/>
- <semanticTypes id="org.eclipse.papyrus.sysml.AssociationNone" name="AssociationNone" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Association.gif"/>
- <semanticTypes id="org.eclipse.papyrus.sysml.AssociationNoneDirected" name="AssociationNoneDirected" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.papyrus.uml.service.types/icons/Association_none_directed.gif"/>
- <semanticTypes id="org.eclipse.papyrus.sysml.AssociationComposite" name="AssociationComposite" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Association_composite.gif"/>
- <semanticTypes id="org.eclipse.papyrus.sysml.AssociationCompositeDirected" name="AssociationCompositeDirected" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.papyrus.uml.service.types/icons/Association_composite_directed.gif"/>
- <semanticTypes id="org.eclipse.papyrus.sysml.AssociationShared" name="AssociationShared" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Association_shared.gif"/>
- <semanticTypes id="org.eclipse.papyrus.sysml.AssociationSharedDirected" name="AssociationSharedDirected" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Association_shared_directed.gif"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.part.NestedBlockPropertyCompositeEditPart"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.policy.StructuredClassifierCreationEditPolicy"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.part.ConstraintPropertyChildLabelEditPart"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.part.FlowPortAffixedLabelNameEditPart"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.part.FlowPortAffixedNodeEditPart"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.part.FlowPropertyChildLabelEditPart"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.part.FlowPortChildLabelEditPart"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.part.BlockPropertyCompositeEditPart"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.part.AssociationEditPart"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.figure.AssociationFigure"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.policy.ConstraintParameterCompartmentSemanticEditPolicy"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.policy.PartCompartmentSemanticEditPolicy"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.policy.PropertyCompartmentSemanticEditPolicy"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.policy.ReferenceCompartmentSemanticEditPolicy"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.policy.StructureCompartmentSemanticEditPolicy"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.policy.ValueCompartmentSemanticEditPolicy"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.policy.BlockPropertyStructureCompartmentSemanticEditPolicy"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.policy.BlockCompositeSemanticEditPolicy"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.policy.FlowPortCompartmentSemanticEditPolicy"/>
-</idgen:Diagram>
+<?xml version="1.0" encoding="UTF-8"?>
+<idgen:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:idgen="http://www.eclipse.org/papyrus/0.7.0/idgen" name="SysML Reusable Parts" type="" icon="" label="" language="" javaPackagePrefix="org.eclipse.papyrus.sysml.diagram.common" javaClassPrefix="SysML" createCommandLabel="">
+ <customNodes xsi:type="idgen:CustomLabelNode" id="shape_sysml_constraintproperty_as_label" label="ConstraintProperty" editPart="org.eclipse.papyrus.sysml.diagram.common.edit.part.ConstraintPropertyChildLabelEditPart" semanticType="org.eclipse.papyrus.sysml.ConstraintProperty" labelMask="Visibility, Derive, Name, Type, Undefined_Type, Multiplicity, Default_Multiplicity, DefaultValue, Modifiers"/>
+ <customNodes xsi:type="idgen:CustomLabelNode" id="shape_sysml_flowport_as_label" label="FlowPort" editPart="org.eclipse.papyrus.sysml.diagram.common.edit.part.FlowPortChildLabelEditPart" semanticType="org.eclipse.papyrus.sysml.FlowPort" labelMask="Direction, Visibility, Derive, Name, Type, Undefined_Type, Multiplicity, Default_Multiplicity, DefaultValue, Modifiers"/>
+ <customNodes xsi:type="idgen:CustomLabelNode" id="shape_sysml_flowproperty_as_label" label="FlowProperty" editPart="org.eclipse.papyrus.sysml.diagram.common.edit.part.FlowPropertyChildLabelEditPart" semanticType="org.eclipse.papyrus.sysml.FlowProperty" labelMask="Direction, Visibility, Derive, Name, Type, Undefined_Type, Multiplicity, Default_Multiplicity, DefaultValue, Modifiers"/>
+ <customNodes xsi:type="idgen:CustomLabelNode" id="shape_sysml_part_as_label" label="Part" semanticType="org.eclipse.papyrus.sysml.PartProperty" labelMask="Visibility, Derive, Name, Type, Undefined_Type, Multiplicity, Default_Multiplicity, DefaultValue, Modifiers">
+ <editPart href="UML.ReusableParts.idgen#org.eclipse.papyrus.uml.diagram.common.edit.part.DefaultChildLabelEditPart"/>
+ </customNodes>
+ <customNodes xsi:type="idgen:CustomLabelNode" id="shape_sysml_reference_as_label" label="Reference" semanticType="org.eclipse.papyrus.sysml.ReferenceProperty" labelMask="Visibility, Derive, Name, Type, Undefined_Type, Multiplicity, Default_Multiplicity, DefaultValue, Modifiers">
+ <editPart href="UML.ReusableParts.idgen#org.eclipse.papyrus.uml.diagram.common.edit.part.DefaultChildLabelEditPart"/>
+ </customNodes>
+ <customNodes xsi:type="idgen:CustomLabelNode" id="shape_sysml_value_as_label" label="Value" semanticType="org.eclipse.papyrus.sysml.ValueProperty" labelMask="Visibility, Derive, Name, Type, Undefined_Type, Multiplicity, Default_Multiplicity, DefaultValue, Modifiers">
+ <editPart href="UML.ReusableParts.idgen#org.eclipse.papyrus.uml.diagram.common.edit.part.DefaultChildLabelEditPart"/>
+ </customNodes>
+ <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_sysml_block_as_classifier" label="Block" semanticPolicy="org.eclipse.papyrus.sysml.diagram.common.edit.policy.BlockCompositeSemanticEditPolicy" creationPolicy="org.eclipse.papyrus.uml.diagram.common.edit.policy.StructuredClassifierCreationEditPolicy" semanticType="org.eclipse.papyrus.sysml.Block" tag="block" labels="label_sysml_block_name">
+ <affixedNodes href="#shape_sysml_flowport_as_affixed"/>
+ <affixedNodes href="UML.ReusableParts.idgen#shape_uml_port_as_affixed"/>
+ <borderedNodeFigure href="UML.ReusableParts.idgen#org.eclipse.papyrus.gmf.diagram.common.figure.SelectableBorderedNodeFigure"/>
+ <compartments href="#compartment_sysml_property_as_list"/>
+ <compartments href="#compartment_sysml_part_as_list"/>
+ <compartments href="#compartment_sysml_reference_as_list"/>
+ <compartments href="UML.ReusableParts.idgen#compartment_uml_port_as_list"/>
+ <compartments href="#compartment_sysml_flowport_as_list"/>
+ <compartments href="UML.ReusableParts.idgen#compartment_uml_operation_as_list"/>
+ <compartments href="#compartment_sysml_constraint_as_list"/>
+ <compartments href="#compartment_sysml_value_as_list"/>
+ <visibleCompartments href="#compartment_sysml_property_as_list"/>
+ <visibleCompartments href="UML.ReusableParts.idgen#compartment_uml_operation_as_list"/>
+ <visibleCompartments href="#compartment_sysml_constraint_as_list"/>
+ </customNodes>
+ <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_sysml_block_as_composite" label="BlockComposite" semanticPolicy="org.eclipse.papyrus.sysml.diagram.common.edit.policy.BlockCompositeSemanticEditPolicy" creationPolicy="org.eclipse.papyrus.uml.diagram.common.edit.policy.StructuredClassifierCreationEditPolicy" semanticType="org.eclipse.papyrus.sysml.Block" tag="block" labels="label_sysml_block_name" compartments="compartment_sysml_structure" visibleCompartments="compartment_sysml_structure">
+ <affixedNodes href="#shape_sysml_flowport_as_affixed"/>
+ <affixedNodes href="UML.ReusableParts.idgen#shape_uml_port_as_affixed"/>
+ <borderedNodeFigure href="UML.ReusableParts.idgen#org.eclipse.papyrus.gmf.diagram.common.figure.SelectableBorderedNodeFigure"/>
+ </customNodes>
+ <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_sysml_blockproperty_as_composite" label="BlockPropertyComposite" editPart="org.eclipse.papyrus.sysml.diagram.common.edit.part.BlockPropertyCompositeEditPart" semanticType="org.eclipse.papyrus.sysml.PartProperty" altSemanticTypes="org.eclipse.papyrus.sysml.ReferenceProperty" tag="[#runtime-defined]" compartments="compartment_sysml_blockproperty_structure" visibleCompartments="compartment_sysml_blockproperty_structure">
+ <labels href="UML.ReusableParts.idgen#label_uml_property_label"/>
+ <affixedNodes href="#shape_sysml_flowport_as_affixed"/>
+ <affixedNodes href="UML.ReusableParts.idgen#shape_uml_port_as_affixed"/>
+ <borderedNodeFigure href="UML.ReusableParts.idgen#org.eclipse.papyrus.gmf.diagram.common.figure.SelectableBorderedNodeFigure"/>
+ </customNodes>
+ <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_sysml_constraintblockproperty_as_composite" label="ConstraintBlockPropertyComposite" editPart="org.eclipse.papyrus.sysml.diagram.common.edit.part.ConstraintBlockPropertyCompositeEditPart" semanticType="org.eclipse.papyrus.sysml.PartProperty" altSemanticTypes="org.eclipse.papyrus.sysml.ReferenceProperty" tag="[#runtime-defined]" compartments="compartment_sysml_blockproperty_structure" visibleCompartments="compartment_sysml_blockproperty_structure">
+ <labels href="UML.ReusableParts.idgen#label_uml_property_label"/>
+ <affixedNodes href="#shape_sysml_flowport_as_affixed"/>
+ <affixedNodes href="UML.ReusableParts.idgen#shape_uml_port_as_affixed"/>
+ <borderedNodeFigure href="UML.ReusableParts.idgen#org.eclipse.papyrus.gmf.diagram.common.figure.SelectableBorderedNodeFigure"/>
+ </customNodes>
+ <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_sysml_dimension_as_classifier" label="Dimension" semanticType="org.eclipse.papyrus.sysml.Dimension" tag="dimension" labels="label_sysml_dimension_name"/>
+ <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_sysml_constraintblock_as_classifier" label="ConstraintBlock" semanticType="org.eclipse.papyrus.sysml.ConstraintBlock" tag="constraint" labels="label_sysml_constraintblock_name" compartments="compartment_sysml_parameter_as_list compartment_sysml_constraint_as_list" visibleCompartments="compartment_sysml_parameter_as_list compartment_sysml_constraint_as_list"/>
+ <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_sysml_flowspecification_as_classifier" label="FlowSpecification" semanticType="org.eclipse.papyrus.sysml.FlowSpecification" tag="flowSpecification" labels="label_sysml_flowspecification_name" compartments="compartment_sysml_flowproperty_as_list" visibleCompartments="compartment_sysml_flowproperty_as_list"/>
+ <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_sysml_unit_as_classifier" label="Unit" semanticType="org.eclipse.papyrus.sysml.Unit" labelMask="Name, Dimension" tag="unit" labels="label_sysml_unit_name"/>
+ <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_sysml_valuetype_as_classifier" label="ValueType" semanticType="org.eclipse.papyrus.sysml.ValueType" tag="valuetype" labels="label_sysml_valuetype_name">
+ <compartments href="UML.ReusableParts.idgen#compartment_uml_property_as_list"/>
+ <compartments href="UML.ReusableParts.idgen#compartment_uml_operation_as_list"/>
+ <visibleCompartments href="UML.ReusableParts.idgen#compartment_uml_property_as_list"/>
+ <visibleCompartments href="UML.ReusableParts.idgen#compartment_uml_operation_as_list"/>
+ </customNodes>
+ <customNodes xsi:type="idgen:CustomAffixedNode" id="shape_sysml_flowport_as_affixed" label="FlowPort" editPart="org.eclipse.papyrus.sysml.diagram.common.edit.part.FlowPortAffixedNodeEditPart" semanticType="org.eclipse.papyrus.sysml.FlowPort" altSemanticTypes="org.eclipse.papyrus.sysml.FlowPort_In org.eclipse.papyrus.sysml.FlowPort_Out org.eclipse.papyrus.sysml.FlowPort_InOut">
+ <affixedLabels href="#affixedlabel_sysml_flowport_label"/>
+ <affixedLabels href="UML.ReusableParts.idgen#affixedlabel_uml_appliedstereotype"/>
+ <locator href="UML.ReusableParts.idgen#org.eclipse.papyrus.uml.diagram.common.locator.PortPositionLocator"/>
+ </customNodes>
+ <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_sysml_nestedblockproperty_as_composite" label="NestedBlockPropertyComposite" editPart="org.eclipse.papyrus.sysml.diagram.common.edit.part.NestedBlockPropertyCompositeEditPart" semanticType="org.eclipse.papyrus.sysml.PartProperty" altSemanticTypes="org.eclipse.papyrus.sysml.ReferenceProperty" tag="[#runtime-defined]">
+ <labels href="UML.ReusableParts.idgen#label_uml_property_label"/>
+ <affixedNodes href="#shape_sysml_flowport_as_affixed"/>
+ <affixedNodes href="UML.ReusableParts.idgen#shape_uml_port_as_affixed"/>
+ <borderedNodeFigure href="UML.ReusableParts.idgen#org.eclipse.papyrus.gmf.diagram.common.figure.SelectableBorderedNodeFigure"/>
+ </customNodes>
+ <customEdges xsi:type="idgen:CustomLink" id="link_sysml_association" label="Association" editPart="org.eclipse.papyrus.sysml.diagram.common.edit.part.AssociationEditPart" semanticType="org.eclipse.papyrus.sysml.Association" altSemanticTypes="org.eclipse.papyrus.sysml.AssociationComposite org.eclipse.papyrus.sysml.AssociationCompositeDirected org.eclipse.papyrus.sysml.AssociationNone org.eclipse.papyrus.sysml.AssociationNoneDirected org.eclipse.papyrus.sysml.AssociationShared org.eclipse.papyrus.sysml.AssociationSharedDirected" figure="org.eclipse.papyrus.sysml.diagram.common.figure.AssociationFigure">
+ <viewFactory href="UML.ReusableParts.idgen#org.eclipse.papyrus.uml.diagram.common.factory.AssociationLinkViewFactory"/>
+ <labels href="UML.ReusableParts.idgen#linklabel_uml_namedelement_name"/>
+ <labels href="UML.ReusableParts.idgen#linklabel_uml_association_source_role"/>
+ <labels href="UML.ReusableParts.idgen#linklabel_uml_association_source_multiplicity"/>
+ <labels href="UML.ReusableParts.idgen#linklabel_uml_association_target_role"/>
+ <labels href="UML.ReusableParts.idgen#linklabel_uml_association_target_multiplicity"/>
+ </customEdges>
+ <customDecorations xsi:type="idgen:CustomCompartment" id="compartment_sysml_constraint_as_list" label="BlockConstraint" title="constraints"/>
+ <customDecorations xsi:type="idgen:CustomCompartment" id="compartment_sysml_flowport_as_list" label="FlowPort" semanticPolicy="org.eclipse.papyrus.sysml.diagram.common.edit.policy.FlowPortCompartmentSemanticEditPolicy" title="flow ports"/>
+ <customDecorations xsi:type="idgen:CustomCompartment" id="compartment_sysml_flowproperty_as_list" label="FlowProperty" title="flow properties"/>
+ <customDecorations xsi:type="idgen:CustomCompartment" id="compartment_sysml_parameter_as_list" label="Parameter" semanticPolicy="org.eclipse.papyrus.sysml.diagram.common.edit.policy.ConstraintParameterCompartmentSemanticEditPolicy" title="parameters"/>
+ <customDecorations xsi:type="idgen:CustomCompartment" id="compartment_sysml_part_as_list" label="PartProperty" semanticPolicy="org.eclipse.papyrus.sysml.diagram.common.edit.policy.PartCompartmentSemanticEditPolicy" title="parts"/>
+ <customDecorations xsi:type="idgen:CustomCompartment" id="compartment_sysml_property_as_list" label="BlockProperty" semanticPolicy="org.eclipse.papyrus.sysml.diagram.common.edit.policy.PropertyCompartmentSemanticEditPolicy" title="properties"/>
+ <customDecorations xsi:type="idgen:CustomCompartment" id="compartment_sysml_reference_as_list" label="ReferenceProperty" semanticPolicy="org.eclipse.papyrus.sysml.diagram.common.edit.policy.ReferenceCompartmentSemanticEditPolicy" title="references"/>
+ <customDecorations xsi:type="idgen:CustomCompartment" id="compartment_sysml_structure" label="Structure" semanticPolicy="org.eclipse.papyrus.sysml.diagram.common.edit.policy.StructureCompartmentSemanticEditPolicy" title="structure" list="false"/>
+ <customDecorations xsi:type="idgen:CustomCompartment" id="compartment_sysml_blockproperty_structure" label="BlockPropertyStructure" semanticPolicy="org.eclipse.papyrus.sysml.diagram.common.edit.policy.BlockPropertyStructureCompartmentSemanticEditPolicy" title="structure" list="false"/>
+ <customDecorations xsi:type="idgen:CustomCompartment" id="compartment_sysml_value_as_list" label="ValueProperty" semanticPolicy="org.eclipse.papyrus.sysml.diagram.common.edit.policy.ValueCompartmentSemanticEditPolicy" title="values"/>
+ <customDecorations xsi:type="idgen:CustomAffixedLabel" id="affixedlabel_sysml_flowport_label" label="FlowPortAffixedLabel" editPart="org.eclipse.papyrus.sysml.diagram.common.edit.part.FlowPortAffixedLabelNameEditPart" role="Label">
+ <locator href="UML.ReusableParts.idgen#org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator"/>
+ </customDecorations>
+ <customDecorations xsi:type="idgen:CustomClassifierInnerLabel" id="label_sysml_block_name" label="BlockLabelName" specificIconKey=""/>
+ <customDecorations xsi:type="idgen:CustomClassifierInnerLabel" id="label_sysml_constraintblock_name" label="ConstraintBlockLabelName" specificIconKey=""/>
+ <customDecorations xsi:type="idgen:CustomClassifierInnerLabel" id="label_sysml_dimension_name" label="DimensionLabelName" specificIconKey=""/>
+ <customDecorations xsi:type="idgen:CustomClassifierInnerLabel" id="label_sysml_flowspecification_name" label="FlowSpecificationLabelName" specificIconKey=""/>
+ <customDecorations xsi:type="idgen:CustomClassifierInnerLabel" id="label_sysml_unit_name" label="UnitLabelName" specificIconKey=""/>
+ <customDecorations xsi:type="idgen:CustomClassifierInnerLabel" id="label_sysml_valuetype_name" label="ValueTypeLabelName" specificIconKey=""/>
+ <semanticTypes id="org.eclipse.papyrus.sysml.Block" name="Block" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.papyrus.sysml/icons/blocks/Block.gif"/>
+ <semanticTypes id="org.eclipse.papyrus.sysml.ConstraintBlock" name="ConstraintBlock" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.papyrus.sysml/icons/constraints/ConstraintBlock.gif"/>
+ <semanticTypes id="org.eclipse.papyrus.sysml.ConstraintProperty" name="ConstraintProperty" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.papyrus.sysml/icons/constraints/ConstraintProperty.gif"/>
+ <semanticTypes id="org.eclipse.papyrus.sysml.Dimension" name="Dimension" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.papyrus.sysml/icons/blocks/Dimension.gif"/>
+ <semanticTypes id="org.eclipse.papyrus.sysml.FlowPort" name="FlowPort" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.papyrus.sysml/icons/portandflows/FlowPort.gif"/>
+ <semanticTypes id="org.eclipse.papyrus.sysml.FlowPort_In" name="FlowPort_In" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.papyrus.sysml/icons/portandflows/FlowPort.gif"/>
+ <semanticTypes id="org.eclipse.papyrus.sysml.FlowPort_Out" name="FlowPort_Out" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.papyrus.sysml/icons/portandflows/FlowPort.gif"/>
+ <semanticTypes id="org.eclipse.papyrus.sysml.FlowPort_InOut" name="FlowPort_InOut" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.papyrus.sysml/icons/portandflows/FlowPort.gif"/>
+ <semanticTypes id="org.eclipse.papyrus.sysml.FlowProperty" name="FlowProperty" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.papyrus.sysml/icons/portandflows/FlowProperty.gif"/>
+ <semanticTypes id="org.eclipse.papyrus.sysml.FlowSpecification" name="FlowSpecification" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.papyrus.sysml/icons/portandflows/FlowSpecification.gif"/>
+ <semanticTypes id="org.eclipse.papyrus.sysml.PartProperty" name="PartProperty" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Property.gif"/>
+ <semanticTypes id="org.eclipse.papyrus.sysml.ReferenceProperty" name="ReferenceProperty" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Property.gif"/>
+ <semanticTypes id="org.eclipse.papyrus.sysml.Unit" name="Unit" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.papyrus.sysml/icons/blocks/Unit.gif"/>
+ <semanticTypes id="org.eclipse.papyrus.sysml.ValueProperty" name="ValueProperty" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Property.gif"/>
+ <semanticTypes id="org.eclipse.papyrus.sysml.ValueType" name="ValueType" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.papyrus.sysml/icons/blocks/ValueType.gif"/>
+ <semanticTypes id="org.eclipse.papyrus.sysml.Association" name="Association" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Association.gif"/>
+ <semanticTypes id="org.eclipse.papyrus.sysml.AssociationNone" name="AssociationNone" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Association.gif"/>
+ <semanticTypes id="org.eclipse.papyrus.sysml.AssociationNoneDirected" name="AssociationNoneDirected" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.papyrus.uml.service.types/icons/Association_none_directed.gif"/>
+ <semanticTypes id="org.eclipse.papyrus.sysml.AssociationComposite" name="AssociationComposite" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Association_composite.gif"/>
+ <semanticTypes id="org.eclipse.papyrus.sysml.AssociationCompositeDirected" name="AssociationCompositeDirected" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.papyrus.uml.service.types/icons/Association_composite_directed.gif"/>
+ <semanticTypes id="org.eclipse.papyrus.sysml.AssociationShared" name="AssociationShared" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Association_shared.gif"/>
+ <semanticTypes id="org.eclipse.papyrus.sysml.AssociationSharedDirected" name="AssociationSharedDirected" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Association_shared_directed.gif"/>
+ <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.part.NestedBlockPropertyCompositeEditPart"/>
+ <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.policy.StructuredClassifierCreationEditPolicy"/>
+ <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.part.ConstraintPropertyChildLabelEditPart"/>
+ <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.part.FlowPortAffixedLabelNameEditPart"/>
+ <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.part.FlowPortAffixedNodeEditPart"/>
+ <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.part.FlowPropertyChildLabelEditPart"/>
+ <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.part.FlowPortChildLabelEditPart"/>
+ <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.part.BlockPropertyCompositeEditPart"/>
+ <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.part.ConstraintBlockPropertyCompositeEditPart"/>
+ <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.part.AssociationEditPart"/>
+ <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.figure.AssociationFigure"/>
+ <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.policy.ConstraintParameterCompartmentSemanticEditPolicy"/>
+ <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.policy.PartCompartmentSemanticEditPolicy"/>
+ <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.policy.PropertyCompartmentSemanticEditPolicy"/>
+ <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.policy.ReferenceCompartmentSemanticEditPolicy"/>
+ <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.policy.StructureCompartmentSemanticEditPolicy"/>
+ <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.policy.ValueCompartmentSemanticEditPolicy"/>
+ <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.policy.BlockPropertyStructureCompartmentSemanticEditPolicy"/>
+ <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.policy.BlockCompositeSemanticEditPolicy"/>
+ <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.policy.FlowPortCompartmentSemanticEditPolicy"/>
+</idgen:Diagram>
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/model/UML.ReusableParts.idgen b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/model/UML.ReusableParts.idgen
index 14cc73df53b..94fb30a108a 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/model/UML.ReusableParts.idgen
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/model/UML.ReusableParts.idgen
@@ -1,86 +1,86 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<idgen:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:idgen="http://www.eclipse.org/papyrus/0.7.0/idgen" name="UML Reusable Parts" type="" icon="" label="" language="" javaPackagePrefix="org.eclipse.papyrus.uml.diagram.common" javaClassPrefix="UML" createCommandLabel="">
- <customNodes xsi:type="idgen:CustomLabelNode" id="shape_uml_constraint_as_label" label="Constraint" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.DefaultChildLabelEditPart" semanticType="org.eclipse.papyrus.uml.Constraint" labelMask="Name, Specification"/>
- <customNodes xsi:type="idgen:CustomLabelNode" id="shape_uml_enumerationliteral_as_label" label="EnumerationLiteral" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.DefaultChildLabelEditPart" semanticType="org.eclipse.papyrus.uml.EnumerationLiteral" labelMask=""/>
- <customNodes xsi:type="idgen:CustomLabelNode" id="shape_uml_operation_as_label" label="Operation" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.DefaultChildLabelEditPart" semanticType="org.eclipse.papyrus.uml.Operation" labelMask="Visibility, Name, Type, Modifiers, Param_Direction, Param_Name, Param_Type, Param_Multiplicity, Param_DefaultValue, Param_Modifiers"/>
- <customNodes xsi:type="idgen:CustomLabelNode" id="shape_uml_port_as_label" label="Port" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.DefaultChildLabelEditPart" semanticType="org.eclipse.papyrus.uml.Port" labelMask="Visibility, Derive, Name, Type, Undefined_Type, Multiplicity, Default_Multiplicity, DefaultValue, Modifiers"/>
- <customNodes xsi:type="idgen:CustomLabelNode" id="shape_uml_property_as_label" label="Property" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.DefaultChildLabelEditPart" semanticType="org.eclipse.papyrus.uml.Property" labelMask="Visibility, Derive, Name, Type, Undefined_Type, Multiplicity, Default_Multiplicity, DefaultValue, Modifiers"/>
- <customNodes xsi:type="idgen:CustomLabelNode" id="shape_uml_reception_as_label" label="Reception" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.DefaultChildLabelEditPart" semanticType="org.eclipse.papyrus.uml.Reception" labelMask="Name, Signal"/>
- <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_uml_actor_as_classifier" label="Actor" viewFactory="org.eclipse.papyrus.uml.diagram.common.factory.ClassifierViewFactory" semanticType="org.eclipse.papyrus.uml.Actor" labels="label_uml_namedelement_name" compartments="compartment_uml_property_as_list compartment_uml_operation_as_list"/>
- <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_uml_datatype_as_classifier" label="DataType" viewFactory="org.eclipse.papyrus.uml.diagram.common.factory.ClassifierViewFactory" semanticType="org.eclipse.papyrus.uml.DataType" tag="datatype" labels="label_uml_namedelement_name" compartments="compartment_uml_property_as_list compartment_uml_operation_as_list" visibleCompartments="compartment_uml_property_as_list"/>
- <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_uml_enumeration_as_classifier" label="Enumeration" semanticType="org.eclipse.papyrus.uml.Enumeration" labels="label_uml_namedelement_name" compartments="compartment_uml_enumerationliteral_as_list" visibleCompartments="compartment_uml_enumerationliteral_as_list"/>
- <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_uml_interface_as_classifier" label="Interface" viewFactory="org.eclipse.papyrus.uml.diagram.common.factory.ClassifierViewFactory" semanticType="org.eclipse.papyrus.uml.Interface" tag="" labels="label_uml_namedelement_name" compartments="compartment_uml_property_as_list compartment_uml_operation_as_list" visibleCompartments="compartment_uml_property_as_list compartment_uml_operation_as_list"/>
- <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_uml_primitivetype_as_classifier" label="PrimitiveType" semanticType="org.eclipse.papyrus.uml.PrimitiveType" tag="primitive" labels="label_uml_namedelement_name"/>
- <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_uml_signal_as_classifier" label="Signal" viewFactory="org.eclipse.papyrus.uml.diagram.common.factory.ClassifierViewFactory" semanticType="org.eclipse.papyrus.uml.Signal" tag="" labels="label_uml_namedelement_name" compartments="compartment_uml_property_as_list compartment_uml_operation_as_list"/>
- <customNodes xsi:type="idgen:CustomAffixedNode" id="shape_uml_port_as_affixed" label="Port" semanticType="org.eclipse.papyrus.uml.Port" affixedLabels="affixedlabel_uml_port_label affixedlabel_uml_appliedstereotype" locator="org.eclipse.papyrus.uml.diagram.common.locator.PortPositionLocator"/>
- <customEdges xsi:type="idgen:CustomLink" id="link_uml_dependency" label="Dependency" semanticType="org.eclipse.papyrus.uml.Dependency" labels="linklabel_uml_namedelement_name" figure="org.eclipse.papyrus.uml.diagram.common.figure.NamedElementEdgeFigure"/>
- <customEdges xsi:type="idgen:CustomLink" id="link_uml_connector" label="Connector" semanticType="org.eclipse.papyrus.uml.Connector" labels="linklabel_uml_connector_label linklabel_uml_connector_source_multiplicity linklabel_uml_connector_target_multiplicity" figure="org.eclipse.papyrus.uml.diagram.common.figure.ConnectorEdgeFigure"/>
- <customEdges xsi:type="idgen:CustomLink" id="link_uml_generalization" label="Generalization" semanticType="org.eclipse.papyrus.uml.Generalization" figure="org.eclipse.papyrus.uml.diagram.common.figure.GeneralizationFigure"/>
- <customEdges xsi:type="idgen:CustomLink" id="link_uml_interfacerealization" label="InterfaceRealization" semanticType="org.eclipse.papyrus.uml.InterfaceRealization" labels="linklabel_uml_namedelement_name" figure="org.eclipse.papyrus.uml.diagram.common.figure.InterfaceRealizationFigure"/>
- <customEdges xsi:type="idgen:CustomLink" id="link_uml_usage" label="Usage" semanticType="org.eclipse.papyrus.uml.Usage" tag="use" labels="linklabel_uml_namedelement_name" figure="org.eclipse.papyrus.uml.diagram.common.figure.NamedElementEdgeFigure"/>
- <customDecorations xsi:type="idgen:CustomCompartment" id="compartment_uml_constraint_as_list" label="Constraint" title="constraints" children="shape_uml_constraint_as_label"/>
- <customDecorations xsi:type="idgen:CustomCompartment" id="compartment_uml_enumerationliteral_as_list" label="EnumerationLiteral" title="literals" children="shape_uml_enumerationliteral_as_label"/>
- <customDecorations xsi:type="idgen:CustomCompartment" id="compartment_uml_operation_as_list" label="Operation" title="operations" children="shape_uml_operation_as_label shape_uml_reception_as_label"/>
- <customDecorations xsi:type="idgen:CustomCompartment" id="compartment_uml_port_as_list" label="Port" title="standard ports" children="shape_uml_port_as_label"/>
- <customDecorations xsi:type="idgen:CustomCompartment" id="compartment_uml_property_as_list" label="Property" title="properties" children="shape_uml_property_as_label shape_uml_port_as_label"/>
- <customDecorations xsi:type="idgen:CustomAffixedLabel" id="affixedlabel_uml_appliedstereotype" label="AppliedStereotypeAffixedLabel" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.AppliedStereotypeAffixedLabelEditPart" locator="org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator" role="Name"/>
- <customDecorations xsi:type="idgen:CustomAffixedLabel" id="affixedlabel_uml_namedelement_name" label="NamedElementAffixedLabelName" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.NamedElementAffixedLabelNameEditPart" locator="org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator" role="Name"/>
- <customDecorations xsi:type="idgen:CustomAffixedLabel" id="affixedlabel_uml_port_label" label="PortAffixedLabel" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.PortAffixedLabelNameEditPart" locator="org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator" role="Label"/>
- <customDecorations xsi:type="idgen:CustomInnerLabel" id="label_uml_namedelement_name" label="NamedElementNodeLabel" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.NamedElementNodeLabelNameEditPart"/>
- <customDecorations xsi:type="idgen:CustomInnerLabel" id="label_uml_property_label" label="PropertyNodeLabel" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.PropertyNodeLabelEditPart"/>
- <customDecorations xsi:type="idgen:CustomLinkLabel" id="linklabel_uml_connector_label" label="ConnectorLinkLabel" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.ConnectorLinkLabelEditPart" role="Name"/>
- <customDecorations xsi:type="idgen:CustomLinkLabel" id="linklabel_uml_namedelement_name" label="NamedElementLinkLabelName" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.NamedElementLinkLabelNameEditPart" role="Name"/>
- <customDecorations xsi:type="idgen:CustomLinkLabel" id="linklabel_uml_appliedstereotype" label="AppliedStereotypeLinkLabel" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.AppliedStereotypeLinkLabelEditPart" role="Stereotype"/>
- <customDecorations xsi:type="idgen:CustomLinkLabel" id="linklabel_uml_association_source_role" label="AssociationLinkLabelSourceRole" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.AssociationLinkLabelSourceRoleEditPart" role="SourceRole"/>
- <customDecorations xsi:type="idgen:CustomLinkLabel" id="linklabel_uml_association_source_multiplicity" label="AssociationLinkLabelSourceMultiplicity" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.AssociationLinkLabelSourceMultiplicityEditPart" role="SourceMultiplicity"/>
- <customDecorations xsi:type="idgen:CustomLinkLabel" id="linklabel_uml_association_target_role" label="AssociationLinkLabelTargetRole" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.AssociationLinkLabelTargetRoleEditPart" role="TargetRole"/>
- <customDecorations xsi:type="idgen:CustomLinkLabel" id="linklabel_uml_association_target_multiplicity" label="AssociationLinkLabelTargetMultiplicity" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.AssociationLinkLabelTargetMultiplicityEditPart" role="TargetMultiplicity"/>
- <customDecorations xsi:type="idgen:CustomLinkLabel" id="linklabel_uml_connector_source_multiplicity" label="ConnectorLinkLabelSourceMultiplicity" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.ConnectorLinkLabelSourceMultiplicityEditPart" role="SourceMultiplicity"/>
- <customDecorations xsi:type="idgen:CustomLinkLabel" id="linklabel_uml_connector_target_multiplicity" label="ConnectorLinkLabelTargetMultiplicity" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.ConnectorLinkLabelTargetMultiplicityEditPart" role="TargetMultiplicity"/>
- <semanticTypes id="org.eclipse.papyrus.uml.Actor" name="Actor" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Actor.gif"/>
- <semanticTypes id="org.eclipse.papyrus.uml.Comment" name="Comment" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Comment.gif"/>
- <semanticTypes id="org.eclipse.papyrus.uml.Connector" name="Connector" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Connector.gif"/>
- <semanticTypes id="org.eclipse.papyrus.uml.Constraint" name="Constraint" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Constraint.gif"/>
- <semanticTypes id="org.eclipse.papyrus.uml.DataType" name="DataType" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/DataType.gif"/>
- <semanticTypes id="org.eclipse.papyrus.uml.Dependency" name="Dependency" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Dependency.gif"/>
- <semanticTypes id="org.eclipse.papyrus.uml.Enumeration" name="Enumeration" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Enumeration.gif"/>
- <semanticTypes id="org.eclipse.papyrus.uml.EnumerationLiteral" name="EnumerationLiteral" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/EnumerationLiteral.gif"/>
- <semanticTypes id="org.eclipse.papyrus.uml.Generalization" name="Generalization" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Generalization.gif"/>
- <semanticTypes id="org.eclipse.papyrus.uml.InstanceSpecification" name="InstanceSpecification" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/InstanceSpecification.gif"/>
- <semanticTypes id="org.eclipse.papyrus.uml.Interface" name="Interface" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Interface.gif"/>
- <semanticTypes id="org.eclipse.papyrus.uml.InterfaceRealization" name="InterfaceRealization" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/InterfaceRealization.gif"/>
- <semanticTypes id="org.eclipse.papyrus.uml.Model" name="Model" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Model.gif"/>
- <semanticTypes id="org.eclipse.papyrus.uml.Operation" name="Operation" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Operation.gif"/>
- <semanticTypes id="org.eclipse.papyrus.uml.Package" name="Package" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Package.gif"/>
- <semanticTypes id="org.eclipse.papyrus.uml.Port" name="Port" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Port.gif"/>
- <semanticTypes id="org.eclipse.papyrus.uml.PrimitiveType" name="PrimitiveType" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/PrimitiveType.gif"/>
- <semanticTypes id="org.eclipse.papyrus.uml.Property" name="Property" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Property.gif"/>
- <semanticTypes id="org.eclipse.papyrus.uml.Reception" name="Reception" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Reception.gif"/>
- <semanticTypes id="org.eclipse.papyrus.uml.Signal" name="Signal" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Signal.gif"/>
- <semanticTypes id="org.eclipse.papyrus.uml.Slot" name="Slot" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Slot.gif"/>
- <semanticTypes id="org.eclipse.papyrus.uml.Usage" name="Usage" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Usage.gif"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.part.AppliedStereotypeAffixedLabelEditPart"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.part.AppliedStereotypeLinkLabelEditPart"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.part.DefaultChildLabelEditPart"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.part.NamedElementAffixedLabelNameEditPart"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.part.NamedElementLinkLabelNameEditPart"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.part.NamedElementNodeLabelNameEditPart"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.part.PropertyNodeLabelEditPart"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.part.PortAffixedLabelNameEditPart"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.part.AssociationLinkLabelSourceRoleEditPart"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.part.AssociationLinkLabelSourceMultiplicityEditPart"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.part.AssociationLinkLabelTargetRoleEditPart"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.part.AssociationLinkLabelTargetMultiplicityEditPart"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.part.ConnectorLinkLabelEditPart"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.part.ConnectorLinkLabelSourceMultiplicityEditPart"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.part.ConnectorLinkLabelTargetMultiplicityEditPart"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.locator.PortPositionLocator"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.factory.ClassifierViewFactory"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.factory.AssociationLinkViewFactory"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.figure.GeneralizationFigure"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.figure.InterfaceRealizationFigure"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.figure.NamedElementEdgeFigure"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.figure.ConnectorEdgeFigure"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.gmf.diagram.common.figure.SelectableBorderedNodeFigure"/>
-</idgen:Diagram>
+<?xml version="1.0" encoding="UTF-8"?>
+<idgen:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:idgen="http://www.eclipse.org/papyrus/0.7.0/idgen" name="UML Reusable Parts" type="" icon="" label="" language="" javaPackagePrefix="org.eclipse.papyrus.uml.diagram.common" javaClassPrefix="UML" createCommandLabel="">
+ <customNodes xsi:type="idgen:CustomLabelNode" id="shape_uml_constraint_as_label" label="Constraint" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.DefaultChildLabelEditPart" semanticType="org.eclipse.papyrus.uml.Constraint" labelMask="Name, Specification"/>
+ <customNodes xsi:type="idgen:CustomLabelNode" id="shape_uml_enumerationliteral_as_label" label="EnumerationLiteral" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.DefaultChildLabelEditPart" semanticType="org.eclipse.papyrus.uml.EnumerationLiteral" labelMask=""/>
+ <customNodes xsi:type="idgen:CustomLabelNode" id="shape_uml_operation_as_label" label="Operation" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.DefaultChildLabelEditPart" semanticType="org.eclipse.papyrus.uml.Operation" labelMask="Visibility, Name, Type, Modifiers, Param_Direction, Param_Name, Param_Type, Param_Multiplicity, Param_DefaultValue, Param_Modifiers"/>
+ <customNodes xsi:type="idgen:CustomLabelNode" id="shape_uml_port_as_label" label="Port" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.DefaultChildLabelEditPart" semanticType="org.eclipse.papyrus.uml.Port" labelMask="Visibility, Derive, Name, Type, Undefined_Type, Multiplicity, Default_Multiplicity, DefaultValue, Modifiers"/>
+ <customNodes xsi:type="idgen:CustomLabelNode" id="shape_uml_property_as_label" label="Property" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.DefaultChildLabelEditPart" semanticType="org.eclipse.papyrus.uml.Property" labelMask="Visibility, Derive, Name, Type, Undefined_Type, Multiplicity, Default_Multiplicity, DefaultValue, Modifiers"/>
+ <customNodes xsi:type="idgen:CustomLabelNode" id="shape_uml_reception_as_label" label="Reception" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.DefaultChildLabelEditPart" semanticType="org.eclipse.papyrus.uml.Reception" labelMask="Name, Signal"/>
+ <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_uml_actor_as_classifier" label="Actor" viewFactory="org.eclipse.papyrus.uml.diagram.common.factory.ClassifierViewFactory" semanticType="org.eclipse.papyrus.uml.Actor" labels="label_uml_namedelement_name" compartments="compartment_uml_property_as_list compartment_uml_operation_as_list"/>
+ <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_uml_datatype_as_classifier" label="DataType" viewFactory="org.eclipse.papyrus.uml.diagram.common.factory.ClassifierViewFactory" semanticType="org.eclipse.papyrus.uml.DataType" tag="datatype" labels="label_uml_namedelement_name" compartments="compartment_uml_property_as_list compartment_uml_operation_as_list" visibleCompartments="compartment_uml_property_as_list"/>
+ <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_uml_enumeration_as_classifier" label="Enumeration" semanticType="org.eclipse.papyrus.uml.Enumeration" labels="label_uml_namedelement_name" compartments="compartment_uml_enumerationliteral_as_list" visibleCompartments="compartment_uml_enumerationliteral_as_list"/>
+ <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_uml_interface_as_classifier" label="Interface" viewFactory="org.eclipse.papyrus.uml.diagram.common.factory.ClassifierViewFactory" semanticType="org.eclipse.papyrus.uml.Interface" tag="" labels="label_uml_namedelement_name" compartments="compartment_uml_property_as_list compartment_uml_operation_as_list" visibleCompartments="compartment_uml_property_as_list compartment_uml_operation_as_list"/>
+ <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_uml_primitivetype_as_classifier" label="PrimitiveType" semanticType="org.eclipse.papyrus.uml.PrimitiveType" tag="primitive" labels="label_uml_namedelement_name"/>
+ <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_uml_signal_as_classifier" label="Signal" viewFactory="org.eclipse.papyrus.uml.diagram.common.factory.ClassifierViewFactory" semanticType="org.eclipse.papyrus.uml.Signal" tag="" labels="label_uml_namedelement_name" compartments="compartment_uml_property_as_list compartment_uml_operation_as_list"/>
+ <customNodes xsi:type="idgen:CustomAffixedNode" id="shape_uml_port_as_affixed" label="Port" semanticType="org.eclipse.papyrus.uml.Port" affixedLabels="affixedlabel_uml_port_label affixedlabel_uml_appliedstereotype" locator="org.eclipse.papyrus.uml.diagram.common.locator.PortPositionLocator"/>
+ <customEdges xsi:type="idgen:CustomLink" id="link_uml_dependency" label="Dependency" semanticType="org.eclipse.papyrus.uml.Dependency" labels="linklabel_uml_namedelement_name" figure="org.eclipse.papyrus.uml.diagram.common.figure.NamedElementEdgeFigure"/>
+ <customEdges xsi:type="idgen:CustomLink" id="link_uml_connector" label="Connector" semanticType="org.eclipse.papyrus.uml.Connector" labels="linklabel_uml_connector_label linklabel_uml_connector_source_multiplicity linklabel_uml_connector_target_multiplicity" figure="org.eclipse.papyrus.uml.diagram.common.figure.ConnectorEdgeFigure"/>
+ <customEdges xsi:type="idgen:CustomLink" id="link_uml_generalization" label="Generalization" semanticType="org.eclipse.papyrus.uml.Generalization" figure="org.eclipse.papyrus.uml.diagram.common.figure.GeneralizationFigure"/>
+ <customEdges xsi:type="idgen:CustomLink" id="link_uml_interfacerealization" label="InterfaceRealization" semanticType="org.eclipse.papyrus.uml.InterfaceRealization" labels="linklabel_uml_namedelement_name" figure="org.eclipse.papyrus.uml.diagram.common.figure.InterfaceRealizationFigure"/>
+ <customEdges xsi:type="idgen:CustomLink" id="link_uml_usage" label="Usage" semanticType="org.eclipse.papyrus.uml.Usage" tag="use" labels="linklabel_uml_namedelement_name" figure="org.eclipse.papyrus.uml.diagram.common.figure.NamedElementEdgeFigure"/>
+ <customDecorations xsi:type="idgen:CustomCompartment" id="compartment_uml_constraint_as_list" label="Constraint" title="constraints" children="shape_uml_constraint_as_label"/>
+ <customDecorations xsi:type="idgen:CustomCompartment" id="compartment_uml_enumerationliteral_as_list" label="EnumerationLiteral" title="literals" children="shape_uml_enumerationliteral_as_label"/>
+ <customDecorations xsi:type="idgen:CustomCompartment" id="compartment_uml_operation_as_list" label="Operation" title="operations" children="shape_uml_operation_as_label shape_uml_reception_as_label"/>
+ <customDecorations xsi:type="idgen:CustomCompartment" id="compartment_uml_port_as_list" label="Port" title="standard ports" children="shape_uml_port_as_label"/>
+ <customDecorations xsi:type="idgen:CustomCompartment" id="compartment_uml_property_as_list" label="Property" title="properties" children="shape_uml_property_as_label shape_uml_port_as_label"/>
+ <customDecorations xsi:type="idgen:CustomAffixedLabel" id="affixedlabel_uml_appliedstereotype" label="AppliedStereotypeAffixedLabel" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.AppliedStereotypeAffixedLabelEditPart" locator="org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator" role="Name"/>
+ <customDecorations xsi:type="idgen:CustomAffixedLabel" id="affixedlabel_uml_namedelement_name" label="NamedElementAffixedLabelName" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.NamedElementAffixedLabelNameEditPart" locator="org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator" role="Name"/>
+ <customDecorations xsi:type="idgen:CustomAffixedLabel" id="affixedlabel_uml_port_label" label="PortAffixedLabel" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.PortAffixedLabelNameEditPart" locator="org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator" role="Label"/>
+ <customDecorations xsi:type="idgen:CustomInnerLabel" id="label_uml_namedelement_name" label="NamedElementNodeLabel" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.NamedElementNodeLabelNameEditPart"/>
+ <customDecorations xsi:type="idgen:CustomInnerLabel" id="label_uml_property_label" label="PropertyNodeLabel" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.PropertyNodeLabelEditPart"/>
+ <customDecorations xsi:type="idgen:CustomLinkLabel" id="linklabel_uml_connector_label" label="ConnectorLinkLabel" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.ConnectorLinkLabelEditPart" role="Name"/>
+ <customDecorations xsi:type="idgen:CustomLinkLabel" id="linklabel_uml_namedelement_name" label="NamedElementLinkLabelName" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.NamedElementLinkLabelNameEditPart" role="Name"/>
+ <customDecorations xsi:type="idgen:CustomLinkLabel" id="linklabel_uml_appliedstereotype" label="AppliedStereotypeLinkLabel" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.AppliedStereotypeLinkLabelEditPart" role="Stereotype"/>
+ <customDecorations xsi:type="idgen:CustomLinkLabel" id="linklabel_uml_association_source_role" label="AssociationLinkLabelSourceRole" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.AssociationLinkLabelSourceRoleEditPart" role="SourceRole"/>
+ <customDecorations xsi:type="idgen:CustomLinkLabel" id="linklabel_uml_association_source_multiplicity" label="AssociationLinkLabelSourceMultiplicity" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.AssociationLinkLabelSourceMultiplicityEditPart" role="SourceMultiplicity"/>
+ <customDecorations xsi:type="idgen:CustomLinkLabel" id="linklabel_uml_association_target_role" label="AssociationLinkLabelTargetRole" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.AssociationLinkLabelTargetRoleEditPart" role="TargetRole"/>
+ <customDecorations xsi:type="idgen:CustomLinkLabel" id="linklabel_uml_association_target_multiplicity" label="AssociationLinkLabelTargetMultiplicity" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.AssociationLinkLabelTargetMultiplicityEditPart" role="TargetMultiplicity"/>
+ <customDecorations xsi:type="idgen:CustomLinkLabel" id="linklabel_uml_connector_source_multiplicity" label="ConnectorLinkLabelSourceMultiplicity" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.ConnectorLinkLabelSourceMultiplicityEditPart" role="SourceMultiplicity"/>
+ <customDecorations xsi:type="idgen:CustomLinkLabel" id="linklabel_uml_connector_target_multiplicity" label="ConnectorLinkLabelTargetMultiplicity" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.ConnectorLinkLabelTargetMultiplicityEditPart" role="TargetMultiplicity"/>
+ <semanticTypes id="org.eclipse.papyrus.uml.Actor" name="Actor" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Actor.gif"/>
+ <semanticTypes id="org.eclipse.papyrus.uml.Comment" name="Comment" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Comment.gif"/>
+ <semanticTypes id="org.eclipse.papyrus.uml.Connector" name="Connector" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Connector.gif"/>
+ <semanticTypes id="org.eclipse.papyrus.uml.Constraint" name="Constraint" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Constraint.gif"/>
+ <semanticTypes id="org.eclipse.papyrus.uml.DataType" name="DataType" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/DataType.gif"/>
+ <semanticTypes id="org.eclipse.papyrus.uml.Dependency" name="Dependency" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Dependency.gif"/>
+ <semanticTypes id="org.eclipse.papyrus.uml.Enumeration" name="Enumeration" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Enumeration.gif"/>
+ <semanticTypes id="org.eclipse.papyrus.uml.EnumerationLiteral" name="EnumerationLiteral" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/EnumerationLiteral.gif"/>
+ <semanticTypes id="org.eclipse.papyrus.uml.Generalization" name="Generalization" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Generalization.gif"/>
+ <semanticTypes id="org.eclipse.papyrus.uml.InstanceSpecification" name="InstanceSpecification" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/InstanceSpecification.gif"/>
+ <semanticTypes id="org.eclipse.papyrus.uml.Interface" name="Interface" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Interface.gif"/>
+ <semanticTypes id="org.eclipse.papyrus.uml.InterfaceRealization" name="InterfaceRealization" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/InterfaceRealization.gif"/>
+ <semanticTypes id="org.eclipse.papyrus.uml.Model" name="Model" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Model.gif"/>
+ <semanticTypes id="org.eclipse.papyrus.uml.Operation" name="Operation" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Operation.gif"/>
+ <semanticTypes id="org.eclipse.papyrus.uml.Package" name="Package" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Package.gif"/>
+ <semanticTypes id="org.eclipse.papyrus.uml.Port" name="Port" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Port.gif"/>
+ <semanticTypes id="org.eclipse.papyrus.uml.PrimitiveType" name="PrimitiveType" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/PrimitiveType.gif"/>
+ <semanticTypes id="org.eclipse.papyrus.uml.Property" name="Property" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Property.gif"/>
+ <semanticTypes id="org.eclipse.papyrus.uml.Reception" name="Reception" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Reception.gif"/>
+ <semanticTypes id="org.eclipse.papyrus.uml.Signal" name="Signal" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Signal.gif"/>
+ <semanticTypes id="org.eclipse.papyrus.uml.Slot" name="Slot" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Slot.gif"/>
+ <semanticTypes id="org.eclipse.papyrus.uml.Usage" name="Usage" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Usage.gif"/>
+ <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.part.AppliedStereotypeAffixedLabelEditPart"/>
+ <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.part.AppliedStereotypeLinkLabelEditPart"/>
+ <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.part.DefaultChildLabelEditPart"/>
+ <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.part.NamedElementAffixedLabelNameEditPart"/>
+ <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.part.NamedElementLinkLabelNameEditPart"/>
+ <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.part.NamedElementNodeLabelNameEditPart"/>
+ <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.part.PropertyNodeLabelEditPart"/>
+ <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.part.PortAffixedLabelNameEditPart"/>
+ <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.part.AssociationLinkLabelSourceRoleEditPart"/>
+ <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.part.AssociationLinkLabelSourceMultiplicityEditPart"/>
+ <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.part.AssociationLinkLabelTargetRoleEditPart"/>
+ <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.part.AssociationLinkLabelTargetMultiplicityEditPart"/>
+ <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.part.ConnectorLinkLabelEditPart"/>
+ <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.part.ConnectorLinkLabelSourceMultiplicityEditPart"/>
+ <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.part.ConnectorLinkLabelTargetMultiplicityEditPart"/>
+ <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.locator.PortPositionLocator"/>
+ <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator"/>
+ <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.factory.ClassifierViewFactory"/>
+ <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.factory.AssociationLinkViewFactory"/>
+ <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.figure.GeneralizationFigure"/>
+ <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.figure.InterfaceRealizationFigure"/>
+ <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.figure.NamedElementEdgeFigure"/>
+ <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.figure.ConnectorEdgeFigure"/>
+ <javaClasses qualifiedName="org.eclipse.papyrus.gmf.diagram.common.figure.SelectableBorderedNodeFigure"/>
+</idgen:Diagram>
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/plugin.properties b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/plugin.properties
index dc047004a43..a140c69c616 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/plugin.properties
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/plugin.properties
@@ -1,12 +1,12 @@
-#################################################################################
-# Copyright (c) 2010 CEA LIST.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - initial API and implementation
-##################################################################################
-pluginName=UML Common diagram for SysML (Incubation)
-providerName=Eclipse Modeling Project
+#################################################################################
+# Copyright (c) 2010 CEA LIST.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - initial API and implementation
+##################################################################################
+pluginName=UML Common diagram for SysML (Incubation)
+providerName=Eclipse Modeling Project
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/plugin.xml b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/plugin.xml
index 3118788f2ff..d04bf6abd85 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/plugin.xml
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/plugin.xml
@@ -1,5 +1,5 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
<plugin>
<extension point="org.eclipse.papyrus.infra.core.papyrusDiagram">
@@ -22,27 +22,27 @@
<test forcePluginActivation="true" property="org.eclipse.papyrus.SysMLSelectionTester.isSysMLModel" value="true"></test>
</with>
</and>
- </definition>
- <definition id="org.eclipse.papyrus.sysml.diagram.common.IsPapyrusActiveWithSysMLBlocks">
- <and>
- <with variable="activeEditorId">
- <equals value="org.eclipse.papyrus.infra.core.papyrusEditor"></equals>
- </with>
- <with variable="selection">
- <test forcePluginActivation="true" property="org.eclipse.papyrus.SysMLSelectionTester.isSysMLBlocksModel" value="true"></test>
- </with>
- </and>
- </definition>
- <definition id="org.eclipse.papyrus.sysml.diagram.common.IsPapyrusActiveWithSysMLRequirements">
- <and>
- <with variable="activeEditorId">
- <equals value="org.eclipse.papyrus.infra.core.papyrusEditor"></equals>
- </with>
- <with variable="selection">
- <test forcePluginActivation="true" property="org.eclipse.papyrus.SysMLSelectionTester.isSysMLRequirementsModel" value="true"></test>
- </with>
- </and>
+ </definition>
+ <definition id="org.eclipse.papyrus.sysml.diagram.common.IsPapyrusActiveWithSysMLBlocks">
+ <and>
+ <with variable="activeEditorId">
+ <equals value="org.eclipse.papyrus.infra.core.papyrusEditor"></equals>
+ </with>
+ <with variable="selection">
+ <test forcePluginActivation="true" property="org.eclipse.papyrus.SysMLSelectionTester.isSysMLBlocksModel" value="true"></test>
+ </with>
+ </and>
+ </definition>
+ <definition id="org.eclipse.papyrus.sysml.diagram.common.IsPapyrusActiveWithSysMLRequirements">
+ <and>
+ <with variable="activeEditorId">
+ <equals value="org.eclipse.papyrus.infra.core.papyrusEditor"></equals>
+ </with>
+ <with variable="selection">
+ <test forcePluginActivation="true" property="org.eclipse.papyrus.SysMLSelectionTester.isSysMLRequirementsModel" value="true"></test>
+ </with>
+ </and>
</definition>
</extension>
-</plugin>
+</plugin>
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/commands/CreateViewCommand.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/commands/CreateViewCommand.java
index f68a9c37ecc..b877e3a2c73 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/commands/CreateViewCommand.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/commands/CreateViewCommand.java
@@ -1,62 +1,62 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.gmf.diagram.common.commands;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.diagram.core.services.ViewService;
-import org.eclipse.gmf.runtime.diagram.ui.commands.CreateCommand;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.notation.View;
-
-/**
- * A replacement for CreateCommand that avoids that takes into account the incorrect
- * generation of ViewProvider by GMFTooling and modifies SemanticAdapter in call to
- * {@link ViewService#provides(Class, org.eclipse.core.runtime.IAdaptable, View, String, int, boolean, org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint)}
- * .
- */
-public class CreateViewCommand extends CreateCommand {
-
- /** Constructor */
- public CreateViewCommand(TransactionalEditingDomain editingDomain, ViewDescriptor viewDescriptor, View containerView) {
- super(editingDomain, viewDescriptor, containerView);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean canExecute() {
-
- // Warning the element adapter can possibly be null (see: https://bugs.eclipse.org/bugs/show_bug.cgi?id=353129)
- if(viewDescriptor.getElementAdapter() == null) {
- return false;
- }
-
- // Try to adapt the descriptor ElementAdapter in EObject
- EObject element = (EObject)viewDescriptor.getElementAdapter().getAdapter(EObject.class);
- IElementType elementType = (IElementType)viewDescriptor.getElementAdapter().getAdapter(IElementType.class);
-
- SemanticElementAdapter semanticAdapter = new SemanticElementAdapter(element, elementType);
-
- // Use the semanticAdapter instead of view descriptor element adapter to avoid the use of provides(ViewForKind) method
- // from ViewProvider which is incorrectly implemented in GMF Tooling generated editors (other editors may have undesired side-effect on each-other).
-
- return ViewService.getInstance().provides(viewDescriptor.getViewKind(), semanticAdapter, containerView, viewDescriptor.getSemanticHint(), viewDescriptor.getIndex(), viewDescriptor.isPersisted(), viewDescriptor.getPreferencesHint());
- }
-
-
-
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.gmf.diagram.common.commands;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.diagram.core.services.ViewService;
+import org.eclipse.gmf.runtime.diagram.ui.commands.CreateCommand;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * A replacement for CreateCommand that avoids that takes into account the incorrect
+ * generation of ViewProvider by GMFTooling and modifies SemanticAdapter in call to
+ * {@link ViewService#provides(Class, org.eclipse.core.runtime.IAdaptable, View, String, int, boolean, org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint)}
+ * .
+ */
+public class CreateViewCommand extends CreateCommand {
+
+ /** Constructor */
+ public CreateViewCommand(TransactionalEditingDomain editingDomain, ViewDescriptor viewDescriptor, View containerView) {
+ super(editingDomain, viewDescriptor, containerView);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean canExecute() {
+
+ // Warning the element adapter can possibly be null (see: https://bugs.eclipse.org/bugs/show_bug.cgi?id=353129)
+ if(viewDescriptor.getElementAdapter() == null) {
+ return false;
+ }
+
+ // Try to adapt the descriptor ElementAdapter in EObject
+ EObject element = (EObject)viewDescriptor.getElementAdapter().getAdapter(EObject.class);
+ IElementType elementType = (IElementType)viewDescriptor.getElementAdapter().getAdapter(IElementType.class);
+
+ SemanticElementAdapter semanticAdapter = new SemanticElementAdapter(element, elementType);
+
+ // Use the semanticAdapter instead of view descriptor element adapter to avoid the use of provides(ViewForKind) method
+ // from ViewProvider which is incorrectly implemented in GMF Tooling generated editors (other editors may have undesired side-effect on each-other).
+
+ return ViewService.getInstance().provides(viewDescriptor.getViewKind(), semanticAdapter, containerView, viewDescriptor.getSemanticHint(), viewDescriptor.getIndex(), viewDescriptor.isPersisted(), viewDescriptor.getPreferencesHint());
+ }
+
+
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/commands/ISemanticHintAdapter.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/commands/ISemanticHintAdapter.java
index ca2558e0e23..cc0b896137a 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/commands/ISemanticHintAdapter.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/commands/ISemanticHintAdapter.java
@@ -1,27 +1,27 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.gmf.diagram.common.commands;
-
-
-/**
- * Interface for an adapter that can give a semantic hint
- */
-public interface ISemanticHintAdapter {
-
- /**
- * Returns the semantic hint for this adapter
- * @return the semantic hint for this adapter
- */
- public String getSemanticHint();
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.gmf.diagram.common.commands;
+
+
+/**
+ * Interface for an adapter that can give a semantic hint
+ */
+public interface ISemanticHintAdapter {
+
+ /**
+ * Returns the semantic hint for this adapter
+ * @return the semantic hint for this adapter
+ */
+ public String getSemanticHint();
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/commands/IdentityCommandWithNotification.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/commands/IdentityCommandWithNotification.java
index d43040da03d..cb65145164b 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/commands/IdentityCommandWithNotification.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/commands/IdentityCommandWithNotification.java
@@ -1,89 +1,89 @@
-/******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * CEA LIST - Papyrus notification added in command execution
- ****************************************************************************/
-package org.eclipse.papyrus.gmf.diagram.common.commands;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.gmf.runtime.common.core.command.AbstractCommand;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.common.core.util.StringStatics;
-import org.eclipse.papyrus.infra.widgets.toolbox.notification.Type;
-import org.eclipse.papyrus.infra.widgets.toolbox.notification.builders.CombinedPopupAndViewBuilder;
-import org.eclipse.papyrus.infra.widgets.toolbox.notification.builders.NotificationBuilder;
-
-/**
- * A command that is always executable, undoable and redoable, but does nothing.
- * It always returns the same OK command result.
- *
- * @author ldamus
- */
-public class IdentityCommandWithNotification extends AbstractCommand {
-
- protected String title = "Papyrus notification";
-
- protected String message = "No message.";
-
- protected Type type = Type.INFO;
-
- /**
- * Public constructor.
- */
- public IdentityCommandWithNotification(String message) {
- this();
- this.message = message;
- }
-
- /**
- * Public constructor.
- */
- public IdentityCommandWithNotification(String title, String message, Type type) {
- this(message);
- this.title = title;
- this.type = type;
- }
-
- /**
- * Private constructor.
- */
- private IdentityCommandWithNotification() {
- super(StringStatics.BLANK, null);
- setResult(CommandResult.newOKCommandResult());
- }
-
- /**
- * Does nothing and returns an OK command result.
- */
- protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException {
-
- new NotificationBuilder().setBuilderClass(CombinedPopupAndViewBuilder.class).setType(type).setTitle(title).setMessage(message).run();
-
- return getCommandResult();
- }
-
- /**
- * Does nothing and returns an OK command result.
- */
- protected CommandResult doRedoWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException {
-
- return getCommandResult();
- }
-
- /**
- * Does nothing and returns an OK command result.
- */
- protected CommandResult doUndoWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException {
-
- return getCommandResult();
- }
-
-}
+/******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * CEA LIST - Papyrus notification added in command execution
+ ****************************************************************************/
+package org.eclipse.papyrus.gmf.diagram.common.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.gmf.runtime.common.core.command.AbstractCommand;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.util.StringStatics;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.Type;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.builders.CombinedPopupAndViewBuilder;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.builders.NotificationBuilder;
+
+/**
+ * A command that is always executable, undoable and redoable, but does nothing.
+ * It always returns the same OK command result.
+ *
+ * @author ldamus
+ */
+public class IdentityCommandWithNotification extends AbstractCommand {
+
+ protected String title = "Papyrus notification";
+
+ protected String message = "No message.";
+
+ protected Type type = Type.INFO;
+
+ /**
+ * Public constructor.
+ */
+ public IdentityCommandWithNotification(String message) {
+ this();
+ this.message = message;
+ }
+
+ /**
+ * Public constructor.
+ */
+ public IdentityCommandWithNotification(String title, String message, Type type) {
+ this(message);
+ this.title = title;
+ this.type = type;
+ }
+
+ /**
+ * Private constructor.
+ */
+ private IdentityCommandWithNotification() {
+ super(StringStatics.BLANK, null);
+ setResult(CommandResult.newOKCommandResult());
+ }
+
+ /**
+ * Does nothing and returns an OK command result.
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException {
+
+ new NotificationBuilder().setBuilderClass(CombinedPopupAndViewBuilder.class).setType(type).setTitle(title).setMessage(message).run();
+
+ return getCommandResult();
+ }
+
+ /**
+ * Does nothing and returns an OK command result.
+ */
+ protected CommandResult doRedoWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException {
+
+ return getCommandResult();
+ }
+
+ /**
+ * Does nothing and returns an OK command result.
+ */
+ protected CommandResult doUndoWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException {
+
+ return getCommandResult();
+ }
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/commands/SemanticElementAdapter.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/commands/SemanticElementAdapter.java
index 649c5e38cd2..cbfbce3b15b 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/commands/SemanticElementAdapter.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/commands/SemanticElementAdapter.java
@@ -1,87 +1,87 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.gmf.diagram.common.commands;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.emf.core.util.PackageUtil;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
-import org.eclipse.papyrus.uml.diagram.common.commands.SemanticAdapter;
-
-/**
- * An adapter for {@link IElementType}, {@link EObject} or {@link View}.
- */
-public class SemanticElementAdapter extends SemanticAdapter implements ISemanticHintAdapter {
-
- /** The elementType. */
- private Object elementType;
-
- /** Constructor from EObject */
- public SemanticElementAdapter(EObject element) {
- super(element, null);
- this.elementType = null;
- }
-
- /** Constructor from IElementType */
- public SemanticElementAdapter(IElementType elementType) {
- super(null, null);
- this.elementType = elementType;
- }
-
- /** Constructor from EObject and IElementType */
- public SemanticElementAdapter(EObject element, IElementType elementType) {
- super(element, null);
- this.elementType = elementType;
- }
-
- /**
- * {@inheritDoc}
- */
- @SuppressWarnings("rawtypes")
- @Override
- public Object getAdapter(Class adapter) {
- if(adapter.equals(IHintedType.class)) {
- if(elementType instanceof IHintedType) {
- return elementType;
- }
- }
-
- if(adapter.equals(IElementType.class)) {
- return elementType;
- }
- return super.getAdapter(adapter);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object getProxyClassID() {
- if(elementType !=null) {
- return PackageUtil.getID(((IElementType)elementType).getEClass());
- }
- return super.getProxyClassID();
- }
-
- /**
- * {@inheritDoc}
- */
- public String getSemanticHint() {
- if(elementType instanceof IHintedType) {
- return ((IHintedType)elementType).getSemanticHint();
- }
- return null;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.gmf.diagram.common.commands;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.core.util.PackageUtil;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
+import org.eclipse.papyrus.uml.diagram.common.commands.SemanticAdapter;
+
+/**
+ * An adapter for {@link IElementType}, {@link EObject} or {@link View}.
+ */
+public class SemanticElementAdapter extends SemanticAdapter implements ISemanticHintAdapter {
+
+ /** The elementType. */
+ private Object elementType;
+
+ /** Constructor from EObject */
+ public SemanticElementAdapter(EObject element) {
+ super(element, null);
+ this.elementType = null;
+ }
+
+ /** Constructor from IElementType */
+ public SemanticElementAdapter(IElementType elementType) {
+ super(null, null);
+ this.elementType = elementType;
+ }
+
+ /** Constructor from EObject and IElementType */
+ public SemanticElementAdapter(EObject element, IElementType elementType) {
+ super(element, null);
+ this.elementType = elementType;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("rawtypes")
+ @Override
+ public Object getAdapter(Class adapter) {
+ if(adapter.equals(IHintedType.class)) {
+ if(elementType instanceof IHintedType) {
+ return elementType;
+ }
+ }
+
+ if(adapter.equals(IElementType.class)) {
+ return elementType;
+ }
+ return super.getAdapter(adapter);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Object getProxyClassID() {
+ if(elementType !=null) {
+ return PackageUtil.getID(((IElementType)elementType).getEClass());
+ }
+ return super.getProxyClassID();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getSemanticHint() {
+ if(elementType instanceof IHintedType) {
+ return ((IHintedType)elementType).getSemanticHint();
+ }
+ return null;
+ }
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/compatibility/DiagramVersioningUtils.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/compatibility/DiagramVersioningUtils.java
index 046f030ab4a..906c4bab0ee 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/compatibility/DiagramVersioningUtils.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/compatibility/DiagramVersioningUtils.java
@@ -1,62 +1,62 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.gmf.diagram.common.compatibility;
-
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.NotationFactory;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.StringValueStyle;
-
-/**
- * This class provide several convenience methods to tag a diagram with a version number
- * in a notation style, or retrieve this version number.
- */
-public class DiagramVersioningUtils {
-
- /**
- * The ID for the diagram internal version number stored in Notation model.
- */
- private static final String DIAGRAM_COMPATIBILITY_VERSION = "diagram_compatibility_version";
-
- /**
- * The ID for the diagram internal version number stored in Notation model.
- */
- public static final String UNDEFINED_VERSION = "undefined";
-
- /**
- * Get the diagram compatibility version.
- * @param diagram the diagram
- * @return the compatibility version.
- */
- public static String getCompatibilityVersion(Diagram diagram) {
- StringValueStyle semanticStyle = (StringValueStyle)diagram.getNamedStyle(NotationPackage.eINSTANCE.getStringValueStyle(), DIAGRAM_COMPATIBILITY_VERSION);
- return semanticStyle == null ? UNDEFINED_VERSION : semanticStyle.getStringValue();
- }
-
- /**
- * Set the diagram compatibility version.
- * @param diagram the diagram
- * @param version the compatibility version
- */
- @SuppressWarnings("unchecked")
- public static void setCompatibilityVersion(Diagram diagram, String version) {
- StringValueStyle style = (StringValueStyle)diagram.getNamedStyle(NotationPackage.eINSTANCE.getStringValueStyle(), DIAGRAM_COMPATIBILITY_VERSION);
- if (style == null) {
- style = NotationFactory.eINSTANCE.createStringValueStyle();
- style.setName(DIAGRAM_COMPATIBILITY_VERSION);
- diagram.getStyles().add(style);
- }
- style.setStringValue(version);
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.gmf.diagram.common.compatibility;
+
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.StringValueStyle;
+
+/**
+ * This class provide several convenience methods to tag a diagram with a version number
+ * in a notation style, or retrieve this version number.
+ */
+public class DiagramVersioningUtils {
+
+ /**
+ * The ID for the diagram internal version number stored in Notation model.
+ */
+ private static final String DIAGRAM_COMPATIBILITY_VERSION = "diagram_compatibility_version";
+
+ /**
+ * The ID for the diagram internal version number stored in Notation model.
+ */
+ public static final String UNDEFINED_VERSION = "undefined";
+
+ /**
+ * Get the diagram compatibility version.
+ * @param diagram the diagram
+ * @return the compatibility version.
+ */
+ public static String getCompatibilityVersion(Diagram diagram) {
+ StringValueStyle semanticStyle = (StringValueStyle)diagram.getNamedStyle(NotationPackage.eINSTANCE.getStringValueStyle(), DIAGRAM_COMPATIBILITY_VERSION);
+ return semanticStyle == null ? UNDEFINED_VERSION : semanticStyle.getStringValue();
+ }
+
+ /**
+ * Set the diagram compatibility version.
+ * @param diagram the diagram
+ * @param version the compatibility version
+ */
+ @SuppressWarnings("unchecked")
+ public static void setCompatibilityVersion(Diagram diagram, String version) {
+ StringValueStyle style = (StringValueStyle)diagram.getNamedStyle(NotationPackage.eINSTANCE.getStringValueStyle(), DIAGRAM_COMPATIBILITY_VERSION);
+ if (style == null) {
+ style = NotationFactory.eINSTANCE.createStringValueStyle();
+ style.setName(DIAGRAM_COMPATIBILITY_VERSION);
+ diagram.getStyles().add(style);
+ }
+ style.setStringValue(version);
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/compatibility/IDiagramVersionUpdater.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/compatibility/IDiagramVersionUpdater.java
index d486348e073..a487396ac2f 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/compatibility/IDiagramVersionUpdater.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/compatibility/IDiagramVersionUpdater.java
@@ -1,31 +1,31 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.gmf.diagram.common.compatibility;
-
-import org.eclipse.gmf.runtime.notation.Diagram;
-
-/**
- * This interface provides an API for migration of diagram from a version to another.
- */
-public interface IDiagramVersionUpdater {
-
- /**
- * Update a diagram to a new version.
- * @param diagram the diagram to update
- * @param oldVersion the old version of the diagram
- * @param newVersion the new version of the diagram
- * @return TODO : should return a status, not int.
- */
- public int update(Diagram diagram, String oldVersion, String newVersion);
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.gmf.diagram.common.compatibility;
+
+import org.eclipse.gmf.runtime.notation.Diagram;
+
+/**
+ * This interface provides an API for migration of diagram from a version to another.
+ */
+public interface IDiagramVersionUpdater {
+
+ /**
+ * Update a diagram to a new version.
+ * @param diagram the diagram to update
+ * @param oldVersion the old version of the diagram
+ * @param newVersion the new version of the diagram
+ * @return TODO : should return a status, not int.
+ */
+ public int update(Diagram diagram, String oldVersion, String newVersion);
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/part/ITextAwareEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/part/ITextAwareEditPart.java
index 6d786423ff2..b887daaf6ed 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/part/ITextAwareEditPart.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/part/ITextAwareEditPart.java
@@ -1,37 +1,37 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.gmf.diagram.common.edit.part;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-
-/**
- * Edit Part that contains editable text.
- */
-public interface ITextAwareEditPart extends org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart {
-
- /**
- * Get the parser elements.
- *
- * @return the element being parsed.
- */
- public EObject getParserElement();
-
- /**
- * Gets the default parser options (meaning parser options stored in preferences).
- *
- * @return ParserOptions the parser options
- */
- public ParserOptions getDefaultParserOptions();
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.gmf.diagram.common.edit.part;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+
+/**
+ * Edit Part that contains editable text.
+ */
+public interface ITextAwareEditPart extends org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart {
+
+ /**
+ * Get the parser elements.
+ *
+ * @return the element being parsed.
+ */
+ public EObject getParserElement();
+
+ /**
+ * Gets the default parser options (meaning parser options stored in preferences).
+ *
+ * @return ParserOptions the parser options
+ */
+ public ParserOptions getDefaultParserOptions();
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/CommonDiagramDragDropEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/CommonDiagramDragDropEditPolicy.java
index b31c9cd819a..bc831f2b5f5 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/CommonDiagramDragDropEditPolicy.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/CommonDiagramDragDropEditPolicy.java
@@ -1,371 +1,371 @@
-/*****************************************************************************
- * Copyright (c) 2011-2012 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - refactor common behavior between diagrams
- *
- * CEA LIST - Adapted to use a local graphical type registry.
- *
- *****************************************************************************/
-package org.eclipse.papyrus.gmf.diagram.common.edit.policy;
-
-import static org.eclipse.papyrus.gmf.diagram.common.provider.IGraphicalTypeRegistry.UNDEFINED_TYPE;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-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.EditPartViewer;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.CompoundCommand;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gef.requests.ChangeBoundsRequest;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
-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.GraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DiagramDragDropEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.requests.ArrangeRequest;
-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.diagram.ui.requests.DropObjectsRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RefreshConnectionsRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.commands.wrappers.CommandProxyWithResult;
-import org.eclipse.papyrus.gmf.diagram.common.provider.IGraphicalTypeRegistry;
-import org.eclipse.papyrus.infra.gmfdiag.common.utils.ViewDescriptorUtil;
-import org.eclipse.papyrus.uml.diagram.common.commands.CommonDeferredCreateConnectionViewCommand;
-import org.eclipse.papyrus.uml.diagram.common.commands.SemanticAdapter;
-import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementBorderEditPart;
-import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.common.util.CrossReferencerUtil;
-
-/**
- * Abstract DND edit policy delegating the choice of the view to create for an EObject to a local
- * graphical type registry.
- */
-public abstract class CommonDiagramDragDropEditPolicy extends DiagramDragDropEditPolicy {
-
- /** The graphical type registry. */
- protected IGraphicalTypeRegistry registry;
-
- /** The list of element types that require a specific drop command. */
- private Set<String> specificDropList = null;
-
- /** The specified link mapping helper depending on the diagram */
- protected ILinkMappingHelper linkMappingHelper;
-
- /** Constructor */
- public CommonDiagramDragDropEditPolicy(ILinkMappingHelper linkMappingHelper) {
- this.linkMappingHelper = linkMappingHelper;
- }
-
- private Set<String> getSpecificDropList() {
- if(specificDropList == null) {
- specificDropList = getSpecificDropBehaviorTypes();
- }
- return specificDropList;
- }
-
- protected abstract Set<String> getSpecificDropBehaviorTypes();
-
- /**
- * <pre>
- * {@inheritedDoc}.
- *
- * Overridden method to fix some exception occurring while moving affixed element (nodes or labels)
- * (https://bugs.eclipse.org/bugs/show_bug.cgi?id=350680).
- * </pre>
- */
- @Override
- protected Command getDropCommand(ChangeBoundsRequest request) {
-
- Iterator<?> iter = request.getEditParts().iterator();
- EObject graphicalParentObject = ((GraphicalEditPart)getHost()).resolveSemanticElement();
- while((graphicalParentObject != null) && (iter.hasNext())) {
- EditPart droppedEditPart = (EditPart)iter.next();
- if(droppedEditPart instanceof AbstractElementBorderEditPart) {
- return UnexecutableCommand.INSTANCE;
- }
- if(droppedEditPart instanceof AbstractElementLabelEditPart) {
- return UnexecutableCommand.INSTANCE;
- }
- }
- return super.getDropCommand(request);
- }
-
- /**
- * {@inheritedDoc}.
- */
- @Override
- public Command getDropObjectsCommand(DropObjectsRequest dropRequest) {
-
- CompoundCommand completeDropCommand = new CompoundCommand("DropObjectsAndArrange"); //$NON-NLS-1$
-
- // Detect file drop
- if((dropRequest.getObjects().size() > 0) && (dropRequest.getObjects().get(0) instanceof String)) {
- return getDropFileCommand(dropRequest);
- }
-
- // Create the drop command by composite drop command for each dropped elements
- CompositeCommand gmfDropCommand = new CompositeCommand("DropObjects"); //$NON-NLS-1$
- Iterator<?> iter = dropRequest.getObjects().iterator();
- while(iter.hasNext()) {
- EObject droppedObject = (EObject)iter.next();
- gmfDropCommand.add(getDropObjectCommand(dropRequest, droppedObject));
- }
-
- // Create the complete drop command by adding an arrange command after drop
- if(!gmfDropCommand.isEmpty()) {
-
- // Retrieve drop result (most probably created view but not necessarily) and update the request
- CommandResult result = gmfDropCommand.getCommandResult();
- List<?> newValues = (List<?>)result.getReturnValue();
- dropRequest.setResult(newValues);
-
- // Prepare refresh command
- RefreshConnectionsRequest refreshRequest = new RefreshConnectionsRequest(newValues);
- Command refreshCommand = getHost().getCommand(refreshRequest);
-
- // Prepare an arrange command to avoid every dropped view to appear at the same location
- ArrangeRequest arrangeRequest = new ArrangeRequest(RequestConstants.REQ_ARRANGE_DEFERRED);
- arrangeRequest.setViewAdaptersToArrange(newValues);
- Command arrangeCommand = getHost().getCommand(arrangeRequest);
-
- // Update the complete drop command (drop - refresh - arrange)
- Command dropCommand = new ICommandProxy(gmfDropCommand);
- completeDropCommand.add(dropCommand.chain(refreshCommand));
- completeDropCommand.add(arrangeCommand);
- }
-
- return completeDropCommand;
- }
-
- protected ICommand getDropObjectCommand(DropObjectsRequest dropRequest, EObject droppedObject) {
-
- Point location = dropRequest.getLocation().getCopy();
-
- View dropTargetView = ((IGraphicalEditPart)getHost()).getNotationView();
- EObject dropTargetElement = dropTargetView.getElement();
-
- String droppedNodeType = registry.getNodeGraphicalType(droppedObject, dropTargetView.getType());
- String droppedEdgeType = registry.getEdgeGraphicalType(droppedObject);
-
- // Test if a specific drop command should be used
- if(getSpecificDropList().contains(droppedNodeType) || getSpecificDropList().contains(droppedEdgeType)) {
- return getSpecificDropCommand(dropRequest, droppedObject, droppedNodeType, droppedEdgeType);
- }
-
- // Decide unknown type handling
- if(UNDEFINED_TYPE.equals(droppedNodeType) && UNDEFINED_TYPE.equals(droppedEdgeType)) {
- return getUnknownDropCommand(dropRequest, droppedObject);
- }
-
- // The dropped element is a node
- if(!UNDEFINED_TYPE.equals(droppedNodeType)) {
-
- // Drop restriction:
- // - no restriction when dropped on diagram
- // - require containment when dropped on any other EObject
- if((dropTargetView instanceof Diagram) || (dropTargetElement.eContents().contains(droppedObject))) {
- return getDefaultDropNodeCommand(droppedNodeType, location, droppedObject);
- }
-
- return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE;
- }
-
- // The dropped element is a edge
- if(!UNDEFINED_TYPE.equals(droppedEdgeType)) {
-
- Collection<?> sources = linkMappingHelper.getSource(droppedObject);
- Collection<?> targets = linkMappingHelper.getTarget(droppedObject);
-
- // Only manage binary link during drop
- if((sources.size() > 0) && (targets.size() > 0)) {
- EObject source = (EObject)sources.toArray()[0];
- EObject target = (EObject)targets.toArray()[0];
- return getDefaultDropEdgeCommand(droppedObject, source, target, droppedEdgeType, location);
- }
-
- return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE;
- }
-
- return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE;
- }
-
- protected ICommand getDefaultDropNodeCommand(String droppedObjectGraphicalType, Point absoluteLocation, EObject droppedObject) {
-
- IAdaptable elementAdapter = new EObjectAdapter(droppedObject);
-
- ViewDescriptor descriptor = new ViewDescriptor(elementAdapter, Node.class, droppedObjectGraphicalType, ViewUtil.APPEND, ViewDescriptorUtil.PERSISTED, getDiagramPreferencesHint());
- CreateViewRequest createViewRequest = new CreateViewRequest(descriptor);
- createViewRequest.setLocation(absoluteLocation);
-
- // Get view creation command for the dropped object
- Command command = getHost().getCommand(createViewRequest);
-
- // Use the ViewDescriptor as command result, it then can be used as an adaptable to retrieve the View
- return new CommandProxyWithResult(command, descriptor);
- }
-
- protected ICommand getDefaultDropEdgeCommand(EObject droppedObject, EObject source, EObject target, String droppedEdgeType, Point absoluteLocation) {
-
- CompositeCommand completeDropCommand = new CompositeCommand("CompleteDropEdge"); //$NON-NLS-1$
-
- // Find views in current diagram representing source and target
- Collection<View> sourceViews = getViews(source);
- Collection<View> targetViews = getViews(target);
-
- IAdaptable sourceViewAdapter = null;
- IAdaptable targetViewAdapter = null;
-
- // If either a source or target lacks create view for these elements
- // - using defaultDrop command (assumed to be a view creation)
- // - try to create view on host
- if(sourceViews.isEmpty() || targetViews.isEmpty()) {
-
- CompositeCommand createEndViewsCommand = new CompositeCommand("CreateSourceTargetViews"); //$NON-NLS-1$
-
- View dropContainerView = ((IGraphicalEditPart)getHost()).getNotationView();
- EObject dropContainerElement = dropContainerView.getElement();
-
- if(sourceViews.isEmpty()) {
- if(dropContainerElement.eContents().contains(source)) {
- ICommand dropSourceCommand = getDefaultDropNodeCommand(registry.getNodeGraphicalType(source, dropContainerView.getType()), absoluteLocation.getCopy(), source);
- CompositeCommand.compose(createEndViewsCommand, dropSourceCommand);
- sourceViewAdapter = (IAdaptable)dropSourceCommand.getCommandResult().getReturnValue();
- } else {
- return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE;
- }
- }
-
- if(targetViews.isEmpty()) {
- if(dropContainerElement.eContents().contains(target)) {
- ICommand dropTargetCommand = getDefaultDropNodeCommand(registry.getNodeGraphicalType(target, dropContainerView.getType()), absoluteLocation.getCopy(), target);
- CompositeCommand.compose(createEndViewsCommand, dropTargetCommand);
- targetViewAdapter = (IAdaptable)dropTargetCommand.getCommandResult().getReturnValue();
- } else {
- return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE;
- }
- }
-
- CompositeCommand.compose(completeDropCommand, createEndViewsCommand);
- }
-
- // Create source adapter
- if(!sourceViews.isEmpty()) { // sourceViewAdapter should still be null in this case
- sourceViewAdapter = new SemanticAdapter(null, sourceViews.toArray()[0]);
- }
-
- // Create target adapter
- if(!targetViews.isEmpty()) { // targetViewAdapter should still be null in this case
- targetViewAdapter = new SemanticAdapter(null, targetViews.toArray()[0]);
- }
-
- // Create a view for the dropped link between the source and target view adapters
- IAdaptable droppedObjectAdapter = new SemanticAdapter(droppedObject, null);
-
- CreateConnectionViewRequest.ConnectionViewDescriptor linkdescriptor = new CreateConnectionViewRequest.ConnectionViewDescriptor(droppedObjectAdapter, droppedEdgeType, getDiagramPreferencesHint());
-
- CommonDeferredCreateConnectionViewCommand createConnectionViewCommand = new CommonDeferredCreateConnectionViewCommand(getEditingDomain(), droppedEdgeType, sourceViewAdapter, targetViewAdapter, getViewer(), getDiagramPreferencesHint(), linkdescriptor, null);
- createConnectionViewCommand.setElement(droppedObject);
-
- CompositeCommand.compose(completeDropCommand, createConnectionViewCommand);
-
- return completeDropCommand.reduce();
- }
-
- /**
- * <pre>
- * Sub-classes have to implement this method in order to provides specific drop command for
- * element which require a specific treatment.
- *
- * @param dropRequest current drop request
- * @param droppedEObject the dropped object
- * @param nodeType the graphical type of the dropped element (node representation)
- * @param edgeType the graphical type of the dropped element (edge representation)
- * @return the drop command
- * </pre>
- */
- protected ICommand getSpecificDropCommand(DropObjectsRequest dropRequest, EObject droppedEObject, String nodeType, String edgeType) {
- return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE;
- }
-
- /**
- * <pre>
- * Sub-classes have to implement this method in order to provides drop command for
- * elements that are not natively known by the diagram.
- *
- * @param dropRequest current drop request
- * @param droppedEObject the dropped object
- * @return the drop command
- * </pre>
- */
- protected ICommand getUnknownDropCommand(DropObjectsRequest dropRequest, EObject droppedEObject) {
- return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE;
- }
-
- protected EditPartViewer getViewer() {
- return ((IGraphicalEditPart)getHost()).getViewer();
- }
-
- protected TransactionalEditingDomain getEditingDomain() {
- return ((IGraphicalEditPart)getHost()).getEditingDomain();
- }
-
- protected PreferencesHint getDiagramPreferencesHint() {
- return ((IGraphicalEditPart)getHost()).getDiagramPreferencesHint();
- }
-
- /**
- * This methods looks for views representing a given EObject in the host diagram.
- *
- * @param eObject
- * the {@link EObject} to look for.
- * @return the list of {@link View} representing the eObject.
- */
- private Set<View> getViews(EObject eObject) {
- Set<View> views = new HashSet<View>();
-
- // Retrieve host diagram
- View hostView = ((IGraphicalEditPart)getHost()).getNotationView();
- View hostDiagram = (hostView instanceof Diagram) ? hostView : hostView.getDiagram();
-
- // Retrieve all views for the eObject
- Collection<View> relatedViews = CrossReferencerUtil.getCrossReferencingViews(eObject, hostDiagram.getType());
-
- // Parse and select views from host diagram only
- Iterator<View> it = relatedViews.iterator();
- while(it.hasNext()) {
- View currentView = it.next();
- if(!(currentView instanceof Diagram) && (currentView.getDiagram() == hostDiagram)) {
- views.add(currentView);
- }
- }
-
- return views;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011-2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - refactor common behavior between diagrams
+ *
+ * CEA LIST - Adapted to use a local graphical type registry.
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.gmf.diagram.common.edit.policy;
+
+import static org.eclipse.papyrus.gmf.diagram.common.provider.IGraphicalTypeRegistry.UNDEFINED_TYPE;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+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.EditPartViewer;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gef.requests.ChangeBoundsRequest;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+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.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DiagramDragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.requests.ArrangeRequest;
+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.diagram.ui.requests.DropObjectsRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RefreshConnectionsRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.commands.wrappers.CommandProxyWithResult;
+import org.eclipse.papyrus.gmf.diagram.common.provider.IGraphicalTypeRegistry;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.ViewDescriptorUtil;
+import org.eclipse.papyrus.uml.diagram.common.commands.CommonDeferredCreateConnectionViewCommand;
+import org.eclipse.papyrus.uml.diagram.common.commands.SemanticAdapter;
+import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementBorderEditPart;
+import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.common.util.CrossReferencerUtil;
+
+/**
+ * Abstract DND edit policy delegating the choice of the view to create for an EObject to a local
+ * graphical type registry.
+ */
+public abstract class CommonDiagramDragDropEditPolicy extends DiagramDragDropEditPolicy {
+
+ /** The graphical type registry. */
+ protected IGraphicalTypeRegistry registry;
+
+ /** The list of element types that require a specific drop command. */
+ private Set<String> specificDropList = null;
+
+ /** The specified link mapping helper depending on the diagram */
+ protected ILinkMappingHelper linkMappingHelper;
+
+ /** Constructor */
+ public CommonDiagramDragDropEditPolicy(ILinkMappingHelper linkMappingHelper) {
+ this.linkMappingHelper = linkMappingHelper;
+ }
+
+ private Set<String> getSpecificDropList() {
+ if(specificDropList == null) {
+ specificDropList = getSpecificDropBehaviorTypes();
+ }
+ return specificDropList;
+ }
+
+ protected abstract Set<String> getSpecificDropBehaviorTypes();
+
+ /**
+ * <pre>
+ * {@inheritedDoc}.
+ *
+ * Overridden method to fix some exception occurring while moving affixed element (nodes or labels)
+ * (https://bugs.eclipse.org/bugs/show_bug.cgi?id=350680).
+ * </pre>
+ */
+ @Override
+ protected Command getDropCommand(ChangeBoundsRequest request) {
+
+ Iterator<?> iter = request.getEditParts().iterator();
+ EObject graphicalParentObject = ((GraphicalEditPart)getHost()).resolveSemanticElement();
+ while((graphicalParentObject != null) && (iter.hasNext())) {
+ EditPart droppedEditPart = (EditPart)iter.next();
+ if(droppedEditPart instanceof AbstractElementBorderEditPart) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ if(droppedEditPart instanceof AbstractElementLabelEditPart) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ }
+ return super.getDropCommand(request);
+ }
+
+ /**
+ * {@inheritedDoc}.
+ */
+ @Override
+ public Command getDropObjectsCommand(DropObjectsRequest dropRequest) {
+
+ CompoundCommand completeDropCommand = new CompoundCommand("DropObjectsAndArrange"); //$NON-NLS-1$
+
+ // Detect file drop
+ if((dropRequest.getObjects().size() > 0) && (dropRequest.getObjects().get(0) instanceof String)) {
+ return getDropFileCommand(dropRequest);
+ }
+
+ // Create the drop command by composite drop command for each dropped elements
+ CompositeCommand gmfDropCommand = new CompositeCommand("DropObjects"); //$NON-NLS-1$
+ Iterator<?> iter = dropRequest.getObjects().iterator();
+ while(iter.hasNext()) {
+ EObject droppedObject = (EObject)iter.next();
+ gmfDropCommand.add(getDropObjectCommand(dropRequest, droppedObject));
+ }
+
+ // Create the complete drop command by adding an arrange command after drop
+ if(!gmfDropCommand.isEmpty()) {
+
+ // Retrieve drop result (most probably created view but not necessarily) and update the request
+ CommandResult result = gmfDropCommand.getCommandResult();
+ List<?> newValues = (List<?>)result.getReturnValue();
+ dropRequest.setResult(newValues);
+
+ // Prepare refresh command
+ RefreshConnectionsRequest refreshRequest = new RefreshConnectionsRequest(newValues);
+ Command refreshCommand = getHost().getCommand(refreshRequest);
+
+ // Prepare an arrange command to avoid every dropped view to appear at the same location
+ ArrangeRequest arrangeRequest = new ArrangeRequest(RequestConstants.REQ_ARRANGE_DEFERRED);
+ arrangeRequest.setViewAdaptersToArrange(newValues);
+ Command arrangeCommand = getHost().getCommand(arrangeRequest);
+
+ // Update the complete drop command (drop - refresh - arrange)
+ Command dropCommand = new ICommandProxy(gmfDropCommand);
+ completeDropCommand.add(dropCommand.chain(refreshCommand));
+ completeDropCommand.add(arrangeCommand);
+ }
+
+ return completeDropCommand;
+ }
+
+ protected ICommand getDropObjectCommand(DropObjectsRequest dropRequest, EObject droppedObject) {
+
+ Point location = dropRequest.getLocation().getCopy();
+
+ View dropTargetView = ((IGraphicalEditPart)getHost()).getNotationView();
+ EObject dropTargetElement = dropTargetView.getElement();
+
+ String droppedNodeType = registry.getNodeGraphicalType(droppedObject, dropTargetView.getType());
+ String droppedEdgeType = registry.getEdgeGraphicalType(droppedObject);
+
+ // Test if a specific drop command should be used
+ if(getSpecificDropList().contains(droppedNodeType) || getSpecificDropList().contains(droppedEdgeType)) {
+ return getSpecificDropCommand(dropRequest, droppedObject, droppedNodeType, droppedEdgeType);
+ }
+
+ // Decide unknown type handling
+ if(UNDEFINED_TYPE.equals(droppedNodeType) && UNDEFINED_TYPE.equals(droppedEdgeType)) {
+ return getUnknownDropCommand(dropRequest, droppedObject);
+ }
+
+ // The dropped element is a node
+ if(!UNDEFINED_TYPE.equals(droppedNodeType)) {
+
+ // Drop restriction:
+ // - no restriction when dropped on diagram
+ // - require containment when dropped on any other EObject
+ if((dropTargetView instanceof Diagram) || (dropTargetElement.eContents().contains(droppedObject))) {
+ return getDefaultDropNodeCommand(droppedNodeType, location, droppedObject);
+ }
+
+ return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE;
+ }
+
+ // The dropped element is a edge
+ if(!UNDEFINED_TYPE.equals(droppedEdgeType)) {
+
+ Collection<?> sources = linkMappingHelper.getSource(droppedObject);
+ Collection<?> targets = linkMappingHelper.getTarget(droppedObject);
+
+ // Only manage binary link during drop
+ if((sources.size() > 0) && (targets.size() > 0)) {
+ EObject source = (EObject)sources.toArray()[0];
+ EObject target = (EObject)targets.toArray()[0];
+ return getDefaultDropEdgeCommand(droppedObject, source, target, droppedEdgeType, location);
+ }
+
+ return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE;
+ }
+
+ return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE;
+ }
+
+ protected ICommand getDefaultDropNodeCommand(String droppedObjectGraphicalType, Point absoluteLocation, EObject droppedObject) {
+
+ IAdaptable elementAdapter = new EObjectAdapter(droppedObject);
+
+ ViewDescriptor descriptor = new ViewDescriptor(elementAdapter, Node.class, droppedObjectGraphicalType, ViewUtil.APPEND, ViewDescriptorUtil.PERSISTED, getDiagramPreferencesHint());
+ CreateViewRequest createViewRequest = new CreateViewRequest(descriptor);
+ createViewRequest.setLocation(absoluteLocation);
+
+ // Get view creation command for the dropped object
+ Command command = getHost().getCommand(createViewRequest);
+
+ // Use the ViewDescriptor as command result, it then can be used as an adaptable to retrieve the View
+ return new CommandProxyWithResult(command, descriptor);
+ }
+
+ protected ICommand getDefaultDropEdgeCommand(EObject droppedObject, EObject source, EObject target, String droppedEdgeType, Point absoluteLocation) {
+
+ CompositeCommand completeDropCommand = new CompositeCommand("CompleteDropEdge"); //$NON-NLS-1$
+
+ // Find views in current diagram representing source and target
+ Collection<View> sourceViews = getViews(source);
+ Collection<View> targetViews = getViews(target);
+
+ IAdaptable sourceViewAdapter = null;
+ IAdaptable targetViewAdapter = null;
+
+ // If either a source or target lacks create view for these elements
+ // - using defaultDrop command (assumed to be a view creation)
+ // - try to create view on host
+ if(sourceViews.isEmpty() || targetViews.isEmpty()) {
+
+ CompositeCommand createEndViewsCommand = new CompositeCommand("CreateSourceTargetViews"); //$NON-NLS-1$
+
+ View dropContainerView = ((IGraphicalEditPart)getHost()).getNotationView();
+ EObject dropContainerElement = dropContainerView.getElement();
+
+ if(sourceViews.isEmpty()) {
+ if(dropContainerElement.eContents().contains(source)) {
+ ICommand dropSourceCommand = getDefaultDropNodeCommand(registry.getNodeGraphicalType(source, dropContainerView.getType()), absoluteLocation.getCopy(), source);
+ CompositeCommand.compose(createEndViewsCommand, dropSourceCommand);
+ sourceViewAdapter = (IAdaptable)dropSourceCommand.getCommandResult().getReturnValue();
+ } else {
+ return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE;
+ }
+ }
+
+ if(targetViews.isEmpty()) {
+ if(dropContainerElement.eContents().contains(target)) {
+ ICommand dropTargetCommand = getDefaultDropNodeCommand(registry.getNodeGraphicalType(target, dropContainerView.getType()), absoluteLocation.getCopy(), target);
+ CompositeCommand.compose(createEndViewsCommand, dropTargetCommand);
+ targetViewAdapter = (IAdaptable)dropTargetCommand.getCommandResult().getReturnValue();
+ } else {
+ return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE;
+ }
+ }
+
+ CompositeCommand.compose(completeDropCommand, createEndViewsCommand);
+ }
+
+ // Create source adapter
+ if(!sourceViews.isEmpty()) { // sourceViewAdapter should still be null in this case
+ sourceViewAdapter = new SemanticAdapter(null, sourceViews.toArray()[0]);
+ }
+
+ // Create target adapter
+ if(!targetViews.isEmpty()) { // targetViewAdapter should still be null in this case
+ targetViewAdapter = new SemanticAdapter(null, targetViews.toArray()[0]);
+ }
+
+ // Create a view for the dropped link between the source and target view adapters
+ IAdaptable droppedObjectAdapter = new SemanticAdapter(droppedObject, null);
+
+ CreateConnectionViewRequest.ConnectionViewDescriptor linkdescriptor = new CreateConnectionViewRequest.ConnectionViewDescriptor(droppedObjectAdapter, droppedEdgeType, getDiagramPreferencesHint());
+
+ CommonDeferredCreateConnectionViewCommand createConnectionViewCommand = new CommonDeferredCreateConnectionViewCommand(getEditingDomain(), droppedEdgeType, sourceViewAdapter, targetViewAdapter, getViewer(), getDiagramPreferencesHint(), linkdescriptor, null);
+ createConnectionViewCommand.setElement(droppedObject);
+
+ CompositeCommand.compose(completeDropCommand, createConnectionViewCommand);
+
+ return completeDropCommand.reduce();
+ }
+
+ /**
+ * <pre>
+ * Sub-classes have to implement this method in order to provides specific drop command for
+ * element which require a specific treatment.
+ *
+ * @param dropRequest current drop request
+ * @param droppedEObject the dropped object
+ * @param nodeType the graphical type of the dropped element (node representation)
+ * @param edgeType the graphical type of the dropped element (edge representation)
+ * @return the drop command
+ * </pre>
+ */
+ protected ICommand getSpecificDropCommand(DropObjectsRequest dropRequest, EObject droppedEObject, String nodeType, String edgeType) {
+ return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * <pre>
+ * Sub-classes have to implement this method in order to provides drop command for
+ * elements that are not natively known by the diagram.
+ *
+ * @param dropRequest current drop request
+ * @param droppedEObject the dropped object
+ * @return the drop command
+ * </pre>
+ */
+ protected ICommand getUnknownDropCommand(DropObjectsRequest dropRequest, EObject droppedEObject) {
+ return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE;
+ }
+
+ protected EditPartViewer getViewer() {
+ return ((IGraphicalEditPart)getHost()).getViewer();
+ }
+
+ protected TransactionalEditingDomain getEditingDomain() {
+ return ((IGraphicalEditPart)getHost()).getEditingDomain();
+ }
+
+ protected PreferencesHint getDiagramPreferencesHint() {
+ return ((IGraphicalEditPart)getHost()).getDiagramPreferencesHint();
+ }
+
+ /**
+ * This methods looks for views representing a given EObject in the host diagram.
+ *
+ * @param eObject
+ * the {@link EObject} to look for.
+ * @return the list of {@link View} representing the eObject.
+ */
+ private Set<View> getViews(EObject eObject) {
+ Set<View> views = new HashSet<View>();
+
+ // Retrieve host diagram
+ View hostView = ((IGraphicalEditPart)getHost()).getNotationView();
+ View hostDiagram = (hostView instanceof Diagram) ? hostView : hostView.getDiagram();
+
+ // Retrieve all views for the eObject
+ Collection<View> relatedViews = CrossReferencerUtil.getCrossReferencingViews(eObject, hostDiagram.getType());
+
+ // Parse and select views from host diagram only
+ Iterator<View> it = relatedViews.iterator();
+ while(it.hasNext()) {
+ View currentView = it.next();
+ if(!(currentView instanceof Diagram) && (currentView.getDiagram() == hostDiagram)) {
+ views.add(currentView);
+ }
+ }
+
+ return views;
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultContainerNodeEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultContainerNodeEditPolicy.java
index c4d7c0ed7b9..2a845240b00 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultContainerNodeEditPolicy.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultContainerNodeEditPolicy.java
@@ -1,72 +1,72 @@
-package org.eclipse.papyrus.gmf.diagram.common.edit.policy;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.draw2d.ConnectionAnchor;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.requests.CreateConnectionRequest;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-import org.eclipse.gmf.runtime.common.core.util.StringStatics;
-import org.eclipse.gmf.runtime.diagram.core.commands.SetConnectionAnchorsCommand;
-import org.eclipse.gmf.runtime.diagram.core.commands.SetConnectionEndsCommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.CreateCommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ContainerNodeEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.internal.commands.SetConnectionBendpointsCommand;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.gmf.diagram.common.commands.CreateViewCommand;
-
-/**
- * Default container node edit policy replacement used to replace {@link CreateCommand} by {@link CreateViewCommand},
- * different implementation of the canExecute() method.
- * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=346739.
- */
-public class DefaultContainerNodeEditPolicy extends ContainerNodeEditPolicy {
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected Command getConnectionCreateCommand(CreateConnectionRequest request) {
- if (!(request instanceof CreateConnectionViewRequest))
- return null;
- CreateConnectionViewRequest req = (CreateConnectionViewRequest) request;
- CompositeCommand cc = new CompositeCommand(
- DiagramUIMessages.Commands_CreateCommand_Connection_Label);
- Diagram diagramView = ((View)getHost().getModel())
- .getDiagram();
-
- // TransactionalEditingDomain editingDomain = getEditingDomain();
- TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
- CreateCommand createCommand = new CreateViewCommand(editingDomain, req
- .getConnectionViewDescriptor(), diagramView.getDiagram());
- //
- setViewAdapter((IAdaptable) createCommand.getCommandResult()
- .getReturnValue());
-
-
- SetConnectionEndsCommand sceCommand = new SetConnectionEndsCommand(editingDomain, StringStatics.BLANK);
- sceCommand.setEdgeAdaptor(getViewAdapter());
- sceCommand.setNewSourceAdaptor(new EObjectAdapter(getView()));
- ConnectionAnchor sourceAnchor = getConnectableEditPart()
- .getSourceConnectionAnchor(request);
- SetConnectionAnchorsCommand scaCommand = new SetConnectionAnchorsCommand(editingDomain, StringStatics.BLANK);
- scaCommand.setEdgeAdaptor(getViewAdapter());
- scaCommand.setNewSourceTerminal(getConnectableEditPart()
- .mapConnectionAnchorToTerminal(sourceAnchor));
- SetConnectionBendpointsCommand sbbCommand = new SetConnectionBendpointsCommand(editingDomain);
- sbbCommand.setEdgeAdapter(getViewAdapter());
- cc.compose(createCommand);
- cc.compose(sceCommand);
- cc.compose(scaCommand);
- cc.compose(sbbCommand);
- Command c = new ICommandProxy(cc);
- request.setStartCommand(c);
- return c;
- }
-}
+package org.eclipse.papyrus.gmf.diagram.common.edit.policy;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.draw2d.ConnectionAnchor;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.requests.CreateConnectionRequest;
+import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
+import org.eclipse.gmf.runtime.common.core.util.StringStatics;
+import org.eclipse.gmf.runtime.diagram.core.commands.SetConnectionAnchorsCommand;
+import org.eclipse.gmf.runtime.diagram.core.commands.SetConnectionEndsCommand;
+import org.eclipse.gmf.runtime.diagram.ui.commands.CreateCommand;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ContainerNodeEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.internal.commands.SetConnectionBendpointsCommand;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.gmf.diagram.common.commands.CreateViewCommand;
+
+/**
+ * Default container node edit policy replacement used to replace {@link CreateCommand} by {@link CreateViewCommand},
+ * different implementation of the canExecute() method.
+ * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=346739.
+ */
+public class DefaultContainerNodeEditPolicy extends ContainerNodeEditPolicy {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Command getConnectionCreateCommand(CreateConnectionRequest request) {
+ if (!(request instanceof CreateConnectionViewRequest))
+ return null;
+ CreateConnectionViewRequest req = (CreateConnectionViewRequest) request;
+ CompositeCommand cc = new CompositeCommand(
+ DiagramUIMessages.Commands_CreateCommand_Connection_Label);
+ Diagram diagramView = ((View)getHost().getModel())
+ .getDiagram();
+
+ // TransactionalEditingDomain editingDomain = getEditingDomain();
+ TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
+ CreateCommand createCommand = new CreateViewCommand(editingDomain, req
+ .getConnectionViewDescriptor(), diagramView.getDiagram());
+ //
+ setViewAdapter((IAdaptable) createCommand.getCommandResult()
+ .getReturnValue());
+
+
+ SetConnectionEndsCommand sceCommand = new SetConnectionEndsCommand(editingDomain, StringStatics.BLANK);
+ sceCommand.setEdgeAdaptor(getViewAdapter());
+ sceCommand.setNewSourceAdaptor(new EObjectAdapter(getView()));
+ ConnectionAnchor sourceAnchor = getConnectableEditPart()
+ .getSourceConnectionAnchor(request);
+ SetConnectionAnchorsCommand scaCommand = new SetConnectionAnchorsCommand(editingDomain, StringStatics.BLANK);
+ scaCommand.setEdgeAdaptor(getViewAdapter());
+ scaCommand.setNewSourceTerminal(getConnectableEditPart()
+ .mapConnectionAnchorToTerminal(sourceAnchor));
+ SetConnectionBendpointsCommand sbbCommand = new SetConnectionBendpointsCommand(editingDomain);
+ sbbCommand.setEdgeAdapter(getViewAdapter());
+ cc.compose(createCommand);
+ cc.compose(sceCommand);
+ cc.compose(scaCommand);
+ cc.compose(sbbCommand);
+ Command c = new ICommandProxy(cc);
+ request.setStartCommand(c);
+ return c;
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultCreationEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultCreationEditPolicy.java
index daf2e75e55b..0e65f571fb5 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultCreationEditPolicy.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultCreationEditPolicy.java
@@ -1,111 +1,111 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.gmf.diagram.common.edit.policy;
-
-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.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gef.requests.ChangeBoundsRequest;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
-import org.eclipse.gmf.runtime.diagram.ui.commands.CreateCommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.gmf.diagram.common.commands.CreateViewCommand;
-
-/**
- * Default creation edit policy replacement used to replace {@link CreateCommand} by {@link CreateViewCommand},
- * different implementation of the canExecute() method.
- * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=346739
- */
-public class DefaultCreationEditPolicy extends CreationEditPolicy {
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected Command getReparentCommand(ChangeBoundsRequest request) {
- //the behavior has been changed in order to allow the move of element
- //that are not attached to a semantic element
- // so it Forbid re-parent in this edit policy (to be used by compartment)
- // in order to avoid node attached to semantic to be moved in compartments.
- @SuppressWarnings("rawtypes")
- Iterator editParts = request.getEditParts().iterator();
- CompositeCommand cc = new CompositeCommand(DiagramUIMessages.AddCommand_Label);
- while ( editParts.hasNext() ) {
- EditPart ep = (EditPart)editParts.next();
- if ( ep instanceof LabelEditPart ) {
- continue;
- }
- View view = (View)ep.getAdapter(View.class);
- if ( view == null ) {
- continue;
- }
-
- EObject semantic = ViewUtil.resolveSemanticElement(view);
- if ( semantic == null ) {
- cc.compose(getReparentViewCommand((IGraphicalEditPart)ep));
- }
- else{
- return UnexecutableCommand.INSTANCE;
- }
-
- }
- return cc.isEmpty() ? null : new ICommandProxy(cc.reduce());
-
-
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected Command getCreateCommand(CreateViewRequest request) {
-
- // This overrides getCreatCommand in order to use a specific CreateViewCommand (instead of
- // org.eclipse.gmf.runtime.diagram.ui.commands.CreateCommand.
-
- // The original CreateCommand#canExecute() implementation rely on ViewProvider#provides(CreateViewForKindOperation op)
- // method to know if a view can be created. The problem is that this method is incorrectly generated by GMF Tooling and should be avoided.
-
- // CreateViewCommand replace the semantic adapter in its call to ViewService to know if a provider exists.
-
- TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
- CompositeTransactionalCommand cc = new CompositeTransactionalCommand(editingDomain, DiagramUIMessages.AddCommand_Label);
-
- Iterator<? extends ViewDescriptor> descriptors = request.getViewDescriptors().iterator();
- while (descriptors.hasNext()) {
-
- CreateViewRequest.ViewDescriptor descriptor = (CreateViewRequest.ViewDescriptor)descriptors.next();
- CreateCommand createCommand = new CreateViewCommand(editingDomain, descriptor, (View)(getHost().getModel()));
- cc.compose(createCommand);
-
- }
-
- return new ICommandProxy(cc.reduce());
-
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.gmf.diagram.common.edit.policy;
+
+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.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gef.requests.ChangeBoundsRequest;
+import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.commands.CreateCommand;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor;
+import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.gmf.diagram.common.commands.CreateViewCommand;
+
+/**
+ * Default creation edit policy replacement used to replace {@link CreateCommand} by {@link CreateViewCommand},
+ * different implementation of the canExecute() method.
+ * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=346739
+ */
+public class DefaultCreationEditPolicy extends CreationEditPolicy {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Command getReparentCommand(ChangeBoundsRequest request) {
+ //the behavior has been changed in order to allow the move of element
+ //that are not attached to a semantic element
+ // so it Forbid re-parent in this edit policy (to be used by compartment)
+ // in order to avoid node attached to semantic to be moved in compartments.
+ @SuppressWarnings("rawtypes")
+ Iterator editParts = request.getEditParts().iterator();
+ CompositeCommand cc = new CompositeCommand(DiagramUIMessages.AddCommand_Label);
+ while ( editParts.hasNext() ) {
+ EditPart ep = (EditPart)editParts.next();
+ if ( ep instanceof LabelEditPart ) {
+ continue;
+ }
+ View view = (View)ep.getAdapter(View.class);
+ if ( view == null ) {
+ continue;
+ }
+
+ EObject semantic = ViewUtil.resolveSemanticElement(view);
+ if ( semantic == null ) {
+ cc.compose(getReparentViewCommand((IGraphicalEditPart)ep));
+ }
+ else{
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ }
+ return cc.isEmpty() ? null : new ICommandProxy(cc.reduce());
+
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Command getCreateCommand(CreateViewRequest request) {
+
+ // This overrides getCreatCommand in order to use a specific CreateViewCommand (instead of
+ // org.eclipse.gmf.runtime.diagram.ui.commands.CreateCommand.
+
+ // The original CreateCommand#canExecute() implementation rely on ViewProvider#provides(CreateViewForKindOperation op)
+ // method to know if a view can be created. The problem is that this method is incorrectly generated by GMF Tooling and should be avoided.
+
+ // CreateViewCommand replace the semantic adapter in its call to ViewService to know if a provider exists.
+
+ TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
+ CompositeTransactionalCommand cc = new CompositeTransactionalCommand(editingDomain, DiagramUIMessages.AddCommand_Label);
+
+ Iterator<? extends ViewDescriptor> descriptors = request.getViewDescriptors().iterator();
+ while (descriptors.hasNext()) {
+
+ CreateViewRequest.ViewDescriptor descriptor = (CreateViewRequest.ViewDescriptor)descriptors.next();
+ CreateCommand createCommand = new CreateViewCommand(editingDomain, descriptor, (View)(getHost().getModel()));
+ cc.compose(createCommand);
+
+ }
+
+ return new ICommandProxy(cc.reduce());
+
+ }
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultGraphicalNodeEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultGraphicalNodeEditPolicy.java
index 33fe7af6f30..30b3d6bf709 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultGraphicalNodeEditPolicy.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultGraphicalNodeEditPolicy.java
@@ -1,109 +1,109 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.gmf.diagram.common.edit.policy;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.draw2d.ConnectionAnchor;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.requests.CreateConnectionRequest;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-import org.eclipse.gmf.runtime.common.core.util.StringStatics;
-import org.eclipse.gmf.runtime.diagram.core.commands.SetConnectionAnchorsCommand;
-import org.eclipse.gmf.runtime.diagram.core.commands.SetConnectionEndsCommand;
-import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter;
-import org.eclipse.gmf.runtime.diagram.ui.commands.CreateCommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.GraphicalNodeEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.internal.commands.SetConnectionBendpointsCommand;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewAndElementRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.gmf.diagram.common.commands.CreateViewCommand;
-import org.eclipse.papyrus.uml.service.types.utils.RequestParameterConstants;
-
-/**
- * Default graphical node edit policy replacement used to replace {@link CreateCommand} by {@link CreateViewCommand},
- * different implementation of the canExecute() method.
- * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=346739.
- */
-public class DefaultGraphicalNodeEditPolicy extends GraphicalNodeEditPolicy {
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected Command getConnectionAndRelationshipCompleteCommand(CreateConnectionViewAndElementRequest request) {
-
- // Add parameter (source and target view to the CreateRelationshipRequest
- CreateElementRequestAdapter requestAdapter = request.getConnectionViewAndElementDescriptor().getCreateElementRequestAdapter();
- CreateRelationshipRequest createElementRequest = (CreateRelationshipRequest)requestAdapter.getAdapter(CreateRelationshipRequest.class);
-
- View sourceView = (View) request.getSourceEditPart().getModel();
- createElementRequest.setParameter(RequestParameterConstants.EDGE_CREATE_REQUEST_SOURCE_VIEW, sourceView);
-
- View targetView = (View) request.getTargetEditPart().getModel();
- createElementRequest.setParameter(RequestParameterConstants.EDGE_CREATE_REQUEST_TARGET_VIEW, targetView);
-
- return super.getConnectionAndRelationshipCompleteCommand(request);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected Command getConnectionCreateCommand(CreateConnectionRequest request) {
- if (!(request instanceof CreateConnectionViewRequest))
- return null;
- CreateConnectionViewRequest req = (CreateConnectionViewRequest) request;
- CompositeCommand cc = new CompositeCommand(
- DiagramUIMessages.Commands_CreateCommand_Connection_Label);
- Diagram diagramView = ((View)getHost().getModel())
- .getDiagram();
-
- // TransactionalEditingDomain editingDomain = getEditingDomain();
- TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
- CreateCommand createCommand = new CreateViewCommand(editingDomain, req
- .getConnectionViewDescriptor(), diagramView.getDiagram());
- //
- setViewAdapter((IAdaptable) createCommand.getCommandResult()
- .getReturnValue());
-
-
- SetConnectionEndsCommand sceCommand = new SetConnectionEndsCommand(editingDomain, StringStatics.BLANK);
- sceCommand.setEdgeAdaptor(getViewAdapter());
- sceCommand.setNewSourceAdaptor(new EObjectAdapter(getView()));
- ConnectionAnchor sourceAnchor = getConnectableEditPart()
- .getSourceConnectionAnchor(request);
- SetConnectionAnchorsCommand scaCommand = new SetConnectionAnchorsCommand(editingDomain, StringStatics.BLANK);
- scaCommand.setEdgeAdaptor(getViewAdapter());
- scaCommand.setNewSourceTerminal(getConnectableEditPart()
- .mapConnectionAnchorToTerminal(sourceAnchor));
- SetConnectionBendpointsCommand sbbCommand = new SetConnectionBendpointsCommand(editingDomain);
- sbbCommand.setEdgeAdapter(getViewAdapter());
- cc.compose(createCommand);
- cc.compose(sceCommand);
- cc.compose(scaCommand);
- cc.compose(sbbCommand);
- Command c = new ICommandProxy(cc);
- request.setStartCommand(c);
- return c;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.gmf.diagram.common.edit.policy;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.draw2d.ConnectionAnchor;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.requests.CreateConnectionRequest;
+import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
+import org.eclipse.gmf.runtime.common.core.util.StringStatics;
+import org.eclipse.gmf.runtime.diagram.core.commands.SetConnectionAnchorsCommand;
+import org.eclipse.gmf.runtime.diagram.core.commands.SetConnectionEndsCommand;
+import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter;
+import org.eclipse.gmf.runtime.diagram.ui.commands.CreateCommand;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.GraphicalNodeEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.internal.commands.SetConnectionBendpointsCommand;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewAndElementRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.gmf.diagram.common.commands.CreateViewCommand;
+import org.eclipse.papyrus.uml.service.types.utils.RequestParameterConstants;
+
+/**
+ * Default graphical node edit policy replacement used to replace {@link CreateCommand} by {@link CreateViewCommand},
+ * different implementation of the canExecute() method.
+ * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=346739.
+ */
+public class DefaultGraphicalNodeEditPolicy extends GraphicalNodeEditPolicy {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Command getConnectionAndRelationshipCompleteCommand(CreateConnectionViewAndElementRequest request) {
+
+ // Add parameter (source and target view to the CreateRelationshipRequest
+ CreateElementRequestAdapter requestAdapter = request.getConnectionViewAndElementDescriptor().getCreateElementRequestAdapter();
+ CreateRelationshipRequest createElementRequest = (CreateRelationshipRequest)requestAdapter.getAdapter(CreateRelationshipRequest.class);
+
+ View sourceView = (View) request.getSourceEditPart().getModel();
+ createElementRequest.setParameter(RequestParameterConstants.EDGE_CREATE_REQUEST_SOURCE_VIEW, sourceView);
+
+ View targetView = (View) request.getTargetEditPart().getModel();
+ createElementRequest.setParameter(RequestParameterConstants.EDGE_CREATE_REQUEST_TARGET_VIEW, targetView);
+
+ return super.getConnectionAndRelationshipCompleteCommand(request);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Command getConnectionCreateCommand(CreateConnectionRequest request) {
+ if (!(request instanceof CreateConnectionViewRequest))
+ return null;
+ CreateConnectionViewRequest req = (CreateConnectionViewRequest) request;
+ CompositeCommand cc = new CompositeCommand(
+ DiagramUIMessages.Commands_CreateCommand_Connection_Label);
+ Diagram diagramView = ((View)getHost().getModel())
+ .getDiagram();
+
+ // TransactionalEditingDomain editingDomain = getEditingDomain();
+ TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
+ CreateCommand createCommand = new CreateViewCommand(editingDomain, req
+ .getConnectionViewDescriptor(), diagramView.getDiagram());
+ //
+ setViewAdapter((IAdaptable) createCommand.getCommandResult()
+ .getReturnValue());
+
+
+ SetConnectionEndsCommand sceCommand = new SetConnectionEndsCommand(editingDomain, StringStatics.BLANK);
+ sceCommand.setEdgeAdaptor(getViewAdapter());
+ sceCommand.setNewSourceAdaptor(new EObjectAdapter(getView()));
+ ConnectionAnchor sourceAnchor = getConnectableEditPart()
+ .getSourceConnectionAnchor(request);
+ SetConnectionAnchorsCommand scaCommand = new SetConnectionAnchorsCommand(editingDomain, StringStatics.BLANK);
+ scaCommand.setEdgeAdaptor(getViewAdapter());
+ scaCommand.setNewSourceTerminal(getConnectableEditPart()
+ .mapConnectionAnchorToTerminal(sourceAnchor));
+ SetConnectionBendpointsCommand sbbCommand = new SetConnectionBendpointsCommand(editingDomain);
+ sbbCommand.setEdgeAdapter(getViewAdapter());
+ cc.compose(createCommand);
+ cc.compose(sceCommand);
+ cc.compose(scaCommand);
+ cc.compose(sbbCommand);
+ Command c = new ICommandProxy(cc);
+ request.setStartCommand(c);
+ return c;
+ }
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultSemanticEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultSemanticEditPolicy.java
index 67cabdc7f3c..2cd79d07ac7 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultSemanticEditPolicy.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultSemanticEditPolicy.java
@@ -1,24 +1,24 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.gmf.diagram.common.edit.policy;
-
-/**
- * This class has been moved in infra.gmfdiag.common framework. Keeping it here for compatibility
- * @deprecated
- * @use {@link org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy}
- */
-@Deprecated
-public class DefaultSemanticEditPolicy extends org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy {
-
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.gmf.diagram.common.edit.policy;
+
+/**
+ * This class has been moved in infra.gmfdiag.common framework. Keeping it here for compatibility
+ * @deprecated
+ * @use {@link org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy}
+ */
+@Deprecated
+public class DefaultSemanticEditPolicy extends org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy {
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultSnapBackEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultSnapBackEditPolicy.java
index 7226ae7ed2b..a9410ae086b 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultSnapBackEditPolicy.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultSnapBackEditPolicy.java
@@ -1,108 +1,108 @@
-/******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * CEA LIST - Adaptation to support a different hint for SnapBack location storage.
- *
- ****************************************************************************/
-package org.eclipse.papyrus.gmf.diagram.common.edit.policy;
-
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-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.commands.SetBoundsCommand;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.GraphicalNodeEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.notation.View;
-
-
-/**
- * <pre>
- * EditPolicy which support the RequestConstants.REQ_SNAP_BACK request type.
- *
- * Returns a command to position a label's offset to it default set at creation.
- *
- * This edit policy is a copy of LabelSnapBackEditPolicy, which does not only use the label view type
- * to find the snap back position (also takes into account the diagram and parent view type).
- *
- * @see org.eclipse.gmf.runtime.diagram.ui.internal.editpolicies.LabelSnapBackEditPolicy
- * </pre>
- */
-@SuppressWarnings("restriction")
-public class DefaultSnapBackEditPolicy extends GraphicalNodeEditPolicy {
-
-
- /**
- * Understands RequestConstants.REQ_SNAP_BACK request types
- *
- * @param request
- * @return boolean
- */
- public boolean understandsRequest(Request request) {
- return RequestConstants.REQ_SNAP_BACK.equals(request.getType());
- }
-
- /**
- * Returns a <code>Command</code> which sets the label's offset to its
- * original position.
- *
- * @param request
- * the request
- * @return the command
- */
- public Command getCommand(Request request) {
- if(RequestConstants.REQ_SNAP_BACK.equals(request.getType())) {
- View view = (View)getHost().getModel();
-
- // YT - Use a snap back hint that takes into account the diagram
- // and parent view type.
- String hint = getSnapBackHint(view);
-
- Point offset = LabelEditPart.getSnapBackPosition(hint);
- if(offset == null)
- return null;
-
- TransactionalEditingDomain editingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
-
- ICommand moveCommand = new SetBoundsCommand(editingDomain, DiagramUIMessages.SetLocationCommand_Label_Resize, new EObjectAdapter(view), offset);
- return new ICommandProxy(moveCommand);
- }
- return null;
- }
-
- public EditPart getTargetEditPart(Request request) {
- if(understandsRequest(request))
- return getHost();
- return super.getTargetEditPart(request);
- }
-
- /**
- * Get the snap back hint for the view.
- *
- * @param view
- * the view to snap back.
- * @return the snap back hint.
- */
- private String getSnapBackHint(View view) {
-
- String diagramType = view.getDiagram().getType();
- String parentType = ViewUtil.getViewContainer(view).getType();
- String labelType = view.getType();
-
- return diagramType + "_" + parentType + "-" + labelType;
- }
-}
+/******************************************************************************
+ * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * CEA LIST - Adaptation to support a different hint for SnapBack location storage.
+ *
+ ****************************************************************************/
+package org.eclipse.papyrus.gmf.diagram.common.edit.policy;
+
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+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.commands.SetBoundsCommand;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.GraphicalNodeEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.View;
+
+
+/**
+ * <pre>
+ * EditPolicy which support the RequestConstants.REQ_SNAP_BACK request type.
+ *
+ * Returns a command to position a label's offset to it default set at creation.
+ *
+ * This edit policy is a copy of LabelSnapBackEditPolicy, which does not only use the label view type
+ * to find the snap back position (also takes into account the diagram and parent view type).
+ *
+ * @see org.eclipse.gmf.runtime.diagram.ui.internal.editpolicies.LabelSnapBackEditPolicy
+ * </pre>
+ */
+@SuppressWarnings("restriction")
+public class DefaultSnapBackEditPolicy extends GraphicalNodeEditPolicy {
+
+
+ /**
+ * Understands RequestConstants.REQ_SNAP_BACK request types
+ *
+ * @param request
+ * @return boolean
+ */
+ public boolean understandsRequest(Request request) {
+ return RequestConstants.REQ_SNAP_BACK.equals(request.getType());
+ }
+
+ /**
+ * Returns a <code>Command</code> which sets the label's offset to its
+ * original position.
+ *
+ * @param request
+ * the request
+ * @return the command
+ */
+ public Command getCommand(Request request) {
+ if(RequestConstants.REQ_SNAP_BACK.equals(request.getType())) {
+ View view = (View)getHost().getModel();
+
+ // YT - Use a snap back hint that takes into account the diagram
+ // and parent view type.
+ String hint = getSnapBackHint(view);
+
+ Point offset = LabelEditPart.getSnapBackPosition(hint);
+ if(offset == null)
+ return null;
+
+ TransactionalEditingDomain editingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
+
+ ICommand moveCommand = new SetBoundsCommand(editingDomain, DiagramUIMessages.SetLocationCommand_Label_Resize, new EObjectAdapter(view), offset);
+ return new ICommandProxy(moveCommand);
+ }
+ return null;
+ }
+
+ public EditPart getTargetEditPart(Request request) {
+ if(understandsRequest(request))
+ return getHost();
+ return super.getTargetEditPart(request);
+ }
+
+ /**
+ * Get the snap back hint for the view.
+ *
+ * @param view
+ * the view to snap back.
+ * @return the snap back hint.
+ */
+ private String getSnapBackHint(View view) {
+
+ String diagramType = view.getDiagram().getType();
+ String parentType = ViewUtil.getViewContainer(view).getType();
+ String labelType = view.getType();
+
+ return diagramType + "_" + parentType + "-" + labelType;
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultXYLayoutEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultXYLayoutEditPolicy.java
index 700a7ae20b6..52bdf9c4860 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultXYLayoutEditPolicy.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultXYLayoutEditPolicy.java
@@ -1,87 +1,87 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.gmf.diagram.common.edit.policy;
-
-import java.util.Iterator;
-
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.requests.CreateRequest;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.XYLayoutEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-
-/**
- * Avoid forcing (-1, -1) dimension in set bounds command (let the view factories deal with
- * size initialization if needed).
- */
-public class DefaultXYLayoutEditPolicy extends XYLayoutEditPolicy {
-
- /**
- * Called in response to a <tt>REQ_CREATE</tt> request. Returns a command
- * to set each created element bounds and auto-size properties.
- *
- * @param request a create request (understands instances of {@link CreateViewRequest}).
- * @return a command to satisfy the request; <tt>null</tt> if the request is not
- * understood.
- */
- protected Command getCreateCommand(CreateRequest request) {
- CreateViewRequest req = (CreateViewRequest) request;
-
-
- TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost())
- .getEditingDomain();
-
- CompositeTransactionalCommand cc = new CompositeTransactionalCommand(
- editingDomain, DiagramUIMessages.AddCommand_Label);
- Iterator<?> iter = req.getViewDescriptors().iterator();
-
- final Rectangle BOUNDS = (Rectangle) getConstraintFor(request);
-
-
-
- while (iter.hasNext()) {
- CreateViewRequest.ViewDescriptor viewDescriptor = (CreateViewRequest.ViewDescriptor)iter.next();
- Rectangle rect = getBoundsOffest(req, BOUNDS,viewDescriptor);
-
- if (rect.getSize().isEmpty()) {
- // Only set location and let the ViewFactory deal with dimension.
- cc.compose(new SetBoundsCommand(editingDomain,
- DiagramUIMessages.SetLocationCommand_Label_Resize,
- viewDescriptor,
- rect.getLocation().getCopy()));
-
- } else {
- // Default set bounds command.
- cc.compose(new SetBoundsCommand(editingDomain,
- DiagramUIMessages.SetLocationCommand_Label_Resize,
- viewDescriptor,
- rect));
-
- }
-
- }
-
- if( cc.reduce() == null )
- return null;
-
- return chainGuideAttachmentCommands( request,
- new ICommandProxy(cc.reduce()));
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.gmf.diagram.common.edit.policy;
+
+import java.util.Iterator;
+
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.XYLayoutEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
+import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
+
+/**
+ * Avoid forcing (-1, -1) dimension in set bounds command (let the view factories deal with
+ * size initialization if needed).
+ */
+public class DefaultXYLayoutEditPolicy extends XYLayoutEditPolicy {
+
+ /**
+ * Called in response to a <tt>REQ_CREATE</tt> request. Returns a command
+ * to set each created element bounds and auto-size properties.
+ *
+ * @param request a create request (understands instances of {@link CreateViewRequest}).
+ * @return a command to satisfy the request; <tt>null</tt> if the request is not
+ * understood.
+ */
+ protected Command getCreateCommand(CreateRequest request) {
+ CreateViewRequest req = (CreateViewRequest) request;
+
+
+ TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost())
+ .getEditingDomain();
+
+ CompositeTransactionalCommand cc = new CompositeTransactionalCommand(
+ editingDomain, DiagramUIMessages.AddCommand_Label);
+ Iterator<?> iter = req.getViewDescriptors().iterator();
+
+ final Rectangle BOUNDS = (Rectangle) getConstraintFor(request);
+
+
+
+ while (iter.hasNext()) {
+ CreateViewRequest.ViewDescriptor viewDescriptor = (CreateViewRequest.ViewDescriptor)iter.next();
+ Rectangle rect = getBoundsOffest(req, BOUNDS,viewDescriptor);
+
+ if (rect.getSize().isEmpty()) {
+ // Only set location and let the ViewFactory deal with dimension.
+ cc.compose(new SetBoundsCommand(editingDomain,
+ DiagramUIMessages.SetLocationCommand_Label_Resize,
+ viewDescriptor,
+ rect.getLocation().getCopy()));
+
+ } else {
+ // Default set bounds command.
+ cc.compose(new SetBoundsCommand(editingDomain,
+ DiagramUIMessages.SetLocationCommand_Label_Resize,
+ viewDescriptor,
+ rect));
+
+ }
+
+ }
+
+ if( cc.reduce() == null )
+ return null;
+
+ return chainGuideAttachmentCommands( request,
+ new ICommandProxy(cc.reduce()));
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/ExternalLabelPrimaryDragRoleEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/ExternalLabelPrimaryDragRoleEditPolicy.java
index cc86e1f4299..0a37dafeb78 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/ExternalLabelPrimaryDragRoleEditPolicy.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/ExternalLabelPrimaryDragRoleEditPolicy.java
@@ -1,75 +1,75 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.gmf.diagram.common.edit.policy;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.geometry.PrecisionRectangle;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.handles.MoveHandle;
-import org.eclipse.gef.requests.ChangeBoundsRequest;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.NonResizableLabelEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.notation.View;
-
-/**
- * This policy provides the selection handles, feedback and move command for
- * external node label.
- * The expected behavior is to provide an external label that can freely move and with a link feedback
- * towards its parent figure during the move.
- */
-public class ExternalLabelPrimaryDragRoleEditPolicy extends NonResizableLabelEditPolicy {
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected List createSelectionHandles() {
- MoveHandle mh = new MoveHandle((GraphicalEditPart)getHost());
- mh.setBorder(null);
- return Collections.singletonList(mh);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected Command getMoveCommand(ChangeBoundsRequest request) {
- LabelEditPart editPart = (LabelEditPart)getHost();
-
- // FeedBack - Parent + Delta
- Rectangle updatedRect = new Rectangle();
- PrecisionRectangle initialRect = new PrecisionRectangle(getInitialFeedbackBounds().getCopy());
- updatedRect = initialRect.getTranslated(getHostFigure().getParent().getBounds().getLocation().getNegated());
- updatedRect = updatedRect.getTranslated(request.getMoveDelta());
-
- // translate the feedback figure
- PrecisionRectangle rect = new PrecisionRectangle(getInitialFeedbackBounds().getCopy());
- getHostFigure().translateToAbsolute(rect);
- rect.translate(request.getMoveDelta());
- rect.resize(request.getSizeDelta());
- getHostFigure().translateToRelative(rect);
-
- ICommand moveCommand = new SetBoundsCommand(editPart.getEditingDomain(), DiagramUIMessages.MoveLabelCommand_Label_Location, new EObjectAdapter((View)editPart.getModel()), updatedRect);
- return new ICommandProxy(moveCommand);
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.gmf.diagram.common.edit.policy;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.geometry.PrecisionRectangle;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.handles.MoveHandle;
+import org.eclipse.gef.requests.ChangeBoundsRequest;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.NonResizableLabelEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * This policy provides the selection handles, feedback and move command for
+ * external node label.
+ * The expected behavior is to provide an external label that can freely move and with a link feedback
+ * towards its parent figure during the move.
+ */
+public class ExternalLabelPrimaryDragRoleEditPolicy extends NonResizableLabelEditPolicy {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected List createSelectionHandles() {
+ MoveHandle mh = new MoveHandle((GraphicalEditPart)getHost());
+ mh.setBorder(null);
+ return Collections.singletonList(mh);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Command getMoveCommand(ChangeBoundsRequest request) {
+ LabelEditPart editPart = (LabelEditPart)getHost();
+
+ // FeedBack - Parent + Delta
+ Rectangle updatedRect = new Rectangle();
+ PrecisionRectangle initialRect = new PrecisionRectangle(getInitialFeedbackBounds().getCopy());
+ updatedRect = initialRect.getTranslated(getHostFigure().getParent().getBounds().getLocation().getNegated());
+ updatedRect = updatedRect.getTranslated(request.getMoveDelta());
+
+ // translate the feedback figure
+ PrecisionRectangle rect = new PrecisionRectangle(getInitialFeedbackBounds().getCopy());
+ getHostFigure().translateToAbsolute(rect);
+ rect.translate(request.getMoveDelta());
+ rect.resize(request.getSizeDelta());
+ getHostFigure().translateToRelative(rect);
+
+ ICommand moveCommand = new SetBoundsCommand(editPart.getEditingDomain(), DiagramUIMessages.MoveLabelCommand_Label_Location, new EObjectAdapter((View)editPart.getModel()), updatedRect);
+ return new ICommandProxy(moveCommand);
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/ILinkMappingHelper.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/ILinkMappingHelper.java
index 1ea548da0f3..d3a8c0fe667 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/ILinkMappingHelper.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/ILinkMappingHelper.java
@@ -1,43 +1,43 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- * CEA LIST - adapted in a non-UML specific manner.
- *
- *****************************************************************************/
-package org.eclipse.papyrus.gmf.diagram.common.edit.policy;
-
-import java.util.Collection;
-
-import org.eclipse.emf.ecore.EObject;
-
-/**
- * Interface to map links at semantic level.
- */
-public interface ILinkMappingHelper {
-
- /**
- * Get the sources.
- *
- * @param link
- * the link.
- * @return the sources.
- */
- public Collection<?> getSource(EObject link);
-
- /**
- * Get the targets.
- *
- * @param link
- * the link.
- * @return the targets.
- */
- public Collection<?> getTarget(EObject link);
-}
+/*****************************************************************************
+ * Copyright (c) 2009 Atos Origin.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
+ * CEA LIST - adapted in a non-UML specific manner.
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.gmf.diagram.common.edit.policy;
+
+import java.util.Collection;
+
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * Interface to map links at semantic level.
+ */
+public interface ILinkMappingHelper {
+
+ /**
+ * Get the sources.
+ *
+ * @param link
+ * the link.
+ * @return the sources.
+ */
+ public Collection<?> getSource(EObject link);
+
+ /**
+ * Get the targets.
+ *
+ * @param link
+ * the link.
+ * @return the targets.
+ */
+ public Collection<?> getTarget(EObject link);
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/LabelDefaultSemanticEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/LabelDefaultSemanticEditPolicy.java
index 85e412dc187..8db6801563e 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/LabelDefaultSemanticEditPolicy.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/LabelDefaultSemanticEditPolicy.java
@@ -1,84 +1,84 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.gmf.diagram.common.edit.policy;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-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.DuplicateElementsRequest;
-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;
-
-/**
- * Semantic edit policy for label (affixed labels mainly), that allow correct destroy,
- * but forbid other edit actions.
- */
-public class LabelDefaultSemanticEditPolicy extends DefaultSemanticEditPolicy {
-
- @Override
- protected Command getDestroyElementCommand(DestroyElementRequest req) {
- return super.getDestroyElementCommand(req);
- }
-
- @Override
- protected Command getConfigureCommand(ConfigureRequest req) {
- return UnexecutableCommand.INSTANCE;
- }
-
- @Override
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- return UnexecutableCommand.INSTANCE;
- }
-
- @Override
- protected Command getCreateCommand(CreateElementRequest req) {
- return UnexecutableCommand.INSTANCE;
- }
-
- @Override
- protected Command getSetCommand(SetRequest req) {
- return UnexecutableCommand.INSTANCE;
- }
-
- @Override
- protected Command getDestroyReferenceCommand(DestroyReferenceRequest req) {
- return UnexecutableCommand.INSTANCE;
- }
-
- @Override
- protected Command getDuplicateCommand(DuplicateElementsRequest req) {
- return UnexecutableCommand.INSTANCE;
- }
-
- @Override
- protected Command getMoveCommand(MoveRequest req) {
- return UnexecutableCommand.INSTANCE;
- }
-
- @Override
- protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
- return UnexecutableCommand.INSTANCE;
- }
-
- @Override
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- return UnexecutableCommand.INSTANCE;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.gmf.diagram.common.edit.policy;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+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.DuplicateElementsRequest;
+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;
+
+/**
+ * Semantic edit policy for label (affixed labels mainly), that allow correct destroy,
+ * but forbid other edit actions.
+ */
+public class LabelDefaultSemanticEditPolicy extends DefaultSemanticEditPolicy {
+
+ @Override
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ return super.getDestroyElementCommand(req);
+ }
+
+ @Override
+ protected Command getConfigureCommand(ConfigureRequest req) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ @Override
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ @Override
+ protected Command getCreateCommand(CreateElementRequest req) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ @Override
+ protected Command getSetCommand(SetRequest req) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ @Override
+ protected Command getDestroyReferenceCommand(DestroyReferenceRequest req) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ @Override
+ protected Command getDuplicateCommand(DuplicateElementsRequest req) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ @Override
+ protected Command getMoveCommand(MoveRequest req) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ @Override
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ @Override
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ return UnexecutableCommand.INSTANCE;
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/LabelDirectEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/LabelDirectEditPolicy.java
index 0b2dff8cf48..a441c171db2 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/LabelDirectEditPolicy.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/LabelDirectEditPolicy.java
@@ -1,109 +1,109 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.gmf.diagram.common.edit.policy;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.gef.ui.internal.parts.TextCellEditorEx;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.gmf.diagram.common.edit.part.ITextAwareEditPart;
-
-/**
- * Overrides {@link org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy} in
- * order to pass parser options to the method that returns the modification command.
- * (always pass 0 - ParserOptions.NONE in the original class).
- *
- * Also this uses (or tries to) the EObject given by {@link org.eclipse.papyrus.gmf.diagram.common.edit.part.ITextAwareEditPart#getParserElement()} to
- * get the edit command instead of using the EObject associated to the edited edit part.
- */
-public class LabelDirectEditPolicy extends org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy {
-
- /**
- * We need an adapter that will be able to hold both a model
- * and an view
- */
- class EObjectAdapterEx extends EObjectAdapter {
-
- private View view = null;
-
- /**
- * constructor
- *
- * @param element
- * element to be wrapped
- * @param view
- * view to be wrapped
- */
- public EObjectAdapterEx(EObject element, View view) {
- super(element);
- this.view = view;
- }
-
- @SuppressWarnings("rawtypes")
- public Object getAdapter(Class adapter) {
- Object o = super.getAdapter(adapter);
- if(o != null)
- return o;
- if(adapter.equals(View.class)) {
- return view;
- }
- return null;
- }
- }
-
- /**
- * @see DirectEditPolicy#getDirectEditCommand(DirectEditRequest)
- */
- protected Command getDirectEditCommand(DirectEditRequest edit) {
- if(edit.getCellEditor() instanceof TextCellEditorEx)
- if(!((TextCellEditorEx)edit.getCellEditor()).hasValueChanged())
- return null;
-
- String labelText = (String)edit.getCellEditor().getValue();
-
- //for CellEditor, null is always returned for invalid values
- if(labelText == null) {
- return null;
- }
-
- // Papyrus - using org.eclipse.papyrus.gmf.diagram.common.edit.part.ITextAwareEditPart here
- ITextAwareEditPart compartment = (ITextAwareEditPart)getHost();
- EObjectAdapter elementAdapter = new EObjectAdapterEx(compartment.getParserElement(), null);
- //
-
- // Papyrus - elementAdapter created with compartment.getParserElement(), no need to use the view here.
- // EObject model = (EObject)compartment.getModel();
- // EObjectAdapter elementAdapter = null;
- // if(model instanceof View) {
- // View view = (View)model;
- // elementAdapter = new EObjectAdapterEx(ViewUtil.resolveSemanticElement(view), view);
- // } else
- // elementAdapter = new EObjectAdapterEx(model, null);
-
- // check to make sure an edit has occurred before returning a command.
- String prevText = compartment.getParser().getEditString(elementAdapter, compartment.getParserOptions().intValue());
- if(!prevText.equals(labelText)) {
- ICommand iCommand = compartment.getParser().getParseCommand(elementAdapter, labelText, compartment.getParserOptions().intValue());
- // Papyrus - use parser options to build command
- // compartment.getParser().getParseCommand(elementAdapter, labelText, 0);
- return new ICommandProxy(iCommand);
- }
-
- return null;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.gmf.diagram.common.edit.policy;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.gef.ui.internal.parts.TextCellEditorEx;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.gmf.diagram.common.edit.part.ITextAwareEditPart;
+
+/**
+ * Overrides {@link org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy} in
+ * order to pass parser options to the method that returns the modification command.
+ * (always pass 0 - ParserOptions.NONE in the original class).
+ *
+ * Also this uses (or tries to) the EObject given by {@link org.eclipse.papyrus.gmf.diagram.common.edit.part.ITextAwareEditPart#getParserElement()} to
+ * get the edit command instead of using the EObject associated to the edited edit part.
+ */
+public class LabelDirectEditPolicy extends org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy {
+
+ /**
+ * We need an adapter that will be able to hold both a model
+ * and an view
+ */
+ class EObjectAdapterEx extends EObjectAdapter {
+
+ private View view = null;
+
+ /**
+ * constructor
+ *
+ * @param element
+ * element to be wrapped
+ * @param view
+ * view to be wrapped
+ */
+ public EObjectAdapterEx(EObject element, View view) {
+ super(element);
+ this.view = view;
+ }
+
+ @SuppressWarnings("rawtypes")
+ public Object getAdapter(Class adapter) {
+ Object o = super.getAdapter(adapter);
+ if(o != null)
+ return o;
+ if(adapter.equals(View.class)) {
+ return view;
+ }
+ return null;
+ }
+ }
+
+ /**
+ * @see DirectEditPolicy#getDirectEditCommand(DirectEditRequest)
+ */
+ protected Command getDirectEditCommand(DirectEditRequest edit) {
+ if(edit.getCellEditor() instanceof TextCellEditorEx)
+ if(!((TextCellEditorEx)edit.getCellEditor()).hasValueChanged())
+ return null;
+
+ String labelText = (String)edit.getCellEditor().getValue();
+
+ //for CellEditor, null is always returned for invalid values
+ if(labelText == null) {
+ return null;
+ }
+
+ // Papyrus - using org.eclipse.papyrus.gmf.diagram.common.edit.part.ITextAwareEditPart here
+ ITextAwareEditPart compartment = (ITextAwareEditPart)getHost();
+ EObjectAdapter elementAdapter = new EObjectAdapterEx(compartment.getParserElement(), null);
+ //
+
+ // Papyrus - elementAdapter created with compartment.getParserElement(), no need to use the view here.
+ // EObject model = (EObject)compartment.getModel();
+ // EObjectAdapter elementAdapter = null;
+ // if(model instanceof View) {
+ // View view = (View)model;
+ // elementAdapter = new EObjectAdapterEx(ViewUtil.resolveSemanticElement(view), view);
+ // } else
+ // elementAdapter = new EObjectAdapterEx(model, null);
+
+ // check to make sure an edit has occurred before returning a command.
+ String prevText = compartment.getParser().getEditString(elementAdapter, compartment.getParserOptions().intValue());
+ if(!prevText.equals(labelText)) {
+ ICommand iCommand = compartment.getParser().getParseCommand(elementAdapter, labelText, compartment.getParserOptions().intValue());
+ // Papyrus - use parser options to build command
+ // compartment.getParser().getParseCommand(elementAdapter, labelText, 0);
+ return new ICommandProxy(iCommand);
+ }
+
+ return null;
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/LinkLabelDragEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/LinkLabelDragEditPolicy.java
index 984aad28dd4..4388650ac3b 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/LinkLabelDragEditPolicy.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/LinkLabelDragEditPolicy.java
@@ -1,39 +1,39 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.gmf.diagram.common.edit.policy;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.handles.MoveHandle;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.NonResizableLabelEditPolicy;
-
-/**
- * Abstract non-diagram specific drag edit policy for link labels.
- * This class is adapted from edit parts generated by GMF Tooling.
- */
-public class LinkLabelDragEditPolicy extends NonResizableLabelEditPolicy {
-
- /**
- * {@inheritDoc}
- */
- @Override
- @SuppressWarnings("rawtypes")
- protected List createSelectionHandles() {
- MoveHandle mh = new MoveHandle((GraphicalEditPart)getHost());
- mh.setBorder(null);
- return Collections.singletonList(mh);
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.gmf.diagram.common.edit.policy;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.handles.MoveHandle;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.NonResizableLabelEditPolicy;
+
+/**
+ * Abstract non-diagram specific drag edit policy for link labels.
+ * This class is adapted from edit parts generated by GMF Tooling.
+ */
+public class LinkLabelDragEditPolicy extends NonResizableLabelEditPolicy {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ @SuppressWarnings("rawtypes")
+ protected List createSelectionHandles() {
+ MoveHandle mh = new MoveHandle((GraphicalEditPart)getHost());
+ mh.setBorder(null);
+ return Collections.singletonList(mh);
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/TextNonResizableEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/TextNonResizableEditPolicy.java
index 2ca2ac00695..9ea6c944bac 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/TextNonResizableEditPolicy.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/TextNonResizableEditPolicy.java
@@ -1,209 +1,209 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.gmf.diagram.common.edit.policy;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.FigureListener;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.handles.MoveHandle;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.NonResizableEditPolicyEx;
-import org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-
-/**
- * Non diagram-specific class generated by GMF Tooling.
- */
-public class TextNonResizableEditPolicy extends NonResizableEditPolicyEx {
-
- private IFigure selectionFeedbackFigure;
-
- private IFigure focusFeedbackFigure;
-
- private FigureListener hostPositionListener;
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void showPrimarySelection() {
- if(getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getHostFigure()).setSelected(true);
- ((WrappingLabel)getHostFigure()).setFocus(true);
- } else {
- showSelection();
- showFocus();
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void showSelection() {
- if(getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getHostFigure()).setSelected(true);
- ((WrappingLabel)getHostFigure()).setFocus(false);
- } else {
- hideSelection();
- addFeedback(selectionFeedbackFigure = createSelectionFeedbackFigure());
- getHostFigure().addFigureListener(getHostPositionListener());
- refreshSelectionFeedback();
- hideFocus();
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void hideSelection() {
- if(getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getHostFigure()).setSelected(false);
- ((WrappingLabel)getHostFigure()).setFocus(false);
- } else {
- if(selectionFeedbackFigure != null) {
- removeFeedback(selectionFeedbackFigure);
- getHostFigure().removeFigureListener(getHostPositionListener());
- selectionFeedbackFigure = null;
- }
- hideFocus();
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void showFocus() {
- if(getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getHostFigure()).setFocus(true);
- } else {
- hideFocus();
- addFeedback(focusFeedbackFigure = createFocusFeedbackFigure());
- refreshFocusFeedback();
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void hideFocus() {
- if(getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getHostFigure()).setFocus(false);
- } else {
- if(focusFeedbackFigure != null) {
- removeFeedback(focusFeedbackFigure);
- focusFeedbackFigure = null;
- }
- }
- }
-
- 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;
- }
-
- 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;
- }
- }
-
- protected IFigure createFocusFeedbackFigure() {
- return new Figure() {
-
- protected void paintFigure(Graphics graphics) {
- graphics.drawFocus(getBounds().getResized(-1, -1));
- }
- };
- }
-
- protected void updateLabel(Label target) {
- Label source = (Label)getHostFigure();
- target.setText(source.getText());
- target.setTextAlignment(source.getTextAlignment());
- target.setFont(source.getFont());
- }
-
- protected void refreshSelectionFeedback() {
- if(selectionFeedbackFigure != null) {
- if(selectionFeedbackFigure instanceof Label) {
- updateLabel((Label)selectionFeedbackFigure);
- selectionFeedbackFigure.setBounds(getFeedbackBounds());
- } else {
- selectionFeedbackFigure.setBounds(getFeedbackBounds().expand(5, 5));
- }
- }
- }
-
- protected void refreshFocusFeedback() {
- if(focusFeedbackFigure != null) {
- focusFeedbackFigure.setBounds(getFeedbackBounds());
- }
- }
-
- public void refreshFeedback() {
- refreshSelectionFeedback();
- refreshFocusFeedback();
- }
-
- private FigureListener getHostPositionListener() {
- if(hostPositionListener == null) {
- hostPositionListener = new FigureListener() {
-
- public void figureMoved(IFigure source) {
- refreshFeedback();
- }
- };
- }
- return hostPositionListener;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected List createSelectionHandles() {
- MoveHandle moveHandle = new MoveHandle((GraphicalEditPart)getHost());
- moveHandle.setBorder(null);
- moveHandle.setDragTracker(new DragEditPartsTrackerEx(getHost()));
- return Collections.singletonList(moveHandle);
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.gmf.diagram.common.edit.policy;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.FigureListener;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.handles.MoveHandle;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.NonResizableEditPolicyEx;
+import org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+
+/**
+ * Non diagram-specific class generated by GMF Tooling.
+ */
+public class TextNonResizableEditPolicy extends NonResizableEditPolicyEx {
+
+ private IFigure selectionFeedbackFigure;
+
+ private IFigure focusFeedbackFigure;
+
+ private FigureListener hostPositionListener;
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void showPrimarySelection() {
+ if(getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel)getHostFigure()).setSelected(true);
+ ((WrappingLabel)getHostFigure()).setFocus(true);
+ } else {
+ showSelection();
+ showFocus();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void showSelection() {
+ if(getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel)getHostFigure()).setSelected(true);
+ ((WrappingLabel)getHostFigure()).setFocus(false);
+ } else {
+ hideSelection();
+ addFeedback(selectionFeedbackFigure = createSelectionFeedbackFigure());
+ getHostFigure().addFigureListener(getHostPositionListener());
+ refreshSelectionFeedback();
+ hideFocus();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void hideSelection() {
+ if(getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel)getHostFigure()).setSelected(false);
+ ((WrappingLabel)getHostFigure()).setFocus(false);
+ } else {
+ if(selectionFeedbackFigure != null) {
+ removeFeedback(selectionFeedbackFigure);
+ getHostFigure().removeFigureListener(getHostPositionListener());
+ selectionFeedbackFigure = null;
+ }
+ hideFocus();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void showFocus() {
+ if(getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel)getHostFigure()).setFocus(true);
+ } else {
+ hideFocus();
+ addFeedback(focusFeedbackFigure = createFocusFeedbackFigure());
+ refreshFocusFeedback();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void hideFocus() {
+ if(getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel)getHostFigure()).setFocus(false);
+ } else {
+ if(focusFeedbackFigure != null) {
+ removeFeedback(focusFeedbackFigure);
+ focusFeedbackFigure = null;
+ }
+ }
+ }
+
+ 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;
+ }
+
+ 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;
+ }
+ }
+
+ protected IFigure createFocusFeedbackFigure() {
+ return new Figure() {
+
+ protected void paintFigure(Graphics graphics) {
+ graphics.drawFocus(getBounds().getResized(-1, -1));
+ }
+ };
+ }
+
+ protected void updateLabel(Label target) {
+ Label source = (Label)getHostFigure();
+ target.setText(source.getText());
+ target.setTextAlignment(source.getTextAlignment());
+ target.setFont(source.getFont());
+ }
+
+ protected void refreshSelectionFeedback() {
+ if(selectionFeedbackFigure != null) {
+ if(selectionFeedbackFigure instanceof Label) {
+ updateLabel((Label)selectionFeedbackFigure);
+ selectionFeedbackFigure.setBounds(getFeedbackBounds());
+ } else {
+ selectionFeedbackFigure.setBounds(getFeedbackBounds().expand(5, 5));
+ }
+ }
+ }
+
+ protected void refreshFocusFeedback() {
+ if(focusFeedbackFigure != null) {
+ focusFeedbackFigure.setBounds(getFeedbackBounds());
+ }
+ }
+
+ public void refreshFeedback() {
+ refreshSelectionFeedback();
+ refreshFocusFeedback();
+ }
+
+ private FigureListener getHostPositionListener() {
+ if(hostPositionListener == null) {
+ hostPositionListener = new FigureListener() {
+
+ public void figureMoved(IFigure source) {
+ refreshFeedback();
+ }
+ };
+ }
+ return hostPositionListener;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected List createSelectionHandles() {
+ MoveHandle moveHandle = new MoveHandle((GraphicalEditPart)getHost());
+ moveHandle.setBorder(null);
+ moveHandle.setDragTracker(new DragEditPartsTrackerEx(getHost()));
+ return Collections.singletonList(moveHandle);
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/TextSelectionEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/TextSelectionEditPolicy.java
index 2df2f703f1a..01392a52ad8 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/TextSelectionEditPolicy.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/TextSelectionEditPolicy.java
@@ -1,192 +1,192 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.gmf.diagram.common.edit.policy;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.FigureListener;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.editpolicies.SelectionEditPolicy;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-
-/**
- * Non diagram-specific class generated by GMF Tooling.
- */
-public class TextSelectionEditPolicy extends SelectionEditPolicy {
-
- private IFigure selectionFeedbackFigure;
-
- private IFigure focusFeedbackFigure;
-
- private FigureListener hostPositionListener;
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void showPrimarySelection() {
- if(getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getHostFigure()).setSelected(true);
- ((WrappingLabel)getHostFigure()).setFocus(true);
- } else {
- showSelection();
- showFocus();
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void showSelection() {
- if(getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getHostFigure()).setSelected(true);
- ((WrappingLabel)getHostFigure()).setFocus(false);
- } else {
- hideSelection();
- addFeedback(selectionFeedbackFigure = createSelectionFeedbackFigure());
- getHostFigure().addFigureListener(getHostPositionListener());
- refreshSelectionFeedback();
- hideFocus();
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void hideSelection() {
- if(getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getHostFigure()).setSelected(false);
- ((WrappingLabel)getHostFigure()).setFocus(false);
- } else {
- if(selectionFeedbackFigure != null) {
- removeFeedback(selectionFeedbackFigure);
- getHostFigure().removeFigureListener(getHostPositionListener());
- selectionFeedbackFigure = null;
- }
- hideFocus();
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void showFocus() {
- if(getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getHostFigure()).setFocus(true);
- } else {
- hideFocus();
- addFeedback(focusFeedbackFigure = createFocusFeedbackFigure());
- refreshFocusFeedback();
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void hideFocus() {
- if(getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getHostFigure()).setFocus(false);
- } else {
- if(focusFeedbackFigure != null) {
- removeFeedback(focusFeedbackFigure);
- focusFeedbackFigure = null;
- }
- }
- }
-
- 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;
- }
-
- 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;
- }
- }
-
- protected IFigure createFocusFeedbackFigure() {
- return new Figure() {
-
- protected void paintFigure(Graphics graphics) {
- graphics.drawFocus(getBounds().getResized(-1, -1));
- }
- };
- }
-
- protected void updateLabel(Label target) {
- Label source = (Label)getHostFigure();
- target.setText(source.getText());
- target.setTextAlignment(source.getTextAlignment());
- target.setFont(source.getFont());
- }
-
- protected void refreshSelectionFeedback() {
- if(selectionFeedbackFigure != null) {
- if(selectionFeedbackFigure instanceof Label) {
- updateLabel((Label)selectionFeedbackFigure);
- selectionFeedbackFigure.setBounds(getFeedbackBounds());
- } else {
- selectionFeedbackFigure.setBounds(getFeedbackBounds().expand(5, 5));
- }
- }
- }
-
- protected void refreshFocusFeedback() {
- if(focusFeedbackFigure != null) {
- focusFeedbackFigure.setBounds(getFeedbackBounds());
- }
- }
-
- public void refreshFeedback() {
- refreshSelectionFeedback();
- refreshFocusFeedback();
- }
-
- private FigureListener getHostPositionListener() {
- if(hostPositionListener == null) {
- hostPositionListener = new FigureListener() {
-
- public void figureMoved(IFigure source) {
- refreshFeedback();
- }
- };
- }
- return hostPositionListener;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.gmf.diagram.common.edit.policy;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.FigureListener;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.editpolicies.SelectionEditPolicy;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+
+/**
+ * Non diagram-specific class generated by GMF Tooling.
+ */
+public class TextSelectionEditPolicy extends SelectionEditPolicy {
+
+ private IFigure selectionFeedbackFigure;
+
+ private IFigure focusFeedbackFigure;
+
+ private FigureListener hostPositionListener;
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void showPrimarySelection() {
+ if(getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel)getHostFigure()).setSelected(true);
+ ((WrappingLabel)getHostFigure()).setFocus(true);
+ } else {
+ showSelection();
+ showFocus();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void showSelection() {
+ if(getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel)getHostFigure()).setSelected(true);
+ ((WrappingLabel)getHostFigure()).setFocus(false);
+ } else {
+ hideSelection();
+ addFeedback(selectionFeedbackFigure = createSelectionFeedbackFigure());
+ getHostFigure().addFigureListener(getHostPositionListener());
+ refreshSelectionFeedback();
+ hideFocus();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void hideSelection() {
+ if(getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel)getHostFigure()).setSelected(false);
+ ((WrappingLabel)getHostFigure()).setFocus(false);
+ } else {
+ if(selectionFeedbackFigure != null) {
+ removeFeedback(selectionFeedbackFigure);
+ getHostFigure().removeFigureListener(getHostPositionListener());
+ selectionFeedbackFigure = null;
+ }
+ hideFocus();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void showFocus() {
+ if(getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel)getHostFigure()).setFocus(true);
+ } else {
+ hideFocus();
+ addFeedback(focusFeedbackFigure = createFocusFeedbackFigure());
+ refreshFocusFeedback();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void hideFocus() {
+ if(getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel)getHostFigure()).setFocus(false);
+ } else {
+ if(focusFeedbackFigure != null) {
+ removeFeedback(focusFeedbackFigure);
+ focusFeedbackFigure = null;
+ }
+ }
+ }
+
+ 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;
+ }
+
+ 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;
+ }
+ }
+
+ protected IFigure createFocusFeedbackFigure() {
+ return new Figure() {
+
+ protected void paintFigure(Graphics graphics) {
+ graphics.drawFocus(getBounds().getResized(-1, -1));
+ }
+ };
+ }
+
+ protected void updateLabel(Label target) {
+ Label source = (Label)getHostFigure();
+ target.setText(source.getText());
+ target.setTextAlignment(source.getTextAlignment());
+ target.setFont(source.getFont());
+ }
+
+ protected void refreshSelectionFeedback() {
+ if(selectionFeedbackFigure != null) {
+ if(selectionFeedbackFigure instanceof Label) {
+ updateLabel((Label)selectionFeedbackFigure);
+ selectionFeedbackFigure.setBounds(getFeedbackBounds());
+ } else {
+ selectionFeedbackFigure.setBounds(getFeedbackBounds().expand(5, 5));
+ }
+ }
+ }
+
+ protected void refreshFocusFeedback() {
+ if(focusFeedbackFigure != null) {
+ focusFeedbackFigure.setBounds(getFeedbackBounds());
+ }
+ }
+
+ public void refreshFeedback() {
+ refreshSelectionFeedback();
+ refreshFocusFeedback();
+ }
+
+ private FigureListener getHostPositionListener() {
+ if(hostPositionListener == null) {
+ hostPositionListener = new FigureListener() {
+
+ public void figureMoved(IFigure source) {
+ refreshFeedback();
+ }
+ };
+ }
+ return hostPositionListener;
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/AbstractLabelViewFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/AbstractLabelViewFactory.java
index 3e619ee6af1..c968ccd23d4 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/AbstractLabelViewFactory.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/AbstractLabelViewFactory.java
@@ -1,32 +1,32 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.gmf.diagram.common.factory;
-
-import org.eclipse.gmf.runtime.diagram.ui.view.factories.optimal.DecorationNodeViewFactory;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.providers.ThemeInitializerManager;
-
-/**
- * Default view Factory for Papyrus custom labels.
- */
-public abstract class AbstractLabelViewFactory extends DecorationNodeViewFactory {
-
- @Override
- protected void initializeFromPreferences(View view) {
- //Do not call initializeFromPreferences when the preference initializer is disabled (Typical use case: CSS are installed)
- if(ThemeInitializerManager.instance.usePreferenceInitializer(view)) {
- super.initializeFromPreferences(view);
- }
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.gmf.diagram.common.factory;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.optimal.DecorationNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.providers.ThemeInitializerManager;
+
+/**
+ * Default view Factory for Papyrus custom labels.
+ */
+public abstract class AbstractLabelViewFactory extends DecorationNodeViewFactory {
+
+ @Override
+ protected void initializeFromPreferences(View view) {
+ //Do not call initializeFromPreferences when the preference initializer is disabled (Typical use case: CSS are installed)
+ if(ThemeInitializerManager.instance.usePreferenceInitializer(view)) {
+ super.initializeFromPreferences(view);
+ }
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/AffixedLabelViewFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/AffixedLabelViewFactory.java
index 76ceea16465..22f46d1feab 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/AffixedLabelViewFactory.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/AffixedLabelViewFactory.java
@@ -1,52 +1,52 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.gmf.diagram.common.factory;
-
-import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
-import org.eclipse.gmf.runtime.notation.LayoutConstraint;
-import org.eclipse.gmf.runtime.notation.NotationFactory;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
-
-/**
- * Default view Factory for Papyrus custom affixed labels.
- */
-public class AffixedLabelViewFactory extends AbstractLabelViewFactory {
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected LayoutConstraint createLayoutConstraint() {
- return NotationFactory.eINSTANCE.createLocation();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void initializeFromPreferences(View view) {
-
- super.initializeFromPreferences(view);
-
- IPreferenceStore store = (IPreferenceStore)getPreferencesHint().getPreferenceStore();
- if(store == null) {
- return;
- }
-
- String preferenceKey = ViewUtil.getViewContainer(view).getType() + "-" + view.getType();
- PreferenceInitializerForElementHelper.initLabelLocationFromPrefs(view, store, preferenceKey);
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.gmf.diagram.common.factory;
+
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.notation.LayoutConstraint;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
+
+/**
+ * Default view Factory for Papyrus custom affixed labels.
+ */
+public class AffixedLabelViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected LayoutConstraint createLayoutConstraint() {
+ return NotationFactory.eINSTANCE.createLocation();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void initializeFromPreferences(View view) {
+
+ super.initializeFromPreferences(view);
+
+ IPreferenceStore store = (IPreferenceStore)getPreferencesHint().getPreferenceStore();
+ if(store == null) {
+ return;
+ }
+
+ String preferenceKey = ViewUtil.getViewContainer(view).getType() + "-" + view.getType();
+ PreferenceInitializerForElementHelper.initLabelLocationFromPrefs(view, store, preferenceKey);
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/CompartmentListViewFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/CompartmentListViewFactory.java
index 03c8f8ae0d1..221da6fb557 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/CompartmentListViewFactory.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/CompartmentListViewFactory.java
@@ -1,33 +1,33 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.gmf.diagram.common.factory;
-
-import org.eclipse.gmf.runtime.diagram.ui.view.factories.ListCompartmentViewFactory;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.NotationFactory;
-
-/**
- * Default compartment view Factory for custom list compartments.
- */
-public class CompartmentListViewFactory extends ListCompartmentViewFactory {
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected Node createNode() {
- return NotationFactory.eINSTANCE.createListCompartment();
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.gmf.diagram.common.factory;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.ListCompartmentViewFactory;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+
+/**
+ * Default compartment view Factory for custom list compartments.
+ */
+public class CompartmentListViewFactory extends ListCompartmentViewFactory {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Node createNode() {
+ return NotationFactory.eINSTANCE.createListCompartment();
+ }
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/CompartmentShapeViewFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/CompartmentShapeViewFactory.java
index 30cb5eb97c0..584658f4138 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/CompartmentShapeViewFactory.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/CompartmentShapeViewFactory.java
@@ -1,37 +1,37 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.gmf.diagram.common.factory;
-
-import java.util.List;
-
-import org.eclipse.gmf.runtime.diagram.ui.view.factories.optimal.BasicCompartmentViewFactory;
-import org.eclipse.gmf.runtime.notation.NotationFactory;
-import org.eclipse.gmf.runtime.notation.View;
-
-/**
- * Default compartment view Factory for custom shape compartments.
- */
-public class CompartmentShapeViewFactory extends BasicCompartmentViewFactory {
-
- /**
- * {@inheritDoc}
- */
- @SuppressWarnings({ "rawtypes", "unchecked" })
- @Override
- protected List createStyles(View view) {
- List styles = super.createStyles(view);
- styles.add(NotationFactory.eINSTANCE.createTitleStyle());
- return styles;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.gmf.diagram.common.factory;
+
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.optimal.BasicCompartmentViewFactory;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * Default compartment view Factory for custom shape compartments.
+ */
+public class CompartmentShapeViewFactory extends BasicCompartmentViewFactory {
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Override
+ protected List createStyles(View view) {
+ List styles = super.createStyles(view);
+ styles.add(NotationFactory.eINSTANCE.createTitleStyle());
+ return styles;
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/ConnectorLabelViewFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/ConnectorLabelViewFactory.java
index 7ea8a3fc482..965660e57bb 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/ConnectorLabelViewFactory.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/ConnectorLabelViewFactory.java
@@ -1,52 +1,52 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.gmf.diagram.common.factory;
-
-import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
-import org.eclipse.gmf.runtime.notation.LayoutConstraint;
-import org.eclipse.gmf.runtime.notation.NotationFactory;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
-
-/**
- * Default view Factory for Papyrus custom affixed labels.
- */
-public class ConnectorLabelViewFactory extends AbstractLabelViewFactory {
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected LayoutConstraint createLayoutConstraint() {
- return NotationFactory.eINSTANCE.createLocation();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void initializeFromPreferences(View view) {
-
- super.initializeFromPreferences(view);
-
- IPreferenceStore store = (IPreferenceStore)getPreferencesHint().getPreferenceStore();
- if(store == null) {
- return;
- }
-
- String preferenceKey = ViewUtil.getViewContainer(view).getType() + "-" + view.getType();
- PreferenceInitializerForElementHelper.initLabelLocationFromPrefs(view, store, preferenceKey);
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.gmf.diagram.common.factory;
+
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.notation.LayoutConstraint;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
+
+/**
+ * Default view Factory for Papyrus custom affixed labels.
+ */
+public class ConnectorLabelViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected LayoutConstraint createLayoutConstraint() {
+ return NotationFactory.eINSTANCE.createLocation();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void initializeFromPreferences(View view) {
+
+ super.initializeFromPreferences(view);
+
+ IPreferenceStore store = (IPreferenceStore)getPreferencesHint().getPreferenceStore();
+ if(store == null) {
+ return;
+ }
+
+ String preferenceKey = ViewUtil.getViewContainer(view).getType() + "-" + view.getType();
+ PreferenceInitializerForElementHelper.initLabelLocationFromPrefs(view, store, preferenceKey);
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/ConnectorViewFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/ConnectorViewFactory.java
index 07750ae94d6..8584e18bd81 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/ConnectorViewFactory.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/ConnectorViewFactory.java
@@ -1,62 +1,62 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.gmf.diagram.common.factory;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.gmf.runtime.notation.NotationFactory;
-import org.eclipse.gmf.runtime.notation.Style;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.infra.gmfdiag.common.providers.ThemeInitializerManager;
-import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
-
-/**
- * Default connector view Factory for Papyrus custom edges.
- */
-public class ConnectorViewFactory extends org.eclipse.gmf.runtime.diagram.ui.view.factories.optimal.ConnectorViewFactory {
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected List createStyles(View view) {
- return Arrays.asList(new Style[]{ NotationFactory.eINSTANCE.createFontStyle() });
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void initializeFromPreferences(View view) {
- //Do not call initializeFromPreferences when the preference initializer is disabled (Typical use case: CSS are installed)
- if(ThemeInitializerManager.instance.usePreferenceInitializer(view)) {
- super.initializeFromPreferences(view);
- }
-
- IPreferenceStore store = (IPreferenceStore)getPreferencesHint().getPreferenceStore();
- if(store == null) {
- return;
- }
-
- //The PreferenceInitializerForElementHelper already checks for usePreferenceInitializer() (When required)
- String elementName = view.getType();
- PreferenceInitializerForElementHelper.initForegroundFromPrefs(view, store, elementName);
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(view, store, elementName);
- PreferenceInitializerForElementHelper.initRoutingFromPrefs(view, store, elementName);
- PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(view, store, elementName);
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.gmf.diagram.common.factory;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.Style;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.common.providers.ThemeInitializerManager;
+import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
+
+/**
+ * Default connector view Factory for Papyrus custom edges.
+ */
+public class ConnectorViewFactory extends org.eclipse.gmf.runtime.diagram.ui.view.factories.optimal.ConnectorViewFactory {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected List createStyles(View view) {
+ return Arrays.asList(new Style[]{ NotationFactory.eINSTANCE.createFontStyle() });
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void initializeFromPreferences(View view) {
+ //Do not call initializeFromPreferences when the preference initializer is disabled (Typical use case: CSS are installed)
+ if(ThemeInitializerManager.instance.usePreferenceInitializer(view)) {
+ super.initializeFromPreferences(view);
+ }
+
+ IPreferenceStore store = (IPreferenceStore)getPreferencesHint().getPreferenceStore();
+ if(store == null) {
+ return;
+ }
+
+ //The PreferenceInitializerForElementHelper already checks for usePreferenceInitializer() (When required)
+ String elementName = view.getType();
+ PreferenceInitializerForElementHelper.initForegroundFromPrefs(view, store, elementName);
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(view, store, elementName);
+ PreferenceInitializerForElementHelper.initRoutingFromPrefs(view, store, elementName);
+ PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(view, store, elementName);
+ }
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/InnerLabelViewFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/InnerLabelViewFactory.java
index d208f2962ea..5f160a0325a 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/InnerLabelViewFactory.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/InnerLabelViewFactory.java
@@ -1,21 +1,21 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.gmf.diagram.common.factory;
-
-/**
- * Default label view Factory for Papyrus custom inner labels.
- */
-public class InnerLabelViewFactory extends AbstractLabelViewFactory {
-
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.gmf.diagram.common.factory;
+
+/**
+ * Default label view Factory for Papyrus custom inner labels.
+ */
+public class InnerLabelViewFactory extends AbstractLabelViewFactory {
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/ShapeChildLabelViewFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/ShapeChildLabelViewFactory.java
index 1c6971c3155..4dc2596b2e0 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/ShapeChildLabelViewFactory.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/ShapeChildLabelViewFactory.java
@@ -1,59 +1,59 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.gmf.diagram.common.factory;
-
-import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
-import org.eclipse.gmf.runtime.notation.LayoutConstraint;
-import org.eclipse.gmf.runtime.notation.NotationFactory;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.infra.gmfdiag.common.providers.ThemeInitializerManager;
-import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
-
-/**
- * Default Shape view Factory for Papyrus custom child label nodes.
- */
-public class ShapeChildLabelViewFactory extends AbstractShapeViewFactory {
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected LayoutConstraint createLayoutConstraint() {
- return NotationFactory.eINSTANCE.createLocation();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void initializeFromPreferences(View view) {
- //Do not call initializeFromPreferences when the preference initializer is disabled (Typical use case: CSS are installed)
- if(ThemeInitializerManager.instance.usePreferenceInitializer(view)) {
- super.initializeFromPreferences(view);
- }
-
- IPreferenceStore store = (IPreferenceStore)getPreferencesHint().getPreferenceStore();
- if(store == null) {
- return;
- }
-
- //The PreferenceInitializerForElementHelper already checks for usePreferenceInitializer() (When required)
- String preferenceKey = view.getType();
- PreferenceInitializerForElementHelper.initForegroundFromPrefs(view, store, preferenceKey);
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(view, store, preferenceKey);
-
- PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(view, store, preferenceKey);
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.gmf.diagram.common.factory;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
+import org.eclipse.gmf.runtime.notation.LayoutConstraint;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.common.providers.ThemeInitializerManager;
+import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
+
+/**
+ * Default Shape view Factory for Papyrus custom child label nodes.
+ */
+public class ShapeChildLabelViewFactory extends AbstractShapeViewFactory {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected LayoutConstraint createLayoutConstraint() {
+ return NotationFactory.eINSTANCE.createLocation();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void initializeFromPreferences(View view) {
+ //Do not call initializeFromPreferences when the preference initializer is disabled (Typical use case: CSS are installed)
+ if(ThemeInitializerManager.instance.usePreferenceInitializer(view)) {
+ super.initializeFromPreferences(view);
+ }
+
+ IPreferenceStore store = (IPreferenceStore)getPreferencesHint().getPreferenceStore();
+ if(store == null) {
+ return;
+ }
+
+ //The PreferenceInitializerForElementHelper already checks for usePreferenceInitializer() (When required)
+ String preferenceKey = view.getType();
+ PreferenceInitializerForElementHelper.initForegroundFromPrefs(view, store, preferenceKey);
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(view, store, preferenceKey);
+
+ PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(view, store, preferenceKey);
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/ShapeViewFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/ShapeViewFactory.java
index 26f07e18587..a40f27caa39 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/ShapeViewFactory.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/ShapeViewFactory.java
@@ -1,59 +1,59 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.gmf.diagram.common.factory;
-
-import org.eclipse.gmf.runtime.notation.NotationFactory;
-import org.eclipse.gmf.runtime.notation.Shape;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.infra.gmfdiag.common.providers.ThemeInitializerManager;
-import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
-
-/**
- * Default Shape view Factory for Papyrus custom nodes.
- */
-public class ShapeViewFactory extends org.eclipse.gmf.runtime.diagram.ui.view.factories.optimal.ShapeViewFactory {
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected Shape createNode() {
- return NotationFactory.eINSTANCE.createShape();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void initializeFromPreferences(View view) {
- //Do not call initializeFromPreferences when the preference initializer is disabled (Typical use case: CSS are installed)
- if(ThemeInitializerManager.instance.usePreferenceInitializer(view)) {
- super.initializeFromPreferences(view);
- }
-
- IPreferenceStore store = (IPreferenceStore)getPreferencesHint().getPreferenceStore();
- if(store == null) {
- return;
- }
-
- //The PreferenceInitializerForElementHelper already checks for usePreferenceInitializer() (When required)
- String elementName = view.getType();
- PreferenceInitializerForElementHelper.initForegroundFromPrefs(view, store, elementName);
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(view, store, elementName);
- PreferenceInitializerForElementHelper.initBackgroundFromPrefs(view, store, elementName);
-
- PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(view, store, elementName);
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.gmf.diagram.common.factory;
+
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.Shape;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.common.providers.ThemeInitializerManager;
+import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
+
+/**
+ * Default Shape view Factory for Papyrus custom nodes.
+ */
+public class ShapeViewFactory extends org.eclipse.gmf.runtime.diagram.ui.view.factories.optimal.ShapeViewFactory {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Shape createNode() {
+ return NotationFactory.eINSTANCE.createShape();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void initializeFromPreferences(View view) {
+ //Do not call initializeFromPreferences when the preference initializer is disabled (Typical use case: CSS are installed)
+ if(ThemeInitializerManager.instance.usePreferenceInitializer(view)) {
+ super.initializeFromPreferences(view);
+ }
+
+ IPreferenceStore store = (IPreferenceStore)getPreferencesHint().getPreferenceStore();
+ if(store == null) {
+ return;
+ }
+
+ //The PreferenceInitializerForElementHelper already checks for usePreferenceInitializer() (When required)
+ String elementName = view.getType();
+ PreferenceInitializerForElementHelper.initForegroundFromPrefs(view, store, elementName);
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(view, store, elementName);
+ PreferenceInitializerForElementHelper.initBackgroundFromPrefs(view, store, elementName);
+
+ PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(view, store, elementName);
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/figure/SelectableBorderedNodeFigure.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/figure/SelectableBorderedNodeFigure.java
index cc2b8f6d8b2..bd1f4c6e882 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/figure/SelectableBorderedNodeFigure.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/figure/SelectableBorderedNodeFigure.java
@@ -1,74 +1,74 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.gmf.diagram.common.figure;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.TreeSearch;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gmf.runtime.diagram.ui.figures.BorderedNodeFigure;
-
-/**
- * <pre>
- * This class modifies findFigureAt method in order to make the figure responsive
- * when the cursor is located in a rectangle around the figure.
- * This behavior ease the creation of borderItem by allowing their creation even when
- * the selection is around the figure (not over it).
- * </pre>
- */
-public class SelectableBorderedNodeFigure extends BorderedNodeFigure {
-
- /** The size of the active margin around the figure */
- protected int MARGIN_SIZE = 10;
-
- /** Constructor */
- public SelectableBorderedNodeFigure(IFigure mainFigure) {
- super(mainFigure);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public IFigure findFigureAt(int x, int y, TreeSearch search) {
- if(search.prune(this))
- return null;
-
- // Start by searching in the borderItemContainer
- IFigure result = getBorderItemContainer().findFigureAt(x, y, search);
- if(result != null) {
- return result;
- }
-
- // Then search over main figure borders with the specified MARGIN inside figure borders
- Rectangle unselectableArea = new Rectangle(getBounds().getCopy());
- unselectableArea.x = unselectableArea.x + MARGIN_SIZE;
- unselectableArea.y = unselectableArea.y + MARGIN_SIZE;
- unselectableArea.width = unselectableArea.width - 2*MARGIN_SIZE;
- unselectableArea.height = unselectableArea.height - 2*MARGIN_SIZE;
-
- Rectangle selectableArea = new Rectangle(getBounds().getCopy());
-
- if((selectableArea.contains(x, y)) && !(unselectableArea.contains(x, y))) {
- return this;
- }
-
- // Then search in the main figure
- result = getMainFigure().findFigureAt(x, y, search);
- if(result != null) {
- return result;
- }
-
- return null;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.gmf.diagram.common.figure;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.TreeSearch;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gmf.runtime.diagram.ui.figures.BorderedNodeFigure;
+
+/**
+ * <pre>
+ * This class modifies findFigureAt method in order to make the figure responsive
+ * when the cursor is located in a rectangle around the figure.
+ * This behavior ease the creation of borderItem by allowing their creation even when
+ * the selection is around the figure (not over it).
+ * </pre>
+ */
+public class SelectableBorderedNodeFigure extends BorderedNodeFigure {
+
+ /** The size of the active margin around the figure */
+ protected int MARGIN_SIZE = 10;
+
+ /** Constructor */
+ public SelectableBorderedNodeFigure(IFigure mainFigure) {
+ super(mainFigure);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public IFigure findFigureAt(int x, int y, TreeSearch search) {
+ if(search.prune(this))
+ return null;
+
+ // Start by searching in the borderItemContainer
+ IFigure result = getBorderItemContainer().findFigureAt(x, y, search);
+ if(result != null) {
+ return result;
+ }
+
+ // Then search over main figure borders with the specified MARGIN inside figure borders
+ Rectangle unselectableArea = new Rectangle(getBounds().getCopy());
+ unselectableArea.x = unselectableArea.x + MARGIN_SIZE;
+ unselectableArea.y = unselectableArea.y + MARGIN_SIZE;
+ unselectableArea.width = unselectableArea.width - 2*MARGIN_SIZE;
+ unselectableArea.height = unselectableArea.height - 2*MARGIN_SIZE;
+
+ Rectangle selectableArea = new Rectangle(getBounds().getCopy());
+
+ if((selectableArea.contains(x, y)) && !(unselectableArea.contains(x, y))) {
+ return this;
+ }
+
+ // Then search in the main figure
+ result = getMainFigure().findFigureAt(x, y, search);
+ if(result != null) {
+ return result;
+ }
+
+ return null;
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/locator/CellEditorLocatorUtil.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/locator/CellEditorLocatorUtil.java
index 8cfbcb7a5d3..bad38357e77 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/locator/CellEditorLocatorUtil.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/locator/CellEditorLocatorUtil.java
@@ -1,36 +1,36 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.gmf.diagram.common.locator;
-
-import org.eclipse.draw2d.Label;
-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.papyrus.uml.diagram.common.figure.node.IMultilineEditableFigure;
-
-/**
- * Non diagram-specific class generated by GMF Tooling.
- */
-public class CellEditorLocatorUtil {
-
- public static CellEditorLocator getTextCellEditorLocator(ITextAwareEditPart source) {
- if(source.getFigure() instanceof IMultilineEditableFigure)
- return new MultilineCellEditorLocator((IMultilineEditableFigure)source.getFigure());
- else if(source.getFigure() instanceof WrappingLabel)
- return new TextCellEditorLocator((WrappingLabel)source.getFigure());
- else {
- return new LabelCellEditorLocator((Label)source.getFigure());
- }
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.gmf.diagram.common.locator;
+
+import org.eclipse.draw2d.Label;
+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.papyrus.uml.diagram.common.figure.node.IMultilineEditableFigure;
+
+/**
+ * Non diagram-specific class generated by GMF Tooling.
+ */
+public class CellEditorLocatorUtil {
+
+ public static CellEditorLocator getTextCellEditorLocator(ITextAwareEditPart source) {
+ if(source.getFigure() instanceof IMultilineEditableFigure)
+ return new MultilineCellEditorLocator((IMultilineEditableFigure)source.getFigure());
+ else if(source.getFigure() instanceof WrappingLabel)
+ return new TextCellEditorLocator((WrappingLabel)source.getFigure());
+ else {
+ return new LabelCellEditorLocator((Label)source.getFigure());
+ }
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/locator/LabelCellEditorLocator.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/locator/LabelCellEditorLocator.java
index bbab13bbe16..1d2ca010a3b 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/locator/LabelCellEditorLocator.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/locator/LabelCellEditorLocator.java
@@ -1,52 +1,52 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.gmf.diagram.common.locator;
-
-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.tools.CellEditorLocator;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * Non diagram-specific class generated by GMF Tooling.
- */
-public class LabelCellEditorLocator implements CellEditorLocator {
-
- private Label label;
-
- public LabelCellEditorLocator(Label label) {
- this.label = label;
- }
-
- public Label getLabel() {
- return label;
- }
-
- public void relocate(CellEditor celleditor) {
- Text text = (Text)celleditor.getControl();
- Rectangle rect = getLabel().getTextBounds().getCopy();
- getLabel().translateToAbsolute(rect);
- if(!text.getFont().isDisposed()) {
- int avr = FigureUtilities.getFontMetrics(text.getFont()).getAverageCharWidth();
- rect.setSize(new Dimension(text.computeSize(SWT.DEFAULT, SWT.DEFAULT)).expand(avr * 2, 0));
- }
- if(!rect.equals(new Rectangle(text.getBounds()))) {
- text.setBounds(rect.x, rect.y, rect.width, rect.height);
- }
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.gmf.diagram.common.locator;
+
+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.tools.CellEditorLocator;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * Non diagram-specific class generated by GMF Tooling.
+ */
+public class LabelCellEditorLocator implements CellEditorLocator {
+
+ private Label label;
+
+ public LabelCellEditorLocator(Label label) {
+ this.label = label;
+ }
+
+ public Label getLabel() {
+ return label;
+ }
+
+ public void relocate(CellEditor celleditor) {
+ Text text = (Text)celleditor.getControl();
+ Rectangle rect = getLabel().getTextBounds().getCopy();
+ getLabel().translateToAbsolute(rect);
+ if(!text.getFont().isDisposed()) {
+ int avr = FigureUtilities.getFontMetrics(text.getFont()).getAverageCharWidth();
+ rect.setSize(new Dimension(text.computeSize(SWT.DEFAULT, SWT.DEFAULT)).expand(avr * 2, 0));
+ }
+ if(!rect.equals(new Rectangle(text.getBounds()))) {
+ text.setBounds(rect.x, rect.y, rect.width, rect.height);
+ }
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/locator/MultilineCellEditorLocator.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/locator/MultilineCellEditorLocator.java
index 306634d3e26..74f283090b6 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/locator/MultilineCellEditorLocator.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/locator/MultilineCellEditorLocator.java
@@ -1,52 +1,52 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.gmf.diagram.common.locator;
-
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.tools.CellEditorLocator;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.IMultilineEditableFigure;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * Non diagram-specific class generated by GMF Tooling.
- */
-public class MultilineCellEditorLocator implements CellEditorLocator {
-
- private IMultilineEditableFigure multilineEditableFigure;
-
- public MultilineCellEditorLocator(IMultilineEditableFigure figure) {
- this.multilineEditableFigure = figure;
- }
-
- public IMultilineEditableFigure getMultilineEditableFigure() {
- return multilineEditableFigure;
- }
-
- public void relocate(CellEditor celleditor) {
- Text text = (Text)celleditor.getControl();
- Rectangle rect = getMultilineEditableFigure().getBounds().getCopy();
- rect.x = getMultilineEditableFigure().getEditionLocation().x;
- rect.y = getMultilineEditableFigure().getEditionLocation().y;
- getMultilineEditableFigure().translateToAbsolute(rect);
- if(getMultilineEditableFigure().getText().length() > 0) {
- rect.setSize(new Dimension(text.computeSize(rect.width, SWT.DEFAULT)));
- }
- if(!rect.equals(new Rectangle(text.getBounds()))) {
- text.setBounds(rect.x, rect.y, rect.width, rect.height);
- }
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.gmf.diagram.common.locator;
+
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.tools.CellEditorLocator;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.IMultilineEditableFigure;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * Non diagram-specific class generated by GMF Tooling.
+ */
+public class MultilineCellEditorLocator implements CellEditorLocator {
+
+ private IMultilineEditableFigure multilineEditableFigure;
+
+ public MultilineCellEditorLocator(IMultilineEditableFigure figure) {
+ this.multilineEditableFigure = figure;
+ }
+
+ public IMultilineEditableFigure getMultilineEditableFigure() {
+ return multilineEditableFigure;
+ }
+
+ public void relocate(CellEditor celleditor) {
+ Text text = (Text)celleditor.getControl();
+ Rectangle rect = getMultilineEditableFigure().getBounds().getCopy();
+ rect.x = getMultilineEditableFigure().getEditionLocation().x;
+ rect.y = getMultilineEditableFigure().getEditionLocation().y;
+ getMultilineEditableFigure().translateToAbsolute(rect);
+ if(getMultilineEditableFigure().getText().length() > 0) {
+ rect.setSize(new Dimension(text.computeSize(rect.width, SWT.DEFAULT)));
+ }
+ if(!rect.equals(new Rectangle(text.getBounds()))) {
+ text.setBounds(rect.x, rect.y, rect.width, rect.height);
+ }
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/locator/TextCellEditorLocator.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/locator/TextCellEditorLocator.java
index ed87c82282a..80e988c45a9 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/locator/TextCellEditorLocator.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/locator/TextCellEditorLocator.java
@@ -1,56 +1,56 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.gmf.diagram.common.locator;
-
-import org.eclipse.draw2d.FigureUtilities;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.tools.CellEditorLocator;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * Non diagram-specific class generated by GMF Tooling.
- */
-public class TextCellEditorLocator implements CellEditorLocator {
-
- private WrappingLabel wrapLabel;
-
- public TextCellEditorLocator(WrappingLabel wrapLabel) {
- this.wrapLabel = wrapLabel;
- }
-
- public WrappingLabel getWrapLabel() {
- return wrapLabel;
- }
-
- public void relocate(CellEditor celleditor) {
- Text text = (Text)celleditor.getControl();
- Rectangle rect = getWrapLabel().getTextBounds().getCopy();
- getWrapLabel().translateToAbsolute(rect);
- if(!text.getFont().isDisposed()) {
- if(getWrapLabel().isTextWrapOn() && getWrapLabel().getText().length() > 0) {
- rect.setSize(new Dimension(text.computeSize(rect.width, SWT.DEFAULT)));
- } else {
- int avr = FigureUtilities.getFontMetrics(text.getFont()).getAverageCharWidth();
- rect.setSize(new Dimension(text.computeSize(SWT.DEFAULT, SWT.DEFAULT)).expand(avr * 2, 0));
- }
- }
- if(!rect.equals(new Rectangle(text.getBounds()))) {
- text.setBounds(rect.x, rect.y, rect.width, rect.height);
- }
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.gmf.diagram.common.locator;
+
+import org.eclipse.draw2d.FigureUtilities;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.tools.CellEditorLocator;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * Non diagram-specific class generated by GMF Tooling.
+ */
+public class TextCellEditorLocator implements CellEditorLocator {
+
+ private WrappingLabel wrapLabel;
+
+ public TextCellEditorLocator(WrappingLabel wrapLabel) {
+ this.wrapLabel = wrapLabel;
+ }
+
+ public WrappingLabel getWrapLabel() {
+ return wrapLabel;
+ }
+
+ public void relocate(CellEditor celleditor) {
+ Text text = (Text)celleditor.getControl();
+ Rectangle rect = getWrapLabel().getTextBounds().getCopy();
+ getWrapLabel().translateToAbsolute(rect);
+ if(!text.getFont().isDisposed()) {
+ if(getWrapLabel().isTextWrapOn() && getWrapLabel().getText().length() > 0) {
+ rect.setSize(new Dimension(text.computeSize(rect.width, SWT.DEFAULT)));
+ } else {
+ int avr = FigureUtilities.getFontMetrics(text.getFont()).getAverageCharWidth();
+ rect.setSize(new Dimension(text.computeSize(SWT.DEFAULT, SWT.DEFAULT)).expand(avr * 2, 0));
+ }
+ }
+ if(!rect.equals(new Rectangle(text.getBounds()))) {
+ text.setBounds(rect.x, rect.y, rect.width, rect.height);
+ }
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/parser/IMaskManagedSemanticParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/parser/IMaskManagedSemanticParser.java
index dd26f3156a8..f6c49e06b49 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/parser/IMaskManagedSemanticParser.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/parser/IMaskManagedSemanticParser.java
@@ -1,34 +1,34 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.gmf.diagram.common.parser;
-
-import java.util.Map;
-
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-
-/**
- * Interface for semantic parsers that support mask options.
- */
-public interface IMaskManagedSemanticParser extends ISemanticParser {
-
- /** The label to show in case ParserOptions.None is passed as flag (avoid a fully masked label) */
- public static final String MaskedLabel = "<empty label>";
-
- /**
- * Get the {@link Map} of masks
- *
- * @return the {@link Map} of masks
- */
- public Map<Integer, String> getMasks();
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.gmf.diagram.common.parser;
+
+import java.util.Map;
+
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+
+/**
+ * Interface for semantic parsers that support mask options.
+ */
+public interface IMaskManagedSemanticParser extends ISemanticParser {
+
+ /** The label to show in case ParserOptions.None is passed as flag (avoid a fully masked label) */
+ public static final String MaskedLabel = "<empty label>";
+
+ /**
+ * Get the {@link Map} of masks
+ *
+ * @return the {@link Map} of masks
+ */
+ public Map<Integer, String> getMasks();
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/AbstractViewProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/AbstractViewProvider.java
index 513cecb2831..ead0e3b9e60 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/AbstractViewProvider.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/AbstractViewProvider.java
@@ -1,313 +1,313 @@
-/******************************************************************************
- * Copyright (c) 2002, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *
- * CEA LIST - createNode and createEdge final statement removed
- * in order to provide different implementation in subclasses.
- * The original class is {@link AbstractViewProvider}.
- *
- ****************************************************************************/
-package org.eclipse.papyrus.gmf.diagram.common.provider;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-import java.util.HashMap;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.emf.ecore.EClass;
-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.service.AbstractProvider;
-import org.eclipse.gmf.runtime.common.core.service.IOperation;
-import org.eclipse.gmf.runtime.common.core.util.Log;
-import org.eclipse.gmf.runtime.diagram.core.internal.DiagramPlugin;
-import org.eclipse.gmf.runtime.diagram.core.internal.DiagramStatusCodes;
-import org.eclipse.gmf.runtime.diagram.core.internal.l10n.DiagramCoreMessages;
-import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
-import org.eclipse.gmf.runtime.diagram.core.providers.IViewProvider;
-import org.eclipse.gmf.runtime.diagram.core.services.view.CreateDiagramViewOperation;
-import org.eclipse.gmf.runtime.diagram.core.services.view.CreateEdgeViewOperation;
-import org.eclipse.gmf.runtime.diagram.core.services.view.CreateNodeViewOperation;
-import org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewForKindOperation;
-import org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewOperation;
-import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.Edge;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Implements of the <code>IViewProvider</code> interface. This
- * implementations invokes the appropriate factory method by inspecting the
- * supplied operation and provides the actual view creation functionality.
- */
-public class AbstractViewProvider extends AbstractProvider implements IViewProvider {
-
- private static String viewCreationMethodName = "createView"; //$NON-NLS-1$
-
- private static String diagramCreationMethodName = "createDiagram"; //$NON-NLS-1$
-
- static protected class ClassToCreationMethodMap extends HashMap {
-
- static final long serialVersionUID = 1;
-
- public void addMethod(Class clazz, Method method) {
- if(get(clazz) == null)
- put(clazz, method);
- }
-
- public Method getCreationMethod(Class clazz) {
- return (Method)get(clazz);
- }
- }
-
- public static ClassToCreationMethodMap classToCreateMethod = new ClassToCreationMethodMap();
-
- /**
- * Determines whether this view provider can provide for the required
- * operation It inspects the type of view operation and calls the
- * corresponding <code>provides</code> method.
- *
- * @see org.eclipse.gmf.runtime.common.core.service.IProvider#provides(IOperation)
- */
- public final boolean provides(IOperation operation) {
- /* if this is the CreateViewForKindOperation operation */
- if(operation instanceof CreateViewForKindOperation)
- return provides((CreateViewForKindOperation)operation);
-
- /* Make sure it is a view operation */
- assert operation instanceof CreateViewOperation : "operation is not CreateViewOperation in AbstractViewProvider";//$NON-NLS-1$
-
- /* call the specific provides method */
- if(operation instanceof CreateDiagramViewOperation)
- return provides((CreateDiagramViewOperation)operation);
- else if(operation instanceof CreateEdgeViewOperation)
- return provides((CreateEdgeViewOperation)operation);
- else if(operation instanceof CreateNodeViewOperation)
- return provides((CreateNodeViewOperation)operation);
- return false;
- }
-
- public final Diagram createDiagram(IAdaptable contextElement, String diagramKind, PreferencesHint preferencesHint) {
- return (Diagram)createNewView(getDiagramViewClass(contextElement, diagramKind), new Object[]{ contextElement, diagramKind, preferencesHint });
- }
-
- // Papyrus - final statement removed
- public Edge createEdge(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
-
- return (Edge)createNewView(getEdgeViewClass(semanticAdapter, containerView, semanticHint), new Object[]{ semanticAdapter, containerView, semanticHint, new Integer(index), Boolean.valueOf(persisted), preferencesHint });
- }
-
- // Papyrus - final statement removed
- public Node createNode(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
-
- return (Node)createNewView(getNodeViewClass(semanticAdapter, containerView, semanticHint), new Object[]{ semanticAdapter, containerView, semanticHint, new Integer(index), Boolean.valueOf(persisted), preferencesHint });
- }
-
- /**
- * Determines whether this provider can provide for the specified view
- * creation operation
- *
- * @param operation
- * Contains a semantic kind and a containerView
- * @return boolean
- */
- protected boolean provides(CreateViewForKindOperation op) {
- if(op.getViewKind() == Node.class)
- return getNodeViewClass(op.getSemanticAdapter(), op.getContainerView(), op.getSemanticHint()) != null;
- if(op.getViewKind() == Edge.class)
- return getEdgeViewClass(op.getSemanticAdapter(), op.getContainerView(), op.getSemanticHint()) != null;
- return true;
- }
-
- /**
- * Determines whether this provider can provide for the specified diagram
- * view operation
- *
- * @param operation
- * @return boolean
- */
- protected boolean provides(CreateDiagramViewOperation operation) {
- return getDiagramViewClass(operation.getSemanticAdapter(), operation.getSemanticHint()) != null;
- }
-
- /**
- * Determines whether this provider can provide for the specified edge view
- * operation
- *
- * @param operation
- * @return boolean
- */
- protected boolean provides(CreateEdgeViewOperation operation) {
- return (getEdgeViewClass(operation.getSemanticAdapter(), operation.getContainerView(), operation.getSemanticHint()) != null);
- }
-
- /**
- * Determines whether this provider can provide for the specified node view
- * operation
- *
- * @param operation
- * @return boolean
- */
- protected boolean provides(CreateNodeViewOperation operation) {
- return (getNodeViewClass(operation.getSemanticAdapter(), operation.getContainerView(), operation.getSemanticHint()) != null);
- }
-
- /**
- * Returns the diagram view class to instantiate based on the passed params
- *
- * @param semanticAdapter
- * TODO
- * @param semanticAdapter
- * @return Class
- */
- protected Class getDiagramViewClass(IAdaptable semanticAdapter, String diagramKind) {
- return null;
- }
-
- /**
- * Returns the edge view class to instantiate based on the passed params
- *
- * @param semanticAdapter
- * @param containerView
- * @param semanticHint
- * @return Class
- */
- protected Class getEdgeViewClass(IAdaptable semanticAdapter, View containerView, String semanticHint) {
- return null;
- }
-
- /**
- * Returns the node view class to instantiate based on the passed params
- *
- * @param semanticAdapter
- * @param containerView
- * @param semanticHint
- * @return Class
- */
- protected Class getNodeViewClass(IAdaptable semanticAdapter, View containerView, String semanticHint) {
- return null;
- }
-
- /**
- * creates a view instance via reflection.
- *
- * @param constructorParams
- * the view's constructor parameters.
- */
- private View createNewView(Class viewClass, Object[] constructorParams) {
- try {
- assert null != viewClass : "Null viewClass in AbstractProvider";//$NON-NLS-1$
- assert null != constructorParams : "Null constructorParams in AbstractProvider";//$NON-NLS-1$
-
- Constructor constructor = getFactoryConstructor(viewClass);
- if(constructor == null) {
- Log.error(DiagramPlugin.getInstance(), DiagramStatusCodes.SERVICE_FAILURE, "View (" + viewClass + ") is missing a proper creation Factory"); //$NON-NLS-1$//$NON-NLS-2$
- return null;
- }
-
- Object factory = constructor.newInstance(new Object[]{});
- Method method = getCreationMethod(viewClass, constructorParams);
- if(method == null) {
- Log.error(DiagramPlugin.getInstance(), DiagramStatusCodes.SERVICE_FAILURE, "View (" + viewClass + ") is missing a proper creation Factory"); //$NON-NLS-1$//$NON-NLS-2$
- return null;
- }
- return (View)method.invoke(factory, constructorParams);
- } catch (Throwable e) {
- String eMsg = NLS.bind(DiagramCoreMessages.AbstractViewProvider_create_view_failed_ERROR_, viewClass.getName());
- Log.warning(DiagramPlugin.getInstance(), IStatus.WARNING, eMsg, e);
- return null;
- }
- }
-
- private Constructor getFactoryConstructor(Class viewClass) {
- if(viewClass != null) {
- Constructor[] ctors = viewClass.getConstructors();
- for(int i = 0; i < ctors.length; i++) {
- if(ctors[i].getParameterTypes().length == 0) {
- return ctors[i];
- }
- }
- }
- return null;
- }
-
- /** Return the <i>creation</i> constructor for the cached view class. */
- private Method getCreationMethod(Class viewClass, Object[] params) {
- if(viewClass != null) {
- Method method = classToCreateMethod.getCreationMethod(viewClass);
- if(method != null)
- return method;
-
- Method[] methods = viewClass.getMethods();
- for(int i = 0; i < methods.length; i++) {
- method = methods[i];
- String methodName = method.getName();
- if(methodName.equals(viewCreationMethodName) || methodName.equals(diagramCreationMethodName)) {
- classToCreateMethod.addMethod(viewClass, method);
- return method;
- }
- }
- }
- return null;
- }
-
- /**
- * Returns the EClass associated with the semantic adapter
- *
- * @param semanticAdapter
- * @return EClass
- */
- protected EClass getSemanticEClass(IAdaptable semanticAdapter) {
- if(semanticAdapter == null)
- return null;
- EObject eObject = (EObject)semanticAdapter.getAdapter(EObject.class);
- if(eObject != null)
- return EMFCoreUtil.getProxyClass(eObject);
- IElementType type = (IElementType)semanticAdapter.getAdapter(IElementType.class);
- if(type != null)
- return type.getEClass();
- return null;
- }
-
- /**
- * Returns the semantic element associated with the semantic adapter
- *
- * @param semanticAdapter
- * @return EClass
- */
- protected EObject getSemanticElement(IAdaptable semanticAdapter) {
- if(semanticAdapter == null)// TODO which MEditingDomain to use?
- return null;
- EObject eObject = (EObject)semanticAdapter.getAdapter(EObject.class);
- if(eObject != null)
- return EMFCoreUtil.resolve(TransactionUtil.getEditingDomain(eObject), eObject);
- return null;
- }
-
- /**
- * Returns the semantic element associated with the semantic adapter
- *
- * @param semanticAdapter
- * @return EClass
- */
- protected EObject getSemanticElement(IAdaptable semanticAdapter, TransactionalEditingDomain domain) {
- if(semanticAdapter == null)
- return null;
- EObject eObject = (EObject)semanticAdapter.getAdapter(EObject.class);
- if(eObject != null)
- return EMFCoreUtil.resolve(domain, eObject);
- return null;
- }
-
-}
+/******************************************************************************
+ * Copyright (c) 2002, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *
+ * CEA LIST - createNode and createEdge final statement removed
+ * in order to provide different implementation in subclasses.
+ * The original class is {@link AbstractViewProvider}.
+ *
+ ****************************************************************************/
+package org.eclipse.papyrus.gmf.diagram.common.provider;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.ecore.EClass;
+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.service.AbstractProvider;
+import org.eclipse.gmf.runtime.common.core.service.IOperation;
+import org.eclipse.gmf.runtime.common.core.util.Log;
+import org.eclipse.gmf.runtime.diagram.core.internal.DiagramPlugin;
+import org.eclipse.gmf.runtime.diagram.core.internal.DiagramStatusCodes;
+import org.eclipse.gmf.runtime.diagram.core.internal.l10n.DiagramCoreMessages;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.core.providers.IViewProvider;
+import org.eclipse.gmf.runtime.diagram.core.services.view.CreateDiagramViewOperation;
+import org.eclipse.gmf.runtime.diagram.core.services.view.CreateEdgeViewOperation;
+import org.eclipse.gmf.runtime.diagram.core.services.view.CreateNodeViewOperation;
+import org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewForKindOperation;
+import org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewOperation;
+import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Implements of the <code>IViewProvider</code> interface. This
+ * implementations invokes the appropriate factory method by inspecting the
+ * supplied operation and provides the actual view creation functionality.
+ */
+public class AbstractViewProvider extends AbstractProvider implements IViewProvider {
+
+ private static String viewCreationMethodName = "createView"; //$NON-NLS-1$
+
+ private static String diagramCreationMethodName = "createDiagram"; //$NON-NLS-1$
+
+ static protected class ClassToCreationMethodMap extends HashMap {
+
+ static final long serialVersionUID = 1;
+
+ public void addMethod(Class clazz, Method method) {
+ if(get(clazz) == null)
+ put(clazz, method);
+ }
+
+ public Method getCreationMethod(Class clazz) {
+ return (Method)get(clazz);
+ }
+ }
+
+ public static ClassToCreationMethodMap classToCreateMethod = new ClassToCreationMethodMap();
+
+ /**
+ * Determines whether this view provider can provide for the required
+ * operation It inspects the type of view operation and calls the
+ * corresponding <code>provides</code> method.
+ *
+ * @see org.eclipse.gmf.runtime.common.core.service.IProvider#provides(IOperation)
+ */
+ public final boolean provides(IOperation operation) {
+ /* if this is the CreateViewForKindOperation operation */
+ if(operation instanceof CreateViewForKindOperation)
+ return provides((CreateViewForKindOperation)operation);
+
+ /* Make sure it is a view operation */
+ assert operation instanceof CreateViewOperation : "operation is not CreateViewOperation in AbstractViewProvider";//$NON-NLS-1$
+
+ /* call the specific provides method */
+ if(operation instanceof CreateDiagramViewOperation)
+ return provides((CreateDiagramViewOperation)operation);
+ else if(operation instanceof CreateEdgeViewOperation)
+ return provides((CreateEdgeViewOperation)operation);
+ else if(operation instanceof CreateNodeViewOperation)
+ return provides((CreateNodeViewOperation)operation);
+ return false;
+ }
+
+ public final Diagram createDiagram(IAdaptable contextElement, String diagramKind, PreferencesHint preferencesHint) {
+ return (Diagram)createNewView(getDiagramViewClass(contextElement, diagramKind), new Object[]{ contextElement, diagramKind, preferencesHint });
+ }
+
+ // Papyrus - final statement removed
+ public Edge createEdge(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
+
+ return (Edge)createNewView(getEdgeViewClass(semanticAdapter, containerView, semanticHint), new Object[]{ semanticAdapter, containerView, semanticHint, new Integer(index), Boolean.valueOf(persisted), preferencesHint });
+ }
+
+ // Papyrus - final statement removed
+ public Node createNode(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
+
+ return (Node)createNewView(getNodeViewClass(semanticAdapter, containerView, semanticHint), new Object[]{ semanticAdapter, containerView, semanticHint, new Integer(index), Boolean.valueOf(persisted), preferencesHint });
+ }
+
+ /**
+ * Determines whether this provider can provide for the specified view
+ * creation operation
+ *
+ * @param operation
+ * Contains a semantic kind and a containerView
+ * @return boolean
+ */
+ protected boolean provides(CreateViewForKindOperation op) {
+ if(op.getViewKind() == Node.class)
+ return getNodeViewClass(op.getSemanticAdapter(), op.getContainerView(), op.getSemanticHint()) != null;
+ if(op.getViewKind() == Edge.class)
+ return getEdgeViewClass(op.getSemanticAdapter(), op.getContainerView(), op.getSemanticHint()) != null;
+ return true;
+ }
+
+ /**
+ * Determines whether this provider can provide for the specified diagram
+ * view operation
+ *
+ * @param operation
+ * @return boolean
+ */
+ protected boolean provides(CreateDiagramViewOperation operation) {
+ return getDiagramViewClass(operation.getSemanticAdapter(), operation.getSemanticHint()) != null;
+ }
+
+ /**
+ * Determines whether this provider can provide for the specified edge view
+ * operation
+ *
+ * @param operation
+ * @return boolean
+ */
+ protected boolean provides(CreateEdgeViewOperation operation) {
+ return (getEdgeViewClass(operation.getSemanticAdapter(), operation.getContainerView(), operation.getSemanticHint()) != null);
+ }
+
+ /**
+ * Determines whether this provider can provide for the specified node view
+ * operation
+ *
+ * @param operation
+ * @return boolean
+ */
+ protected boolean provides(CreateNodeViewOperation operation) {
+ return (getNodeViewClass(operation.getSemanticAdapter(), operation.getContainerView(), operation.getSemanticHint()) != null);
+ }
+
+ /**
+ * Returns the diagram view class to instantiate based on the passed params
+ *
+ * @param semanticAdapter
+ * TODO
+ * @param semanticAdapter
+ * @return Class
+ */
+ protected Class getDiagramViewClass(IAdaptable semanticAdapter, String diagramKind) {
+ return null;
+ }
+
+ /**
+ * Returns the edge view class to instantiate based on the passed params
+ *
+ * @param semanticAdapter
+ * @param containerView
+ * @param semanticHint
+ * @return Class
+ */
+ protected Class getEdgeViewClass(IAdaptable semanticAdapter, View containerView, String semanticHint) {
+ return null;
+ }
+
+ /**
+ * Returns the node view class to instantiate based on the passed params
+ *
+ * @param semanticAdapter
+ * @param containerView
+ * @param semanticHint
+ * @return Class
+ */
+ protected Class getNodeViewClass(IAdaptable semanticAdapter, View containerView, String semanticHint) {
+ return null;
+ }
+
+ /**
+ * creates a view instance via reflection.
+ *
+ * @param constructorParams
+ * the view's constructor parameters.
+ */
+ private View createNewView(Class viewClass, Object[] constructorParams) {
+ try {
+ assert null != viewClass : "Null viewClass in AbstractProvider";//$NON-NLS-1$
+ assert null != constructorParams : "Null constructorParams in AbstractProvider";//$NON-NLS-1$
+
+ Constructor constructor = getFactoryConstructor(viewClass);
+ if(constructor == null) {
+ Log.error(DiagramPlugin.getInstance(), DiagramStatusCodes.SERVICE_FAILURE, "View (" + viewClass + ") is missing a proper creation Factory"); //$NON-NLS-1$//$NON-NLS-2$
+ return null;
+ }
+
+ Object factory = constructor.newInstance(new Object[]{});
+ Method method = getCreationMethod(viewClass, constructorParams);
+ if(method == null) {
+ Log.error(DiagramPlugin.getInstance(), DiagramStatusCodes.SERVICE_FAILURE, "View (" + viewClass + ") is missing a proper creation Factory"); //$NON-NLS-1$//$NON-NLS-2$
+ return null;
+ }
+ return (View)method.invoke(factory, constructorParams);
+ } catch (Throwable e) {
+ String eMsg = NLS.bind(DiagramCoreMessages.AbstractViewProvider_create_view_failed_ERROR_, viewClass.getName());
+ Log.warning(DiagramPlugin.getInstance(), IStatus.WARNING, eMsg, e);
+ return null;
+ }
+ }
+
+ private Constructor getFactoryConstructor(Class viewClass) {
+ if(viewClass != null) {
+ Constructor[] ctors = viewClass.getConstructors();
+ for(int i = 0; i < ctors.length; i++) {
+ if(ctors[i].getParameterTypes().length == 0) {
+ return ctors[i];
+ }
+ }
+ }
+ return null;
+ }
+
+ /** Return the <i>creation</i> constructor for the cached view class. */
+ private Method getCreationMethod(Class viewClass, Object[] params) {
+ if(viewClass != null) {
+ Method method = classToCreateMethod.getCreationMethod(viewClass);
+ if(method != null)
+ return method;
+
+ Method[] methods = viewClass.getMethods();
+ for(int i = 0; i < methods.length; i++) {
+ method = methods[i];
+ String methodName = method.getName();
+ if(methodName.equals(viewCreationMethodName) || methodName.equals(diagramCreationMethodName)) {
+ classToCreateMethod.addMethod(viewClass, method);
+ return method;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the EClass associated with the semantic adapter
+ *
+ * @param semanticAdapter
+ * @return EClass
+ */
+ protected EClass getSemanticEClass(IAdaptable semanticAdapter) {
+ if(semanticAdapter == null)
+ return null;
+ EObject eObject = (EObject)semanticAdapter.getAdapter(EObject.class);
+ if(eObject != null)
+ return EMFCoreUtil.getProxyClass(eObject);
+ IElementType type = (IElementType)semanticAdapter.getAdapter(IElementType.class);
+ if(type != null)
+ return type.getEClass();
+ return null;
+ }
+
+ /**
+ * Returns the semantic element associated with the semantic adapter
+ *
+ * @param semanticAdapter
+ * @return EClass
+ */
+ protected EObject getSemanticElement(IAdaptable semanticAdapter) {
+ if(semanticAdapter == null)// TODO which MEditingDomain to use?
+ return null;
+ EObject eObject = (EObject)semanticAdapter.getAdapter(EObject.class);
+ if(eObject != null)
+ return EMFCoreUtil.resolve(TransactionUtil.getEditingDomain(eObject), eObject);
+ return null;
+ }
+
+ /**
+ * Returns the semantic element associated with the semantic adapter
+ *
+ * @param semanticAdapter
+ * @return EClass
+ */
+ protected EObject getSemanticElement(IAdaptable semanticAdapter, TransactionalEditingDomain domain) {
+ if(semanticAdapter == null)
+ return null;
+ EObject eObject = (EObject)semanticAdapter.getAdapter(EObject.class);
+ if(eObject != null)
+ return EMFCoreUtil.resolve(domain, eObject);
+ return null;
+ }
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/CustomAbstractEditPartProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/CustomAbstractEditPartProvider.java
index 100390f0c71..41a3cc8031b 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/CustomAbstractEditPartProvider.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/CustomAbstractEditPartProvider.java
@@ -1,49 +1,49 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.gmf.diagram.common.provider;
-
-import org.eclipse.gmf.runtime.common.core.service.IOperation;
-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;
-
-/**
- * This abstract edit part provider restricts its contribution to view that are owned by
- * a given type of diagram.
- */
-public abstract class CustomAbstractEditPartProvider extends AbstractEditPartProvider {
-
- /** The provides only provides for this diagram type */
- protected String diagramType;
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean provides(IOperation operation) {
- if(operation instanceof CreateGraphicEditPartOperation) {
- String currentDiagramType = ((IEditPartOperation)operation).getView().getDiagram().getType();
-
- if((diagramType == null) || (!diagramType.equals(currentDiagramType))) {
- return false;
- }
- }
-
- return super.provides(operation);
- }
-
-
-
-
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.gmf.diagram.common.provider;
+
+import org.eclipse.gmf.runtime.common.core.service.IOperation;
+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;
+
+/**
+ * This abstract edit part provider restricts its contribution to view that are owned by
+ * a given type of diagram.
+ */
+public abstract class CustomAbstractEditPartProvider extends AbstractEditPartProvider {
+
+ /** The provides only provides for this diagram type */
+ protected String diagramType;
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean provides(IOperation operation) {
+ if(operation instanceof CreateGraphicEditPartOperation) {
+ String currentDiagramType = ((IEditPartOperation)operation).getView().getDiagram().getType();
+
+ if((diagramType == null) || (!diagramType.equals(currentDiagramType))) {
+ return false;
+ }
+ }
+
+ return super.provides(operation);
+ }
+
+
+
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/CustomAbstractViewProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/CustomAbstractViewProvider.java
index 3464a7dd199..c112a1944a6 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/CustomAbstractViewProvider.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/CustomAbstractViewProvider.java
@@ -1,154 +1,154 @@
-/*****************************************************************************
- * Copyright (c) 2011-2012 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.gmf.diagram.common.provider;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
-import org.eclipse.gmf.runtime.diagram.core.services.view.CreateEdgeViewOperation;
-import org.eclipse.gmf.runtime.diagram.core.services.view.CreateNodeViewOperation;
-import org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewForKindOperation;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.notation.Edge;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.View;
-
-/**
- * This abstract view provider retrieve the view type from the graphical type
- * registry and use it in edge and node view creation.
- */
-public abstract class CustomAbstractViewProvider extends AbstractViewProvider {
-
- /** Local graphical type registry */
- protected IGraphicalTypeRegistry registry;
-
- /** The provides only provides for this diagram type */
- protected String diagramType;
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Edge createEdge(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
- String graphicalType = getEdgeGraphicalType(semanticAdapter, containerView, semanticHint);
- return super.createEdge(semanticAdapter, containerView, graphicalType, index, persisted, preferencesHint);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Node createNode(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
- String graphicalType = getNodeGraphicalType(semanticAdapter, containerView, semanticHint);
- return super.createNode(semanticAdapter, containerView, graphicalType, index, persisted, preferencesHint);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected boolean provides(CreateViewForKindOperation op) {
-
- // This method should generally not be called (https://bugs.eclipse.org/bugs/show_bug.cgi?id=346739).
-
- if((diagramType == null) || (!diagramType.equals(op.getContainerView().getDiagram().getType()))) {
- return false;
- }
-
-// if(op.getViewKind() == Node.class) {
-// String graphicalType = getNodeGraphicalType(op.getSemanticAdapter(), op.getContainerView(), op.getSemanticHint());
-// return getNodeViewClass(op.getSemanticAdapter(), op.getContainerView(), graphicalType) != null;
-// }
-//
-// if(op.getViewKind() == Edge.class) {
-// String graphicalType = getEdgeGraphicalType(op.getSemanticAdapter(), op.getContainerView(), op.getSemanticHint());
-// return getEdgeViewClass(op.getSemanticAdapter(), op.getContainerView(), graphicalType) != null;
-// }
-
- throw new UnsupportedOperationException("Should never be called by the "+diagramType+" diagram.");
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected boolean provides(CreateEdgeViewOperation operation) {
-
- if((diagramType == null) || (!diagramType.equals(operation.getContainerView().getDiagram().getType()))) {
- return false;
- }
-
- String graphicalType = getEdgeGraphicalType(operation.getSemanticAdapter(), operation.getContainerView(), operation.getSemanticHint());
- return (getEdgeViewClass(operation.getSemanticAdapter(), operation.getContainerView(), graphicalType) != null);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected boolean provides(CreateNodeViewOperation operation) {
-
- if((diagramType == null) || (!diagramType.equals(operation.getContainerView().getDiagram().getType()))) {
- return false;
- }
-
- String graphicalType = getNodeGraphicalType(operation.getSemanticAdapter(), operation.getContainerView(), operation.getSemanticHint());
- return (getNodeViewClass(operation.getSemanticAdapter(), operation.getContainerView(), graphicalType) != null);
- }
-
- private String getNodeGraphicalType(IAdaptable semanticAdapter, View containerView, String semanticHint) {
- String graphicalType = null;
-
- // Some ViewDescriptor constructors initialize unspecified semanticHint with ""
- if((semanticHint != null) && (! "".equals(semanticHint))) {
- graphicalType = registry.getNodeGraphicalType(semanticHint, containerView.getType());
-
- } else {
-
- EObject domainElement = (EObject)semanticAdapter.getAdapter(EObject.class);
- if(domainElement != null) {
- graphicalType = registry.getNodeGraphicalType(domainElement, containerView.getType());
- }
-
- IElementType elementType = (IElementType)semanticAdapter.getAdapter(IElementType.class);
- if(elementType != null) {
- graphicalType = registry.getNodeGraphicalType(elementType, containerView.getType());
-
- }
- }
- return graphicalType;
- }
-
- private String getEdgeGraphicalType(IAdaptable semanticAdapter, View containerView, String semanticHint) {
- String graphicalType = null;
- // Some ViewDescriptor constructors initialize unspecified semanticHint with ""
- if((semanticHint != null) && (! "".equals(semanticHint))) {
- graphicalType = registry.getEdgeGraphicalType(semanticHint);
-
- } else {
-
- EObject domainElement = (EObject)semanticAdapter.getAdapter(EObject.class);
- if(domainElement != null) {
- graphicalType = registry.getEdgeGraphicalType(domainElement);
- }
-
- IElementType elementType = (IElementType)semanticAdapter.getAdapter(IElementType.class);
- if(elementType != null) {
- graphicalType = registry.getEdgeGraphicalType(elementType);
-
- }
- }
- return graphicalType;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011-2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.gmf.diagram.common.provider;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.core.services.view.CreateEdgeViewOperation;
+import org.eclipse.gmf.runtime.diagram.core.services.view.CreateNodeViewOperation;
+import org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewForKindOperation;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * This abstract view provider retrieve the view type from the graphical type
+ * registry and use it in edge and node view creation.
+ */
+public abstract class CustomAbstractViewProvider extends AbstractViewProvider {
+
+ /** Local graphical type registry */
+ protected IGraphicalTypeRegistry registry;
+
+ /** The provides only provides for this diagram type */
+ protected String diagramType;
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Edge createEdge(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
+ String graphicalType = getEdgeGraphicalType(semanticAdapter, containerView, semanticHint);
+ return super.createEdge(semanticAdapter, containerView, graphicalType, index, persisted, preferencesHint);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Node createNode(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
+ String graphicalType = getNodeGraphicalType(semanticAdapter, containerView, semanticHint);
+ return super.createNode(semanticAdapter, containerView, graphicalType, index, persisted, preferencesHint);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected boolean provides(CreateViewForKindOperation op) {
+
+ // This method should generally not be called (https://bugs.eclipse.org/bugs/show_bug.cgi?id=346739).
+
+ if((diagramType == null) || (!diagramType.equals(op.getContainerView().getDiagram().getType()))) {
+ return false;
+ }
+
+// if(op.getViewKind() == Node.class) {
+// String graphicalType = getNodeGraphicalType(op.getSemanticAdapter(), op.getContainerView(), op.getSemanticHint());
+// return getNodeViewClass(op.getSemanticAdapter(), op.getContainerView(), graphicalType) != null;
+// }
+//
+// if(op.getViewKind() == Edge.class) {
+// String graphicalType = getEdgeGraphicalType(op.getSemanticAdapter(), op.getContainerView(), op.getSemanticHint());
+// return getEdgeViewClass(op.getSemanticAdapter(), op.getContainerView(), graphicalType) != null;
+// }
+
+ throw new UnsupportedOperationException("Should never be called by the "+diagramType+" diagram.");
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected boolean provides(CreateEdgeViewOperation operation) {
+
+ if((diagramType == null) || (!diagramType.equals(operation.getContainerView().getDiagram().getType()))) {
+ return false;
+ }
+
+ String graphicalType = getEdgeGraphicalType(operation.getSemanticAdapter(), operation.getContainerView(), operation.getSemanticHint());
+ return (getEdgeViewClass(operation.getSemanticAdapter(), operation.getContainerView(), graphicalType) != null);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected boolean provides(CreateNodeViewOperation operation) {
+
+ if((diagramType == null) || (!diagramType.equals(operation.getContainerView().getDiagram().getType()))) {
+ return false;
+ }
+
+ String graphicalType = getNodeGraphicalType(operation.getSemanticAdapter(), operation.getContainerView(), operation.getSemanticHint());
+ return (getNodeViewClass(operation.getSemanticAdapter(), operation.getContainerView(), graphicalType) != null);
+ }
+
+ private String getNodeGraphicalType(IAdaptable semanticAdapter, View containerView, String semanticHint) {
+ String graphicalType = null;
+
+ // Some ViewDescriptor constructors initialize unspecified semanticHint with ""
+ if((semanticHint != null) && (! "".equals(semanticHint))) {
+ graphicalType = registry.getNodeGraphicalType(semanticHint, containerView.getType());
+
+ } else {
+
+ EObject domainElement = (EObject)semanticAdapter.getAdapter(EObject.class);
+ if(domainElement != null) {
+ graphicalType = registry.getNodeGraphicalType(domainElement, containerView.getType());
+ }
+
+ IElementType elementType = (IElementType)semanticAdapter.getAdapter(IElementType.class);
+ if(elementType != null) {
+ graphicalType = registry.getNodeGraphicalType(elementType, containerView.getType());
+
+ }
+ }
+ return graphicalType;
+ }
+
+ private String getEdgeGraphicalType(IAdaptable semanticAdapter, View containerView, String semanticHint) {
+ String graphicalType = null;
+ // Some ViewDescriptor constructors initialize unspecified semanticHint with ""
+ if((semanticHint != null) && (! "".equals(semanticHint))) {
+ graphicalType = registry.getEdgeGraphicalType(semanticHint);
+
+ } else {
+
+ EObject domainElement = (EObject)semanticAdapter.getAdapter(EObject.class);
+ if(domainElement != null) {
+ graphicalType = registry.getEdgeGraphicalType(domainElement);
+ }
+
+ IElementType elementType = (IElementType)semanticAdapter.getAdapter(IElementType.class);
+ if(elementType != null) {
+ graphicalType = registry.getEdgeGraphicalType(elementType);
+
+ }
+ }
+ return graphicalType;
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/DiagramEditorUtil.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/DiagramEditorUtil.java
index cd31b0530aa..e7a68cd2469 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/DiagramEditorUtil.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/DiagramEditorUtil.java
@@ -1,42 +1,42 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.gmf.diagram.common.provider;
-
-import java.util.List;
-
-import org.eclipse.gef.EditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart;
-
-/**
- * Non diagram-specific class generated by GMF Tooling.
- */
-public class DiagramEditorUtil {
-
- public static void selectElementsInDiagram(IDiagramWorkbenchPart diagramPart, List<EditPart> editParts) {
- diagramPart.getDiagramGraphicalViewer().deselectAll();
-
- EditPart firstPrimary = null;
- for(EditPart nextPart : editParts) {
- diagramPart.getDiagramGraphicalViewer().appendSelection(nextPart);
- if(firstPrimary == null && nextPart instanceof IPrimaryEditPart) {
- firstPrimary = nextPart;
- }
- }
-
- if(!editParts.isEmpty()) {
- diagramPart.getDiagramGraphicalViewer().reveal(firstPrimary != null ? firstPrimary : (EditPart)editParts.get(0));
- }
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.gmf.diagram.common.provider;
+
+import java.util.List;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart;
+
+/**
+ * Non diagram-specific class generated by GMF Tooling.
+ */
+public class DiagramEditorUtil {
+
+ public static void selectElementsInDiagram(IDiagramWorkbenchPart diagramPart, List<EditPart> editParts) {
+ diagramPart.getDiagramGraphicalViewer().deselectAll();
+
+ EditPart firstPrimary = null;
+ for(EditPart nextPart : editParts) {
+ diagramPart.getDiagramGraphicalViewer().appendSelection(nextPart);
+ if(firstPrimary == null && nextPart instanceof IPrimaryEditPart) {
+ firstPrimary = nextPart;
+ }
+ }
+
+ if(!editParts.isEmpty()) {
+ diagramPart.getDiagramGraphicalViewer().reveal(firstPrimary != null ? firstPrimary : (EditPart)editParts.get(0));
+ }
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/ElementTypeLabelProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/ElementTypeLabelProvider.java
index aba6a03b037..e5bd29f1d5a 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/ElementTypeLabelProvider.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/ElementTypeLabelProvider.java
@@ -1,50 +1,50 @@
-/******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- ****************************************************************************/
-package org.eclipse.papyrus.gmf.diagram.common.provider;
-
-import org.eclipse.gmf.runtime.common.ui.services.icon.IconService;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * A label provider that provides the name and image for <code>IElementType</code> objects.
- *
- * @author cmahoney
- */
-public class ElementTypeLabelProvider extends LabelProvider {
-
- /**
- * Retrieves the image for <code>IElementType</code> objects using
- * the <code>IconService</code>.
- *
- * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
- */
- public Image getImage(Object object) {
- if(object instanceof IElementType) {
- return IconService.getInstance().getIcon((IElementType)object);
- }
- return null;
- }
-
- /**
- * Uses <code>IElementType.getDisplayName()</code> for the text.
- *
- * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
- */
- public String getText(Object object) {
- if(object instanceof IElementType) {
- return ((IElementType)object).getDisplayName();
- } else {
- return object.toString();
- }
- }
-}
+/******************************************************************************
+ * Copyright (c) 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ ****************************************************************************/
+package org.eclipse.papyrus.gmf.diagram.common.provider;
+
+import org.eclipse.gmf.runtime.common.ui.services.icon.IconService;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * A label provider that provides the name and image for <code>IElementType</code> objects.
+ *
+ * @author cmahoney
+ */
+public class ElementTypeLabelProvider extends LabelProvider {
+
+ /**
+ * Retrieves the image for <code>IElementType</code> objects using
+ * the <code>IconService</code>.
+ *
+ * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
+ */
+ public Image getImage(Object object) {
+ if(object instanceof IElementType) {
+ return IconService.getInstance().getIcon((IElementType)object);
+ }
+ return null;
+ }
+
+ /**
+ * Uses <code>IElementType.getDisplayName()</code> for the text.
+ *
+ * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
+ */
+ public String getText(Object object) {
+ if(object instanceof IElementType) {
+ return ((IElementType)object).getDisplayName();
+ } else {
+ return object.toString();
+ }
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/MarkerNavigationProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/MarkerNavigationProvider.java
index 891fe69d63d..969c80b1550 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/MarkerNavigationProvider.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/MarkerNavigationProvider.java
@@ -1,91 +1,91 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.gmf.diagram.common.provider;
-
-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.sysml.diagram.common.Activator;
-
-/**
- * Non diagram-specific class generated by GMF Tooling.
- */
-public class MarkerNavigationProvider extends AbstractModelMarkerNavigationProvider {
-
- public static final String MARKER_TYPE = Activator.PLUGIN_ID + ".diagnostic"; //$NON-NLS-1$
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void doGotoMarker(IMarker marker) {
- String elementId = marker.getAttribute(org.eclipse.gmf.runtime.common.core.resources.IMarker.ELEMENT_ID, null);
- if(elementId == null || !(getEditor() instanceof DiagramEditor)) {
- return;
- }
- DiagramEditor editor = (DiagramEditor)getEditor();
- Map editPartRegistry = editor.getDiagramGraphicalViewer().getEditPartRegistry();
- EObject targetView = editor.getDiagram().eResource().getEObject(elementId);
- if(targetView == null) {
- return;
- }
- EditPart targetEditPart = (EditPart)editPartRegistry.get(targetView);
- if(targetEditPart != null) {
- DiagramEditorUtil.selectElementsInDiagram(editor, Arrays.asList(new EditPart[]{ targetEditPart }));
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public static void deleteMarkers(IResource resource) {
- try {
- resource.deleteMarkers(MARKER_TYPE, true, IResource.DEPTH_ZERO);
- } catch (CoreException e) {
- Activator.log.error("Failed to delete validation markers", e); //$NON-NLS-1$
- }
- }
-
- /**
- * {@inheritDoc}
- */
- 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) {
- Activator.log.error("Failed to create validation marker", e); //$NON-NLS-1$
- }
- return marker;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.gmf.diagram.common.provider;
+
+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.sysml.diagram.common.Activator;
+
+/**
+ * Non diagram-specific class generated by GMF Tooling.
+ */
+public class MarkerNavigationProvider extends AbstractModelMarkerNavigationProvider {
+
+ public static final String MARKER_TYPE = Activator.PLUGIN_ID + ".diagnostic"; //$NON-NLS-1$
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void doGotoMarker(IMarker marker) {
+ String elementId = marker.getAttribute(org.eclipse.gmf.runtime.common.core.resources.IMarker.ELEMENT_ID, null);
+ if(elementId == null || !(getEditor() instanceof DiagramEditor)) {
+ return;
+ }
+ DiagramEditor editor = (DiagramEditor)getEditor();
+ Map editPartRegistry = editor.getDiagramGraphicalViewer().getEditPartRegistry();
+ EObject targetView = editor.getDiagram().eResource().getEObject(elementId);
+ if(targetView == null) {
+ return;
+ }
+ EditPart targetEditPart = (EditPart)editPartRegistry.get(targetView);
+ if(targetEditPart != null) {
+ DiagramEditorUtil.selectElementsInDiagram(editor, Arrays.asList(new EditPart[]{ targetEditPart }));
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public static void deleteMarkers(IResource resource) {
+ try {
+ resource.deleteMarkers(MARKER_TYPE, true, IResource.DEPTH_ZERO);
+ } catch (CoreException e) {
+ Activator.log.error("Failed to delete validation markers", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ 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) {
+ Activator.log.error("Failed to create validation marker", e); //$NON-NLS-1$
+ }
+ return marker;
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/ConstraintExtendedDirectEditionDialog.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/ConstraintExtendedDirectEditionDialog.java
new file mode 100644
index 00000000000..dbac0ce2dc4
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/ConstraintExtendedDirectEditionDialog.java
@@ -0,0 +1,16 @@
+package org.eclipse.papyrus.sysml.diagram.common.commands;
+
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.swt.widgets.Shell;
+
+public class ConstraintExtendedDirectEditionDialog extends ExtendedDirectEditionDialog {
+
+ public ConstraintExtendedDirectEditionDialog(Shell parentShell,
+ Object object, String initialValue,
+ IDirectEditorConfiguration configuration) {
+ super(parentShell, object, initialValue, configuration);
+ this.title = "Edit Constraint specification";
+ }
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateActorPartWithTypeConfigureCommandFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateActorPartWithTypeConfigureCommandFactory.java
index 886612c7d74..8a41c91511c 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateActorPartWithTypeConfigureCommandFactory.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateActorPartWithTypeConfigureCommandFactory.java
@@ -1,89 +1,89 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.common.commands;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.type.core.commands.ConfigureElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.papyrus.infra.services.edit.commands.AbstractConfigureCommandFactory;
-import org.eclipse.papyrus.infra.services.edit.utils.GMFCommandUtils;
-import org.eclipse.papyrus.sysml.diagram.common.dialogs.CreateOrSelectActorPartTypeDialog;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.Property;
-import org.eclipse.uml2.uml.Type;
-
-/**
- * This command factory provides a command that enable ActorPart type to be selected or created during creation.
- */
-public class CreateActorPartWithTypeConfigureCommandFactory extends AbstractConfigureCommandFactory {
-
- /**
- * {@inheritDoc}
- */
- public ICommand create(ConfigureRequest request) {
-
- ICommand configureCommand = null;
-
- Shell shell = Display.getDefault().getActiveShell();
- // Start dialog to identify the new part type
- Property part = (Property)request.getElementToConfigure();
- Package partPkg = part.getNearestPackage();
-
- CreateOrSelectActorPartTypeDialog dialog = new CreateOrSelectActorPartTypeDialog(shell, partPkg);
- dialog.open();
- if(dialog.getReturnCode() == CreateOrSelectActorPartTypeDialog.OK) {
-
- final ICommand typeCreationCommand = dialog.getNewTypeCreateCommand();
- final Type actorPartType = (Type)dialog.getExistingType();
-
- // Abort if type creation command exists but is not executable
- if((typeCreationCommand != null) && (!typeCreationCommand.canExecute())) {
- return cancelCommand(request);
- } else {
- configureCommand = CompositeCommand.compose(configureCommand, typeCreationCommand);
- }
-
- // Create the configure command that will set the ActorPart type
- ICommand setTypeCommand = new ConfigureElementCommand(request) {
-
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Property actorPart = (Property)getElementToEdit();
- if(actorPartType != null) {
- actorPart.setType(actorPartType);
- } else {
- Type newType = (Type)GMFCommandUtils.getCommandEObjectResult(typeCreationCommand);
- actorPart.setType(newType);
- }
-
- return CommandResult.newOKCommandResult(actorPart);
- }
-
- };
-
- configureCommand = CompositeCommand.compose(configureCommand, setTypeCommand);
- return configureCommand;
- }
-
- return cancelCommand(request);
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.common.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.ConfigureElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.papyrus.infra.services.edit.commands.AbstractConfigureCommandFactory;
+import org.eclipse.papyrus.infra.services.edit.utils.GMFCommandUtils;
+import org.eclipse.papyrus.sysml.diagram.common.dialogs.CreateOrSelectActorPartTypeDialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.Type;
+
+/**
+ * This command factory provides a command that enable ActorPart type to be selected or created during creation.
+ */
+public class CreateActorPartWithTypeConfigureCommandFactory extends AbstractConfigureCommandFactory {
+
+ /**
+ * {@inheritDoc}
+ */
+ public ICommand create(ConfigureRequest request) {
+
+ ICommand configureCommand = null;
+
+ Shell shell = Display.getDefault().getActiveShell();
+ // Start dialog to identify the new part type
+ Property part = (Property)request.getElementToConfigure();
+ Package partPkg = part.getNearestPackage();
+
+ CreateOrSelectActorPartTypeDialog dialog = new CreateOrSelectActorPartTypeDialog(shell, partPkg);
+ dialog.open();
+ if(dialog.getReturnCode() == CreateOrSelectActorPartTypeDialog.OK) {
+
+ final ICommand typeCreationCommand = dialog.getNewTypeCreateCommand();
+ final Type actorPartType = (Type)dialog.getExistingType();
+
+ // Abort if type creation command exists but is not executable
+ if((typeCreationCommand != null) && (!typeCreationCommand.canExecute())) {
+ return cancelCommand(request);
+ } else {
+ configureCommand = CompositeCommand.compose(configureCommand, typeCreationCommand);
+ }
+
+ // Create the configure command that will set the ActorPart type
+ ICommand setTypeCommand = new ConfigureElementCommand(request) {
+
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+
+ Property actorPart = (Property)getElementToEdit();
+ if(actorPartType != null) {
+ actorPart.setType(actorPartType);
+ } else {
+ Type newType = (Type)GMFCommandUtils.getCommandEObjectResult(typeCreationCommand);
+ actorPart.setType(newType);
+ }
+
+ return CommandResult.newOKCommandResult(actorPart);
+ }
+
+ };
+
+ configureCommand = CompositeCommand.compose(configureCommand, setTypeCommand);
+ return configureCommand;
+ }
+
+ return cancelCommand(request);
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateConstraintPropertyWithTypeConfigureCommandFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateConstraintPropertyWithTypeConfigureCommandFactory.java
new file mode 100644
index 00000000000..2371e626b6e
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateConstraintPropertyWithTypeConfigureCommandFactory.java
@@ -0,0 +1,154 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.common.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.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+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.emf.type.core.commands.ConfigureElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.services.edit.commands.AbstractConfigureCommandFactory;
+import org.eclipse.papyrus.infra.services.edit.commands.ConfigureFeatureCommandFactory;
+import org.eclipse.papyrus.infra.services.edit.commands.IConfigureCommandFactory;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.infra.services.edit.utils.GMFCommandUtils;
+import org.eclipse.papyrus.sysml.diagram.common.dialogs.CreateOrSelectConstraintPropertyTypeDialog;
+import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.Type;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * This command factory provides a command that enable Part type to be selected or created during creation.
+ */
+public class CreateConstraintPropertyWithTypeConfigureCommandFactory extends AbstractConfigureCommandFactory {
+
+ /**
+ * {@inheritDoc}
+ */
+ public ICommand create(ConfigureRequest request) {
+
+ ICommand configureCommand = null;
+
+ Shell shell = Display.getDefault().getActiveShell();
+ // Start dialog to identify the new part type
+ Property part = (Property)request.getElementToConfigure();
+ Package partPkg = part.getNearestPackage();
+
+ CreateOrSelectConstraintPropertyTypeDialog dialog = new CreateOrSelectConstraintPropertyTypeDialog(shell, partPkg);
+ dialog.open();
+ if(dialog.getReturnCode() == CreateOrSelectConstraintPropertyTypeDialog.OK) {
+
+ final ICommand typeCreationCommand = dialog.getNewTypeCreateCommand();
+ final Type partType = (Type)dialog.getExistingType();
+
+ // Abort if type creation command exists but is not executable
+ if((typeCreationCommand != null) && (!typeCreationCommand.canExecute())) {
+ return cancelCommand(request);
+ } else {
+ configureCommand = CompositeCommand.compose(configureCommand, typeCreationCommand);
+ }
+
+ // Create the configure command that will set the constraint property type
+ ICommand setTypeCommand = new ConfigureElementCommand(request) {
+
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+
+ Property part = (Property)getElementToEdit();
+ if(partType != null) {
+ part.setType(partType);
+ } else {
+ Type newType = (Type)GMFCommandUtils.getCommandEObjectResult(typeCreationCommand);
+ createConstraintBlockConstraint(newType, monitor, info);
+ part.setType(newType);
+ }
+ return CommandResult.newOKCommandResult(part);
+ }
+
+ private void createConstraintBlockConstraint(Type newType, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ // Create the constraint attached to the ConstraintBlock
+ IElementEditService commandService = ElementEditServiceUtils.getCommandProvider(newType);
+ if(commandService != null) {
+ CreateElementRequest createTypeRequest = new CreateElementRequest(newType, UMLElementTypes.CONSTRAINT);
+ createTypeRequest.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID,
+ new ConfigureFeatureCommandFactory(UMLPackage.eINSTANCE.getNamedElement_Name(), newType.getName() + "Specification"));
+ ICommand newConstraintCreateCommand = commandService.getEditCommand(createTypeRequest);
+ if (newConstraintCreateCommand.canExecute()) {
+ newConstraintCreateCommand.execute(monitor, info);
+ Object newObject = newConstraintCreateCommand.getCommandResult().getReturnValue();
+ // Create the constraint specification
+ if (newObject instanceof EObject) {
+ final EObject newElement = (EObject)newObject;
+ final IDirectEditorConfiguration configuration = initExtendedEditorConfiguration(newElement);
+ Dialog dialog = new ConstraintExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), newElement, configuration.getTextToEdit(newElement), configuration);
+ final Dialog finalDialog = dialog;
+ if(Window.OK == dialog.open()) {
+ TransactionalEditingDomain domain = getEditingDomain();
+ RecordingCommand command = new RecordingCommand(domain, "Edit Constraint specification") {
+ @Override
+ protected void doExecute() {
+ configuration.postEditAction(newElement, ((ILabelEditorDialog)finalDialog).getValue());
+ }
+ };
+ domain.getCommandStack().execute(command);
+ }
+ }
+
+ }
+ }
+ }
+ };
+
+ configureCommand = CompositeCommand.compose(configureCommand, setTypeCommand);
+ return configureCommand;
+ }
+
+ return cancelCommand(request);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ */
+ protected IDirectEditorConfiguration initExtendedEditorConfiguration(EObject element) {
+ IDirectEditorConfiguration configuration;
+ final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + element.eClass().getInstanceClassName());
+ if(languagePreferred != null && !languagePreferred.equals("")) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, element.eClass().getInstanceClassName());
+ } else {
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, element.eClass().getInstanceClassName());
+ }
+ return configuration;
+ }
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateFlowPortWithFlowSpecificationConfigureCommandFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateFlowPortWithFlowSpecificationConfigureCommandFactory.java
index 64ef05e8e81..ac62e065270 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateFlowPortWithFlowSpecificationConfigureCommandFactory.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateFlowPortWithFlowSpecificationConfigureCommandFactory.java
@@ -1,88 +1,88 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.common.commands;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.type.core.commands.ConfigureElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.papyrus.infra.services.edit.commands.AbstractConfigureCommandFactory;
-import org.eclipse.papyrus.infra.services.edit.utils.GMFCommandUtils;
-import org.eclipse.papyrus.sysml.diagram.common.dialogs.CreateOrSelectNonAtomicFlowPortTypeDialog;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.Port;
-import org.eclipse.uml2.uml.Type;
-
-/**
- * This command factory provides a command that enable FlowPort type (FlowSpecification) to be selected or created during creation.
- */
-public class CreateFlowPortWithFlowSpecificationConfigureCommandFactory extends AbstractConfigureCommandFactory {
-
- /**
- * {@inheritDoc}
- */
- public ICommand create(ConfigureRequest request) {
-
- ICommand configureCommand = null;
-
- Shell shell = Display.getDefault().getActiveShell();
- // Start dialog to identify the new port type
- Port port = (Port)request.getElementToConfigure();
- Package partPkg = port.getNearestPackage();
-
- CreateOrSelectNonAtomicFlowPortTypeDialog dialog = new CreateOrSelectNonAtomicFlowPortTypeDialog(shell, partPkg);
- dialog.open();
- if(dialog.getReturnCode() == CreateOrSelectNonAtomicFlowPortTypeDialog.OK) {
-
- final ICommand typeCreationCommand = dialog.getNewTypeCreateCommand();
- final Type portType = (Type)dialog.getExistingType();
-
- // Abort if type creation command exists but is not executable
- if((typeCreationCommand != null) && (!typeCreationCommand.canExecute())) {
- return cancelCommand(request);
- } else {
- configureCommand = CompositeCommand.compose(configureCommand, typeCreationCommand);
- }
-
- // Create the configure command that will set the part type
- ICommand setTypeCommand = new ConfigureElementCommand(request) {
-
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Port port = (Port)getElementToEdit();
- if(portType != null) {
- port.setType(portType);
- } else {
- Type newType = (Type)GMFCommandUtils.getCommandEObjectResult(typeCreationCommand);
- port.setType(newType);
- }
- return CommandResult.newOKCommandResult(port);
- }
-
- };
-
- configureCommand = CompositeCommand.compose(configureCommand, setTypeCommand);
- return configureCommand;
- }
-
- return cancelCommand(request);
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.common.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.ConfigureElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.papyrus.infra.services.edit.commands.AbstractConfigureCommandFactory;
+import org.eclipse.papyrus.infra.services.edit.utils.GMFCommandUtils;
+import org.eclipse.papyrus.sysml.diagram.common.dialogs.CreateOrSelectNonAtomicFlowPortTypeDialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.Port;
+import org.eclipse.uml2.uml.Type;
+
+/**
+ * This command factory provides a command that enable FlowPort type (FlowSpecification) to be selected or created during creation.
+ */
+public class CreateFlowPortWithFlowSpecificationConfigureCommandFactory extends AbstractConfigureCommandFactory {
+
+ /**
+ * {@inheritDoc}
+ */
+ public ICommand create(ConfigureRequest request) {
+
+ ICommand configureCommand = null;
+
+ Shell shell = Display.getDefault().getActiveShell();
+ // Start dialog to identify the new port type
+ Port port = (Port)request.getElementToConfigure();
+ Package partPkg = port.getNearestPackage();
+
+ CreateOrSelectNonAtomicFlowPortTypeDialog dialog = new CreateOrSelectNonAtomicFlowPortTypeDialog(shell, partPkg);
+ dialog.open();
+ if(dialog.getReturnCode() == CreateOrSelectNonAtomicFlowPortTypeDialog.OK) {
+
+ final ICommand typeCreationCommand = dialog.getNewTypeCreateCommand();
+ final Type portType = (Type)dialog.getExistingType();
+
+ // Abort if type creation command exists but is not executable
+ if((typeCreationCommand != null) && (!typeCreationCommand.canExecute())) {
+ return cancelCommand(request);
+ } else {
+ configureCommand = CompositeCommand.compose(configureCommand, typeCreationCommand);
+ }
+
+ // Create the configure command that will set the part type
+ ICommand setTypeCommand = new ConfigureElementCommand(request) {
+
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+
+ Port port = (Port)getElementToEdit();
+ if(portType != null) {
+ port.setType(portType);
+ } else {
+ Type newType = (Type)GMFCommandUtils.getCommandEObjectResult(typeCreationCommand);
+ port.setType(newType);
+ }
+ return CommandResult.newOKCommandResult(port);
+ }
+
+ };
+
+ configureCommand = CompositeCommand.compose(configureCommand, setTypeCommand);
+ return configureCommand;
+ }
+
+ return cancelCommand(request);
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreatePartWithTypeConfigureCommandFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreatePartWithTypeConfigureCommandFactory.java
index 96da614a4a2..2bd53e7f3dd 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreatePartWithTypeConfigureCommandFactory.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreatePartWithTypeConfigureCommandFactory.java
@@ -1,88 +1,88 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.common.commands;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.type.core.commands.ConfigureElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.papyrus.infra.services.edit.commands.AbstractConfigureCommandFactory;
-import org.eclipse.papyrus.infra.services.edit.utils.GMFCommandUtils;
-import org.eclipse.papyrus.sysml.diagram.common.dialogs.CreateOrSelectBlockPropertyTypeDialog;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.Property;
-import org.eclipse.uml2.uml.Type;
-
-/**
- * This command factory provides a command that enable Part type to be selected or created during creation.
- */
-public class CreatePartWithTypeConfigureCommandFactory extends AbstractConfigureCommandFactory {
-
- /**
- * {@inheritDoc}
- */
- public ICommand create(ConfigureRequest request) {
-
- ICommand configureCommand = null;
-
- Shell shell = Display.getDefault().getActiveShell();
- // Start dialog to identify the new part type
- Property part = (Property)request.getElementToConfigure();
- Package partPkg = part.getNearestPackage();
-
- CreateOrSelectBlockPropertyTypeDialog dialog = new CreateOrSelectBlockPropertyTypeDialog(shell, partPkg);
- dialog.open();
- if(dialog.getReturnCode() == CreateOrSelectBlockPropertyTypeDialog.OK) {
-
- final ICommand typeCreationCommand = dialog.getNewTypeCreateCommand();
- final Type partType = (Type)dialog.getExistingType();
-
- // Abort if type creation command exists but is not executable
- if((typeCreationCommand != null) && (!typeCreationCommand.canExecute())) {
- return cancelCommand(request);
- } else {
- configureCommand = CompositeCommand.compose(configureCommand, typeCreationCommand);
- }
-
- // Create the configure command that will set the part type
- ICommand setTypeCommand = new ConfigureElementCommand(request) {
-
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Property part = (Property)getElementToEdit();
- if(partType != null) {
- part.setType(partType);
- } else {
- Type newType = (Type)GMFCommandUtils.getCommandEObjectResult(typeCreationCommand);
- part.setType(newType);
- }
- return CommandResult.newOKCommandResult(part);
- }
-
- };
-
- configureCommand = CompositeCommand.compose(configureCommand, setTypeCommand);
- return configureCommand;
- }
-
- return cancelCommand(request);
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.common.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.ConfigureElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.papyrus.infra.services.edit.commands.AbstractConfigureCommandFactory;
+import org.eclipse.papyrus.infra.services.edit.utils.GMFCommandUtils;
+import org.eclipse.papyrus.sysml.diagram.common.dialogs.CreateOrSelectBlockPropertyTypeDialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.Type;
+
+/**
+ * This command factory provides a command that enable Part type to be selected or created during creation.
+ */
+public class CreatePartWithTypeConfigureCommandFactory extends AbstractConfigureCommandFactory {
+
+ /**
+ * {@inheritDoc}
+ */
+ public ICommand create(ConfigureRequest request) {
+
+ ICommand configureCommand = null;
+
+ Shell shell = Display.getDefault().getActiveShell();
+ // Start dialog to identify the new part type
+ Property part = (Property)request.getElementToConfigure();
+ Package partPkg = part.getNearestPackage();
+
+ CreateOrSelectBlockPropertyTypeDialog dialog = new CreateOrSelectBlockPropertyTypeDialog(shell, partPkg);
+ dialog.open();
+ if(dialog.getReturnCode() == CreateOrSelectBlockPropertyTypeDialog.OK) {
+
+ final ICommand typeCreationCommand = dialog.getNewTypeCreateCommand();
+ final Type partType = (Type)dialog.getExistingType();
+
+ // Abort if type creation command exists but is not executable
+ if((typeCreationCommand != null) && (!typeCreationCommand.canExecute())) {
+ return cancelCommand(request);
+ } else {
+ configureCommand = CompositeCommand.compose(configureCommand, typeCreationCommand);
+ }
+
+ // Create the configure command that will set the part type
+ ICommand setTypeCommand = new ConfigureElementCommand(request) {
+
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+
+ Property part = (Property)getElementToEdit();
+ if(partType != null) {
+ part.setType(partType);
+ } else {
+ Type newType = (Type)GMFCommandUtils.getCommandEObjectResult(typeCreationCommand);
+ part.setType(newType);
+ }
+ return CommandResult.newOKCommandResult(part);
+ }
+
+ };
+
+ configureCommand = CompositeCommand.compose(configureCommand, setTypeCommand);
+ return configureCommand;
+ }
+
+ return cancelCommand(request);
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateReferenceWithTypeConfigureCommandFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateReferenceWithTypeConfigureCommandFactory.java
index 49b35be177a..50b7889349d 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateReferenceWithTypeConfigureCommandFactory.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateReferenceWithTypeConfigureCommandFactory.java
@@ -1,88 +1,88 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.common.commands;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.type.core.commands.ConfigureElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.papyrus.infra.services.edit.commands.AbstractConfigureCommandFactory;
-import org.eclipse.papyrus.infra.services.edit.utils.GMFCommandUtils;
-import org.eclipse.papyrus.sysml.diagram.common.dialogs.CreateOrSelectBlockPropertyTypeDialog;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.Property;
-import org.eclipse.uml2.uml.Type;
-
-/**
- * This command factory provides a command that enable Reference type to be selected or created during creation.
- */
-public class CreateReferenceWithTypeConfigureCommandFactory extends AbstractConfigureCommandFactory {
-
- /**
- * {@inheritDoc}
- */
- public ICommand create(ConfigureRequest request) {
-
- ICommand configureCommand = null;
-
- Shell shell = Display.getDefault().getActiveShell();
- // Start dialog to identify the new part type
- Property part = (Property)request.getElementToConfigure();
- Package partPkg = part.getNearestPackage();
-
- CreateOrSelectBlockPropertyTypeDialog dialog = new CreateOrSelectBlockPropertyTypeDialog(shell, partPkg);
- dialog.open();
- if(dialog.getReturnCode() == CreateOrSelectBlockPropertyTypeDialog.OK) {
-
- final ICommand typeCreationCommand = dialog.getNewTypeCreateCommand();
- final Type partType = (Type)dialog.getExistingType();
-
- // Abort if type creation command exists but is not executable
- if((typeCreationCommand != null) && (!typeCreationCommand.canExecute())) {
- return cancelCommand(request);
- } else {
- configureCommand = CompositeCommand.compose(configureCommand, typeCreationCommand);
- }
-
- // Create the configure command that will set the part type
- ICommand setTypeCommand = new ConfigureElementCommand(request) {
-
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Property part = (Property)getElementToEdit();
- if(partType != null) {
- part.setType(partType);
- } else {
- Type newType = (Type)GMFCommandUtils.getCommandEObjectResult(typeCreationCommand);
- part.setType(newType);
- }
- return CommandResult.newOKCommandResult(part);
- }
-
- };
-
- configureCommand = CompositeCommand.compose(configureCommand, setTypeCommand);
- return configureCommand;
- }
-
- return cancelCommand(request);
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.common.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.ConfigureElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.papyrus.infra.services.edit.commands.AbstractConfigureCommandFactory;
+import org.eclipse.papyrus.infra.services.edit.utils.GMFCommandUtils;
+import org.eclipse.papyrus.sysml.diagram.common.dialogs.CreateOrSelectBlockPropertyTypeDialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.Type;
+
+/**
+ * This command factory provides a command that enable Reference type to be selected or created during creation.
+ */
+public class CreateReferenceWithTypeConfigureCommandFactory extends AbstractConfigureCommandFactory {
+
+ /**
+ * {@inheritDoc}
+ */
+ public ICommand create(ConfigureRequest request) {
+
+ ICommand configureCommand = null;
+
+ Shell shell = Display.getDefault().getActiveShell();
+ // Start dialog to identify the new part type
+ Property part = (Property)request.getElementToConfigure();
+ Package partPkg = part.getNearestPackage();
+
+ CreateOrSelectBlockPropertyTypeDialog dialog = new CreateOrSelectBlockPropertyTypeDialog(shell, partPkg);
+ dialog.open();
+ if(dialog.getReturnCode() == CreateOrSelectBlockPropertyTypeDialog.OK) {
+
+ final ICommand typeCreationCommand = dialog.getNewTypeCreateCommand();
+ final Type partType = (Type)dialog.getExistingType();
+
+ // Abort if type creation command exists but is not executable
+ if((typeCreationCommand != null) && (!typeCreationCommand.canExecute())) {
+ return cancelCommand(request);
+ } else {
+ configureCommand = CompositeCommand.compose(configureCommand, typeCreationCommand);
+ }
+
+ // Create the configure command that will set the part type
+ ICommand setTypeCommand = new ConfigureElementCommand(request) {
+
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+
+ Property part = (Property)getElementToEdit();
+ if(partType != null) {
+ part.setType(partType);
+ } else {
+ Type newType = (Type)GMFCommandUtils.getCommandEObjectResult(typeCreationCommand);
+ part.setType(newType);
+ }
+ return CommandResult.newOKCommandResult(part);
+ }
+
+ };
+
+ configureCommand = CompositeCommand.compose(configureCommand, setTypeCommand);
+ return configureCommand;
+ }
+
+ return cancelCommand(request);
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateValueWithTypeConfigureCommandFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateValueWithTypeConfigureCommandFactory.java
index e60996c8420..fc21e248d3f 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateValueWithTypeConfigureCommandFactory.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateValueWithTypeConfigureCommandFactory.java
@@ -1,88 +1,88 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.common.commands;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.type.core.commands.ConfigureElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.papyrus.infra.services.edit.commands.AbstractConfigureCommandFactory;
-import org.eclipse.papyrus.infra.services.edit.utils.GMFCommandUtils;
-import org.eclipse.papyrus.sysml.diagram.common.dialogs.CreateOrSelectValuePropertyTypeDialog;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.Property;
-import org.eclipse.uml2.uml.Type;
-
-/**
- * This command factory provides a command that enable Value type to be selected or created during creation.
- */
-public class CreateValueWithTypeConfigureCommandFactory extends AbstractConfigureCommandFactory {
-
- /**
- * {@inheritDoc}
- */
- public ICommand create(ConfigureRequest request) {
-
- ICommand configureCommand = null;
-
- Shell shell = Display.getDefault().getActiveShell();
- // Start dialog to identify the new part type
- Property part = (Property)request.getElementToConfigure();
- Package partPkg = part.getNearestPackage();
-
- CreateOrSelectValuePropertyTypeDialog dialog = new CreateOrSelectValuePropertyTypeDialog(shell, partPkg);
- dialog.open();
- if(dialog.getReturnCode() == CreateOrSelectValuePropertyTypeDialog.OK) {
-
- final ICommand typeCreationCommand = dialog.getNewTypeCreateCommand();
- final Type partType = (Type)dialog.getExistingType();
-
- // Abort if type creation command exists but is not executable
- if((typeCreationCommand != null) && (!typeCreationCommand.canExecute())) {
- return cancelCommand(request);
- } else {
- configureCommand = CompositeCommand.compose(configureCommand, typeCreationCommand);
- }
-
- // Create the configure command that will set the part type
- ICommand setTypeCommand = new ConfigureElementCommand(request) {
-
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Property part = (Property)getElementToEdit();
- if(partType != null) {
- part.setType(partType);
- } else {
- Type newType = (Type)GMFCommandUtils.getCommandEObjectResult(typeCreationCommand);
- part.setType(newType);
- }
- return CommandResult.newOKCommandResult(part);
- }
-
- };
-
- configureCommand = CompositeCommand.compose(configureCommand, setTypeCommand);
- return configureCommand;
- }
-
- return cancelCommand(request);
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.common.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.ConfigureElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.papyrus.infra.services.edit.commands.AbstractConfigureCommandFactory;
+import org.eclipse.papyrus.infra.services.edit.utils.GMFCommandUtils;
+import org.eclipse.papyrus.sysml.diagram.common.dialogs.CreateOrSelectValuePropertyTypeDialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.Type;
+
+/**
+ * This command factory provides a command that enable Value type to be selected or created during creation.
+ */
+public class CreateValueWithTypeConfigureCommandFactory extends AbstractConfigureCommandFactory {
+
+ /**
+ * {@inheritDoc}
+ */
+ public ICommand create(ConfigureRequest request) {
+
+ ICommand configureCommand = null;
+
+ Shell shell = Display.getDefault().getActiveShell();
+ // Start dialog to identify the new part type
+ Property part = (Property)request.getElementToConfigure();
+ Package partPkg = part.getNearestPackage();
+
+ CreateOrSelectValuePropertyTypeDialog dialog = new CreateOrSelectValuePropertyTypeDialog(shell, partPkg);
+ dialog.open();
+ if(dialog.getReturnCode() == CreateOrSelectValuePropertyTypeDialog.OK) {
+
+ final ICommand typeCreationCommand = dialog.getNewTypeCreateCommand();
+ final Type partType = (Type)dialog.getExistingType();
+
+ // Abort if type creation command exists but is not executable
+ if((typeCreationCommand != null) && (!typeCreationCommand.canExecute())) {
+ return cancelCommand(request);
+ } else {
+ configureCommand = CompositeCommand.compose(configureCommand, typeCreationCommand);
+ }
+
+ // Create the configure command that will set the part type
+ ICommand setTypeCommand = new ConfigureElementCommand(request) {
+
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+
+ Property part = (Property)getElementToEdit();
+ if(partType != null) {
+ part.setType(partType);
+ } else {
+ Type newType = (Type)GMFCommandUtils.getCommandEObjectResult(typeCreationCommand);
+ part.setType(newType);
+ }
+ return CommandResult.newOKCommandResult(part);
+ }
+
+ };
+
+ configureCommand = CompositeCommand.compose(configureCommand, setTypeCommand);
+ return configureCommand;
+ }
+
+ return cancelCommand(request);
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectActorPartTypeDialog.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectActorPartTypeDialog.java
index 18ea1e49a8c..d2e22627b71 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectActorPartTypeDialog.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectActorPartTypeDialog.java
@@ -1,119 +1,119 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.common.dialogs;
-
-import org.eclipse.papyrus.sysml.diagram.common.messages.Messages;
-import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * Dialog for initialization of ActorPart (Property) type (the type is either selected or created).
- */
-public class CreateOrSelectActorPartTypeDialog extends CreateOrSelectTypeDialog {
-
- /** Constructor */
- public CreateOrSelectActorPartTypeDialog(Shell shell, NamedElement owner) {
- super(shell, owner, UMLElementTypes.ACTOR, UMLPackage.eINSTANCE.getTypedElement_Type(), UMLPackage.eINSTANCE.getActor(), UMLElementTypes.PACKAGE, UMLPackage.eINSTANCE.getPackage_PackagedElement(), null);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getDialogTitle() {
- return Messages.CreateOrSelectActorPartTypeDialog_DialogTitle;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getSelectionSectionTitle() {
- return Messages.CreateOrSelectActorPartTypeDialog_SelectionSectionTitle;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getSelectionSectionRadioLabel() {
- return Messages.CreateOrSelectActorPartTypeDialog_SelectionSectionRadioLabel;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getCreationSectionTitle() {
- return Messages.CreateOrSelectActorPartTypeDialog_CreationSectionTitle;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getCreationSectionRadioLabel() {
- return Messages.CreateOrSelectActorPartTypeDialog_CreationSectionRadioLabel;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getNewTypeNameLabel() {
- return Messages.CreateOrSelectActorPartTypeDialog_NewTypeNameLabel;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getNewTypeContainerNameLabel() {
- return Messages.CreateOrSelectActorPartTypeDialog_NewTypeContainerNameLabel;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getNewTypeContainerDialogTitle() {
- return Messages.CreateOrSelectActorPartTypeDialog_SelectNewTypeContainerDialogTitle;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getNewTypeContainerDialogMessage() {
- return Messages.CreateOrSelectActorPartTypeDialog_SelectNewTypeContainerDialogMessage;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getTypeDialogTitle() {
- return Messages.CreateOrSelectActorPartTypeDialog_SelectTypeDialogTitle;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getTypeDialogMessage() {
- return Messages.CreateOrSelectActorPartTypeDialog_SelectTypeDialogMessage;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.common.dialogs;
+
+import org.eclipse.papyrus.sysml.diagram.common.messages.Messages;
+import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * Dialog for initialization of ActorPart (Property) type (the type is either selected or created).
+ */
+public class CreateOrSelectActorPartTypeDialog extends CreateOrSelectTypeDialog {
+
+ /** Constructor */
+ public CreateOrSelectActorPartTypeDialog(Shell shell, NamedElement owner) {
+ super(shell, owner, UMLElementTypes.ACTOR, UMLPackage.eINSTANCE.getTypedElement_Type(), UMLPackage.eINSTANCE.getActor(), UMLElementTypes.PACKAGE, UMLPackage.eINSTANCE.getPackage_PackagedElement(), null);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getDialogTitle() {
+ return Messages.CreateOrSelectActorPartTypeDialog_DialogTitle;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getSelectionSectionTitle() {
+ return Messages.CreateOrSelectActorPartTypeDialog_SelectionSectionTitle;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getSelectionSectionRadioLabel() {
+ return Messages.CreateOrSelectActorPartTypeDialog_SelectionSectionRadioLabel;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getCreationSectionTitle() {
+ return Messages.CreateOrSelectActorPartTypeDialog_CreationSectionTitle;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getCreationSectionRadioLabel() {
+ return Messages.CreateOrSelectActorPartTypeDialog_CreationSectionRadioLabel;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getNewTypeNameLabel() {
+ return Messages.CreateOrSelectActorPartTypeDialog_NewTypeNameLabel;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getNewTypeContainerNameLabel() {
+ return Messages.CreateOrSelectActorPartTypeDialog_NewTypeContainerNameLabel;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getNewTypeContainerDialogTitle() {
+ return Messages.CreateOrSelectActorPartTypeDialog_SelectNewTypeContainerDialogTitle;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getNewTypeContainerDialogMessage() {
+ return Messages.CreateOrSelectActorPartTypeDialog_SelectNewTypeContainerDialogMessage;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getTypeDialogTitle() {
+ return Messages.CreateOrSelectActorPartTypeDialog_SelectTypeDialogTitle;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getTypeDialogMessage() {
+ return Messages.CreateOrSelectActorPartTypeDialog_SelectTypeDialogMessage;
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectBlockPropertyTypeDialog.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectBlockPropertyTypeDialog.java
index a145efcc937..28ba0f980b3 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectBlockPropertyTypeDialog.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectBlockPropertyTypeDialog.java
@@ -1,121 +1,121 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.common.dialogs;
-
-import org.eclipse.papyrus.sysml.blocks.BlocksPackage;
-import org.eclipse.papyrus.sysml.diagram.common.messages.Messages;
-import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes;
-import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * Dialog for initialization of Part (Property) type (the type is either selected or created).
- */
-public class CreateOrSelectBlockPropertyTypeDialog extends CreateOrSelectTypeDialog {
-
- /** Constructor */
- public CreateOrSelectBlockPropertyTypeDialog(Shell shell, NamedElement owner) {
- super(shell, owner, SysMLElementTypes.BLOCK, UMLPackage.eINSTANCE.getTypedElement_Type(), BlocksPackage.eINSTANCE.getBlock(), UMLElementTypes.PACKAGE, UMLPackage.eINSTANCE.getPackage_PackagedElement(), null);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getDialogTitle() {
- return Messages.CreateOrSelectBlockPropertyTypeDialog_DialogTitle;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getSelectionSectionTitle() {
- return Messages.CreateOrSelectBlockPropertyTypeDialog_SelectionSectionTitle;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getSelectionSectionRadioLabel() {
- return Messages.CreateOrSelectBlockPropertyTypeDialog_SelectionSectionRadioLabel;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getCreationSectionTitle() {
- return Messages.CreateOrSelectBlockPropertyTypeDialog_CreationSectionTitle;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getCreationSectionRadioLabel() {
- return Messages.CreateOrSelectBlockPropertyTypeDialog_CreationSectionRadioLabel;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getNewTypeNameLabel() {
- return Messages.CreateOrSelectBlockPropertyTypeDialog_NewTypeNameLabel;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getNewTypeContainerNameLabel() {
- return Messages.CreateOrSelectBlockPropertyTypeDialog_NewTypeContainerNameLabel;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getNewTypeContainerDialogTitle() {
- return Messages.CreateOrSelectBlockPropertyTypeDialog_SelectNewTypeContainerDialogTitle;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getNewTypeContainerDialogMessage() {
- return Messages.CreateOrSelectBlockPropertyTypeDialog_SelectNewTypeContainerDialogMessage;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getTypeDialogTitle() {
- return Messages.CreateOrSelectBlockPropertyTypeDialog_SelectTypeDialogTitle;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getTypeDialogMessage() {
- return Messages.CreateOrSelectBlockPropertyTypeDialog_SelectTypeDialogMessage;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.common.dialogs;
+
+import org.eclipse.papyrus.sysml.blocks.BlocksPackage;
+import org.eclipse.papyrus.sysml.diagram.common.messages.Messages;
+import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes;
+import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * Dialog for initialization of Part (Property) type (the type is either selected or created).
+ */
+public class CreateOrSelectBlockPropertyTypeDialog extends CreateOrSelectTypeDialog {
+
+ /** Constructor */
+ public CreateOrSelectBlockPropertyTypeDialog(Shell shell, NamedElement owner) {
+ super(shell, owner, SysMLElementTypes.BLOCK, UMLPackage.eINSTANCE.getTypedElement_Type(), BlocksPackage.eINSTANCE.getBlock(), UMLElementTypes.PACKAGE, UMLPackage.eINSTANCE.getPackage_PackagedElement(), null);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getDialogTitle() {
+ return Messages.CreateOrSelectBlockPropertyTypeDialog_DialogTitle;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getSelectionSectionTitle() {
+ return Messages.CreateOrSelectBlockPropertyTypeDialog_SelectionSectionTitle;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getSelectionSectionRadioLabel() {
+ return Messages.CreateOrSelectBlockPropertyTypeDialog_SelectionSectionRadioLabel;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getCreationSectionTitle() {
+ return Messages.CreateOrSelectBlockPropertyTypeDialog_CreationSectionTitle;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getCreationSectionRadioLabel() {
+ return Messages.CreateOrSelectBlockPropertyTypeDialog_CreationSectionRadioLabel;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getNewTypeNameLabel() {
+ return Messages.CreateOrSelectBlockPropertyTypeDialog_NewTypeNameLabel;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getNewTypeContainerNameLabel() {
+ return Messages.CreateOrSelectBlockPropertyTypeDialog_NewTypeContainerNameLabel;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getNewTypeContainerDialogTitle() {
+ return Messages.CreateOrSelectBlockPropertyTypeDialog_SelectNewTypeContainerDialogTitle;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getNewTypeContainerDialogMessage() {
+ return Messages.CreateOrSelectBlockPropertyTypeDialog_SelectNewTypeContainerDialogMessage;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getTypeDialogTitle() {
+ return Messages.CreateOrSelectBlockPropertyTypeDialog_SelectTypeDialogTitle;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getTypeDialogMessage() {
+ return Messages.CreateOrSelectBlockPropertyTypeDialog_SelectTypeDialogMessage;
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectConstraintPropertyTypeDialog.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectConstraintPropertyTypeDialog.java
new file mode 100644
index 00000000000..8e80820c06b
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectConstraintPropertyTypeDialog.java
@@ -0,0 +1,122 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.common.dialogs;
+
+import org.eclipse.papyrus.sysml.constraints.ConstraintsPackage;
+import org.eclipse.papyrus.sysml.diagram.common.messages.Messages;
+import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes;
+import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * Dialog for initialization of Part (Property) type (the type is either selected or created).
+ */
+public class CreateOrSelectConstraintPropertyTypeDialog extends CreateOrSelectTypeDialog {
+
+ /** Constructor */
+ public CreateOrSelectConstraintPropertyTypeDialog(Shell shell, NamedElement owner) {
+ super(shell, owner, SysMLElementTypes.CONSTRAINT_BLOCK, UMLPackage.eINSTANCE.getTypedElement_Type(), ConstraintsPackage.eINSTANCE.getConstraintBlock(), UMLElementTypes.PACKAGE, UMLPackage.eINSTANCE.getPackage_PackagedElement(), null);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getDialogTitle() {
+ return Messages.CreateOrSelectConstraintPropertyTypeDialog_DialogTitle;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getSelectionSectionTitle() {
+ return Messages.CreateOrSelectConstraintPropertyTypeDialog_SelectionSectionTitle;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getSelectionSectionRadioLabel() {
+ return Messages.CreateOrSelectConstraintPropertyTypeDialog_SelectionSectionRadioLabel;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getCreationSectionTitle() {
+ return Messages.CreateOrSelectConstraintPropertyTypeDialog_CreationSectionTitle;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getCreationSectionRadioLabel() {
+ return Messages.CreateOrSelectConstraintPropertyTypeDialog_CreationSectionRadioLabel;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getNewTypeNameLabel() {
+ return Messages.CreateOrSelectConstraintPropertyTypeDialog_NewTypeNameLabel;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getNewTypeContainerNameLabel() {
+ return Messages.CreateOrSelectConstraintPropertyTypeDialog_NewTypeContainerNameLabel;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getNewTypeContainerDialogTitle() {
+ return Messages.CreateOrSelectConstraintPropertyTypeDialog_SelectNewTypeContainerDialogTitle;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getNewTypeContainerDialogMessage() {
+ return Messages.CreateOrSelectConstraintPropertyTypeDialog_SelectNewTypeContainerDialogMessage;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getTypeDialogTitle() {
+ return Messages.CreateOrSelectConstraintPropertyTypeDialog_SelectTypeDialogTitle;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getTypeDialogMessage() {
+ return Messages.CreateOrSelectConstraintPropertyTypeDialog_SelectTypeDialogMessage;
+ }
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectNonAtomicFlowPortTypeDialog.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectNonAtomicFlowPortTypeDialog.java
index d0651d2fb05..6976905cf7f 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectNonAtomicFlowPortTypeDialog.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectNonAtomicFlowPortTypeDialog.java
@@ -1,121 +1,121 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.common.dialogs;
-
-import org.eclipse.papyrus.sysml.diagram.common.messages.Messages;
-import org.eclipse.papyrus.sysml.portandflows.PortandflowsPackage;
-import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes;
-import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * Dialog for initialization of non atomic FlowPort type (the type is a FlowSpecification either selected or created).
- */
-public class CreateOrSelectNonAtomicFlowPortTypeDialog extends CreateOrSelectTypeDialog {
-
- /** Constructor */
- public CreateOrSelectNonAtomicFlowPortTypeDialog(Shell shell, NamedElement owner) {
- super(shell, owner, SysMLElementTypes.FLOW_SPECIFICATION, UMLPackage.eINSTANCE.getTypedElement_Type(), PortandflowsPackage.eINSTANCE.getFlowSpecification(), UMLElementTypes.PACKAGE, UMLPackage.eINSTANCE.getPackage_PackagedElement(), null);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getDialogTitle() {
- return Messages.CreateOrSelectNonAtomicFlowPortTypeDialog_DialogTitle;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getSelectionSectionTitle() {
- return Messages.CreateOrSelectNonAtomicFlowPortTypeDialog_SelectionSectionTitle;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getSelectionSectionRadioLabel() {
- return Messages.CreateOrSelectNonAtomicFlowPortTypeDialog_SelectionSectionRadioLabel;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getCreationSectionTitle() {
- return Messages.CreateOrSelectNonAtomicFlowPortTypeDialog_CreationSectionTitle;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getCreationSectionRadioLabel() {
- return Messages.CreateOrSelectNonAtomicFlowPortTypeDialog_CreationSectionRadioLabel;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getNewTypeNameLabel() {
- return Messages.CreateOrSelectNonAtomicFlowPortTypeDialog_NewTypeNameLabel;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getNewTypeContainerNameLabel() {
- return Messages.CreateOrSelectNonAtomicFlowPortTypeDialog_NewTypeContainerNameLabel;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getNewTypeContainerDialogTitle() {
- return Messages.CreateOrSelectNonAtomicFlowPortTypeDialog_SelectNewTypeContainerDialogTitle;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getNewTypeContainerDialogMessage() {
- return Messages.CreateOrSelectNonAtomicFlowPortTypeDialog_SelectNewTypeContainerDialogMessage;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getTypeDialogTitle() {
- return Messages.CreateOrSelectNonAtomicFlowPortTypeDialog_SelectTypeDialogTitle;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getTypeDialogMessage() {
- return Messages.CreateOrSelectNonAtomicFlowPortTypeDialog_SelectTypeDialogMessage;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.common.dialogs;
+
+import org.eclipse.papyrus.sysml.diagram.common.messages.Messages;
+import org.eclipse.papyrus.sysml.portandflows.PortandflowsPackage;
+import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes;
+import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * Dialog for initialization of non atomic FlowPort type (the type is a FlowSpecification either selected or created).
+ */
+public class CreateOrSelectNonAtomicFlowPortTypeDialog extends CreateOrSelectTypeDialog {
+
+ /** Constructor */
+ public CreateOrSelectNonAtomicFlowPortTypeDialog(Shell shell, NamedElement owner) {
+ super(shell, owner, SysMLElementTypes.FLOW_SPECIFICATION, UMLPackage.eINSTANCE.getTypedElement_Type(), PortandflowsPackage.eINSTANCE.getFlowSpecification(), UMLElementTypes.PACKAGE, UMLPackage.eINSTANCE.getPackage_PackagedElement(), null);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getDialogTitle() {
+ return Messages.CreateOrSelectNonAtomicFlowPortTypeDialog_DialogTitle;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getSelectionSectionTitle() {
+ return Messages.CreateOrSelectNonAtomicFlowPortTypeDialog_SelectionSectionTitle;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getSelectionSectionRadioLabel() {
+ return Messages.CreateOrSelectNonAtomicFlowPortTypeDialog_SelectionSectionRadioLabel;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getCreationSectionTitle() {
+ return Messages.CreateOrSelectNonAtomicFlowPortTypeDialog_CreationSectionTitle;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getCreationSectionRadioLabel() {
+ return Messages.CreateOrSelectNonAtomicFlowPortTypeDialog_CreationSectionRadioLabel;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getNewTypeNameLabel() {
+ return Messages.CreateOrSelectNonAtomicFlowPortTypeDialog_NewTypeNameLabel;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getNewTypeContainerNameLabel() {
+ return Messages.CreateOrSelectNonAtomicFlowPortTypeDialog_NewTypeContainerNameLabel;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getNewTypeContainerDialogTitle() {
+ return Messages.CreateOrSelectNonAtomicFlowPortTypeDialog_SelectNewTypeContainerDialogTitle;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getNewTypeContainerDialogMessage() {
+ return Messages.CreateOrSelectNonAtomicFlowPortTypeDialog_SelectNewTypeContainerDialogMessage;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getTypeDialogTitle() {
+ return Messages.CreateOrSelectNonAtomicFlowPortTypeDialog_SelectTypeDialogTitle;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getTypeDialogMessage() {
+ return Messages.CreateOrSelectNonAtomicFlowPortTypeDialog_SelectTypeDialogMessage;
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectTypeDialog.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectTypeDialog.java
index e19ab0e7724..2b1e9e15ef0 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectTypeDialog.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectTypeDialog.java
@@ -1,605 +1,605 @@
-/*****************************************************************************
- * Copyright (c) 2010 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- * CEA LIST - Class Adaptation in SysML context, Content and Label provider replacement.
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.common.dialogs;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.ISpecializationType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.infra.services.edit.commands.ConfigureFeatureCommandFactory;
-import org.eclipse.papyrus.infra.services.edit.commands.IConfigureCommandFactory;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-import org.eclipse.papyrus.infra.widgets.editors.TreeSelectorDialog;
-import org.eclipse.papyrus.sysml.diagram.common.Activator;
-import org.eclipse.papyrus.sysml.diagram.common.messages.Messages;
-import org.eclipse.papyrus.uml.tools.providers.UMLLabelProvider;
-import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.forms.FormDialog;
-import org.eclipse.ui.forms.IManagedForm;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.ScrolledForm;
-import org.eclipse.ui.forms.widgets.Section;
-import org.eclipse.uml2.uml.Namespace;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * Dialog for initialization of Property type (the type is either selected or created).
- */
-public class CreateOrSelectTypeDialog extends FormDialog {
-
- protected Button creationRadio;
-
- protected Button selectionRadio;
-
- protected Text newTypeNameText;
-
- protected Text newTypeContainerNameText;
-
- protected Button newTypeContainerButton;
-
- protected String newTypeName = null;
-
- protected ICommand newTypeCreateCommand = null;
-
- protected EObject newTypeContainer = null;
-
- protected Text existingTypeNameText;
-
- protected Button existingTypeButton;
-
- protected EObject existingType = null;
-
- protected EObject defaultContainer;
-
- protected ILabelProvider labelProvider;
-
- protected IElementType elementType;
-
- protected EStructuralFeature editedFeature;
-
- protected EClass elementEClass;
-
- protected IElementType containerType;
-
- protected EStructuralFeature containerFeature;
-
- protected EClass containerEClass;
-
- /**
- * Create a new dialog to initialize an ActivityParameterNode.
- *
- * @param shell
- * parent shell
- * @param owner
- * the activity that owns the action
- */
- public CreateOrSelectTypeDialog(Shell shell, EObject defaultContainer, IElementType elementType, EStructuralFeature editedFeature, EClass elementEClass, IElementType containerType, EStructuralFeature containerFeature, EClass containerEClass) {
- super(shell);
- this.defaultContainer = defaultContainer;
- this.elementType = elementType;
- this.editedFeature = editedFeature;
- this.elementEClass = elementEClass;
- this.containerType = containerType;
- this.containerFeature = containerFeature;
- this.containerEClass = containerEClass;
- this.labelProvider = new UMLLabelProvider();
- }
-
- protected String getDialogTitle() {
- return Messages.CreateOrSelectTypeDialog_DialogTitle;
- }
-
- protected String getSelectionSectionTitle() {
- return Messages.CreateOrSelectTypeDialog_SelectionSectionTitle;
- }
-
- protected String getSelectionSectionRadioLabel() {
- return Messages.CreateOrSelectTypeDialog_SelectionSectionRadioLabel;
- }
-
- protected String getCreationSectionTitle() {
- return Messages.CreateOrSelectTypeDialog_CreationSectionTitle;
- }
-
- protected String getCreationSectionRadioLabel() {
- return Messages.CreateOrSelectTypeDialog_CreationSectionRadioLabel;
- }
-
- protected String getNewTypeNameLabel() {
- return Messages.CreateOrSelectTypeDialog_NewTypeNameLabel;
- }
-
- protected String getNewTypeContainerNameLabel() {
- return Messages.CreateOrSelectTypeDialog_NewTypeContainerNameLabel;
- }
-
- protected String getNewTypeContainerDialogTitle() {
- return Messages.CreateOrSelectTypeDialog_SelectNewTypeContainerDialogTitle;
- }
-
- protected String getNewTypeContainerDialogMessage() {
- return Messages.CreateOrSelectTypeDialog_SelectNewTypeContainerDialogMessage;
- }
-
- protected String getTypeDialogTitle() {
- return Messages.CreateOrSelectTypeDialog_SelectTypeDialogTitle;
- }
-
- protected String getTypeDialogMessage() {
- return Messages.CreateOrSelectTypeDialog_SelectTypeDialogMessage;
- }
-
- /**
- * Create the form to :
- *
- * - ask the user to choose or create an existing element.
- *
- * @see org.eclipse.ui.forms.FormDialog#createFormContent(org.eclipse.ui.forms.IManagedForm)
- */
- @Override
- protected void createFormContent(IManagedForm pForm) {
- pForm.getForm().setText(getDialogTitle());
- ScrolledForm scrolledForm = pForm.getForm();
- FormToolkit toolkit = pForm.getToolkit();
- Composite parent = scrolledForm.getBody();
- parent.setLayout(new GridLayout());
-
- createFormCreationSection(scrolledForm.getBody(), toolkit);
- createFormSelectionSection(scrolledForm.getBody(), toolkit);
-
- refreshSectionsEnable(false);
- hookListeners();
- // invoked name is set after listeners, since we count on listener to update it properly
- setNewTypeContainer(defaultContainer);
- setNewTypeName(null);
-
- scrolledForm.reflow(true);
- }
-
- /**
- * Adds buttons to this dialog's button bar.
- *
- * @param parent
- * the button bar composite
- */
- @Override
- protected void createButtonsForButtonBar(Composite parent) {
- super.createButtonsForButtonBar(parent);
- refreshOkButton();
- }
-
- /**
- * Create the section to ask the user to choose an existing element.
- *
- * @param pParent
- * the section's parent widget
- * @param pToolkit
- * the form toolkit
- */
- protected void createFormSelectionSection(Composite pParent, FormToolkit pToolkit) {
- // create the section
- String lSectionTitle = getSelectionSectionTitle();
- Section lSection = pToolkit.createSection(pParent, Section.EXPANDED | Section.TITLE_BAR);
- lSection.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- if(lSectionTitle != null) {
- lSection.setText(lSectionTitle);
- }
-
- ScrolledForm lInsideScrolledForm = pToolkit.createScrolledForm(lSection);
- lInsideScrolledForm.setExpandHorizontal(true);
- lInsideScrolledForm.setExpandVertical(true);
- Composite lBody = lInsideScrolledForm.getBody();
-
- GridLayout lLayout = new GridLayout();
- lLayout.numColumns = 3;
- lBody.setLayout(lLayout);
-
- // content of the section
- selectionRadio = pToolkit.createButton(lBody, getSelectionSectionRadioLabel(), SWT.RADIO);
- selectionRadio.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1));
-
- // manage elementType selection
- pToolkit.createLabel(lBody, elementType.getDisplayName(), SWT.NONE);
- existingTypeNameText = pToolkit.createText(lBody, "", SWT.BORDER | SWT.READ_ONLY);
- existingTypeNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- existingTypeButton = pToolkit.createButton(lBody, "...", SWT.FLAT);
-
- Image image = Activator.getInstance().getImage(elementType.getEClass());
- if(elementEClass != null) {
- image = Activator.getInstance().getImage(elementEClass);
- }
-
- existingTypeButton.setImage(image);
- existingTypeButton.setLayoutData(new GridData(SWT.NONE));
-
- lInsideScrolledForm.reflow(true);
- lSection.setClient(lInsideScrolledForm);
- }
-
- /**
- * Create the section to ask the user to create an invoked element.
- *
- * @param pParent
- * the section's parent widget
- * @param pToolkit
- * the form toolkit
- */
- protected void createFormCreationSection(Composite pParent, FormToolkit pToolkit) {
- // create the section
- String lSectionTitle = getCreationSectionTitle();
- Section lSection = pToolkit.createSection(pParent, Section.EXPANDED | Section.TITLE_BAR);
- lSection.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- if(lSectionTitle != null) {
- lSection.setText(lSectionTitle);
- }
-
- ScrolledForm lInsideScrolledForm = pToolkit.createScrolledForm(lSection);
- lInsideScrolledForm.setExpandHorizontal(true);
- lInsideScrolledForm.setExpandVertical(true);
- Composite lBody = lInsideScrolledForm.getBody();
-
- GridLayout lLayout = new GridLayout();
- lLayout.numColumns = 3;
- lBody.setLayout(lLayout);
-
- // content of the section
- creationRadio = pToolkit.createButton(lBody, getCreationSectionRadioLabel(), SWT.RADIO);
- creationRadio.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1));
-
- pToolkit.createLabel(lBody, getNewTypeNameLabel(), SWT.NONE);
- newTypeNameText = pToolkit.createText(lBody, "", SWT.BORDER);
- newTypeNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
- newTypeNameText.setFocus();
-
- // manage type selection
- pToolkit.createLabel(lBody, getNewTypeContainerNameLabel(), SWT.NONE);
- newTypeContainerNameText = pToolkit.createText(lBody, labelProvider.getText(newTypeContainer), SWT.BORDER | SWT.READ_ONLY);
- newTypeContainerNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- newTypeContainerButton = pToolkit.createButton(lBody, "...", SWT.FLAT);
- Image image = Activator.getInstance().getImage(containerType.getEClass());
- if(containerEClass != null) {
- image = Activator.getInstance().getImage(containerEClass);
- }
- newTypeContainerButton.setImage(image);
- newTypeContainerButton.setLayoutData(new GridData(SWT.NONE));
-
- lInsideScrolledForm.reflow(true);
- lSection.setClient(lInsideScrolledForm);
- }
-
-
- @Override
- protected void okPressed() {
-
- // Build type creation command if needed
- boolean isSelectionMode = selectionRadio.getSelection();
- if(!isSelectionMode) {
- // Creation mode - Prepare type creation command and set existing type to null.
- existingType = null;
- buildNewTypeCreateCommand();
-
- } else {
- // Selection mode - Set the type creation command to null.
- newTypeCreateCommand = null;
- }
-
- super.okPressed();
- }
-
- protected void buildNewTypeCreateCommand() {
- // The new element is expected to be a NamedElement.
- IElementEditService commandService = ElementEditServiceUtils.getCommandProvider(newTypeContainer);
- if(commandService != null) {
- CreateElementRequest createTypeRequest = new CreateElementRequest(newTypeContainer, elementType);
- createTypeRequest.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new ConfigureFeatureCommandFactory(UMLPackage.eINSTANCE.getNamedElement_Name(), newTypeNameText.getText()));
- newTypeCreateCommand = commandService.getEditCommand(createTypeRequest);
- }
- }
-
- public ICommand getNewTypeCreateCommand() {
- return newTypeCreateCommand;
- }
-
- public String getNewTypeName() {
- return newTypeNameText.getText();
- }
-
- public EObject getExistingType() {
- return existingType;
- }
-
- /**
- * Add listeners to widgets
- */
- protected void hookListeners() {
- // listener to choose active section
- SelectionListener selectCreateListener = new SelectionAdapter() {
-
- /**
- * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- @Override
- public void widgetSelected(SelectionEvent e) {
- if(creationRadio.equals(e.getSource())) {
- refreshSectionsEnable(false);
- } else {
- refreshSectionsEnable(true);
- }
- refreshOkButton();
- }
- };
- selectionRadio.addSelectionListener(selectCreateListener);
- creationRadio.addSelectionListener(selectCreateListener);
-
- // listener to select existing element
- SelectionListener selectBtnListener = new SelectionAdapter() {
-
- /**
- * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- @Override
- public void widgetSelected(SelectionEvent e) {
- handleChooseType();
- refreshOkButton();
- }
- };
- existingTypeButton.addSelectionListener(selectBtnListener);
-
- // listener to existing element name
- ModifyListener lNameListener = new ModifyListener() {
-
- /**
- * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
- */
- public void modifyText(ModifyEvent e) {
- setNewTypeName(existingTypeNameText.getText());
- }
- };
- existingTypeNameText.addModifyListener(lNameListener);
-
- // listener to select new element type container
- SelectionListener selectTypeBtnListener = new SelectionAdapter() {
-
- /**
- * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- @Override
- public void widgetSelected(SelectionEvent e) {
- handleChooseNewTypeContainer();
- // reset name if not set
- if(newTypeName == null) {
- setNewTypeName(null);
- }
- refreshOkButton();
- }
- };
- newTypeContainerButton.addSelectionListener(selectTypeBtnListener);
-
- // listener to new element name
- ModifyListener lNewNameListener = new ModifyListener() {
-
- /**
- * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
- */
- public void modifyText(ModifyEvent e) {
- validateNewTypeName();
- refreshOkButton();
- }
- };
- newTypeNameText.addModifyListener(lNewNameListener);
- }
-
- /**
- * Set the name of the new type
- *
- * @param text
- * the text string or null for auto-initialization
- */
- protected void setNewTypeName(String text) {
- String name = text;
- if(text == null) {
- name = NamedElementUtil.getDefaultNameWithIncrementFromBase(elementType.getEClass().getName(), newTypeContainer.eContents());
- if(elementEClass != null) {
- name = NamedElementUtil.getDefaultNameWithIncrementFromBase(elementEClass.getName(), newTypeContainer.eContents());
- }
- newTypeNameText.setText(name);
-
- } else {
- newTypeNameText.setText(name);
- newTypeName = name;
- }
-
- validateNewTypeName();
- refreshOkButton();
- }
-
- protected void validateNewTypeName() {
- if(isValidName(newTypeContainer, newTypeNameText.getText())) {
- Color black = newTypeNameText.getDisplay().getSystemColor(SWT.COLOR_BLACK);
- newTypeNameText.setForeground(black);
-
- } else {
- Color red = newTypeNameText.getDisplay().getSystemColor(SWT.COLOR_RED);
- newTypeNameText.setForeground(red);
- }
- }
-
- protected boolean isValidName(EObject container, String newName) {
- boolean isValid = true;
- if(container instanceof Namespace) {
- if(((Namespace)container).getOwnedMember(newName) != null) {
- isValid = false;
- }
- }
-
- return isValid;
- }
-
- /** Open the dialog to choose an existing type */
- protected void handleChooseType() {
-
- TreeSelectorDialog dialog = new TreeSelectorDialog(getShell());
-
- dialog.setMessage(getTypeDialogMessage());
- dialog.setTitle(getTypeDialogTitle());
- dialog.setInput(EcoreUtil.getRootContainer(defaultContainer));
-
- ServiceEditContentProvider provider = new ServiceEditContentProvider(elementType, editedFeature, EcoreUtil.getRootContainer(defaultContainer));
- dialog.setContentProvider(provider);
- dialog.setLabelProvider(labelProvider);
-
- if(dialog.open() == Window.OK) {
- Object result = dialog.getResult()[0];
- if(result instanceof IAdaptable) {
- result = ((IAdaptable)result).getAdapter(EObject.class);
- }
-
- if(result instanceof EObject) {
- setExistingTypeSelection((EObject)result);
- } else {
- setExistingTypeSelection(null);
- }
- }
- }
-
- /**
- * Set the existing type selected (if selection mode is chosen)
- *
- * @param invokedElement
- * the selected element
- */
- protected void setExistingTypeSelection(EObject type) {
- if(type == null) {
- existingTypeNameText.setText("");
- } else {
- existingType = type;
- existingTypeNameText.setText(labelProvider.getText(existingType));
- }
- }
-
- /** Open the dialog to choose new type container */
- protected void handleChooseNewTypeContainer() {
-
- TreeSelectorDialog dialog = new TreeSelectorDialog(getShell());
-
- dialog.setMessage(getNewTypeContainerDialogMessage());
- dialog.setTitle(getNewTypeContainerDialogTitle());
- dialog.setInput(EcoreUtil.getRootContainer(defaultContainer));
-
- ServiceEditContentProvider provider = new ServiceEditContentProvider(containerType, containerFeature, EcoreUtil.getRootContainer(defaultContainer));
- dialog.setContentProvider(provider);
- dialog.setLabelProvider(labelProvider);
-
- if(dialog.open() == Window.OK) {
- Object result = dialog.getResult()[0];
- if(result instanceof IAdaptable) {
- result = ((IAdaptable)result).getAdapter(EObject.class);
- }
-
- if(result instanceof EObject) {
- setNewTypeContainer((EObject)result);
- } else {
- setNewTypeContainer(null);
- }
- }
- }
-
- /**
- * Define the type of the object that will be created (if creation mode is chosen)
- *
- * @param the
- * selected parent
- */
- protected void setNewTypeContainer(EObject container) {
-
- if((containerType instanceof ISpecializationType) && ((ISpecializationType)containerType).getMatcher().matches(container)) {
- newTypeContainer = container;
- newTypeContainerNameText.setText(labelProvider.getText(newTypeContainer));
-
- } else if(containerType.getEClass().isInstance(container)) {
- newTypeContainer = container;
- newTypeContainerNameText.setText(labelProvider.getText(newTypeContainer));
-
- } else {
- newTypeContainer = null;
- newTypeContainerNameText.setText("");
- }
- }
-
- /**
- * Refresh the enabled and disabled elements in various sections
- *
- * @param isSelectionSelected
- * true if we choose to select an existing element, false if we choose to create an element
- */
- private void refreshSectionsEnable(boolean isSelectionSelected) {
- // handle radio button value
- if(isSelectionSelected) {
- creationRadio.setSelection(false);
- if(!selectionRadio.getSelection()) {
- selectionRadio.setSelection(true);
- }
- } else {
- selectionRadio.setSelection(false);
- if(!creationRadio.getSelection()) {
- creationRadio.setSelection(true);
- }
- }
- // handle disabled section
- existingTypeNameText.setEnabled(isSelectionSelected);
- existingTypeButton.setEnabled(isSelectionSelected);
- newTypeNameText.setEnabled(!isSelectionSelected);
- newTypeNameText.setFocus();
- newTypeContainerNameText.setEnabled(!isSelectionSelected);
- newTypeContainerButton.setEnabled(!isSelectionSelected);
- }
-
-
- /** Refresh the OK button activation */
- protected void refreshOkButton() {
- boolean isSelectionSelected = selectionRadio.getSelection();
- if(getButton(IDialogConstants.OK_ID) != null && !getButton(IDialogConstants.OK_ID).isDisposed()) {
- if(isSelectionSelected) {
- getButton(IDialogConstants.OK_ID).setEnabled(existingType != null);
- } else {
- getButton(IDialogConstants.OK_ID).setEnabled((newTypeContainer != null) && (isValidName(newTypeContainer, newTypeNameText.getText())));
- }
- }
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2010 Atos Origin.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
+ *
+ * CEA LIST - Class Adaptation in SysML context, Content and Label provider replacement.
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.common.dialogs;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.ISpecializationType;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.infra.services.edit.commands.ConfigureFeatureCommandFactory;
+import org.eclipse.papyrus.infra.services.edit.commands.IConfigureCommandFactory;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.infra.widgets.editors.TreeSelectorDialog;
+import org.eclipse.papyrus.sysml.diagram.common.Activator;
+import org.eclipse.papyrus.sysml.diagram.common.messages.Messages;
+import org.eclipse.papyrus.uml.tools.providers.UMLLabelProvider;
+import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.FormDialog;
+import org.eclipse.ui.forms.IManagedForm;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.uml2.uml.Namespace;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * Dialog for initialization of Property type (the type is either selected or created).
+ */
+public class CreateOrSelectTypeDialog extends FormDialog {
+
+ protected Button creationRadio;
+
+ protected Button selectionRadio;
+
+ protected Text newTypeNameText;
+
+ protected Text newTypeContainerNameText;
+
+ protected Button newTypeContainerButton;
+
+ protected String newTypeName = null;
+
+ protected ICommand newTypeCreateCommand = null;
+
+ protected EObject newTypeContainer = null;
+
+ protected Text existingTypeNameText;
+
+ protected Button existingTypeButton;
+
+ protected EObject existingType = null;
+
+ protected EObject defaultContainer;
+
+ protected ILabelProvider labelProvider;
+
+ protected IElementType elementType;
+
+ protected EStructuralFeature editedFeature;
+
+ protected EClass elementEClass;
+
+ protected IElementType containerType;
+
+ protected EStructuralFeature containerFeature;
+
+ protected EClass containerEClass;
+
+ /**
+ * Create a new dialog to initialize an ActivityParameterNode.
+ *
+ * @param shell
+ * parent shell
+ * @param owner
+ * the activity that owns the action
+ */
+ public CreateOrSelectTypeDialog(Shell shell, EObject defaultContainer, IElementType elementType, EStructuralFeature editedFeature, EClass elementEClass, IElementType containerType, EStructuralFeature containerFeature, EClass containerEClass) {
+ super(shell);
+ this.defaultContainer = defaultContainer;
+ this.elementType = elementType;
+ this.editedFeature = editedFeature;
+ this.elementEClass = elementEClass;
+ this.containerType = containerType;
+ this.containerFeature = containerFeature;
+ this.containerEClass = containerEClass;
+ this.labelProvider = new UMLLabelProvider();
+ }
+
+ protected String getDialogTitle() {
+ return Messages.CreateOrSelectTypeDialog_DialogTitle;
+ }
+
+ protected String getSelectionSectionTitle() {
+ return Messages.CreateOrSelectTypeDialog_SelectionSectionTitle;
+ }
+
+ protected String getSelectionSectionRadioLabel() {
+ return Messages.CreateOrSelectTypeDialog_SelectionSectionRadioLabel;
+ }
+
+ protected String getCreationSectionTitle() {
+ return Messages.CreateOrSelectTypeDialog_CreationSectionTitle;
+ }
+
+ protected String getCreationSectionRadioLabel() {
+ return Messages.CreateOrSelectTypeDialog_CreationSectionRadioLabel;
+ }
+
+ protected String getNewTypeNameLabel() {
+ return Messages.CreateOrSelectTypeDialog_NewTypeNameLabel;
+ }
+
+ protected String getNewTypeContainerNameLabel() {
+ return Messages.CreateOrSelectTypeDialog_NewTypeContainerNameLabel;
+ }
+
+ protected String getNewTypeContainerDialogTitle() {
+ return Messages.CreateOrSelectTypeDialog_SelectNewTypeContainerDialogTitle;
+ }
+
+ protected String getNewTypeContainerDialogMessage() {
+ return Messages.CreateOrSelectTypeDialog_SelectNewTypeContainerDialogMessage;
+ }
+
+ protected String getTypeDialogTitle() {
+ return Messages.CreateOrSelectTypeDialog_SelectTypeDialogTitle;
+ }
+
+ protected String getTypeDialogMessage() {
+ return Messages.CreateOrSelectTypeDialog_SelectTypeDialogMessage;
+ }
+
+ /**
+ * Create the form to :
+ *
+ * - ask the user to choose or create an existing element.
+ *
+ * @see org.eclipse.ui.forms.FormDialog#createFormContent(org.eclipse.ui.forms.IManagedForm)
+ */
+ @Override
+ protected void createFormContent(IManagedForm pForm) {
+ pForm.getForm().setText(getDialogTitle());
+ ScrolledForm scrolledForm = pForm.getForm();
+ FormToolkit toolkit = pForm.getToolkit();
+ Composite parent = scrolledForm.getBody();
+ parent.setLayout(new GridLayout());
+
+ createFormCreationSection(scrolledForm.getBody(), toolkit);
+ createFormSelectionSection(scrolledForm.getBody(), toolkit);
+
+ refreshSectionsEnable(false);
+ hookListeners();
+ // invoked name is set after listeners, since we count on listener to update it properly
+ setNewTypeContainer(defaultContainer);
+ setNewTypeName(null);
+
+ scrolledForm.reflow(true);
+ }
+
+ /**
+ * Adds buttons to this dialog's button bar.
+ *
+ * @param parent
+ * the button bar composite
+ */
+ @Override
+ protected void createButtonsForButtonBar(Composite parent) {
+ super.createButtonsForButtonBar(parent);
+ refreshOkButton();
+ }
+
+ /**
+ * Create the section to ask the user to choose an existing element.
+ *
+ * @param pParent
+ * the section's parent widget
+ * @param pToolkit
+ * the form toolkit
+ */
+ protected void createFormSelectionSection(Composite pParent, FormToolkit pToolkit) {
+ // create the section
+ String lSectionTitle = getSelectionSectionTitle();
+ Section lSection = pToolkit.createSection(pParent, Section.EXPANDED | Section.TITLE_BAR);
+ lSection.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ if(lSectionTitle != null) {
+ lSection.setText(lSectionTitle);
+ }
+
+ ScrolledForm lInsideScrolledForm = pToolkit.createScrolledForm(lSection);
+ lInsideScrolledForm.setExpandHorizontal(true);
+ lInsideScrolledForm.setExpandVertical(true);
+ Composite lBody = lInsideScrolledForm.getBody();
+
+ GridLayout lLayout = new GridLayout();
+ lLayout.numColumns = 3;
+ lBody.setLayout(lLayout);
+
+ // content of the section
+ selectionRadio = pToolkit.createButton(lBody, getSelectionSectionRadioLabel(), SWT.RADIO);
+ selectionRadio.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1));
+
+ // manage elementType selection
+ pToolkit.createLabel(lBody, elementType.getDisplayName(), SWT.NONE);
+ existingTypeNameText = pToolkit.createText(lBody, "", SWT.BORDER | SWT.READ_ONLY);
+ existingTypeNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ existingTypeButton = pToolkit.createButton(lBody, "...", SWT.FLAT);
+
+ Image image = Activator.getInstance().getImage(elementType.getEClass());
+ if(elementEClass != null) {
+ image = Activator.getInstance().getImage(elementEClass);
+ }
+
+ existingTypeButton.setImage(image);
+ existingTypeButton.setLayoutData(new GridData(SWT.NONE));
+
+ lInsideScrolledForm.reflow(true);
+ lSection.setClient(lInsideScrolledForm);
+ }
+
+ /**
+ * Create the section to ask the user to create an invoked element.
+ *
+ * @param pParent
+ * the section's parent widget
+ * @param pToolkit
+ * the form toolkit
+ */
+ protected void createFormCreationSection(Composite pParent, FormToolkit pToolkit) {
+ // create the section
+ String lSectionTitle = getCreationSectionTitle();
+ Section lSection = pToolkit.createSection(pParent, Section.EXPANDED | Section.TITLE_BAR);
+ lSection.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ if(lSectionTitle != null) {
+ lSection.setText(lSectionTitle);
+ }
+
+ ScrolledForm lInsideScrolledForm = pToolkit.createScrolledForm(lSection);
+ lInsideScrolledForm.setExpandHorizontal(true);
+ lInsideScrolledForm.setExpandVertical(true);
+ Composite lBody = lInsideScrolledForm.getBody();
+
+ GridLayout lLayout = new GridLayout();
+ lLayout.numColumns = 3;
+ lBody.setLayout(lLayout);
+
+ // content of the section
+ creationRadio = pToolkit.createButton(lBody, getCreationSectionRadioLabel(), SWT.RADIO);
+ creationRadio.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1));
+
+ pToolkit.createLabel(lBody, getNewTypeNameLabel(), SWT.NONE);
+ newTypeNameText = pToolkit.createText(lBody, "", SWT.BORDER);
+ newTypeNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
+ newTypeNameText.setFocus();
+
+ // manage type selection
+ pToolkit.createLabel(lBody, getNewTypeContainerNameLabel(), SWT.NONE);
+ newTypeContainerNameText = pToolkit.createText(lBody, labelProvider.getText(newTypeContainer), SWT.BORDER | SWT.READ_ONLY);
+ newTypeContainerNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ newTypeContainerButton = pToolkit.createButton(lBody, "...", SWT.FLAT);
+ Image image = Activator.getInstance().getImage(containerType.getEClass());
+ if(containerEClass != null) {
+ image = Activator.getInstance().getImage(containerEClass);
+ }
+ newTypeContainerButton.setImage(image);
+ newTypeContainerButton.setLayoutData(new GridData(SWT.NONE));
+
+ lInsideScrolledForm.reflow(true);
+ lSection.setClient(lInsideScrolledForm);
+ }
+
+
+ @Override
+ protected void okPressed() {
+
+ // Build type creation command if needed
+ boolean isSelectionMode = selectionRadio.getSelection();
+ if(!isSelectionMode) {
+ // Creation mode - Prepare type creation command and set existing type to null.
+ existingType = null;
+ buildNewTypeCreateCommand();
+
+ } else {
+ // Selection mode - Set the type creation command to null.
+ newTypeCreateCommand = null;
+ }
+
+ super.okPressed();
+ }
+
+ protected void buildNewTypeCreateCommand() {
+ // The new element is expected to be a NamedElement.
+ IElementEditService commandService = ElementEditServiceUtils.getCommandProvider(newTypeContainer);
+ if(commandService != null) {
+ CreateElementRequest createTypeRequest = new CreateElementRequest(newTypeContainer, elementType);
+ createTypeRequest.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new ConfigureFeatureCommandFactory(UMLPackage.eINSTANCE.getNamedElement_Name(), newTypeNameText.getText()));
+ newTypeCreateCommand = commandService.getEditCommand(createTypeRequest);
+ }
+ }
+
+ public ICommand getNewTypeCreateCommand() {
+ return newTypeCreateCommand;
+ }
+
+ public String getNewTypeName() {
+ return newTypeNameText.getText();
+ }
+
+ public EObject getExistingType() {
+ return existingType;
+ }
+
+ /**
+ * Add listeners to widgets
+ */
+ protected void hookListeners() {
+ // listener to choose active section
+ SelectionListener selectCreateListener = new SelectionAdapter() {
+
+ /**
+ * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if(creationRadio.equals(e.getSource())) {
+ refreshSectionsEnable(false);
+ } else {
+ refreshSectionsEnable(true);
+ }
+ refreshOkButton();
+ }
+ };
+ selectionRadio.addSelectionListener(selectCreateListener);
+ creationRadio.addSelectionListener(selectCreateListener);
+
+ // listener to select existing element
+ SelectionListener selectBtnListener = new SelectionAdapter() {
+
+ /**
+ * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ handleChooseType();
+ refreshOkButton();
+ }
+ };
+ existingTypeButton.addSelectionListener(selectBtnListener);
+
+ // listener to existing element name
+ ModifyListener lNameListener = new ModifyListener() {
+
+ /**
+ * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
+ */
+ public void modifyText(ModifyEvent e) {
+ setNewTypeName(existingTypeNameText.getText());
+ }
+ };
+ existingTypeNameText.addModifyListener(lNameListener);
+
+ // listener to select new element type container
+ SelectionListener selectTypeBtnListener = new SelectionAdapter() {
+
+ /**
+ * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ handleChooseNewTypeContainer();
+ // reset name if not set
+ if(newTypeName == null) {
+ setNewTypeName(null);
+ }
+ refreshOkButton();
+ }
+ };
+ newTypeContainerButton.addSelectionListener(selectTypeBtnListener);
+
+ // listener to new element name
+ ModifyListener lNewNameListener = new ModifyListener() {
+
+ /**
+ * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
+ */
+ public void modifyText(ModifyEvent e) {
+ validateNewTypeName();
+ refreshOkButton();
+ }
+ };
+ newTypeNameText.addModifyListener(lNewNameListener);
+ }
+
+ /**
+ * Set the name of the new type
+ *
+ * @param text
+ * the text string or null for auto-initialization
+ */
+ protected void setNewTypeName(String text) {
+ String name = text;
+ if(text == null) {
+ name = NamedElementUtil.getDefaultNameWithIncrementFromBase(elementType.getEClass().getName(), newTypeContainer.eContents());
+ if(elementEClass != null) {
+ name = NamedElementUtil.getDefaultNameWithIncrementFromBase(elementEClass.getName(), newTypeContainer.eContents());
+ }
+ newTypeNameText.setText(name);
+
+ } else {
+ newTypeNameText.setText(name);
+ newTypeName = name;
+ }
+
+ validateNewTypeName();
+ refreshOkButton();
+ }
+
+ protected void validateNewTypeName() {
+ if(isValidName(newTypeContainer, newTypeNameText.getText())) {
+ Color black = newTypeNameText.getDisplay().getSystemColor(SWT.COLOR_BLACK);
+ newTypeNameText.setForeground(black);
+
+ } else {
+ Color red = newTypeNameText.getDisplay().getSystemColor(SWT.COLOR_RED);
+ newTypeNameText.setForeground(red);
+ }
+ }
+
+ protected boolean isValidName(EObject container, String newName) {
+ boolean isValid = true;
+ if(container instanceof Namespace) {
+ if(((Namespace)container).getOwnedMember(newName) != null) {
+ isValid = false;
+ }
+ }
+
+ return isValid;
+ }
+
+ /** Open the dialog to choose an existing type */
+ protected void handleChooseType() {
+
+ TreeSelectorDialog dialog = new TreeSelectorDialog(getShell());
+
+ dialog.setMessage(getTypeDialogMessage());
+ dialog.setTitle(getTypeDialogTitle());
+ dialog.setInput(EcoreUtil.getRootContainer(defaultContainer));
+
+ ServiceEditContentProvider provider = new ServiceEditContentProvider(elementType, editedFeature, EcoreUtil.getRootContainer(defaultContainer));
+ dialog.setContentProvider(provider);
+ dialog.setLabelProvider(labelProvider);
+
+ if(dialog.open() == Window.OK) {
+ Object result = dialog.getResult()[0];
+ if(result instanceof IAdaptable) {
+ result = ((IAdaptable)result).getAdapter(EObject.class);
+ }
+
+ if(result instanceof EObject) {
+ setExistingTypeSelection((EObject)result);
+ } else {
+ setExistingTypeSelection(null);
+ }
+ }
+ }
+
+ /**
+ * Set the existing type selected (if selection mode is chosen)
+ *
+ * @param invokedElement
+ * the selected element
+ */
+ protected void setExistingTypeSelection(EObject type) {
+ if(type == null) {
+ existingTypeNameText.setText("");
+ } else {
+ existingType = type;
+ existingTypeNameText.setText(labelProvider.getText(existingType));
+ }
+ }
+
+ /** Open the dialog to choose new type container */
+ protected void handleChooseNewTypeContainer() {
+
+ TreeSelectorDialog dialog = new TreeSelectorDialog(getShell());
+
+ dialog.setMessage(getNewTypeContainerDialogMessage());
+ dialog.setTitle(getNewTypeContainerDialogTitle());
+ dialog.setInput(EcoreUtil.getRootContainer(defaultContainer));
+
+ ServiceEditContentProvider provider = new ServiceEditContentProvider(containerType, containerFeature, EcoreUtil.getRootContainer(defaultContainer));
+ dialog.setContentProvider(provider);
+ dialog.setLabelProvider(labelProvider);
+
+ if(dialog.open() == Window.OK) {
+ Object result = dialog.getResult()[0];
+ if(result instanceof IAdaptable) {
+ result = ((IAdaptable)result).getAdapter(EObject.class);
+ }
+
+ if(result instanceof EObject) {
+ setNewTypeContainer((EObject)result);
+ } else {
+ setNewTypeContainer(null);
+ }
+ }
+ }
+
+ /**
+ * Define the type of the object that will be created (if creation mode is chosen)
+ *
+ * @param the
+ * selected parent
+ */
+ protected void setNewTypeContainer(EObject container) {
+
+ if((containerType instanceof ISpecializationType) && ((ISpecializationType)containerType).getMatcher().matches(container)) {
+ newTypeContainer = container;
+ newTypeContainerNameText.setText(labelProvider.getText(newTypeContainer));
+
+ } else if(containerType.getEClass().isInstance(container)) {
+ newTypeContainer = container;
+ newTypeContainerNameText.setText(labelProvider.getText(newTypeContainer));
+
+ } else {
+ newTypeContainer = null;
+ newTypeContainerNameText.setText("");
+ }
+ }
+
+ /**
+ * Refresh the enabled and disabled elements in various sections
+ *
+ * @param isSelectionSelected
+ * true if we choose to select an existing element, false if we choose to create an element
+ */
+ private void refreshSectionsEnable(boolean isSelectionSelected) {
+ // handle radio button value
+ if(isSelectionSelected) {
+ creationRadio.setSelection(false);
+ if(!selectionRadio.getSelection()) {
+ selectionRadio.setSelection(true);
+ }
+ } else {
+ selectionRadio.setSelection(false);
+ if(!creationRadio.getSelection()) {
+ creationRadio.setSelection(true);
+ }
+ }
+ // handle disabled section
+ existingTypeNameText.setEnabled(isSelectionSelected);
+ existingTypeButton.setEnabled(isSelectionSelected);
+ newTypeNameText.setEnabled(!isSelectionSelected);
+ newTypeNameText.setFocus();
+ newTypeContainerNameText.setEnabled(!isSelectionSelected);
+ newTypeContainerButton.setEnabled(!isSelectionSelected);
+ }
+
+
+ /** Refresh the OK button activation */
+ protected void refreshOkButton() {
+ boolean isSelectionSelected = selectionRadio.getSelection();
+ if(getButton(IDialogConstants.OK_ID) != null && !getButton(IDialogConstants.OK_ID).isDisposed()) {
+ if(isSelectionSelected) {
+ getButton(IDialogConstants.OK_ID).setEnabled(existingType != null);
+ } else {
+ getButton(IDialogConstants.OK_ID).setEnabled((newTypeContainer != null) && (isValidName(newTypeContainer, newTypeNameText.getText())));
+ }
+ }
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectValuePropertyTypeDialog.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectValuePropertyTypeDialog.java
index 5929dce3207..de014aa97a1 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectValuePropertyTypeDialog.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectValuePropertyTypeDialog.java
@@ -1,284 +1,284 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.common.dialogs;
-
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.jface.viewers.ComboViewer;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.papyrus.gmf.diagram.common.provider.ElementTypeLabelProvider;
-import org.eclipse.papyrus.infra.services.edit.commands.ConfigureFeatureCommandFactory;
-import org.eclipse.papyrus.infra.services.edit.commands.IConfigureCommandFactory;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-import org.eclipse.papyrus.sysml.blocks.BlocksPackage;
-import org.eclipse.papyrus.sysml.diagram.common.Activator;
-import org.eclipse.papyrus.sysml.diagram.common.messages.Messages;
-import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes;
-import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes;
-import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.ScrolledForm;
-import org.eclipse.ui.forms.widgets.Section;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * Dialog for initialization of Value (Property) type (the type is either selected or created).
- */
-public class CreateOrSelectValuePropertyTypeDialog extends CreateOrSelectTypeDialog {
-
- protected ComboViewer newTypeKindComboViewer = null;
-
- protected Combo newTypeKindCombo = null;
-
- protected IElementType[] valueTypeKind = { UMLElementTypes.DATA_TYPE, SysMLElementTypes.VALUE_TYPE, UMLElementTypes.PRIMITIVE_TYPE, UMLElementTypes.ENUMERATION };
-
- protected IElementType newTypeKind = UMLElementTypes.DATA_TYPE;
-
- /** Constructor */
- public CreateOrSelectValuePropertyTypeDialog(Shell shell, NamedElement owner) {
- super(shell, owner, UMLElementTypes.DATA_TYPE, UMLPackage.eINSTANCE.getTypedElement_Type(), null, UMLElementTypes.PACKAGE, UMLPackage.eINSTANCE.getPackage_PackagedElement(), null);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void createFormCreationSection(Composite pParent, FormToolkit pToolkit) {
- // create the section
- String lSectionTitle = getCreationSectionTitle();
- Section lSection = pToolkit.createSection(pParent, Section.EXPANDED | Section.TITLE_BAR);
- lSection.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- if(lSectionTitle != null) {
- lSection.setText(lSectionTitle);
- }
-
- ScrolledForm lInsideScrolledForm = pToolkit.createScrolledForm(lSection);
- lInsideScrolledForm.setExpandHorizontal(true);
- lInsideScrolledForm.setExpandVertical(true);
- Composite lBody = lInsideScrolledForm.getBody();
-
- GridLayout lLayout = new GridLayout();
- lLayout.numColumns = 3;
- lBody.setLayout(lLayout);
-
- // content of the section
- creationRadio = pToolkit.createButton(lBody, getCreationSectionRadioLabel(), SWT.RADIO);
- creationRadio.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1));
-
- pToolkit.createLabel(lBody, getNewTypeNameLabel(), SWT.NONE);
- newTypeNameText = pToolkit.createText(lBody, "", SWT.BORDER);
- newTypeNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
- newTypeNameText.setFocus();
-
- // manage type selection
- pToolkit.createLabel(lBody, getNewTypeContainerNameLabel(), SWT.NONE);
- newTypeContainerNameText = pToolkit.createText(lBody, labelProvider.getText(newTypeContainer), SWT.BORDER | SWT.READ_ONLY);
- newTypeContainerNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- newTypeContainerButton = pToolkit.createButton(lBody, "...", SWT.FLAT);
- Image image = Activator.getInstance().getImage(containerType.getEClass());
- if(containerEClass != null) {
- image = Activator.getInstance().getImage(containerEClass);
- }
- newTypeContainerButton.setImage(image);
- newTypeContainerButton.setLayoutData(new GridData(SWT.NONE));
-
- pToolkit.createLabel(lBody, getNewTypeKindLabel(), SWT.NONE);
- newTypeKindCombo = new Combo(lBody, SWT.DROP_DOWN | SWT.READ_ONLY);
- newTypeKindComboViewer = new ComboViewer(newTypeKindCombo);
- pToolkit.adapt(newTypeKindCombo);
- newTypeKindCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
- newTypeKindComboViewer.setLabelProvider(new ElementTypeLabelProvider());
- newTypeKindComboViewer.add(valueTypeKind);
- newTypeKindComboViewer.setSelection(new StructuredSelection(valueTypeKind[0]));
-
- lInsideScrolledForm.reflow(true);
- lSection.setClient(lInsideScrolledForm);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void buildNewTypeCreateCommand() {
- // The new element is expected to be a NamedElement.
- IElementEditService commandService = ElementEditServiceUtils.getCommandProvider(newTypeContainer);
- if(commandService != null) {
- CreateElementRequest createTypeRequest = new CreateElementRequest(newTypeContainer, newTypeKind);
- createTypeRequest.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new ConfigureFeatureCommandFactory(UMLPackage.eINSTANCE.getNamedElement_Name(), newTypeNameText.getText()));
- newTypeCreateCommand = commandService.getEditCommand(createTypeRequest);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void hookListeners() {
- super.hookListeners();
-
- // listener to select invocation type
- ModifyListener newTypeKindListener = new ModifyListener() {
-
- /**
- * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
- */
- public void modifyText(ModifyEvent e) {
- ISelection sel = newTypeKindComboViewer.getSelection();
- if(sel instanceof StructuredSelection) {
- Object type = ((StructuredSelection)sel).getFirstElement();
- if(type instanceof IElementType) {
- newTypeKind = (IElementType)type;
- } else {
- newTypeKind = null;
- }
-
- // reset name
- setNewTypeName(null);
- }
- }
- };
- newTypeKindCombo.addModifyListener(newTypeKindListener);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void setNewTypeName(String text) {
- String name = text;
- if(text == null) {
- name = NamedElementUtil.getDefaultNameWithIncrementFromBase(newTypeKind.getEClass().getName(), newTypeContainer.eContents());
- if(newTypeKind == SysMLElementTypes.VALUE_TYPE) {
- name = NamedElementUtil.getDefaultNameWithIncrementFromBase(BlocksPackage.eINSTANCE.getValueType().getName(), newTypeContainer.eContents());
- }
- newTypeNameText.setText(name);
-
- } else {
- newTypeNameText.setText(name);
- newTypeName = name;
- }
-
- validateNewTypeName();
- refreshOkButton();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getDialogTitle() {
- return Messages.CreateOrSelectValuePropertyTypeDialog_DialogTitle;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getSelectionSectionTitle() {
- return Messages.CreateOrSelectValuePropertyTypeDialog_SelectionSectionTitle;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getSelectionSectionRadioLabel() {
- return Messages.CreateOrSelectValuePropertyTypeDialog_SelectionSectionRadioLabel;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getCreationSectionTitle() {
- return Messages.CreateOrSelectValuePropertyTypeDialog_CreationSectionTitle;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getCreationSectionRadioLabel() {
- return Messages.CreateOrSelectValuePropertyTypeDialog_CreationSectionRadioLabel;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getNewTypeNameLabel() {
- return Messages.CreateOrSelectValuePropertyTypeDialog_NewTypeNameLabel;
- }
-
- /**
- * Get the newTypeKind label.
- *
- * @return the label
- */
- protected String getNewTypeKindLabel() {
- return Messages.CreateOrSelectValuePropertyTypeDialog_NewTypeKindLabel;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getNewTypeContainerNameLabel() {
- return Messages.CreateOrSelectValuePropertyTypeDialog_NewTypeContainerNameLabel;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getNewTypeContainerDialogTitle() {
- return Messages.CreateOrSelectValuePropertyTypeDialog_SelectNewTypeContainerDialogTitle;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getNewTypeContainerDialogMessage() {
- return Messages.CreateOrSelectValuePropertyTypeDialog_SelectNewTypeContainerDialogMessage;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getTypeDialogTitle() {
- return Messages.CreateOrSelectValuePropertyTypeDialog_SelectTypeDialogTitle;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getTypeDialogMessage() {
- return Messages.CreateOrSelectValuePropertyTypeDialog_SelectTypeDialogMessage;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.common.dialogs;
+
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.jface.viewers.ComboViewer;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.papyrus.gmf.diagram.common.provider.ElementTypeLabelProvider;
+import org.eclipse.papyrus.infra.services.edit.commands.ConfigureFeatureCommandFactory;
+import org.eclipse.papyrus.infra.services.edit.commands.IConfigureCommandFactory;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.sysml.blocks.BlocksPackage;
+import org.eclipse.papyrus.sysml.diagram.common.Activator;
+import org.eclipse.papyrus.sysml.diagram.common.messages.Messages;
+import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes;
+import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes;
+import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * Dialog for initialization of Value (Property) type (the type is either selected or created).
+ */
+public class CreateOrSelectValuePropertyTypeDialog extends CreateOrSelectTypeDialog {
+
+ protected ComboViewer newTypeKindComboViewer = null;
+
+ protected Combo newTypeKindCombo = null;
+
+ protected IElementType[] valueTypeKind = { UMLElementTypes.DATA_TYPE, SysMLElementTypes.VALUE_TYPE, UMLElementTypes.PRIMITIVE_TYPE, UMLElementTypes.ENUMERATION };
+
+ protected IElementType newTypeKind = UMLElementTypes.DATA_TYPE;
+
+ /** Constructor */
+ public CreateOrSelectValuePropertyTypeDialog(Shell shell, NamedElement owner) {
+ super(shell, owner, UMLElementTypes.DATA_TYPE, UMLPackage.eINSTANCE.getTypedElement_Type(), null, UMLElementTypes.PACKAGE, UMLPackage.eINSTANCE.getPackage_PackagedElement(), null);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void createFormCreationSection(Composite pParent, FormToolkit pToolkit) {
+ // create the section
+ String lSectionTitle = getCreationSectionTitle();
+ Section lSection = pToolkit.createSection(pParent, Section.EXPANDED | Section.TITLE_BAR);
+ lSection.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ if(lSectionTitle != null) {
+ lSection.setText(lSectionTitle);
+ }
+
+ ScrolledForm lInsideScrolledForm = pToolkit.createScrolledForm(lSection);
+ lInsideScrolledForm.setExpandHorizontal(true);
+ lInsideScrolledForm.setExpandVertical(true);
+ Composite lBody = lInsideScrolledForm.getBody();
+
+ GridLayout lLayout = new GridLayout();
+ lLayout.numColumns = 3;
+ lBody.setLayout(lLayout);
+
+ // content of the section
+ creationRadio = pToolkit.createButton(lBody, getCreationSectionRadioLabel(), SWT.RADIO);
+ creationRadio.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1));
+
+ pToolkit.createLabel(lBody, getNewTypeNameLabel(), SWT.NONE);
+ newTypeNameText = pToolkit.createText(lBody, "", SWT.BORDER);
+ newTypeNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
+ newTypeNameText.setFocus();
+
+ // manage type selection
+ pToolkit.createLabel(lBody, getNewTypeContainerNameLabel(), SWT.NONE);
+ newTypeContainerNameText = pToolkit.createText(lBody, labelProvider.getText(newTypeContainer), SWT.BORDER | SWT.READ_ONLY);
+ newTypeContainerNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ newTypeContainerButton = pToolkit.createButton(lBody, "...", SWT.FLAT);
+ Image image = Activator.getInstance().getImage(containerType.getEClass());
+ if(containerEClass != null) {
+ image = Activator.getInstance().getImage(containerEClass);
+ }
+ newTypeContainerButton.setImage(image);
+ newTypeContainerButton.setLayoutData(new GridData(SWT.NONE));
+
+ pToolkit.createLabel(lBody, getNewTypeKindLabel(), SWT.NONE);
+ newTypeKindCombo = new Combo(lBody, SWT.DROP_DOWN | SWT.READ_ONLY);
+ newTypeKindComboViewer = new ComboViewer(newTypeKindCombo);
+ pToolkit.adapt(newTypeKindCombo);
+ newTypeKindCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
+ newTypeKindComboViewer.setLabelProvider(new ElementTypeLabelProvider());
+ newTypeKindComboViewer.add(valueTypeKind);
+ newTypeKindComboViewer.setSelection(new StructuredSelection(valueTypeKind[0]));
+
+ lInsideScrolledForm.reflow(true);
+ lSection.setClient(lInsideScrolledForm);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void buildNewTypeCreateCommand() {
+ // The new element is expected to be a NamedElement.
+ IElementEditService commandService = ElementEditServiceUtils.getCommandProvider(newTypeContainer);
+ if(commandService != null) {
+ CreateElementRequest createTypeRequest = new CreateElementRequest(newTypeContainer, newTypeKind);
+ createTypeRequest.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new ConfigureFeatureCommandFactory(UMLPackage.eINSTANCE.getNamedElement_Name(), newTypeNameText.getText()));
+ newTypeCreateCommand = commandService.getEditCommand(createTypeRequest);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void hookListeners() {
+ super.hookListeners();
+
+ // listener to select invocation type
+ ModifyListener newTypeKindListener = new ModifyListener() {
+
+ /**
+ * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
+ */
+ public void modifyText(ModifyEvent e) {
+ ISelection sel = newTypeKindComboViewer.getSelection();
+ if(sel instanceof StructuredSelection) {
+ Object type = ((StructuredSelection)sel).getFirstElement();
+ if(type instanceof IElementType) {
+ newTypeKind = (IElementType)type;
+ } else {
+ newTypeKind = null;
+ }
+
+ // reset name
+ setNewTypeName(null);
+ }
+ }
+ };
+ newTypeKindCombo.addModifyListener(newTypeKindListener);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void setNewTypeName(String text) {
+ String name = text;
+ if(text == null) {
+ name = NamedElementUtil.getDefaultNameWithIncrementFromBase(newTypeKind.getEClass().getName(), newTypeContainer.eContents());
+ if(newTypeKind == SysMLElementTypes.VALUE_TYPE) {
+ name = NamedElementUtil.getDefaultNameWithIncrementFromBase(BlocksPackage.eINSTANCE.getValueType().getName(), newTypeContainer.eContents());
+ }
+ newTypeNameText.setText(name);
+
+ } else {
+ newTypeNameText.setText(name);
+ newTypeName = name;
+ }
+
+ validateNewTypeName();
+ refreshOkButton();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getDialogTitle() {
+ return Messages.CreateOrSelectValuePropertyTypeDialog_DialogTitle;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getSelectionSectionTitle() {
+ return Messages.CreateOrSelectValuePropertyTypeDialog_SelectionSectionTitle;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getSelectionSectionRadioLabel() {
+ return Messages.CreateOrSelectValuePropertyTypeDialog_SelectionSectionRadioLabel;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getCreationSectionTitle() {
+ return Messages.CreateOrSelectValuePropertyTypeDialog_CreationSectionTitle;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getCreationSectionRadioLabel() {
+ return Messages.CreateOrSelectValuePropertyTypeDialog_CreationSectionRadioLabel;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getNewTypeNameLabel() {
+ return Messages.CreateOrSelectValuePropertyTypeDialog_NewTypeNameLabel;
+ }
+
+ /**
+ * Get the newTypeKind label.
+ *
+ * @return the label
+ */
+ protected String getNewTypeKindLabel() {
+ return Messages.CreateOrSelectValuePropertyTypeDialog_NewTypeKindLabel;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getNewTypeContainerNameLabel() {
+ return Messages.CreateOrSelectValuePropertyTypeDialog_NewTypeContainerNameLabel;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getNewTypeContainerDialogTitle() {
+ return Messages.CreateOrSelectValuePropertyTypeDialog_SelectNewTypeContainerDialogTitle;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getNewTypeContainerDialogMessage() {
+ return Messages.CreateOrSelectValuePropertyTypeDialog_SelectNewTypeContainerDialogMessage;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getTypeDialogTitle() {
+ return Messages.CreateOrSelectValuePropertyTypeDialog_SelectTypeDialogTitle;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getTypeDialogMessage() {
+ return Messages.CreateOrSelectValuePropertyTypeDialog_SelectTypeDialogMessage;
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/ServiceEditContentProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/ServiceEditContentProvider.java
index 732de5fe9fd..a7df7258007 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/ServiceEditContentProvider.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/ServiceEditContentProvider.java
@@ -1,42 +1,42 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.common.dialogs;
-
-import java.util.Collections;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.papyrus.infra.services.edit.utils.ElementTypeValidator;
-import org.eclipse.papyrus.uml.tools.providers.SemanticUMLContentProvider;
-
-/**
- * A content provider that takes into account the nature of the searched element
- * (org.eclipse.papyrus.uml.tools.providers.ServiceEditFilteredContentProvider).
- */
-public class ServiceEditContentProvider extends SemanticUMLContentProvider {
-
- private ElementTypeValidator validator;
-
- public ServiceEditContentProvider(IElementType elementType, EStructuralFeature feature, EObject semanticRoot) {
- super(semanticRoot.eResource().getResourceSet());
- setWantedMetaclasses(Collections.singletonList(feature.getEType()));
- validator = new ElementTypeValidator(elementType);
- }
-
- @Override
- public boolean isValidValue(Object element) {
- return super.isValidValue(element) && validator.validate(new Object[]{ getAdaptedValue(element) }).isOK();
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.common.dialogs;
+
+import java.util.Collections;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.papyrus.infra.services.edit.utils.ElementTypeValidator;
+import org.eclipse.papyrus.uml.tools.providers.SemanticUMLContentProvider;
+
+/**
+ * A content provider that takes into account the nature of the searched element
+ * (org.eclipse.papyrus.uml.tools.providers.ServiceEditFilteredContentProvider).
+ */
+public class ServiceEditContentProvider extends SemanticUMLContentProvider {
+
+ private ElementTypeValidator validator;
+
+ public ServiceEditContentProvider(IElementType elementType, EStructuralFeature feature, EObject semanticRoot) {
+ super(semanticRoot.eResource().getResourceSet());
+ setWantedMetaclasses(Collections.singletonList(feature.getEType()));
+ validator = new ElementTypeValidator(elementType);
+ }
+
+ @Override
+ public boolean isValidValue(Object element) {
+ return super.isValidValue(element) && validator.validate(new Object[]{ getAdaptedValue(element) }).isOK();
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/ConstraintBlockPropertyCompositeEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/ConstraintBlockPropertyCompositeEditPart.java
new file mode 100644
index 00000000000..a7521f85bf4
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/ConstraintBlockPropertyCompositeEditPart.java
@@ -0,0 +1,222 @@
+/*****************************************************************************
+ * Copyright (c) 2011-2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.common.edit.part;
+
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+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.NonResizableEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.gmf.diagram.common.figure.SelectableBorderedNodeFigure;
+import org.eclipse.papyrus.sysml.diagram.common.edit.policy.BlockPropertyCompositeSemanticEditPolicy;
+import org.eclipse.papyrus.sysml.diagram.common.figure.ConstraintBlockPropertyCompositeFigure;
+import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementEditPart;
+import org.eclipse.papyrus.uml.diagram.common.edit.part.ConstraintNodeLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.common.edit.part.ConstraintParameterAffixedNodeEditPart;
+import org.eclipse.papyrus.uml.diagram.common.edit.part.PortAffixedNodeEditPart;
+import org.eclipse.papyrus.uml.diagram.common.edit.part.PropertyNodeLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.common.edit.policy.EncapsulatedClassifierResizableShapeEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.edit.policy.StructuredClassifierCreationEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AffixedNodeAlignmentEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.BorderItemResizableEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideRelatedContentsEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.NodeNamedElementFigure;
+import org.eclipse.papyrus.uml.diagram.common.locator.ConstraintParameterPositionLocator;
+import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.UMLPackage;
+
+public class ConstraintBlockPropertyCompositeEditPart extends AbstractElementEditPart {
+
+ public ConstraintBlockPropertyCompositeEditPart(View view) {
+ super(view);
+ }
+
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new BlockPropertyCompositeSemanticEditPolicy());
+ installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy());
+ installEditPolicy(ShowHideRelatedContentsEditPolicy.SHOW_HIDE_RELATED_CONTENTS_POLICY, new ShowHideRelatedContentsEditPolicy());
+ installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
+ installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
+ installEditPolicy(AffixedNodeAlignmentEditPolicy.AFFIXED_CHILD_ALIGNMENT_ROLE, new AffixedNodeAlignmentEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new StructuredClassifierCreationEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new EncapsulatedClassifierResizableShapeEditPolicy());
+ }
+
+ @Override
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+ org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() {
+
+ @Override
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ if(child instanceof IBorderItemEditPart) {
+ return new BorderItemResizableEditPolicy();
+ }
+
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if(result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ @Override
+ protected boolean addFixedChild(EditPart childEditPart) {
+
+ if(childEditPart instanceof PropertyNodeLabelEditPart) {
+ ((PropertyNodeLabelEditPart)childEditPart).setLabel(getPrimaryShape().getNameLabel());
+ return true;
+ }
+ if(childEditPart instanceof ConstraintNodeLabelEditPart) {
+ ((ConstraintNodeLabelEditPart)childEditPart).setLabel((((ConstraintBlockPropertyCompositeFigure)getPrimaryShape()).getConstraintLabel()));
+ return true;
+ }
+
+ if(childEditPart instanceof ConstraintParameterAffixedNodeEditPart) {
+ IBorderItemLocator locator = new ConstraintParameterPositionLocator(getMainFigure(), PositionConstants.NONE);
+ getBorderedFigure().getBorderItemContainer().add(((ConstraintParameterAffixedNodeEditPart)childEditPart).getFigure(), locator);
+ return true;
+ }
+
+ return false;
+ }
+
+ @Override
+ protected boolean removeFixedChild(EditPart childEditPart) {
+
+ if(childEditPart instanceof PropertyNodeLabelEditPart) {
+ return true;
+ }
+
+ if(childEditPart instanceof FlowPortAffixedNodeEditPart) {
+ getBorderedFigure().getBorderItemContainer().remove(((FlowPortAffixedNodeEditPart)childEditPart).getFigure());
+ return true;
+ }
+ if(childEditPart instanceof PortAffixedNodeEditPart) {
+ getBorderedFigure().getBorderItemContainer().remove(((PortAffixedNodeEditPart)childEditPart).getFigure());
+ return true;
+ }
+
+ return false;
+ }
+
+ @Override
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+ if(editPart instanceof IBorderItemEditPart) {
+ return getBorderedFigure().getBorderItemContainer();
+ }
+
+ return getContentPane();
+ }
+
+ @Override
+ protected NodeFigure createNodeFigure() {
+ return new SelectableBorderedNodeFigure(createMainFigure());
+ }
+
+ @Override
+ protected IFigure createNodeShape() {
+ primaryShape = new ConstraintBlockPropertyCompositeFigure();
+ return primaryShape;
+ }
+
+
+ @Override
+ public NodeNamedElementFigure getPrimaryShape() {
+ return (NodeNamedElementFigure)primaryShape;
+ }
+
+ @Override
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLGraphicalTypes.LABEL_UML_PROPERTY_LABEL_ID);
+ }
+
+ @SuppressWarnings("rawtypes")
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ List children = getChildren();
+ for (Object editPart : children) {
+ if (editPart instanceof EditPart) {
+ ((EditPart) editPart).refresh();
+ }
+ }
+ }
+
+ /**
+ * <pre>
+ *
+ * {@inheritDoc}
+ * </pre>
+ */
+ @Override
+ protected void handleNotificationEvent(Notification event) {
+
+ // A visual refresh may also be needed when the following properties are changing : aggregation, type, or the related association.
+ if(resolveSemanticElement() != null) {
+ EObject element = resolveSemanticElement();
+
+ if((element != null) && (element.equals(event.getNotifier())) && (element instanceof Property)) {
+
+ if(UMLPackage.eINSTANCE.getProperty_Aggregation().equals(event.getFeature())) {
+ refreshVisuals();
+ }
+
+ if(UMLPackage.eINSTANCE.getTypedElement_Type().equals(event.getFeature())) {
+ refreshVisuals();
+ }
+
+ if(UMLPackage.eINSTANCE.getProperty_Association().equals(event.getFeature())) {
+ refreshVisuals();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ refresh();
+ }
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/ConstraintPropertyChildLabelEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/ConstraintPropertyChildLabelEditPart.java
index e7f665932c1..5200ba8e85f 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/ConstraintPropertyChildLabelEditPart.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/ConstraintPropertyChildLabelEditPart.java
@@ -1,56 +1,56 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.common.edit.part;
-
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementChildLabelEditPart;
-
-/**
- * Edit part for {@link ConstraintProperty} used as Child label node.
- */
-public class ConstraintPropertyChildLabelEditPart extends AbstractElementChildLabelEditPart {
-
- /** Constructor */
- public ConstraintPropertyChildLabelEditPart(View view) {
- super(view);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- }
-
- // /**
- // * {@inheritDoc}
- // */
- // @Override
- // protected Image getLabelIcon() {
- // EObject parserElement = getParserElement();
- // if(parserElement == null) {
- // return null;
- // }
- //
- // List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer());
- // for(View view : views) {
- // if(NameLabelIconHelper.showLabelIcon(view)) {
- // return Activator.getInstance().getLabelProvider().getImage(parserElement);
- // }
- // }
- //
- // return null;
- // }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.common.edit.part;
+
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementChildLabelEditPart;
+
+/**
+ * Edit part for {@link ConstraintProperty} used as Child label node.
+ */
+public class ConstraintPropertyChildLabelEditPart extends AbstractElementChildLabelEditPart {
+
+ /** Constructor */
+ public ConstraintPropertyChildLabelEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ }
+
+ // /**
+ // * {@inheritDoc}
+ // */
+ // @Override
+ // protected Image getLabelIcon() {
+ // EObject parserElement = getParserElement();
+ // if(parserElement == null) {
+ // return null;
+ // }
+ //
+ // List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer());
+ // for(View view : views) {
+ // if(NameLabelIconHelper.showLabelIcon(view)) {
+ // return Activator.getInstance().getLabelProvider().getImage(parserElement);
+ // }
+ // }
+ //
+ // return null;
+ // }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/FlowPortAffixedLabelNameEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/FlowPortAffixedLabelNameEditPart.java
index 1fe6aafd21f..4b1bfeaffc7 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/FlowPortAffixedLabelNameEditPart.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/FlowPortAffixedLabelNameEditPart.java
@@ -1,129 +1,129 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.common.edit.part;
-
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.papyrus.infra.emf.appearance.helper.NameLabelIconHelper;
-import org.eclipse.papyrus.sysml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusWrappingLabel;
-import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * This class implements a FlowPort affixed label edit part.
- */
-public class FlowPortAffixedLabelNameEditPart extends AbstractElementLabelEditPart implements IBorderItemEditPart {
-
- /** label provider for icons */
- private final ILabelProvider labelProvider;
-
- /** Constructor */
- public FlowPortAffixedLabelNameEditPart(View view) {
- super(view);
- addSnapBackLocation();
- labelProvider = Activator.getInstance().getLabelProvider();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- }
-
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if(parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator)constraint;
- }
- return null;
- }
-
- @Override
- public void refreshBounds() {
- int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
-
- // Update locator constraint
- IBorderItemLocator locator = getBorderItemLocator();
- locator.setConstraint(new Rectangle(x, y, width, height));
-
- // Set new constraint on parent figure
- getFigure().getParent().setConstraint(getFigure(), locator);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected Image getLabelIcon() {
- EObject parserElement = getParserElement();
- if(parserElement == null) {
- return null;
- }
-
- List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer());
- for(View view : views) {
- if(NameLabelIconHelper.showLabelIcon(view)) {
- return labelProvider.getImage(parserElement);
- }
- }
-
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected IFigure createFigure() {
- IFigure label = createFigurePrim();
- defaultText = getLabelTextHelper(label);
- return label;
- }
-
- protected IFigure createFigurePrim() {
- return new PapyrusWrappingLabel();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getLabelRole() {
- return "Label"; //$NON-NLS-1$
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getIconPathRole() {
- return ""; //$NON-NLS-1$
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.common.edit.part;
+
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.papyrus.infra.emf.appearance.helper.NameLabelIconHelper;
+import org.eclipse.papyrus.sysml.diagram.common.Activator;
+import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusWrappingLabel;
+import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * This class implements a FlowPort affixed label edit part.
+ */
+public class FlowPortAffixedLabelNameEditPart extends AbstractElementLabelEditPart implements IBorderItemEditPart {
+
+ /** label provider for icons */
+ private final ILabelProvider labelProvider;
+
+ /** Constructor */
+ public FlowPortAffixedLabelNameEditPart(View view) {
+ super(view);
+ addSnapBackLocation();
+ labelProvider = Activator.getInstance().getLabelProvider();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ }
+
+ public IBorderItemLocator getBorderItemLocator() {
+ IFigure parentFigure = getFigure().getParent();
+ if(parentFigure != null && parentFigure.getLayoutManager() != null) {
+ Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
+ return (IBorderItemLocator)constraint;
+ }
+ return null;
+ }
+
+ @Override
+ public void refreshBounds() {
+ int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
+ int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
+
+ // Update locator constraint
+ IBorderItemLocator locator = getBorderItemLocator();
+ locator.setConstraint(new Rectangle(x, y, width, height));
+
+ // Set new constraint on parent figure
+ getFigure().getParent().setConstraint(getFigure(), locator);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Image getLabelIcon() {
+ EObject parserElement = getParserElement();
+ if(parserElement == null) {
+ return null;
+ }
+
+ List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer());
+ for(View view : views) {
+ if(NameLabelIconHelper.showLabelIcon(view)) {
+ return labelProvider.getImage(parserElement);
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected IFigure createFigure() {
+ IFigure label = createFigurePrim();
+ defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ protected IFigure createFigurePrim() {
+ return new PapyrusWrappingLabel();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getLabelRole() {
+ return "Label"; //$NON-NLS-1$
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getIconPathRole() {
+ return ""; //$NON-NLS-1$
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/FlowPortChildLabelEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/FlowPortChildLabelEditPart.java
index 997892dfa86..5e0de40aa63 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/FlowPortChildLabelEditPart.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/FlowPortChildLabelEditPart.java
@@ -1,56 +1,56 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.common.edit.part;
-
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementChildLabelEditPart;
-
-/**
- * Edit part for {@link FlowPort} used as Child label node.
- */
-public class FlowPortChildLabelEditPart extends AbstractElementChildLabelEditPart {
-
- /** Constructor */
- public FlowPortChildLabelEditPart(View view) {
- super(view);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- }
-
- // /**
- // * {@inheritDoc}
- // */
- // @Override
- // protected Image getLabelIcon() {
- // EObject parserElement = getParserElement();
- // if(parserElement == null) {
- // return null;
- // }
- //
- // List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer());
- // for(View view : views) {
- // if(NameLabelIconHelper.showLabelIcon(view)) {
- // return labelProvider.getImage(parserElement);
- // }
- // }
- //
- // return null;
- // }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.common.edit.part;
+
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementChildLabelEditPart;
+
+/**
+ * Edit part for {@link FlowPort} used as Child label node.
+ */
+public class FlowPortChildLabelEditPart extends AbstractElementChildLabelEditPart {
+
+ /** Constructor */
+ public FlowPortChildLabelEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ }
+
+ // /**
+ // * {@inheritDoc}
+ // */
+ // @Override
+ // protected Image getLabelIcon() {
+ // EObject parserElement = getParserElement();
+ // if(parserElement == null) {
+ // return null;
+ // }
+ //
+ // List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer());
+ // for(View view : views) {
+ // if(NameLabelIconHelper.showLabelIcon(view)) {
+ // return labelProvider.getImage(parserElement);
+ // }
+ // }
+ //
+ // return null;
+ // }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/FlowPropertyChildLabelEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/FlowPropertyChildLabelEditPart.java
index 3fd4ef7c400..a4dd8ede7fa 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/FlowPropertyChildLabelEditPart.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/FlowPropertyChildLabelEditPart.java
@@ -1,56 +1,56 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.common.edit.part;
-
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementChildLabelEditPart;
-
-/**
- * Edit part for {@link FlowProperty} used as Child label node.
- */
-public class FlowPropertyChildLabelEditPart extends AbstractElementChildLabelEditPart {
-
- /** Constructor */
- public FlowPropertyChildLabelEditPart(View view) {
- super(view);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- }
-
- // /**
- // * {@inheritDoc}
- // */
- // @Override
- // protected Image getLabelIcon() {
- // EObject parserElement = getParserElement();
- // if(parserElement == null) {
- // return null;
- // }
- //
- // List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer());
- // for(View view : views) {
- // if(NameLabelIconHelper.showLabelIcon(view)) {
- // return labelProvider.getImage(parserElement);
- // }
- // }
- //
- // return null;
- // }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.common.edit.part;
+
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementChildLabelEditPart;
+
+/**
+ * Edit part for {@link FlowProperty} used as Child label node.
+ */
+public class FlowPropertyChildLabelEditPart extends AbstractElementChildLabelEditPart {
+
+ /** Constructor */
+ public FlowPropertyChildLabelEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ }
+
+ // /**
+ // * {@inheritDoc}
+ // */
+ // @Override
+ // protected Image getLabelIcon() {
+ // EObject parserElement = getParserElement();
+ // if(parserElement == null) {
+ // return null;
+ // }
+ //
+ // List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer());
+ // for(View view : views) {
+ // if(NameLabelIconHelper.showLabelIcon(view)) {
+ // return labelProvider.getImage(parserElement);
+ // }
+ // }
+ //
+ // return null;
+ // }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/BlockPropertyStructureCompartmentSemanticEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/BlockPropertyStructureCompartmentSemanticEditPolicy.java
index 93daef1b1a9..5bcd7e72b9a 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/BlockPropertyStructureCompartmentSemanticEditPolicy.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/BlockPropertyStructureCompartmentSemanticEditPolicy.java
@@ -23,6 +23,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.gmf.diagram.common.edit.policy.CompartmentSemanticEditPolicy;
import org.eclipse.papyrus.infra.services.edit.commands.IConfigureCommandFactory;
import org.eclipse.papyrus.sysml.diagram.common.commands.CreateActorPartWithTypeConfigureCommandFactory;
+import org.eclipse.papyrus.sysml.diagram.common.commands.CreateConstraintPropertyWithTypeConfigureCommandFactory;
import org.eclipse.papyrus.sysml.diagram.common.commands.CreatePartWithTypeConfigureCommandFactory;
import org.eclipse.papyrus.sysml.diagram.common.commands.CreateReferenceWithTypeConfigureCommandFactory;
import org.eclipse.papyrus.sysml.diagram.common.commands.CreateValueWithTypeConfigureCommandFactory;
@@ -72,6 +73,11 @@ public class BlockPropertyStructureCompartmentSemanticEditPolicy extends Compart
if(UMLElementTypes.PROPERTY == req.getElementType()) {
req.setContainer(type);
}
+
+ if(SysMLElementTypes.CONSTRAINT_PROPERTY == req.getElementType()) {
+ req.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new CreateConstraintPropertyWithTypeConfigureCommandFactory());
+ }
+
} else if ((UMLElementTypes.PROPERTY == req.getElementType()) || (Arrays.asList(req.getElementType().getAllSuperTypes()).contains(UMLElementTypes.PROPERTY))) {
// Forbid Property::qualifier creation
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/CustomDuplicatePasteEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/CustomDuplicatePasteEditPolicy.java
index 8921a3807e6..a65f4599b49 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/CustomDuplicatePasteEditPolicy.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/CustomDuplicatePasteEditPolicy.java
@@ -1,57 +1,57 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.common.edit.policy;
-
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.diagram.ui.requests.DuplicateRequest;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.DuplicatePasteEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes;
-
-
-/**
- * Specific edit policy for compartment, to forbid the duplication of ports as affixed children.
- * @see bug 375041
- */
-public class CustomDuplicatePasteEditPolicy extends DuplicatePasteEditPolicy {
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected Command constructDuplicationCommand(List notationViewsToDuplicate, Set elementsToDuplicate, DuplicateRequest request, TransactionalEditingDomain editingDomain) {
- if(notationViewsToDuplicate !=null && !notationViewsToDuplicate.isEmpty()) {
- for(Object o : notationViewsToDuplicate) {
- if(o instanceof View) {
- String type = ((View)o).getType();
- if(SysMLGraphicalTypes.SHAPE_SYSML_FLOWPORT_AS_AFFIXED_ID.equals(type) || UMLGraphicalTypes.SHAPE_UML_PORT_AS_AFFIXED_ID.equals(type)) {
- return UnexecutableCommand.INSTANCE;
- }
- }
- }
- }
-
-
- return super.constructDuplicationCommand(notationViewsToDuplicate, elementsToDuplicate, request, editingDomain);
- }
-
-}
-
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.common.edit.policy;
+
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.runtime.diagram.ui.requests.DuplicateRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.DuplicatePasteEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes;
+
+
+/**
+ * Specific edit policy for compartment, to forbid the duplication of ports as affixed children.
+ * @see bug 375041
+ */
+public class CustomDuplicatePasteEditPolicy extends DuplicatePasteEditPolicy {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Command constructDuplicationCommand(List notationViewsToDuplicate, Set elementsToDuplicate, DuplicateRequest request, TransactionalEditingDomain editingDomain) {
+ if(notationViewsToDuplicate !=null && !notationViewsToDuplicate.isEmpty()) {
+ for(Object o : notationViewsToDuplicate) {
+ if(o instanceof View) {
+ String type = ((View)o).getType();
+ if(SysMLGraphicalTypes.SHAPE_SYSML_FLOWPORT_AS_AFFIXED_ID.equals(type) || UMLGraphicalTypes.SHAPE_UML_PORT_AS_AFFIXED_ID.equals(type)) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ }
+ }
+ }
+
+
+ return super.constructDuplicationCommand(notationViewsToDuplicate, elementsToDuplicate, request, editingDomain);
+ }
+
+}
+
\ No newline at end of file
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/PartCompartmentSemanticEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/PartCompartmentSemanticEditPolicy.java
index 6c557f5c024..622dd608d3b 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/PartCompartmentSemanticEditPolicy.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/PartCompartmentSemanticEditPolicy.java
@@ -17,6 +17,7 @@ import org.eclipse.gef.commands.Command;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.gmf.diagram.common.edit.policy.CompartmentSemanticEditPolicy;
import org.eclipse.papyrus.infra.services.edit.commands.IConfigureCommandFactory;
+import org.eclipse.papyrus.sysml.diagram.common.commands.CreateConstraintPropertyWithTypeConfigureCommandFactory;
import org.eclipse.papyrus.sysml.diagram.common.commands.CreatePartWithTypeConfigureCommandFactory;
import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes;
@@ -35,6 +36,10 @@ public class PartCompartmentSemanticEditPolicy extends CompartmentSemanticEditPo
req.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new CreatePartWithTypeConfigureCommandFactory());
}
+ if(SysMLElementTypes.CONSTRAINT_PROPERTY == req.getElementType()) {
+ req.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new CreateConstraintPropertyWithTypeConfigureCommandFactory());
+ }
+
return super.getCreateCommand(req);
}
}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/PropertyCompartmentSemanticEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/PropertyCompartmentSemanticEditPolicy.java
index 823e18e85fc..ed795654df5 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/PropertyCompartmentSemanticEditPolicy.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/PropertyCompartmentSemanticEditPolicy.java
@@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.gmf.diagram.common.edit.policy.CompartmentSemanticEditPolicy;
import org.eclipse.papyrus.infra.services.edit.commands.IConfigureCommandFactory;
import org.eclipse.papyrus.sysml.diagram.common.commands.CreateActorPartWithTypeConfigureCommandFactory;
+import org.eclipse.papyrus.sysml.diagram.common.commands.CreateConstraintPropertyWithTypeConfigureCommandFactory;
import org.eclipse.papyrus.sysml.diagram.common.commands.CreateFlowPortWithFlowSpecificationConfigureCommandFactory;
import org.eclipse.papyrus.sysml.diagram.common.commands.CreatePartWithTypeConfigureCommandFactory;
import org.eclipse.papyrus.sysml.diagram.common.commands.CreateReferenceWithTypeConfigureCommandFactory;
@@ -50,7 +51,10 @@ public class PropertyCompartmentSemanticEditPolicy extends CompartmentSemanticEd
if(SysMLElementTypes.FLOW_PORT_NA == req.getElementType()) {
req.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new CreateFlowPortWithFlowSpecificationConfigureCommandFactory());
}
-
+ if(SysMLElementTypes.CONSTRAINT_PROPERTY == req.getElementType()) {
+ req.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new CreateConstraintPropertyWithTypeConfigureCommandFactory());
+ }
+
return super.getCreateCommand(req);
}
}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/StructureCompartmentSemanticEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/StructureCompartmentSemanticEditPolicy.java
index 2552f154514..f045b8976ee 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/StructureCompartmentSemanticEditPolicy.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/StructureCompartmentSemanticEditPolicy.java
@@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.gmf.diagram.common.edit.policy.CompartmentSemanticEditPolicy;
import org.eclipse.papyrus.infra.services.edit.commands.IConfigureCommandFactory;
import org.eclipse.papyrus.sysml.diagram.common.commands.CreateActorPartWithTypeConfigureCommandFactory;
+import org.eclipse.papyrus.sysml.diagram.common.commands.CreateConstraintPropertyWithTypeConfigureCommandFactory;
import org.eclipse.papyrus.sysml.diagram.common.commands.CreatePartWithTypeConfigureCommandFactory;
import org.eclipse.papyrus.sysml.diagram.common.commands.CreateReferenceWithTypeConfigureCommandFactory;
import org.eclipse.papyrus.sysml.diagram.common.commands.CreateValueWithTypeConfigureCommandFactory;
@@ -50,6 +51,10 @@ public class StructureCompartmentSemanticEditPolicy extends CompartmentSemanticE
req.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new CreateValueWithTypeConfigureCommandFactory());
}
+ if(SysMLElementTypes.CONSTRAINT_PROPERTY == req.getElementType()) {
+ req.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new CreateConstraintPropertyWithTypeConfigureCommandFactory());
+ }
+
return super.getCreateCommand(req);
}
}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/figure/AssociationFigure.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/figure/AssociationFigure.java
index 7a99e59502e..3b3b4593fff 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/figure/AssociationFigure.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/figure/AssociationFigure.java
@@ -1,121 +1,121 @@
-/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- * CEA LIST - Adaptation for SysML purpose.
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.common.figure;
-
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.papyrus.uml.diagram.common.figure.NamedElementEdgeFigure;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusWrappingLabel;
-
-/**
- * This figure is used to represent {@link Association} in SysML diagrams.
- */
-public class AssociationFigure extends NamedElementEdgeFigure {
-
- /** The multiplicity source label. */
- private WrappingLabel fSourceMultiplicityLabel;
-
- /** The multiplicity target label. */
- private WrappingLabel fTargetMultiplicityLabel;
-
- /** The role source label. */
- private WrappingLabel fSourceRoleLabel;
-
- /** The role target label. */
- private WrappingLabel fTargetRoleLabel;
-
- /**
- * Instantiates a new association figure.
- */
- public AssociationFigure() {
- super();
- createContents();
- }
-
- /**
- * Creates the contents.
- */
- @Override
- protected void createContents() {
- super.createContents();
-
- fSourceRoleLabel = new PapyrusWrappingLabel();
- fSourceRoleLabel.setText("");
-
- this.add(fSourceRoleLabel);
-
- fSourceMultiplicityLabel = new PapyrusWrappingLabel();
- fSourceMultiplicityLabel.setText("");
-
- this.add(fSourceMultiplicityLabel);
-
- fTargetRoleLabel = new PapyrusWrappingLabel();
- fTargetRoleLabel.setText("");
-
- this.add(fTargetRoleLabel);
-
- fTargetMultiplicityLabel = new PapyrusWrappingLabel();
- fTargetMultiplicityLabel.setText("");
-
- this.add(fTargetMultiplicityLabel);
-
- }
-
- /**
- * Gets the applied stereotype association label.
- *
- * @return the applied stereotype association label
- */
- @Override
- public WrappingLabel getAppliedStereotypeLabel() {
- return appliedStereotypeLabel;
- }
-
- /**
- * Gets the multiplicity source label.
- *
- * @return the multiplicity source label
- */
- public WrappingLabel getSourceMultiplicityLabel() {
- return fSourceMultiplicityLabel;
- }
-
- /**
- * Gets the multiplicity target label.
- *
- * @return the multiplicity target label
- */
- public WrappingLabel getTargetMultiplicityLabel() {
- return fTargetMultiplicityLabel;
- }
-
- /**
- * Gets the role source label.
- *
- * @return the role source label
- */
- public WrappingLabel getSourceRoleLabel() {
- return fSourceRoleLabel;
- }
-
- /**
- * Gets the role target label.
- *
- * @return the role target label
- */
- public WrappingLabel getTargetRoleLabel() {
- return fTargetRoleLabel;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2009-2011 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ * CEA LIST - Adaptation for SysML purpose.
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.common.figure;
+
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.papyrus.uml.diagram.common.figure.NamedElementEdgeFigure;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusWrappingLabel;
+
+/**
+ * This figure is used to represent {@link Association} in SysML diagrams.
+ */
+public class AssociationFigure extends NamedElementEdgeFigure {
+
+ /** The multiplicity source label. */
+ private WrappingLabel fSourceMultiplicityLabel;
+
+ /** The multiplicity target label. */
+ private WrappingLabel fTargetMultiplicityLabel;
+
+ /** The role source label. */
+ private WrappingLabel fSourceRoleLabel;
+
+ /** The role target label. */
+ private WrappingLabel fTargetRoleLabel;
+
+ /**
+ * Instantiates a new association figure.
+ */
+ public AssociationFigure() {
+ super();
+ createContents();
+ }
+
+ /**
+ * Creates the contents.
+ */
+ @Override
+ protected void createContents() {
+ super.createContents();
+
+ fSourceRoleLabel = new PapyrusWrappingLabel();
+ fSourceRoleLabel.setText("");
+
+ this.add(fSourceRoleLabel);
+
+ fSourceMultiplicityLabel = new PapyrusWrappingLabel();
+ fSourceMultiplicityLabel.setText("");
+
+ this.add(fSourceMultiplicityLabel);
+
+ fTargetRoleLabel = new PapyrusWrappingLabel();
+ fTargetRoleLabel.setText("");
+
+ this.add(fTargetRoleLabel);
+
+ fTargetMultiplicityLabel = new PapyrusWrappingLabel();
+ fTargetMultiplicityLabel.setText("");
+
+ this.add(fTargetMultiplicityLabel);
+
+ }
+
+ /**
+ * Gets the applied stereotype association label.
+ *
+ * @return the applied stereotype association label
+ */
+ @Override
+ public WrappingLabel getAppliedStereotypeLabel() {
+ return appliedStereotypeLabel;
+ }
+
+ /**
+ * Gets the multiplicity source label.
+ *
+ * @return the multiplicity source label
+ */
+ public WrappingLabel getSourceMultiplicityLabel() {
+ return fSourceMultiplicityLabel;
+ }
+
+ /**
+ * Gets the multiplicity target label.
+ *
+ * @return the multiplicity target label
+ */
+ public WrappingLabel getTargetMultiplicityLabel() {
+ return fTargetMultiplicityLabel;
+ }
+
+ /**
+ * Gets the role source label.
+ *
+ * @return the role source label
+ */
+ public WrappingLabel getSourceRoleLabel() {
+ return fSourceRoleLabel;
+ }
+
+ /**
+ * Gets the role target label.
+ *
+ * @return the role target label
+ */
+ public WrappingLabel getTargetRoleLabel() {
+ return fTargetRoleLabel;
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/figure/FlowPortFigure.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/figure/FlowPortFigure.java
index e374ec6912e..8748a9c778f 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/figure/FlowPortFigure.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/figure/FlowPortFigure.java
@@ -1,34 +1,34 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.common.figure;
-
-import org.eclipse.papyrus.uml.diagram.common.figure.node.AffixedNamedElementFigure;
-import org.eclipse.swt.graphics.Image;
-
-
-/**
- * Figure for Port representation.
- */
-public class FlowPortFigure extends AffixedNamedElementFigure {
-
- /**
- * Set the image in FlowPort figure.
- *
- * @param image
- * the image to show in the FlowPort
- */
- public void setImage(Image image) {
- setIcon(image);
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.common.figure;
+
+import org.eclipse.papyrus.uml.diagram.common.figure.node.AffixedNamedElementFigure;
+import org.eclipse.swt.graphics.Image;
+
+
+/**
+ * Figure for Port representation.
+ */
+public class FlowPortFigure extends AffixedNamedElementFigure {
+
+ /**
+ * Set the image in FlowPort figure.
+ *
+ * @param image
+ * the image to show in the FlowPort
+ */
+ public void setImage(Image image) {
+ setIcon(image);
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/messages/Messages.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/messages/Messages.java
index 5be5e2b7217..d7b31fe3162 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/messages/Messages.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/messages/Messages.java
@@ -1,138 +1,160 @@
-/*****************************************************************************
- * Copyright (c) 2011-2012 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.common.messages;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
-
- public static String CreateOrSelectTypeDialog_DialogTitle;
-
- public static String CreateOrSelectTypeDialog_SelectionSectionTitle;
-
- public static String CreateOrSelectTypeDialog_SelectionSectionRadioLabel;
-
- public static String CreateOrSelectTypeDialog_CreationSectionTitle;
-
- public static String CreateOrSelectTypeDialog_CreationSectionRadioLabel;
-
- public static String CreateOrSelectTypeDialog_NewTypeNameLabel;
-
- public static String CreateOrSelectTypeDialog_NewTypeContainerNameLabel;
-
- public static String CreateOrSelectTypeDialog_SelectTypeDialogTitle;
-
- public static String CreateOrSelectTypeDialog_SelectTypeDialogMessage;
-
- public static String CreateOrSelectTypeDialog_SelectNewTypeContainerDialogTitle;
-
- public static String CreateOrSelectTypeDialog_SelectNewTypeContainerDialogMessage;
-
- public static String CreateOrSelectBlockPropertyTypeDialog_DialogTitle;
-
- public static String CreateOrSelectBlockPropertyTypeDialog_SelectionSectionTitle;
-
- public static String CreateOrSelectBlockPropertyTypeDialog_SelectionSectionRadioLabel;
-
- public static String CreateOrSelectBlockPropertyTypeDialog_CreationSectionTitle;
-
- public static String CreateOrSelectBlockPropertyTypeDialog_CreationSectionRadioLabel;
-
- public static String CreateOrSelectBlockPropertyTypeDialog_NewTypeNameLabel;
-
- public static String CreateOrSelectBlockPropertyTypeDialog_NewTypeContainerNameLabel;
-
- public static String CreateOrSelectBlockPropertyTypeDialog_SelectTypeDialogTitle;
-
- public static String CreateOrSelectBlockPropertyTypeDialog_SelectTypeDialogMessage;
-
- public static String CreateOrSelectBlockPropertyTypeDialog_SelectNewTypeContainerDialogTitle;
-
- public static String CreateOrSelectBlockPropertyTypeDialog_SelectNewTypeContainerDialogMessage;
-
- public static String CreateOrSelectActorPartTypeDialog_DialogTitle;
-
- public static String CreateOrSelectActorPartTypeDialog_SelectionSectionTitle;
-
- public static String CreateOrSelectActorPartTypeDialog_SelectionSectionRadioLabel;
-
- public static String CreateOrSelectActorPartTypeDialog_CreationSectionTitle;
-
- public static String CreateOrSelectActorPartTypeDialog_CreationSectionRadioLabel;
-
- public static String CreateOrSelectActorPartTypeDialog_NewTypeNameLabel;
-
- public static String CreateOrSelectActorPartTypeDialog_NewTypeContainerNameLabel;
-
- public static String CreateOrSelectActorPartTypeDialog_SelectTypeDialogTitle;
-
- public static String CreateOrSelectActorPartTypeDialog_SelectTypeDialogMessage;
-
- public static String CreateOrSelectActorPartTypeDialog_SelectNewTypeContainerDialogTitle;
-
- public static String CreateOrSelectActorPartTypeDialog_SelectNewTypeContainerDialogMessage;
-
- public static String CreateOrSelectValuePropertyTypeDialog_DialogTitle;
-
- public static String CreateOrSelectValuePropertyTypeDialog_SelectionSectionTitle;
-
- public static String CreateOrSelectValuePropertyTypeDialog_SelectionSectionRadioLabel;
-
- public static String CreateOrSelectValuePropertyTypeDialog_CreationSectionTitle;
-
- public static String CreateOrSelectValuePropertyTypeDialog_CreationSectionRadioLabel;
-
- public static String CreateOrSelectValuePropertyTypeDialog_NewTypeNameLabel;
-
- public static String CreateOrSelectValuePropertyTypeDialog_NewTypeContainerNameLabel;
-
- public static String CreateOrSelectValuePropertyTypeDialog_SelectTypeDialogTitle;
-
- public static String CreateOrSelectValuePropertyTypeDialog_SelectTypeDialogMessage;
-
- public static String CreateOrSelectValuePropertyTypeDialog_SelectNewTypeContainerDialogTitle;
-
- public static String CreateOrSelectValuePropertyTypeDialog_SelectNewTypeContainerDialogMessage;
-
- public static String CreateOrSelectValuePropertyTypeDialog_NewTypeKindLabel;
-
- public static String CreateOrSelectNonAtomicFlowPortTypeDialog_DialogTitle;
-
- public static String CreateOrSelectNonAtomicFlowPortTypeDialog_SelectionSectionTitle;
-
- public static String CreateOrSelectNonAtomicFlowPortTypeDialog_SelectionSectionRadioLabel;
-
- public static String CreateOrSelectNonAtomicFlowPortTypeDialog_CreationSectionTitle;
-
- public static String CreateOrSelectNonAtomicFlowPortTypeDialog_CreationSectionRadioLabel;
-
- public static String CreateOrSelectNonAtomicFlowPortTypeDialog_NewTypeNameLabel;
-
- public static String CreateOrSelectNonAtomicFlowPortTypeDialog_NewTypeContainerNameLabel;
-
- public static String CreateOrSelectNonAtomicFlowPortTypeDialog_SelectTypeDialogTitle;
-
- public static String CreateOrSelectNonAtomicFlowPortTypeDialog_SelectTypeDialogMessage;
-
- public static String CreateOrSelectNonAtomicFlowPortTypeDialog_SelectNewTypeContainerDialogTitle;
-
- public static String CreateOrSelectNonAtomicFlowPortTypeDialog_SelectNewTypeContainerDialogMessage;
-
- static {
- NLS.initializeMessages("org.eclipse.papyrus.sysml.diagram.common.messages.messages", Messages.class); //$NON-NLS-1$
- }
-
- private Messages() {
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011-2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.common.messages;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+
+ public static String CreateOrSelectTypeDialog_DialogTitle;
+
+ public static String CreateOrSelectTypeDialog_SelectionSectionTitle;
+
+ public static String CreateOrSelectTypeDialog_SelectionSectionRadioLabel;
+
+ public static String CreateOrSelectTypeDialog_CreationSectionTitle;
+
+ public static String CreateOrSelectTypeDialog_CreationSectionRadioLabel;
+
+ public static String CreateOrSelectTypeDialog_NewTypeNameLabel;
+
+ public static String CreateOrSelectTypeDialog_NewTypeContainerNameLabel;
+
+ public static String CreateOrSelectTypeDialog_SelectTypeDialogTitle;
+
+ public static String CreateOrSelectTypeDialog_SelectTypeDialogMessage;
+
+ public static String CreateOrSelectTypeDialog_SelectNewTypeContainerDialogTitle;
+
+ public static String CreateOrSelectTypeDialog_SelectNewTypeContainerDialogMessage;
+
+ public static String CreateOrSelectBlockPropertyTypeDialog_DialogTitle;
+
+ public static String CreateOrSelectBlockPropertyTypeDialog_SelectionSectionTitle;
+
+ public static String CreateOrSelectBlockPropertyTypeDialog_SelectionSectionRadioLabel;
+
+ public static String CreateOrSelectBlockPropertyTypeDialog_CreationSectionTitle;
+
+ public static String CreateOrSelectBlockPropertyTypeDialog_CreationSectionRadioLabel;
+
+ public static String CreateOrSelectBlockPropertyTypeDialog_NewTypeNameLabel;
+
+ public static String CreateOrSelectBlockPropertyTypeDialog_NewTypeContainerNameLabel;
+
+ public static String CreateOrSelectBlockPropertyTypeDialog_SelectTypeDialogTitle;
+
+ public static String CreateOrSelectBlockPropertyTypeDialog_SelectTypeDialogMessage;
+
+ public static String CreateOrSelectBlockPropertyTypeDialog_SelectNewTypeContainerDialogTitle;
+
+ public static String CreateOrSelectBlockPropertyTypeDialog_SelectNewTypeContainerDialogMessage;
+
+ public static String CreateOrSelectConstraintPropertyTypeDialog_DialogTitle;
+
+ public static String CreateOrSelectConstraintPropertyTypeDialog_SelectionSectionTitle;
+
+ public static String CreateOrSelectConstraintPropertyTypeDialog_SelectionSectionRadioLabel;
+
+ public static String CreateOrSelectConstraintPropertyTypeDialog_CreationSectionTitle;
+
+ public static String CreateOrSelectConstraintPropertyTypeDialog_CreationSectionRadioLabel;
+
+ public static String CreateOrSelectConstraintPropertyTypeDialog_NewTypeNameLabel;
+
+ public static String CreateOrSelectConstraintPropertyTypeDialog_NewTypeContainerNameLabel;
+
+ public static String CreateOrSelectConstraintPropertyTypeDialog_SelectTypeDialogTitle;
+
+ public static String CreateOrSelectConstraintPropertyTypeDialog_SelectTypeDialogMessage;
+
+ public static String CreateOrSelectConstraintPropertyTypeDialog_SelectNewTypeContainerDialogTitle;
+
+ public static String CreateOrSelectConstraintPropertyTypeDialog_SelectNewTypeContainerDialogMessage;
+
+ public static String CreateOrSelectActorPartTypeDialog_DialogTitle;
+
+ public static String CreateOrSelectActorPartTypeDialog_SelectionSectionTitle;
+
+ public static String CreateOrSelectActorPartTypeDialog_SelectionSectionRadioLabel;
+
+ public static String CreateOrSelectActorPartTypeDialog_CreationSectionTitle;
+
+ public static String CreateOrSelectActorPartTypeDialog_CreationSectionRadioLabel;
+
+ public static String CreateOrSelectActorPartTypeDialog_NewTypeNameLabel;
+
+ public static String CreateOrSelectActorPartTypeDialog_NewTypeContainerNameLabel;
+
+ public static String CreateOrSelectActorPartTypeDialog_SelectTypeDialogTitle;
+
+ public static String CreateOrSelectActorPartTypeDialog_SelectTypeDialogMessage;
+
+ public static String CreateOrSelectActorPartTypeDialog_SelectNewTypeContainerDialogTitle;
+
+ public static String CreateOrSelectActorPartTypeDialog_SelectNewTypeContainerDialogMessage;
+
+ public static String CreateOrSelectValuePropertyTypeDialog_DialogTitle;
+
+ public static String CreateOrSelectValuePropertyTypeDialog_SelectionSectionTitle;
+
+ public static String CreateOrSelectValuePropertyTypeDialog_SelectionSectionRadioLabel;
+
+ public static String CreateOrSelectValuePropertyTypeDialog_CreationSectionTitle;
+
+ public static String CreateOrSelectValuePropertyTypeDialog_CreationSectionRadioLabel;
+
+ public static String CreateOrSelectValuePropertyTypeDialog_NewTypeNameLabel;
+
+ public static String CreateOrSelectValuePropertyTypeDialog_NewTypeContainerNameLabel;
+
+ public static String CreateOrSelectValuePropertyTypeDialog_SelectTypeDialogTitle;
+
+ public static String CreateOrSelectValuePropertyTypeDialog_SelectTypeDialogMessage;
+
+ public static String CreateOrSelectValuePropertyTypeDialog_SelectNewTypeContainerDialogTitle;
+
+ public static String CreateOrSelectValuePropertyTypeDialog_SelectNewTypeContainerDialogMessage;
+
+ public static String CreateOrSelectValuePropertyTypeDialog_NewTypeKindLabel;
+
+ public static String CreateOrSelectNonAtomicFlowPortTypeDialog_DialogTitle;
+
+ public static String CreateOrSelectNonAtomicFlowPortTypeDialog_SelectionSectionTitle;
+
+ public static String CreateOrSelectNonAtomicFlowPortTypeDialog_SelectionSectionRadioLabel;
+
+ public static String CreateOrSelectNonAtomicFlowPortTypeDialog_CreationSectionTitle;
+
+ public static String CreateOrSelectNonAtomicFlowPortTypeDialog_CreationSectionRadioLabel;
+
+ public static String CreateOrSelectNonAtomicFlowPortTypeDialog_NewTypeNameLabel;
+
+ public static String CreateOrSelectNonAtomicFlowPortTypeDialog_NewTypeContainerNameLabel;
+
+ public static String CreateOrSelectNonAtomicFlowPortTypeDialog_SelectTypeDialogTitle;
+
+ public static String CreateOrSelectNonAtomicFlowPortTypeDialog_SelectTypeDialogMessage;
+
+ public static String CreateOrSelectNonAtomicFlowPortTypeDialog_SelectNewTypeContainerDialogTitle;
+
+ public static String CreateOrSelectNonAtomicFlowPortTypeDialog_SelectNewTypeContainerDialogMessage;
+
+ static {
+ NLS.initializeMessages("org.eclipse.papyrus.sysml.diagram.common.messages.messages", Messages.class); //$NON-NLS-1$
+ }
+
+ private Messages() {
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/messages/messages.properties b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/messages/messages.properties
index cece3d4efbc..a5d917ce35c 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/messages/messages.properties
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/messages/messages.properties
@@ -29,6 +29,22 @@ CreateOrSelectBlockPropertyTypeDialog_SelectTypeDialogMessage=Select a Block to
CreateOrSelectBlockPropertyTypeDialog_SelectNewTypeContainerDialogTitle=Type container selection
CreateOrSelectBlockPropertyTypeDialog_SelectNewTypeContainerDialogMessage=Select the container for the new Block
+CreateOrSelectConstraintPropertyTypeDialog_DialogTitle=ConstraintProperty type initialization
+CreateOrSelectConstraintPropertyTypeDialog_SelectionSectionTitle=Select an existing type (ConstraintBlock)
+CreateOrSelectConstraintPropertyTypeDialog_SelectionSectionRadioLabel=ConstraintBlock (type) selection mode
+
+CreateOrSelectConstraintPropertyTypeDialog_CreationSectionTitle=Create a new type (ConstraintBlock)
+CreateOrSelectConstraintPropertyTypeDialog_CreationSectionRadioLabel=ConstraintBlock (type) creation mode
+CreateOrSelectConstraintPropertyTypeDialog_NewTypeNameLabel=Select new ConstraintBlock name
+CreateOrSelectConstraintPropertyTypeDialog_NewTypeContainerNameLabel=Select new ConstraintBlock container
+
+CreateOrSelectConstraintPropertyTypeDialog_SelectTypeDialogTitle=Type selection
+CreateOrSelectConstraintPropertyTypeDialog_SelectTypeDialogMessage=Select a ConstraintBlock to use as new element type
+
+CreateOrSelectConstraintPropertyTypeDialog_SelectNewTypeContainerDialogTitle=Type container selection
+CreateOrSelectConstraintPropertyTypeDialog_SelectNewTypeContainerDialogMessage=Select the container for the new ConstraintBlock
+
+
CreateOrSelectActorPartTypeDialog_DialogTitle=ActorPart type initialization
CreateOrSelectActorPartTypeDialog_SelectionSectionTitle=Select an existing type (Actor)
CreateOrSelectActorPartTypeDialog_SelectionSectionRadioLabel=Actor (type) selection mode
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/FlowPortLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/FlowPortLabelParser.java
index 3936cdc2c9a..290d871a00a 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/FlowPortLabelParser.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/FlowPortLabelParser.java
@@ -1,251 +1,251 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.common.parser;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants;
-import org.eclipse.papyrus.sysml.portandflows.FlowDirection;
-import org.eclipse.papyrus.sysml.portandflows.FlowPort;
-import org.eclipse.papyrus.sysml.portandflows.FlowSpecification;
-import org.eclipse.papyrus.sysml.portandflows.PortandflowsPackage;
-import org.eclipse.papyrus.uml.diagram.common.parser.PropertyLabelParser;
-import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil;
-import org.eclipse.uml2.uml.InstanceValue;
-import org.eclipse.uml2.uml.Port;
-import org.eclipse.uml2.uml.Property;
-import org.eclipse.uml2.uml.ValueSpecification;
-import org.eclipse.uml2.uml.VisibilityKind;
-import org.eclipse.uml2.uml.util.UMLUtil;
-
-/**
- * Semantic Parser for {@link FlowPort}
- */
-public class FlowPortLabelParser extends PropertyLabelParser {
-
- /** The String format for displaying a FlowProperty with direction */
- protected static final String DIRECTION_FORMAT = "%s %s";
-
- /** The String format for displaying a FlowProperty with direction */
- protected static final String CONJUGATED_FORMAT = "~%s";
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getPrintString(IAdaptable element, int flags) {
-
- if(flags == 0) {
- return MaskedLabel;
- }
-
- String result = "";
- EObject eObject = (EObject)element.getAdapter(EObject.class);
-
- if((eObject != null) && (eObject instanceof Port)) {
-
- Property property = (Property)eObject;
-
- FlowPort flowPort = UMLUtil.getStereotypeApplication(property, FlowPort.class);
- if(flowPort != null) {
-
- int directionFlag = flags & ILabelPreferenceConstants.DISP_DIRECTION;
- // manage direction only if the FlowPort is type and type is not a FlowSpecification
- if((flags & ILabelPreferenceConstants.DISP_DIRECTION) == ILabelPreferenceConstants.DISP_DIRECTION) {
- String direction;
- switch(flowPort.getDirection().getValue()) {
- case FlowDirection.IN_VALUE:
- direction = "in";
- break;
- case FlowDirection.OUT_VALUE:
- direction = "out";
- break;
- case FlowDirection.INOUT_VALUE:
- direction = "inout";
- break;
- default:
- direction = "inout";
- break;
- }
-
- // manage direction only if the FlowPort is not a FlowSpecification
- if((property.getType() == null) || ((property.getType() != null) && (UMLUtil.getStereotypeApplication(property.getType(), FlowSpecification.class) == null))) {
- result = String.format(DIRECTION_FORMAT, direction, result);
- }
- }
- }
-
- // manage visibility
- if((flags & ILabelPreferenceConstants.DISP_VISIBILITY) == ILabelPreferenceConstants.DISP_VISIBILITY) {
- String visibility;
- switch(property.getVisibility().getValue()) {
- case VisibilityKind.PACKAGE:
- visibility = "~";
- break;
- case VisibilityKind.PUBLIC:
- visibility = "+";
- break;
- case VisibilityKind.PROTECTED:
- visibility = "#";
- break;
- case VisibilityKind.PRIVATE:
- visibility = "-";
- break;
- default:
- visibility = "+";
- break;
- }
- result = String.format(VISIBILITY_FORMAT, visibility, result);
- }
-
- // manage derived modifier
- if(((flags & ILabelPreferenceConstants.DISP_DERIVE) == ILabelPreferenceConstants.DISP_DERIVE) && (property.isDerived())) {
- result = String.format(DERIVED_FORMAT, result);
- }
-
- // manage name
- if(((flags & ILabelPreferenceConstants.DISP_NAME) == ILabelPreferenceConstants.DISP_NAME) && (property.isSetName())) {
- String name = property.getName();
- result = String.format(NAME_FORMAT, result, name);
- }
-
- // manage type and conjugated property
- if(((flags & ILabelPreferenceConstants.DISP_TYPE) == ILabelPreferenceConstants.DISP_TYPE)) {
-
- String type = "<Undefined>";
- if(property.getType() != null) {
- type = property.getType().getName();
- }
-
- // If type is undefined only show "<Undefined>" when explicitly asked.
- if(((flags & ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) == ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) || (!"<Undefined>".equals(type))) {
- if((flowPort != null) && (flowPort.isConjugated())) {
- type = String.format(CONJUGATED_FORMAT, type);
- }
- result = String.format(TYPE_FORMAT, result, type);
- }
- }
-
- // manage multiplicity
- if(((flags & ILabelPreferenceConstants.DISP_MULTIPLICITY) == ILabelPreferenceConstants.DISP_MULTIPLICITY)) {
-
- // If multiplicity is [1] (SysML default), only show when explicitly asked.
- // TODO : add a case for default with multiplicity not set.
- String lower = (property.getLowerValue() != null) ? ValueSpecificationUtil.getSpecificationValue(property.getLowerValue()) : "1";
- String upper = (property.getLowerValue() != null) ? ValueSpecificationUtil.getSpecificationValue(property.getUpperValue()) : "1";
- if(((flags & ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY) == ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY) || !("1".equals(lower) && "1".equals(upper))) {
-
- if(lower.equals(upper)) {
- result = String.format(MULTIPLICITY_FORMAT_ALT, result, lower, upper);
- } else {
- result = String.format(MULTIPLICITY_FORMAT, result, lower, upper);
- }
- }
- }
-
- // manage default value
- if(((flags & ILabelPreferenceConstants.DISP_DEFAULTVALUE) == ILabelPreferenceConstants.DISP_DEFAULTVALUE) && ((property.getDefaultValue() != null))) {
- ValueSpecification valueSpecification = property.getDefaultValue();
- if(valueSpecification instanceof InstanceValue && property.getType().equals(valueSpecification.getType())) {
- result = String.format(DEFAULT_VALUE_FORMAT, result, ValueSpecificationUtil.getSpecificationValue(valueSpecification));
- }
- }
-
- // manage modifier
- if((flags & ILabelPreferenceConstants.DISP_MODIFIERS) == ILabelPreferenceConstants.DISP_MODIFIERS) {
- StringBuffer sb = new StringBuffer();
- if(property.isReadOnly()) {
- sb.append(sb.length() == 0 ? "readOnly" : ", readOnly");
- }
- if(property.isOrdered()) {
- sb.append(sb.length() == 0 ? "ordered" : ", ordered");
- }
- if(property.isUnique()) {
- sb.append(sb.length() == 0 ? "unique" : ", unique");
- }
- if(property.isDerivedUnion()) {
- sb.append(sb.length() == 0 ? "union" : ", union");
- }
- EList<Property> redefinedProperties = property.getRedefinedProperties();
- if(redefinedProperties != null && !redefinedProperties.isEmpty()) {
- for(Property p : redefinedProperties) {
- sb.append(sb.length() == 0 ? p.getName() : ", redefines " + p.getName());
- }
- }
- if(sb.length() != 0) {
- result = String.format(MODIFIER_FORMAT, result, sb.toString());
- }
- }
- }
-
- return result;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isAffectingEvent(Object event, int flags) {
-
- if(event instanceof Notification) {
- Object feature = ((Notification)event).getFeature();
- if(feature instanceof EStructuralFeature) {
- return PortandflowsPackage.eINSTANCE.getFlowPort_Direction().equals(feature) || PortandflowsPackage.eINSTANCE.getFlowPort_IsConjugated().equals(feature) || super.isAffectingEvent(event, flags);
- }
- }
-
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public List<EObject> getSemanticElementsBeingParsed(EObject element) {
- List<EObject> semanticElementsBeingParsed = super.getSemanticElementsBeingParsed(element);
-
- if((element != null) && (element instanceof Port)) {
- Port semElement = (Port)element;
-
- FlowPort flowPort = UMLUtil.getStereotypeApplication(semElement, FlowPort.class);
- if(flowPort != null) {
- semanticElementsBeingParsed.add(flowPort);
- }
- }
- return semanticElementsBeingParsed;
- }
-
- @Override
- public Map<Integer, String> getMasks() {
- Map<Integer, String> masks = new HashMap<Integer, String>(10);
- masks.put(ILabelPreferenceConstants.DISP_DIRECTION, "Direction");
- masks.put(ILabelPreferenceConstants.DISP_VISIBILITY, "Visibility");
- masks.put(ILabelPreferenceConstants.DISP_DERIVE, "Is Derived");
- masks.put(ILabelPreferenceConstants.DISP_NAME, "Name");
- masks.put(ILabelPreferenceConstants.DISP_TYPE, "Type");
- masks.put(ILabelPreferenceConstants.DISP_UNDEFINED_TYPE, "Show <Undefined> type");
- masks.put(ILabelPreferenceConstants.DISP_MULTIPLICITY, "Multiplicity");
- masks.put(ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY, "Show default multiplicity");
- masks.put(ILabelPreferenceConstants.DISP_DEFAULTVALUE, "Default Value");
- masks.put(ILabelPreferenceConstants.DISP_MODIFIERS, "Modifiers");
- return masks;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.common.parser;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants;
+import org.eclipse.papyrus.sysml.portandflows.FlowDirection;
+import org.eclipse.papyrus.sysml.portandflows.FlowPort;
+import org.eclipse.papyrus.sysml.portandflows.FlowSpecification;
+import org.eclipse.papyrus.sysml.portandflows.PortandflowsPackage;
+import org.eclipse.papyrus.uml.diagram.common.parser.PropertyLabelParser;
+import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil;
+import org.eclipse.uml2.uml.InstanceValue;
+import org.eclipse.uml2.uml.Port;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.ValueSpecification;
+import org.eclipse.uml2.uml.VisibilityKind;
+import org.eclipse.uml2.uml.util.UMLUtil;
+
+/**
+ * Semantic Parser for {@link FlowPort}
+ */
+public class FlowPortLabelParser extends PropertyLabelParser {
+
+ /** The String format for displaying a FlowProperty with direction */
+ protected static final String DIRECTION_FORMAT = "%s %s";
+
+ /** The String format for displaying a FlowProperty with direction */
+ protected static final String CONJUGATED_FORMAT = "~%s";
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getPrintString(IAdaptable element, int flags) {
+
+ if(flags == 0) {
+ return MaskedLabel;
+ }
+
+ String result = "";
+ EObject eObject = (EObject)element.getAdapter(EObject.class);
+
+ if((eObject != null) && (eObject instanceof Port)) {
+
+ Property property = (Property)eObject;
+
+ FlowPort flowPort = UMLUtil.getStereotypeApplication(property, FlowPort.class);
+ if(flowPort != null) {
+
+ int directionFlag = flags & ILabelPreferenceConstants.DISP_DIRECTION;
+ // manage direction only if the FlowPort is type and type is not a FlowSpecification
+ if((flags & ILabelPreferenceConstants.DISP_DIRECTION) == ILabelPreferenceConstants.DISP_DIRECTION) {
+ String direction;
+ switch(flowPort.getDirection().getValue()) {
+ case FlowDirection.IN_VALUE:
+ direction = "in";
+ break;
+ case FlowDirection.OUT_VALUE:
+ direction = "out";
+ break;
+ case FlowDirection.INOUT_VALUE:
+ direction = "inout";
+ break;
+ default:
+ direction = "inout";
+ break;
+ }
+
+ // manage direction only if the FlowPort is not a FlowSpecification
+ if((property.getType() == null) || ((property.getType() != null) && (UMLUtil.getStereotypeApplication(property.getType(), FlowSpecification.class) == null))) {
+ result = String.format(DIRECTION_FORMAT, direction, result);
+ }
+ }
+ }
+
+ // manage visibility
+ if((flags & ILabelPreferenceConstants.DISP_VISIBILITY) == ILabelPreferenceConstants.DISP_VISIBILITY) {
+ String visibility;
+ switch(property.getVisibility().getValue()) {
+ case VisibilityKind.PACKAGE:
+ visibility = "~";
+ break;
+ case VisibilityKind.PUBLIC:
+ visibility = "+";
+ break;
+ case VisibilityKind.PROTECTED:
+ visibility = "#";
+ break;
+ case VisibilityKind.PRIVATE:
+ visibility = "-";
+ break;
+ default:
+ visibility = "+";
+ break;
+ }
+ result = String.format(VISIBILITY_FORMAT, visibility, result);
+ }
+
+ // manage derived modifier
+ if(((flags & ILabelPreferenceConstants.DISP_DERIVE) == ILabelPreferenceConstants.DISP_DERIVE) && (property.isDerived())) {
+ result = String.format(DERIVED_FORMAT, result);
+ }
+
+ // manage name
+ if(((flags & ILabelPreferenceConstants.DISP_NAME) == ILabelPreferenceConstants.DISP_NAME) && (property.isSetName())) {
+ String name = property.getName();
+ result = String.format(NAME_FORMAT, result, name);
+ }
+
+ // manage type and conjugated property
+ if(((flags & ILabelPreferenceConstants.DISP_TYPE) == ILabelPreferenceConstants.DISP_TYPE)) {
+
+ String type = "<Undefined>";
+ if(property.getType() != null) {
+ type = property.getType().getName();
+ }
+
+ // If type is undefined only show "<Undefined>" when explicitly asked.
+ if(((flags & ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) == ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) || (!"<Undefined>".equals(type))) {
+ if((flowPort != null) && (flowPort.isConjugated())) {
+ type = String.format(CONJUGATED_FORMAT, type);
+ }
+ result = String.format(TYPE_FORMAT, result, type);
+ }
+ }
+
+ // manage multiplicity
+ if(((flags & ILabelPreferenceConstants.DISP_MULTIPLICITY) == ILabelPreferenceConstants.DISP_MULTIPLICITY)) {
+
+ // If multiplicity is [1] (SysML default), only show when explicitly asked.
+ // TODO : add a case for default with multiplicity not set.
+ String lower = (property.getLowerValue() != null) ? ValueSpecificationUtil.getSpecificationValue(property.getLowerValue()) : "1";
+ String upper = (property.getLowerValue() != null) ? ValueSpecificationUtil.getSpecificationValue(property.getUpperValue()) : "1";
+ if(((flags & ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY) == ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY) || !("1".equals(lower) && "1".equals(upper))) {
+
+ if(lower.equals(upper)) {
+ result = String.format(MULTIPLICITY_FORMAT_ALT, result, lower, upper);
+ } else {
+ result = String.format(MULTIPLICITY_FORMAT, result, lower, upper);
+ }
+ }
+ }
+
+ // manage default value
+ if(((flags & ILabelPreferenceConstants.DISP_DEFAULTVALUE) == ILabelPreferenceConstants.DISP_DEFAULTVALUE) && ((property.getDefaultValue() != null))) {
+ ValueSpecification valueSpecification = property.getDefaultValue();
+ if(valueSpecification instanceof InstanceValue && property.getType().equals(valueSpecification.getType())) {
+ result = String.format(DEFAULT_VALUE_FORMAT, result, ValueSpecificationUtil.getSpecificationValue(valueSpecification));
+ }
+ }
+
+ // manage modifier
+ if((flags & ILabelPreferenceConstants.DISP_MODIFIERS) == ILabelPreferenceConstants.DISP_MODIFIERS) {
+ StringBuffer sb = new StringBuffer();
+ if(property.isReadOnly()) {
+ sb.append(sb.length() == 0 ? "readOnly" : ", readOnly");
+ }
+ if(property.isOrdered()) {
+ sb.append(sb.length() == 0 ? "ordered" : ", ordered");
+ }
+ if(property.isUnique()) {
+ sb.append(sb.length() == 0 ? "unique" : ", unique");
+ }
+ if(property.isDerivedUnion()) {
+ sb.append(sb.length() == 0 ? "union" : ", union");
+ }
+ EList<Property> redefinedProperties = property.getRedefinedProperties();
+ if(redefinedProperties != null && !redefinedProperties.isEmpty()) {
+ for(Property p : redefinedProperties) {
+ sb.append(sb.length() == 0 ? p.getName() : ", redefines " + p.getName());
+ }
+ }
+ if(sb.length() != 0) {
+ result = String.format(MODIFIER_FORMAT, result, sb.toString());
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isAffectingEvent(Object event, int flags) {
+
+ if(event instanceof Notification) {
+ Object feature = ((Notification)event).getFeature();
+ if(feature instanceof EStructuralFeature) {
+ return PortandflowsPackage.eINSTANCE.getFlowPort_Direction().equals(feature) || PortandflowsPackage.eINSTANCE.getFlowPort_IsConjugated().equals(feature) || super.isAffectingEvent(event, flags);
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<EObject> getSemanticElementsBeingParsed(EObject element) {
+ List<EObject> semanticElementsBeingParsed = super.getSemanticElementsBeingParsed(element);
+
+ if((element != null) && (element instanceof Port)) {
+ Port semElement = (Port)element;
+
+ FlowPort flowPort = UMLUtil.getStereotypeApplication(semElement, FlowPort.class);
+ if(flowPort != null) {
+ semanticElementsBeingParsed.add(flowPort);
+ }
+ }
+ return semanticElementsBeingParsed;
+ }
+
+ @Override
+ public Map<Integer, String> getMasks() {
+ Map<Integer, String> masks = new HashMap<Integer, String>(10);
+ masks.put(ILabelPreferenceConstants.DISP_DIRECTION, "Direction");
+ masks.put(ILabelPreferenceConstants.DISP_VISIBILITY, "Visibility");
+ masks.put(ILabelPreferenceConstants.DISP_DERIVE, "Is Derived");
+ masks.put(ILabelPreferenceConstants.DISP_NAME, "Name");
+ masks.put(ILabelPreferenceConstants.DISP_TYPE, "Type");
+ masks.put(ILabelPreferenceConstants.DISP_UNDEFINED_TYPE, "Show <Undefined> type");
+ masks.put(ILabelPreferenceConstants.DISP_MULTIPLICITY, "Multiplicity");
+ masks.put(ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY, "Show default multiplicity");
+ masks.put(ILabelPreferenceConstants.DISP_DEFAULTVALUE, "Default Value");
+ masks.put(ILabelPreferenceConstants.DISP_MODIFIERS, "Modifiers");
+ return masks;
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/FlowPropertyLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/FlowPropertyLabelParser.java
index 8a4ae645c7e..9edb455a35f 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/FlowPropertyLabelParser.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/FlowPropertyLabelParser.java
@@ -1,132 +1,132 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.common.parser;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants;
-import org.eclipse.papyrus.sysml.portandflows.FlowDirection;
-import org.eclipse.papyrus.sysml.portandflows.FlowProperty;
-import org.eclipse.papyrus.sysml.portandflows.PortandflowsPackage;
-import org.eclipse.papyrus.uml.diagram.common.parser.PropertyLabelParser;
-import org.eclipse.uml2.uml.Property;
-import org.eclipse.uml2.uml.util.UMLUtil;
-
-/**
- * Semantic Parser for {@link FlowProperty}
- */
-public class FlowPropertyLabelParser extends PropertyLabelParser {
-
- /** The String format for displaying a FlowProperty with direction */
- protected static final String DIRECTION_FORMAT = "%s %s";
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getPrintString(IAdaptable element, int flags) {
-
- if (flags == 0) {
- return MaskedLabel;
- }
-
- String result = super.getPrintString(element, flags);
-
- EObject eObject = (EObject)element.getAdapter(EObject.class);
- if((eObject != null) && (eObject instanceof Property)) {
-
- Property property = (Property)eObject;
- FlowProperty flowProperty = UMLUtil.getStereotypeApplication(property, FlowProperty.class);
- if(flowProperty != null) {
-
- // manage direction
- if((flags & ILabelPreferenceConstants.DISP_DIRECTION) == ILabelPreferenceConstants.DISP_DIRECTION) {
- String direction;
- switch(flowProperty.getDirection().getValue()) {
- case FlowDirection.IN_VALUE:
- direction = "in";
- break;
- case FlowDirection.OUT_VALUE:
- direction = "out";
- break;
- case FlowDirection.INOUT_VALUE:
- direction = "inout";
- break;
- default:
- direction = "inout";
- break;
- }
- result = String.format(DIRECTION_FORMAT, direction, result);
- }
- }
- }
-
- return result;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isAffectingEvent(Object event, int flags) {
-
- if(event instanceof Notification) {
- Object feature = ((Notification)event).getFeature();
- if(feature instanceof EStructuralFeature) {
- return PortandflowsPackage.eINSTANCE.getFlowProperty_Direction().equals(feature) || super.isAffectingEvent(event, flags);
- }
- }
-
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public List<EObject> getSemanticElementsBeingParsed(EObject element) {
- List<EObject> semanticElementsBeingParsed = super.getSemanticElementsBeingParsed(element);
-
- if((element != null) && (element instanceof Property)) {
- Property semElement = (Property)element;
-
- FlowProperty flowProperty = UMLUtil.getStereotypeApplication(semElement, FlowProperty.class);
- if(flowProperty != null) {
- semanticElementsBeingParsed.add(flowProperty);
- }
- }
- return semanticElementsBeingParsed;
- }
-
- public Map<Integer, String> getMasks() {
- Map<Integer, String> masks = new HashMap<Integer, String>(10);
- masks.put(ILabelPreferenceConstants.DISP_DIRECTION, "Direction");
- masks.put(ILabelPreferenceConstants.DISP_VISIBILITY, "Visibility");
- masks.put(ILabelPreferenceConstants.DISP_DERIVE, "Is Derived");
- masks.put(ILabelPreferenceConstants.DISP_NAME, "Name");
- masks.put(ILabelPreferenceConstants.DISP_TYPE, "Type");
- masks.put(ILabelPreferenceConstants.DISP_UNDEFINED_TYPE, "Show <Undefined> type");
- masks.put(ILabelPreferenceConstants.DISP_MULTIPLICITY, "Multiplicity");
- masks.put(ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY, "Show default multiplicity");
- masks.put(ILabelPreferenceConstants.DISP_DEFAULTVALUE, "Default Value");
- masks.put(ILabelPreferenceConstants.DISP_MODIFIERS, "Modifiers");
- return masks;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.common.parser;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants;
+import org.eclipse.papyrus.sysml.portandflows.FlowDirection;
+import org.eclipse.papyrus.sysml.portandflows.FlowProperty;
+import org.eclipse.papyrus.sysml.portandflows.PortandflowsPackage;
+import org.eclipse.papyrus.uml.diagram.common.parser.PropertyLabelParser;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.util.UMLUtil;
+
+/**
+ * Semantic Parser for {@link FlowProperty}
+ */
+public class FlowPropertyLabelParser extends PropertyLabelParser {
+
+ /** The String format for displaying a FlowProperty with direction */
+ protected static final String DIRECTION_FORMAT = "%s %s";
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getPrintString(IAdaptable element, int flags) {
+
+ if (flags == 0) {
+ return MaskedLabel;
+ }
+
+ String result = super.getPrintString(element, flags);
+
+ EObject eObject = (EObject)element.getAdapter(EObject.class);
+ if((eObject != null) && (eObject instanceof Property)) {
+
+ Property property = (Property)eObject;
+ FlowProperty flowProperty = UMLUtil.getStereotypeApplication(property, FlowProperty.class);
+ if(flowProperty != null) {
+
+ // manage direction
+ if((flags & ILabelPreferenceConstants.DISP_DIRECTION) == ILabelPreferenceConstants.DISP_DIRECTION) {
+ String direction;
+ switch(flowProperty.getDirection().getValue()) {
+ case FlowDirection.IN_VALUE:
+ direction = "in";
+ break;
+ case FlowDirection.OUT_VALUE:
+ direction = "out";
+ break;
+ case FlowDirection.INOUT_VALUE:
+ direction = "inout";
+ break;
+ default:
+ direction = "inout";
+ break;
+ }
+ result = String.format(DIRECTION_FORMAT, direction, result);
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isAffectingEvent(Object event, int flags) {
+
+ if(event instanceof Notification) {
+ Object feature = ((Notification)event).getFeature();
+ if(feature instanceof EStructuralFeature) {
+ return PortandflowsPackage.eINSTANCE.getFlowProperty_Direction().equals(feature) || super.isAffectingEvent(event, flags);
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<EObject> getSemanticElementsBeingParsed(EObject element) {
+ List<EObject> semanticElementsBeingParsed = super.getSemanticElementsBeingParsed(element);
+
+ if((element != null) && (element instanceof Property)) {
+ Property semElement = (Property)element;
+
+ FlowProperty flowProperty = UMLUtil.getStereotypeApplication(semElement, FlowProperty.class);
+ if(flowProperty != null) {
+ semanticElementsBeingParsed.add(flowProperty);
+ }
+ }
+ return semanticElementsBeingParsed;
+ }
+
+ public Map<Integer, String> getMasks() {
+ Map<Integer, String> masks = new HashMap<Integer, String>(10);
+ masks.put(ILabelPreferenceConstants.DISP_DIRECTION, "Direction");
+ masks.put(ILabelPreferenceConstants.DISP_VISIBILITY, "Visibility");
+ masks.put(ILabelPreferenceConstants.DISP_DERIVE, "Is Derived");
+ masks.put(ILabelPreferenceConstants.DISP_NAME, "Name");
+ masks.put(ILabelPreferenceConstants.DISP_TYPE, "Type");
+ masks.put(ILabelPreferenceConstants.DISP_UNDEFINED_TYPE, "Show <Undefined> type");
+ masks.put(ILabelPreferenceConstants.DISP_MULTIPLICITY, "Multiplicity");
+ masks.put(ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY, "Show default multiplicity");
+ masks.put(ILabelPreferenceConstants.DISP_DEFAULTVALUE, "Default Value");
+ masks.put(ILabelPreferenceConstants.DISP_MODIFIERS, "Modifiers");
+ return masks;
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/RequirementLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/RequirementLabelParser.java
index a67c76c689b..f41231b13cf 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/RequirementLabelParser.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/RequirementLabelParser.java
@@ -1,89 +1,89 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.common.parser;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants;
-import org.eclipse.papyrus.sysml.requirements.Requirement;
-import org.eclipse.papyrus.uml.diagram.common.parser.NamedElementLabelParser;
-import org.eclipse.uml2.uml.Class;
-import org.eclipse.uml2.uml.util.UMLUtil;
-
-/**
- * Semantic Parser for {@link Requirement}
- */
-public class RequirementLabelParser extends NamedElementLabelParser {
-
- /** The String format for displaying a Requirement name */
- protected static final String NAME_FORMAT = "%s";
-
- /** The String format for displaying a FlowProperty with direction */
- protected static final String ID_FORMAT = "%s{id = %s}";
-
- /**
- * {@inheritDoc}
- */
- public String getPrintString(IAdaptable element, int flags) {
-
- String result = "";
- EObject eObject = (EObject)element.getAdapter(EObject.class);
-
- if((eObject != null) && (eObject instanceof Class)) {
-
- Class clazz = (Class)eObject;
- Requirement requirement = UMLUtil.getStereotypeApplication(clazz, Requirement.class);
-
- // manage name
- if((flags & ILabelPreferenceConstants.DISP_NAME) == ILabelPreferenceConstants.DISP_NAME) {
- String name = clazz.getName();
- result = String.format(NAME_FORMAT, name);
- }
-
-
- if(requirement != null) {
-
- // manage id
- if((flags & ILabelPreferenceConstants.DISP_ID) == ILabelPreferenceConstants.DISP_ID) {
- String id = requirement.getId();
- result = String.format(ID_FORMAT, result, id);
- }
- }
- }
-
- return result;
- }
-
- /**
- * {@inheritDoc}
- */
- public List<EObject> getSemanticElementsBeingParsed(EObject element) {
- List<EObject> semanticElementsBeingParsed = new ArrayList<EObject>();
-
- if((element != null) && (element instanceof Class)) {
- Class semElement = (Class)element;
-
- semanticElementsBeingParsed.add(semElement);
-
- Requirement requirement = UMLUtil.getStereotypeApplication(semElement, Requirement.class);
- if(requirement != null) {
- semanticElementsBeingParsed.add(requirement);
- }
- }
- return semanticElementsBeingParsed;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.common.parser;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants;
+import org.eclipse.papyrus.sysml.requirements.Requirement;
+import org.eclipse.papyrus.uml.diagram.common.parser.NamedElementLabelParser;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.util.UMLUtil;
+
+/**
+ * Semantic Parser for {@link Requirement}
+ */
+public class RequirementLabelParser extends NamedElementLabelParser {
+
+ /** The String format for displaying a Requirement name */
+ protected static final String NAME_FORMAT = "%s";
+
+ /** The String format for displaying a FlowProperty with direction */
+ protected static final String ID_FORMAT = "%s{id = %s}";
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getPrintString(IAdaptable element, int flags) {
+
+ String result = "";
+ EObject eObject = (EObject)element.getAdapter(EObject.class);
+
+ if((eObject != null) && (eObject instanceof Class)) {
+
+ Class clazz = (Class)eObject;
+ Requirement requirement = UMLUtil.getStereotypeApplication(clazz, Requirement.class);
+
+ // manage name
+ if((flags & ILabelPreferenceConstants.DISP_NAME) == ILabelPreferenceConstants.DISP_NAME) {
+ String name = clazz.getName();
+ result = String.format(NAME_FORMAT, name);
+ }
+
+
+ if(requirement != null) {
+
+ // manage id
+ if((flags & ILabelPreferenceConstants.DISP_ID) == ILabelPreferenceConstants.DISP_ID) {
+ String id = requirement.getId();
+ result = String.format(ID_FORMAT, result, id);
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public List<EObject> getSemanticElementsBeingParsed(EObject element) {
+ List<EObject> semanticElementsBeingParsed = new ArrayList<EObject>();
+
+ if((element != null) && (element instanceof Class)) {
+ Class semElement = (Class)element;
+
+ semanticElementsBeingParsed.add(semElement);
+
+ Requirement requirement = UMLUtil.getStereotypeApplication(semElement, Requirement.class);
+ if(requirement != null) {
+ semanticElementsBeingParsed.add(requirement);
+ }
+ }
+ return semanticElementsBeingParsed;
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/UnitLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/UnitLabelParser.java
index c0e335954f7..66141a680b9 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/UnitLabelParser.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/UnitLabelParser.java
@@ -1,126 +1,126 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.common.parser;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.papyrus.sysml.blocks.BlocksPackage;
-import org.eclipse.papyrus.sysml.blocks.Dimension;
-import org.eclipse.papyrus.sysml.blocks.Unit;
-import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants;
-import org.eclipse.papyrus.uml.diagram.common.parser.NamedElementLabelParser;
-import org.eclipse.uml2.uml.InstanceSpecification;
-import org.eclipse.uml2.uml.util.UMLUtil;
-
-/**
- * Semantic Parser for {@link Unit}
- */
-public class UnitLabelParser extends NamedElementLabelParser {
-
- /** The String format for displaying a {@link Unit} label with its name */
- protected static final String NAME_FORMAT = "%s";
-
- /** The String format for displaying a {@link Unit} with direction */
- protected static final String DIMENSION_FORMAT = "%s {%s}";
-
- /**
- * {@inheritDoc}
- */
- public String getPrintString(IAdaptable element, int flags) {
-
- if (flags == 0) {
- return MaskedLabel;
- }
-
- String result = "";
- EObject eObject = (EObject)element.getAdapter(EObject.class);
-
- if((eObject != null) && (eObject instanceof InstanceSpecification)) {
-
- InstanceSpecification iSpec = (InstanceSpecification)eObject;
-
- Unit unit = UMLUtil.getStereotypeApplication(iSpec, Unit.class);
-
- // manage name
- if(((flags & ILabelPreferenceConstants.DISP_NAME) == ILabelPreferenceConstants.DISP_NAME) && (iSpec.isSetName())) {
- String name = iSpec.getName();
- result = String.format(NAME_FORMAT, name);
- }
-
- // manage dimension
- if(((flags & ILabelPreferenceConstants.DISP_DIMENSION) == ILabelPreferenceConstants.DISP_DIMENSION)) {
- String dimensionName = "<Undefined>";
- if((unit != null) && (unit.getDimension() != null)) {
- Dimension dim = unit.getDimension();
- if((dim.getBase_InstanceSpecification() != null) && (dim.getBase_InstanceSpecification().isSetName())) {
- dimensionName = dim.getBase_InstanceSpecification().getName();
- }
- }
- result = String.format(DIMENSION_FORMAT, result, dimensionName);
- }
-
- }
-
- return result;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isAffectingEvent(Object event, int flags) {
-
- if(event instanceof Notification) {
- Object feature = ((Notification)event).getFeature();
- if(feature instanceof EStructuralFeature) {
- return BlocksPackage.eINSTANCE.getUnit_Dimension().equals(feature) || super.isAffectingEvent(event, flags);
- }
- }
-
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- public List<EObject> getSemanticElementsBeingParsed(EObject element) {
- List<EObject> semanticElementsBeingParsed = new ArrayList<EObject>();
-
- if((element != null) && (element instanceof InstanceSpecification)) {
- InstanceSpecification semElement = (InstanceSpecification)element;
-
- semanticElementsBeingParsed.add(semElement);
-
- Unit unit = UMLUtil.getStereotypeApplication(semElement, Unit.class);
- if(unit != null) {
- semanticElementsBeingParsed.add(unit);
- }
- }
- return semanticElementsBeingParsed;
- }
-
-
- public Map<Integer, String> getMasks() {
- Map<Integer, String> masks = new HashMap<Integer, String>(2);
- masks.put(ILabelPreferenceConstants.DISP_NAME, "Name");
- masks.put(ILabelPreferenceConstants.DISP_DIMENSION, "Dimension");
- return masks;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.common.parser;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.papyrus.sysml.blocks.BlocksPackage;
+import org.eclipse.papyrus.sysml.blocks.Dimension;
+import org.eclipse.papyrus.sysml.blocks.Unit;
+import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants;
+import org.eclipse.papyrus.uml.diagram.common.parser.NamedElementLabelParser;
+import org.eclipse.uml2.uml.InstanceSpecification;
+import org.eclipse.uml2.uml.util.UMLUtil;
+
+/**
+ * Semantic Parser for {@link Unit}
+ */
+public class UnitLabelParser extends NamedElementLabelParser {
+
+ /** The String format for displaying a {@link Unit} label with its name */
+ protected static final String NAME_FORMAT = "%s";
+
+ /** The String format for displaying a {@link Unit} with direction */
+ protected static final String DIMENSION_FORMAT = "%s {%s}";
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getPrintString(IAdaptable element, int flags) {
+
+ if (flags == 0) {
+ return MaskedLabel;
+ }
+
+ String result = "";
+ EObject eObject = (EObject)element.getAdapter(EObject.class);
+
+ if((eObject != null) && (eObject instanceof InstanceSpecification)) {
+
+ InstanceSpecification iSpec = (InstanceSpecification)eObject;
+
+ Unit unit = UMLUtil.getStereotypeApplication(iSpec, Unit.class);
+
+ // manage name
+ if(((flags & ILabelPreferenceConstants.DISP_NAME) == ILabelPreferenceConstants.DISP_NAME) && (iSpec.isSetName())) {
+ String name = iSpec.getName();
+ result = String.format(NAME_FORMAT, name);
+ }
+
+ // manage dimension
+ if(((flags & ILabelPreferenceConstants.DISP_DIMENSION) == ILabelPreferenceConstants.DISP_DIMENSION)) {
+ String dimensionName = "<Undefined>";
+ if((unit != null) && (unit.getDimension() != null)) {
+ Dimension dim = unit.getDimension();
+ if((dim.getBase_InstanceSpecification() != null) && (dim.getBase_InstanceSpecification().isSetName())) {
+ dimensionName = dim.getBase_InstanceSpecification().getName();
+ }
+ }
+ result = String.format(DIMENSION_FORMAT, result, dimensionName);
+ }
+
+ }
+
+ return result;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isAffectingEvent(Object event, int flags) {
+
+ if(event instanceof Notification) {
+ Object feature = ((Notification)event).getFeature();
+ if(feature instanceof EStructuralFeature) {
+ return BlocksPackage.eINSTANCE.getUnit_Dimension().equals(feature) || super.isAffectingEvent(event, flags);
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public List<EObject> getSemanticElementsBeingParsed(EObject element) {
+ List<EObject> semanticElementsBeingParsed = new ArrayList<EObject>();
+
+ if((element != null) && (element instanceof InstanceSpecification)) {
+ InstanceSpecification semElement = (InstanceSpecification)element;
+
+ semanticElementsBeingParsed.add(semElement);
+
+ Unit unit = UMLUtil.getStereotypeApplication(semElement, Unit.class);
+ if(unit != null) {
+ semanticElementsBeingParsed.add(unit);
+ }
+ }
+ return semanticElementsBeingParsed;
+ }
+
+
+ public Map<Integer, String> getMasks() {
+ Map<Integer, String> masks = new HashMap<Integer, String>(2);
+ masks.put(ILabelPreferenceConstants.DISP_NAME, "Name");
+ masks.put(ILabelPreferenceConstants.DISP_DIMENSION, "Dimension");
+ return masks;
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/preferences/ILabelPreferenceConstants.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/preferences/ILabelPreferenceConstants.java
index 8409519101e..6711d85583c 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/preferences/ILabelPreferenceConstants.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/preferences/ILabelPreferenceConstants.java
@@ -1,89 +1,89 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.common.preferences;
-
-/**
- * Label constants for label mask preferences.
- */
-public interface ILabelPreferenceConstants {
-
- /** preference id for display labels */
- public String LABEL_DISPLAY_PREFERENCE = "label.display";
-
- /** Style constant for visibility display in labels. */
- public final static int DISP_VISIBILITY = 1 << 1;
-
- /** Style constant for isDerive display in labels. */
- public final static int DISP_DERIVE = 1 << 2;
-
- /** Style constant for name display in labels. */
- public final static int DISP_NAME = 1 << 3;
-
- /** Style constant for type display in labels. */
- public final static int DISP_TYPE = 1 << 4;
-
- /** Style constant for multiplicity display in labels. */
- public final static int DISP_MULTIPLICITY = 1 << 5;
-
- /** Style constant for default value display in labels. */
- public final static int DISP_DEFAULTVALUE = 1 << 6;
-
- /** Style constant for modifiers display in labels. */
- public final static int DISP_MODIFIERS = 1 << 7;
-
- /** Style constant for direction display in labels. */
- public final static int DISP_DIRECTION = 1 << 8;
-
- /** Style constant for conjugated info display in labels. */
- public final static int DISP_CONJUGATED = 1 << 9;
-
- /** Style constant for id info display in labels. */
- public final static int DISP_ID = 1 << 10;
-
- /** Style constant for dimension info display in labels. */
- public final static int DISP_DIMENSION = 1 << 11;
-
- /** Style constant for specification info display in labels. */
- public final static int DISP_SPECIFICATION = 1 << 12;
-
- /** Style constant for signal info display in labels. */
- public final static int DISP_SIGNAL = 1 << 13;
-
- /** Style constant for parameter name display in labels. */
- public final static int DISP_PARAM_NAME = 1 << 14;
-
- /** Style constant for parameter type display in labels. */
- public final static int DISP_PARAM_TYPE = 1 << 15;
-
- /** Style constant for parameter multiplicity display in labels. */
- public final static int DISP_PARAM_MULTIPLICITY = 1 << 16;
-
- /** Style constant for parameter default value display in labels. */
- public final static int DISP_PARAM_DEFAULTVALUE = 1 << 17;
-
- /** Style constant for parameter modifiers display in labels. */
- public final static int DISP_PARAM_MODIFIERS = 1 << 18;
-
- /** Style constant for parameter direction display in labels. */
- public final static int DISP_PARAM_DIRECTION = 1 << 19;
-
- /** Style constant forcing multiplicity display in labels. */
- public final static int DISP_DEFAULT_MULTIPLICITY = 1 << 20;
-
- /** Style constant forcing type display in labels. */
- public final static int DISP_UNDEFINED_TYPE = 1 << 21;
-
- /** Style constant forcing name display in labels. */
- public final static int DISP_NON_NAVIGABLE_ROLE = 1 << 22;
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.common.preferences;
+
+/**
+ * Label constants for label mask preferences.
+ */
+public interface ILabelPreferenceConstants {
+
+ /** preference id for display labels */
+ public String LABEL_DISPLAY_PREFERENCE = "label.display";
+
+ /** Style constant for visibility display in labels. */
+ public final static int DISP_VISIBILITY = 1 << 1;
+
+ /** Style constant for isDerive display in labels. */
+ public final static int DISP_DERIVE = 1 << 2;
+
+ /** Style constant for name display in labels. */
+ public final static int DISP_NAME = 1 << 3;
+
+ /** Style constant for type display in labels. */
+ public final static int DISP_TYPE = 1 << 4;
+
+ /** Style constant for multiplicity display in labels. */
+ public final static int DISP_MULTIPLICITY = 1 << 5;
+
+ /** Style constant for default value display in labels. */
+ public final static int DISP_DEFAULTVALUE = 1 << 6;
+
+ /** Style constant for modifiers display in labels. */
+ public final static int DISP_MODIFIERS = 1 << 7;
+
+ /** Style constant for direction display in labels. */
+ public final static int DISP_DIRECTION = 1 << 8;
+
+ /** Style constant for conjugated info display in labels. */
+ public final static int DISP_CONJUGATED = 1 << 9;
+
+ /** Style constant for id info display in labels. */
+ public final static int DISP_ID = 1 << 10;
+
+ /** Style constant for dimension info display in labels. */
+ public final static int DISP_DIMENSION = 1 << 11;
+
+ /** Style constant for specification info display in labels. */
+ public final static int DISP_SPECIFICATION = 1 << 12;
+
+ /** Style constant for signal info display in labels. */
+ public final static int DISP_SIGNAL = 1 << 13;
+
+ /** Style constant for parameter name display in labels. */
+ public final static int DISP_PARAM_NAME = 1 << 14;
+
+ /** Style constant for parameter type display in labels. */
+ public final static int DISP_PARAM_TYPE = 1 << 15;
+
+ /** Style constant for parameter multiplicity display in labels. */
+ public final static int DISP_PARAM_MULTIPLICITY = 1 << 16;
+
+ /** Style constant for parameter default value display in labels. */
+ public final static int DISP_PARAM_DEFAULTVALUE = 1 << 17;
+
+ /** Style constant for parameter modifiers display in labels. */
+ public final static int DISP_PARAM_MODIFIERS = 1 << 18;
+
+ /** Style constant for parameter direction display in labels. */
+ public final static int DISP_PARAM_DIRECTION = 1 << 19;
+
+ /** Style constant forcing multiplicity display in labels. */
+ public final static int DISP_DEFAULT_MULTIPLICITY = 1 << 20;
+
+ /** Style constant forcing type display in labels. */
+ public final static int DISP_UNDEFINED_TYPE = 1 << 21;
+
+ /** Style constant forcing name display in labels. */
+ public final static int DISP_NON_NAVIGABLE_ROLE = 1 << 22;
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/preferences/LabelPreferenceHelper.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/preferences/LabelPreferenceHelper.java
index 0e17b58d5ea..b748bc77fe8 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/preferences/LabelPreferenceHelper.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/preferences/LabelPreferenceHelper.java
@@ -1,50 +1,50 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.common.preferences;
-
-/**
- * Utility class for building label preference constants.
- */
-public class LabelPreferenceHelper {
-
- /**
- * Create the preference constant for a label view.
- *
- * @param diagramType
- * the type of diagram
- * @param viewType
- * the type of the view
- * @param constantPreferenceKey
- * the constant key of the preference to retrieve
- * @return the complete preference key
- * @deprecated see https://bugs.eclipse.org/bugs/show_bug.cgi?id=353193
- */
- @Deprecated
- public static String getPreferenceConstant(String diagramType, String viewType, String constantPreferenceKey) {
- return diagramType + '_' + viewType + '.' + constantPreferenceKey;
- }
-
- /**
- * Create the preference constant for a label view.
- *
- * @param elementkey
- * the element key (including diagram hint)
- * @param constantPreferenceKey
- * the constant key of the preference to retrieve
- * @return the complete preference key
- */
- public static String getPreferenceConstant(String elementkey, String constantPreferenceKey) {
- return elementkey + '.' + constantPreferenceKey;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.common.preferences;
+
+/**
+ * Utility class for building label preference constants.
+ */
+public class LabelPreferenceHelper {
+
+ /**
+ * Create the preference constant for a label view.
+ *
+ * @param diagramType
+ * the type of diagram
+ * @param viewType
+ * the type of the view
+ * @param constantPreferenceKey
+ * the constant key of the preference to retrieve
+ * @return the complete preference key
+ * @deprecated see https://bugs.eclipse.org/bugs/show_bug.cgi?id=353193
+ */
+ @Deprecated
+ public static String getPreferenceConstant(String diagramType, String viewType, String constantPreferenceKey) {
+ return diagramType + '_' + viewType + '.' + constantPreferenceKey;
+ }
+
+ /**
+ * Create the preference constant for a label view.
+ *
+ * @param elementkey
+ * the element key (including diagram hint)
+ * @param constantPreferenceKey
+ * the constant key of the preference to retrieve
+ * @return the complete preference key
+ */
+ public static String getPreferenceConstant(String elementkey, String constantPreferenceKey) {
+ return elementkey + '.' + constantPreferenceKey;
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/dnd/helper/LinkMappingHelper.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/dnd/helper/LinkMappingHelper.java
index 3ca34d31c52..93dbf89a877 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/dnd/helper/LinkMappingHelper.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/dnd/helper/LinkMappingHelper.java
@@ -1,156 +1,156 @@
-/*****************************************************************************
- * Copyright (c) 2009 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - refactor common behavior between diagrams
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.dnd.helper;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.papyrus.gmf.diagram.common.edit.policy.ILinkMappingHelper;
-import org.eclipse.uml2.uml.util.UMLSwitch;
-
-/**
- * Original class {@link org.eclipse.papyrus.uml.diagram.common.helper.LinkMappingHelper} slightly
- * modified to use EObject instead of UML Element in its interface.
- */
-public class LinkMappingHelper implements ILinkMappingHelper {
-
- /**
- * {@inheritDoc}
- */
- public Collection<?> getSource(EObject link) {
- CommonSourceUMLSwitch umlSwitch = new CommonSourceUMLSwitch();
- return umlSwitch.doSwitch(link);
- }
-
- /**
- * {@inheritDoc}
- */
- public Collection<?> getTarget(EObject link) {
- CommonTargetUMLSwitch umlSwitch = new CommonTargetUMLSwitch();
- return umlSwitch.doSwitch(link);
- }
-
- /**
- * Contains diagrams common behavior that need to be redefined
- *
- * @author eperico
- */
- public static class CommonSourceUMLSwitch extends UMLSwitch<Collection<?>> {
-
- @Override
- public java.util.Collection<?> caseAssociation(org.eclipse.uml2.uml.Association object) {
- return object.getEndTypes();
- };
-
- @Override
- public java.util.Collection<?> caseComment(org.eclipse.uml2.uml.Comment object) {
- ArrayList<EObject> result = new ArrayList<EObject>();
- result.add(object);
- return result;
- };
-
- @Override
- public Collection<?> caseDependency(org.eclipse.uml2.uml.Dependency object) {
- return object.getClients();
- };
-
- @Override
- public java.util.Collection<?> caseGeneralization(org.eclipse.uml2.uml.Generalization object) {
- ArrayList<EObject> result = new ArrayList<EObject>();
- result.add(object.getOwner());
- return result;
- };
-
- @Override
- public java.util.Collection<?> casePackageMerge(org.eclipse.uml2.uml.PackageMerge object) {
- ArrayList<EObject> result = new ArrayList<EObject>();
- result.add(object.getReceivingPackage());
- return result;
- };
-
- @Override
- public java.util.Collection<?> casePackageImport(org.eclipse.uml2.uml.PackageImport object) {
- ArrayList<EObject> result = new ArrayList<EObject>();
- result.add(object.getImportingNamespace());
- return result;
- };
-
- @Override
- public Collection<?> caseInformationFlow(org.eclipse.uml2.uml.InformationFlow object) {
- return object.getInformationSources();
- };
-
- @Override
- public Collection<?> defaultCase(org.eclipse.emf.ecore.EObject object) {
- return Collections.EMPTY_LIST;
- };
- }
-
- /**
- * Contains diagrams common behavior that need to be redefined
- *
- * @author eperico
- */
- public static class CommonTargetUMLSwitch extends UMLSwitch<Collection<?>> {
-
- @Override
- public java.util.Collection<?> caseAssociation(org.eclipse.uml2.uml.Association object) {
- return object.getEndTypes();
- };
-
- @Override
- public java.util.Collection<?> caseComment(org.eclipse.uml2.uml.Comment object) {
- return object.getAnnotatedElements();
- };
-
- @Override
- public Collection<?> caseDependency(org.eclipse.uml2.uml.Dependency object) {
- return object.getSuppliers();
- };
-
- @Override
- public java.util.Collection<?> caseGeneralization(org.eclipse.uml2.uml.Generalization object) {
- ArrayList<EObject> result = new ArrayList<EObject>();
- result.add(object.getGeneral());
- return result;
- };
-
- @Override
- public java.util.Collection<?> casePackageMerge(org.eclipse.uml2.uml.PackageMerge object) {
- ArrayList<EObject> result = new ArrayList<EObject>();
- result.add(object.getMergedPackage());
- return result;
- };
-
- @Override
- public java.util.Collection<?> casePackageImport(org.eclipse.uml2.uml.PackageImport object) {
- ArrayList<EObject> result = new ArrayList<EObject>();
- result.add(object.getImportedPackage());
- return result;
- };
-
- @Override
- public Collection<?> caseInformationFlow(org.eclipse.uml2.uml.InformationFlow object) {
- return object.getInformationTargets();
- };
-
- @Override
- public Collection<?> defaultCase(org.eclipse.emf.ecore.EObject object) {
- return Collections.EMPTY_LIST;
- };
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2009 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - refactor common behavior between diagrams
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.dnd.helper;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.gmf.diagram.common.edit.policy.ILinkMappingHelper;
+import org.eclipse.uml2.uml.util.UMLSwitch;
+
+/**
+ * Original class {@link org.eclipse.papyrus.uml.diagram.common.helper.LinkMappingHelper} slightly
+ * modified to use EObject instead of UML Element in its interface.
+ */
+public class LinkMappingHelper implements ILinkMappingHelper {
+
+ /**
+ * {@inheritDoc}
+ */
+ public Collection<?> getSource(EObject link) {
+ CommonSourceUMLSwitch umlSwitch = new CommonSourceUMLSwitch();
+ return umlSwitch.doSwitch(link);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Collection<?> getTarget(EObject link) {
+ CommonTargetUMLSwitch umlSwitch = new CommonTargetUMLSwitch();
+ return umlSwitch.doSwitch(link);
+ }
+
+ /**
+ * Contains diagrams common behavior that need to be redefined
+ *
+ * @author eperico
+ */
+ public static class CommonSourceUMLSwitch extends UMLSwitch<Collection<?>> {
+
+ @Override
+ public java.util.Collection<?> caseAssociation(org.eclipse.uml2.uml.Association object) {
+ return object.getEndTypes();
+ };
+
+ @Override
+ public java.util.Collection<?> caseComment(org.eclipse.uml2.uml.Comment object) {
+ ArrayList<EObject> result = new ArrayList<EObject>();
+ result.add(object);
+ return result;
+ };
+
+ @Override
+ public Collection<?> caseDependency(org.eclipse.uml2.uml.Dependency object) {
+ return object.getClients();
+ };
+
+ @Override
+ public java.util.Collection<?> caseGeneralization(org.eclipse.uml2.uml.Generalization object) {
+ ArrayList<EObject> result = new ArrayList<EObject>();
+ result.add(object.getOwner());
+ return result;
+ };
+
+ @Override
+ public java.util.Collection<?> casePackageMerge(org.eclipse.uml2.uml.PackageMerge object) {
+ ArrayList<EObject> result = new ArrayList<EObject>();
+ result.add(object.getReceivingPackage());
+ return result;
+ };
+
+ @Override
+ public java.util.Collection<?> casePackageImport(org.eclipse.uml2.uml.PackageImport object) {
+ ArrayList<EObject> result = new ArrayList<EObject>();
+ result.add(object.getImportingNamespace());
+ return result;
+ };
+
+ @Override
+ public Collection<?> caseInformationFlow(org.eclipse.uml2.uml.InformationFlow object) {
+ return object.getInformationSources();
+ };
+
+ @Override
+ public Collection<?> defaultCase(org.eclipse.emf.ecore.EObject object) {
+ return Collections.EMPTY_LIST;
+ };
+ }
+
+ /**
+ * Contains diagrams common behavior that need to be redefined
+ *
+ * @author eperico
+ */
+ public static class CommonTargetUMLSwitch extends UMLSwitch<Collection<?>> {
+
+ @Override
+ public java.util.Collection<?> caseAssociation(org.eclipse.uml2.uml.Association object) {
+ return object.getEndTypes();
+ };
+
+ @Override
+ public java.util.Collection<?> caseComment(org.eclipse.uml2.uml.Comment object) {
+ return object.getAnnotatedElements();
+ };
+
+ @Override
+ public Collection<?> caseDependency(org.eclipse.uml2.uml.Dependency object) {
+ return object.getSuppliers();
+ };
+
+ @Override
+ public java.util.Collection<?> caseGeneralization(org.eclipse.uml2.uml.Generalization object) {
+ ArrayList<EObject> result = new ArrayList<EObject>();
+ result.add(object.getGeneral());
+ return result;
+ };
+
+ @Override
+ public java.util.Collection<?> casePackageMerge(org.eclipse.uml2.uml.PackageMerge object) {
+ ArrayList<EObject> result = new ArrayList<EObject>();
+ result.add(object.getMergedPackage());
+ return result;
+ };
+
+ @Override
+ public java.util.Collection<?> casePackageImport(org.eclipse.uml2.uml.PackageImport object) {
+ ArrayList<EObject> result = new ArrayList<EObject>();
+ result.add(object.getImportedPackage());
+ return result;
+ };
+
+ @Override
+ public Collection<?> caseInformationFlow(org.eclipse.uml2.uml.InformationFlow object) {
+ return object.getInformationTargets();
+ };
+
+ @Override
+ public Collection<?> defaultCase(org.eclipse.emf.ecore.EObject object) {
+ return Collections.EMPTY_LIST;
+ };
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementBorderEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementBorderEditPart.java
index a140dd5beaf..e3f9c410d81 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementBorderEditPart.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementBorderEditPart.java
@@ -1,228 +1,228 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.edit.part;
-
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.StackLayout;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.editpolicies.LayoutEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
-import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
-import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
-import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
-import org.eclipse.gmf.runtime.notation.Edge;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceConverter;
-import org.eclipse.papyrus.gmf.diagram.common.edit.policy.DefaultGraphicalNodeEditPolicy;
-import org.eclipse.papyrus.gmf.diagram.common.edit.policy.DefaultSemanticEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
-import org.eclipse.papyrus.sysml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractBorderEditPart;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.AffixedNamedElementFigure;
-import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * Abstract non-diagram specific edit part for border node.
- * This class is adapted from edit parts generated by GMF Tooling.
- */
-public abstract class AbstractElementBorderEditPart extends AbstractBorderEditPart {
-
- protected IFigure contentPane;
-
- protected IFigure primaryShape;
-
- public AbstractElementBorderEditPart(View view) {
- super(view);
- }
-
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
- installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- }
-
- protected abstract LayoutEditPolicy createLayoutEditPolicy();
-
- protected IFigure createNodeShape() {
- return primaryShape = new AffixedNamedElementFigure();
- }
-
- public AffixedNamedElementFigure getPrimaryShape() {
- return (AffixedNamedElementFigure)primaryShape;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if(parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator)constraint;
- }
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void handleNotificationEvent(Notification event) {
- // When a node has external node labels, the methods refreshChildren() removes the label's
- // edit part from the registry. Once removed from the registry the visibility cannot be set back to visible.
-
- // Copied from generated code for Affixed nodes to fix:
- // 366504: [SysML Block Definition Diagram] Cannot make masked labels of border items (Port) visible
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=366504
- // 366503: [SysML Internal Block Diagram] Cannot make masked labels of border items (Port) visible
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=366503
-
- // (this sounds strange as the "Show all labels" manages to get labels back without trouble...).
- if(NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) {
- Object notifier = event.getNotifier();
- List<?> modelChildren = ((View)getModel()).getChildren();
- if(!(notifier instanceof Edge)) {
- if(modelChildren.contains(event.getNotifier())) {
- return;
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void refreshBounds() {
- if(getBorderItemLocator() != null) {
- int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- Point loc = new Point(x, y);
-
- int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- Dimension size = new Dimension(width, height);
-
- // Update locator constraint
- IBorderItemLocator locator = getBorderItemLocator();
- locator.setConstraint(new Rectangle(loc, size));
-
- // Set new constraint on parent figure
- getFigure().getParent().setConstraint(getFigure(), locator);
-
- } else {
- super.refreshBounds();
- }
- }
-
- protected NodeFigure createNodePlate() {
- String prefElementId = getNotationView().getType();
- IPreferenceStore store = Activator.getInstance().getPreferenceStore();
- String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.WIDTH);
- String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.HEIGHT);
- DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
-
- //FIXME: workaround for #154536
- result.getBounds().setSize(result.getPreferredSize());
- return result;
- }
-
- protected NodeFigure createMainFigure() {
- NodeFigure figure = createNodePlate();
- figure.setLayoutManager(new StackLayout());
- IFigure shape = createNodeShape();
- figure.add(shape);
- contentPane = setupContentPane(shape);
- return figure;
- }
-
- protected IFigure setupContentPane(IFigure nodeShape) {
- return nodeShape; // use nodeShape itself as contentPane
- }
-
- /**
- * @generated
- */
- public IFigure getContentPane() {
- if(contentPane != null) {
- return contentPane;
- }
- return super.getContentPane();
- }
-
- protected void setForegroundColor(Color color) {
- if(primaryShape != null) {
- primaryShape.setForegroundColor(color);
- }
- }
-
- public abstract EditPart getPrimaryChildEditPart();
-
- @Override
- public Object getPreferredValue(EStructuralFeature feature) {
- String prefKey = getNotationView().getType();
-
- IPreferenceStore store = (IPreferenceStore)getDiagramPreferencesHint().getPreferenceStore();
- Object result = null;
-
- if(feature == NotationPackage.eINSTANCE.getLineStyle_LineColor() || feature == NotationPackage.eINSTANCE.getFontStyle_FontColor() || feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
-
- String prefColor = null;
- if(feature == NotationPackage.eINSTANCE.getLineStyle_LineColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant(prefKey, PreferenceConstantHelper.COLOR_LINE);
-
- } else if(feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant(prefKey, PreferenceConstantHelper.COLOR_FONT);
-
- } else if(feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant(prefKey, PreferenceConstantHelper.COLOR_FILL);
-
- }
- result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor((IPreferenceStore)store, prefColor));
-
- } else if(feature == NotationPackage.eINSTANCE.getFillStyle_Transparency() || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
-
- String prefGradient = PreferenceConstantHelper.getElementConstant(prefKey, PreferenceConstantHelper.COLOR_GRADIENT);
- GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(store.getString(prefGradient));
- if(feature == NotationPackage.eINSTANCE.getFillStyle_Transparency()) {
- result = new Integer(gradientPreferenceConverter.getTransparency());
-
- } else if(feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
- result = gradientPreferenceConverter.getGradientData();
-
- }
- }
-
- if(result == null) {
- result = getStructuralFeatureValue(feature);
- }
- return result;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.edit.part;
+
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.papyrus.gmf.diagram.common.edit.policy.DefaultGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.gmf.diagram.common.edit.policy.DefaultSemanticEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.sysml.diagram.common.Activator;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractBorderEditPart;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.AffixedNamedElementFigure;
+import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * Abstract non-diagram specific edit part for border node.
+ * This class is adapted from edit parts generated by GMF Tooling.
+ */
+public abstract class AbstractElementBorderEditPart extends AbstractBorderEditPart {
+
+ protected IFigure contentPane;
+
+ protected IFigure primaryShape;
+
+ public AbstractElementBorderEditPart(View view) {
+ super(view);
+ }
+
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ }
+
+ protected abstract LayoutEditPolicy createLayoutEditPolicy();
+
+ protected IFigure createNodeShape() {
+ return primaryShape = new AffixedNamedElementFigure();
+ }
+
+ public AffixedNamedElementFigure getPrimaryShape() {
+ return (AffixedNamedElementFigure)primaryShape;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public IBorderItemLocator getBorderItemLocator() {
+ IFigure parentFigure = getFigure().getParent();
+ if(parentFigure != null && parentFigure.getLayoutManager() != null) {
+ Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
+ return (IBorderItemLocator)constraint;
+ }
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void handleNotificationEvent(Notification event) {
+ // When a node has external node labels, the methods refreshChildren() removes the label's
+ // edit part from the registry. Once removed from the registry the visibility cannot be set back to visible.
+
+ // Copied from generated code for Affixed nodes to fix:
+ // 366504: [SysML Block Definition Diagram] Cannot make masked labels of border items (Port) visible
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=366504
+ // 366503: [SysML Internal Block Diagram] Cannot make masked labels of border items (Port) visible
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=366503
+
+ // (this sounds strange as the "Show all labels" manages to get labels back without trouble...).
+ if(NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) {
+ Object notifier = event.getNotifier();
+ List<?> modelChildren = ((View)getModel()).getChildren();
+ if(!(notifier instanceof Edge)) {
+ if(modelChildren.contains(event.getNotifier())) {
+ return;
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void refreshBounds() {
+ if(getBorderItemLocator() != null) {
+ int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ Point loc = new Point(x, y);
+
+ int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
+ int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
+ Dimension size = new Dimension(width, height);
+
+ // Update locator constraint
+ IBorderItemLocator locator = getBorderItemLocator();
+ locator.setConstraint(new Rectangle(loc, size));
+
+ // Set new constraint on parent figure
+ getFigure().getParent().setConstraint(getFigure(), locator);
+
+ } else {
+ super.refreshBounds();
+ }
+ }
+
+ protected NodeFigure createNodePlate() {
+ String prefElementId = getNotationView().getType();
+ IPreferenceStore store = Activator.getInstance().getPreferenceStore();
+ String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.WIDTH);
+ String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.HEIGHT);
+ DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
+
+ //FIXME: workaround for #154536
+ result.getBounds().setSize(result.getPreferredSize());
+ return result;
+ }
+
+ protected NodeFigure createMainFigure() {
+ NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ IFigure shape = createNodeShape();
+ figure.add(shape);
+ contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure getContentPane() {
+ if(contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ protected void setForegroundColor(Color color) {
+ if(primaryShape != null) {
+ primaryShape.setForegroundColor(color);
+ }
+ }
+
+ public abstract EditPart getPrimaryChildEditPart();
+
+ @Override
+ public Object getPreferredValue(EStructuralFeature feature) {
+ String prefKey = getNotationView().getType();
+
+ IPreferenceStore store = (IPreferenceStore)getDiagramPreferencesHint().getPreferenceStore();
+ Object result = null;
+
+ if(feature == NotationPackage.eINSTANCE.getLineStyle_LineColor() || feature == NotationPackage.eINSTANCE.getFontStyle_FontColor() || feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
+
+ String prefColor = null;
+ if(feature == NotationPackage.eINSTANCE.getLineStyle_LineColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant(prefKey, PreferenceConstantHelper.COLOR_LINE);
+
+ } else if(feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant(prefKey, PreferenceConstantHelper.COLOR_FONT);
+
+ } else if(feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant(prefKey, PreferenceConstantHelper.COLOR_FILL);
+
+ }
+ result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor((IPreferenceStore)store, prefColor));
+
+ } else if(feature == NotationPackage.eINSTANCE.getFillStyle_Transparency() || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
+
+ String prefGradient = PreferenceConstantHelper.getElementConstant(prefKey, PreferenceConstantHelper.COLOR_GRADIENT);
+ GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(store.getString(prefGradient));
+ if(feature == NotationPackage.eINSTANCE.getFillStyle_Transparency()) {
+ result = new Integer(gradientPreferenceConverter.getTransparency());
+
+ } else if(feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
+ result = gradientPreferenceConverter.getGradientData();
+
+ }
+ }
+
+ if(result == null) {
+ result = getStructuralFeatureValue(feature);
+ }
+ return result;
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementChildLabelEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementChildLabelEditPart.java
index 56beab793a0..ffa1143c800 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementChildLabelEditPart.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementChildLabelEditPart.java
@@ -1,863 +1,863 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- * Arthur Daussy - arthur.daussy@atos.net - 395920: [Block Diagram Definition] All element contained by a block should be able to be linked to constraint or comment
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.edit.part;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.ConnectionAnchor;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.DragTracker;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.requests.DropRequest;
-import org.eclipse.gef.requests.ReconnectRequest;
-import org.eclipse.gef.requests.SelectionRequest;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gef.tools.SelectEditPartTracker;
-import org.eclipse.gmf.runtime.common.core.util.Log;
-import org.eclipse.gmf.runtime.common.core.util.Trace;
-import org.eclipse.gmf.runtime.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.core.util.ViewUtil;
-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.editparts.INodeEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ConnectionHandleEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ListItemComponentEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIDebugOptions;
-import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIPlugin;
-import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIStatusCodes;
-import org.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.IAnchorableFigure;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.Anchor;
-import org.eclipse.gmf.runtime.notation.Edge;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.IdentityAnchor;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.gmf.diagram.common.edit.part.ITextAwareEditPart;
-import org.eclipse.papyrus.gmf.diagram.common.edit.policy.DefaultGraphicalNodeEditPolicy;
-import org.eclipse.papyrus.gmf.diagram.common.edit.policy.LabelDirectEditPolicy;
-import org.eclipse.papyrus.gmf.diagram.common.edit.policy.TextNonResizableEditPolicy;
-import org.eclipse.papyrus.gmf.diagram.common.edit.policy.TextSelectionEditPolicy;
-import org.eclipse.papyrus.gmf.diagram.common.locator.CellEditorLocatorUtil;
-import org.eclipse.papyrus.infra.emf.appearance.helper.NameLabelIconHelper;
-import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusAnchorableWrappingLabel;
-import org.eclipse.papyrus.sysml.diagram.common.Activator;
-import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants;
-import org.eclipse.papyrus.sysml.diagram.common.preferences.LabelPreferenceHelper;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.edit.policy.MaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.common.parser.DefaultParserHintAdapter;
-import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil;
-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;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Abstract non-diagram specific edit part for child label node.
- * This class is adapted from edit parts generated by GMF Tooling.
- */
-public class AbstractElementChildLabelEditPart extends GraphicalEditPart implements ITextAwareEditPart, IPrimaryEditPart, INodeEditPart {
-
- private DirectEditManager manager;
-
- protected IParser parser;
-
- private List<?> parserElements;
-
- private String defaultText;
-
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- protected IDirectEditorConfiguration configuration;
-
- /** Constructor */
- public AbstractElementChildLabelEditPart(View view) {
- super(view);
- }
-
- @Override
- public DragTracker getDragTracker(Request request) {
- if(request instanceof SelectionRequest && ((SelectionRequest)request).getLastButtonPressed() == 3) {
- return null;
- }
- //return new DragEditPartsTrackerEx(this);
- // Disable current child label DnD as this is not correctly handled by Papyrus.
- return new SelectEditPartTracker(this);
- }
-
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY, new MaskManagedLabelEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new TextNonResizableEditPolicy());
- installEditPolicy(EditPolicy.COMPONENT_ROLE, new ListItemComponentEditPolicy());
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
- installEditPolicy(EditPolicyRoles.CONNECTION_HANDLES_ROLE, new ConnectionHandleEditPolicy());
- }
-
- protected String getLabelTextHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getText();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getText();
- } else {
- return ((Label)figure).getText();
- }
- }
-
- protected void setLabelTextHelper(IFigure figure, String text) {
- if(figure instanceof WrappingLabel) {
- ((WrappingLabel)figure).setText(text);
- } else if(figure instanceof ILabelFigure) {
- ((ILabelFigure)figure).setText(text);
- } else {
- ((Label)figure).setText(text);
- }
- }
-
- protected Image getLabelIconHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getIcon();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getIcon();
- } else {
- return ((Label)figure).getIcon();
- }
- }
-
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if(figure instanceof WrappingLabel) {
- ((WrappingLabel)figure).setIcon(icon);
- } else if(figure instanceof ILabelFigure) {
- ((ILabelFigure)figure).setIcon(icon);
- } else {
- ((Label)figure).setIcon(icon);
- }
- }
-
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- @Override
- protected List getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- public EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- protected Image getLabelIcon() {
- EObject parserElement = getParserElement();
- if(parserElement == null) {
- return null;
- }
-
- List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer());
- for(View view : views) {
- if(NameLabelIconHelper.showLabelIcon(view)) {
- return Activator.getInstance().getLabelProvider().getImage(parserElement);
- }
- }
- return null;
-
- }
-
- 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;
- }
-
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof TextSelectionEditPolicy) {
- ((TextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof TextSelectionEditPolicy) {
- ((TextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
- }
-
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- 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;
- }
- };
- }
-
- public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- public ParserOptions getParserOptions() {
-
- if(getNotationView() == null || getNotationView().getDiagram() == null) {
- return ParserOptions.NONE;
- }
-
- EAnnotation display = getNotationView().getEAnnotation(VisualInformationPapyrusConstants.CUSTOM_APPEARENCE_ANNOTATION);
- if(display == null) {
- return getDefaultParserOptions();
- }
-
- // display != null
- int displayOptions = Integer.parseInt(display.getDetails().get(VisualInformationPapyrusConstants.CUSTOM_APPEARANCE_MASK_VALUE));
- return new ParserOptions(displayOptions);
- }
-
- public ParserOptions getDefaultParserOptions() {
-
- if(getNotationView() == null || getNotationView().getDiagram() == null) {
- return ParserOptions.NONE;
- }
-
- IPreferenceStore store = org.eclipse.papyrus.infra.gmfdiag.preferences.Activator.getDefault().getPreferenceStore();
- int displayOptions = store.getInt(LabelPreferenceHelper.getPreferenceConstant(getLabelPreferenceKey(), ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE));
- if(displayOptions == 0) {
- return ParserOptions.NONE;
- }
-
- return new ParserOptions(displayOptions);
- }
-
- public IParser getParser() {
- if(parser == null) {
- parser = ParserService.getInstance().getParser(new DefaultParserHintAdapter(getNotationView().getDiagram(), resolveSemanticElement(), getNotationView().getType()));
- }
- return parser;
- }
-
- protected DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), CellEditorLocatorUtil.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() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch(directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if(configuration == null || configuration.getLanguage() == null) {
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
- helper.showEditor();
- return;
- } else if(configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if(configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if(Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
-
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- public void run() {
- if(isActive() && isEditable()) {
- if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- break;
- default:
- break;
- }
- }
-
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- protected void refreshLabel() {
-
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
-
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof TextSelectionEditPolicy) {
- ((TextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof TextSelectionEditPolicy) {
- ((TextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- protected void refreshUnderline() {
- FontStyle style = (FontStyle)getView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline());
- }
- }
-
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- @Override
- protected void refreshFont() {
- FontStyle style = (FontStyle)getView().getStyle(NotationPackage.eINSTANCE.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);
- }
- }
-
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- @Override
- protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element);
- for(int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- @Override
- protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- private View getView() {
- return (View)getModel();
- }
-
- public int getDirectEditionType() {
- if(checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if(checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- protected boolean checkExtendedEditor() {
- if(resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
- }
- return false;
- }
-
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
- final String languagePreferred = Activator.getInstance().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
- }
- }
- }
-
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getInstance().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- public void run() {
- if(isActive() && isEditable()) {
- if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- @Override
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
- }
-
- @Override
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); //$NON-NLS-1$
- }
-
- @Override
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer)event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else if(NotationPackage.eINSTANCE.getView_SourceEdges().equals(feature)) {
- refreshSourceConnections();
- } else if(NotationPackage.eINSTANCE.getView_TargetEdges().equals(feature)) {
- refreshTargetConnections();
- } 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);
- }
-
- @Override
- protected IFigure createFigure() {
- IFigure label = createFigurePrim();
- defaultText = getLabelTextHelper(label);
- return label;
- }
-
- protected IFigure createFigurePrim() {
- return new FigureDescriptor();
- }
-
- static final Font THIS_FONT = new Font(Display.getCurrent(), "Arial", 10, SWT.NORMAL);
-
- public class FigureDescriptor extends PapyrusAnchorableWrappingLabel {
-
- public FigureDescriptor() {
- this.setText("");
- this.setFont(THIS_FONT);
- }
- }
-
- private String getLabelPreferenceKey() {
- String diagramType = getNotationView().getDiagram().getType();
- String labelType = getNotationView().getType();
- return diagramType + "_" + labelType;
- }
-
- /*
- * (non-Javadoc)
- * Copied from @see org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart#getModelSourceConnections()
- *
- * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#getModelSourceConnections()
- */
- protected List getModelSourceConnections() {
- return ViewUtil.getSourceConnectionsConnectingVisibleViews((View)getModel());
- }
-
- /*
- * (non-Javadoc)
- * Copied from @see org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart#getModelTargetConnections()
- *
- * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#getModelTargetConnections()
- */
- protected List getModelTargetConnections() {
- return ViewUtil.getTargetConnectionsConnectingVisibleViews((View)getModel());
- }
-
-
- /*
- * (non-Javadoc)
- * Copied from @see org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart#getSourceConnectionAnchor()
- *
- * @see org.eclipse.gef.NodeEditPart#getSourceConnectionAnchor(org.eclipse.gef.ConnectionEditPart)
- */
- public ConnectionAnchor getSourceConnectionAnchor(org.eclipse.gef.ConnectionEditPart connEditPart) {
- final org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart connection = (org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart)connEditPart;
- String t = ""; //$NON-NLS-1$
- try {
- t = (String)getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
-
- public void run() {
- Anchor a = ((Edge)connection.getModel()).getSourceAnchor();
- if(a instanceof IdentityAnchor)
- setResult(((IdentityAnchor)a).getId());
- else
- setResult(""); //$NON-NLS-1$
- }
- });
- } catch (InterruptedException e) {
- Trace.catching(DiagramUIPlugin.getInstance(), DiagramUIDebugOptions.EXCEPTIONS_CATCHING, getClass(), "getSourceConnectionAnchor", e); //$NON-NLS-1$
- Log.error(DiagramUIPlugin.getInstance(), DiagramUIStatusCodes.IGNORED_EXCEPTION_WARNING, "getSourceConnectionAnchor", e); //$NON-NLS-1$
- }
- return getAnchorableFigure().getConnectionAnchor(t);
- }
-
- /*
- * (non-Javadoc)
- * Copied from @see org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart#getAnchorableFigure()
- *
- * @see org.eclipse.gef.NodeEditPart#getSourceConnectionAnchor(org.eclipse.gef.Request)
- */
- protected IAnchorableFigure getAnchorableFigure() {
- IFigure myFigure = getFigure();
- if(myFigure instanceof IAnchorableFigure) {
- return (IAnchorableFigure)myFigure;
- }
- throw new RuntimeException("The figure of this element should be an IAnchorable Figure");////$NON-NLS-0$
- }
-
-
- /*
- * (non-Javadoc)
- * Copied from @see org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart#getSourceConnectionAnchor()
- *
- * @see org.eclipse.gef.NodeEditPart#getSourceConnectionAnchor(org.eclipse.gef.Request)
- */
- public ConnectionAnchor getSourceConnectionAnchor(Request request) {
- if(request instanceof ReconnectRequest) {
- if(((DropRequest)request).getLocation() == null) {
- return getAnchorableFigure().getSourceConnectionAnchorAt(null);
- }
- Point pt = ((DropRequest)request).getLocation().getCopy();
- return getAnchorableFigure().getSourceConnectionAnchorAt(pt);
- } else if(request instanceof DropRequest) {
- return getAnchorableFigure().getSourceConnectionAnchorAt(((DropRequest)request).getLocation());
- }
- return getAnchorableFigure().getSourceConnectionAnchorAt(null);
- }
-
-
- /*
- * (non-Javadoc)
- * Copied from @see org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart#getTargetConnectionAnchor()
- *
- * @see org.eclipse.gef.NodeEditPart#getTargetConnectionAnchor(org.eclipse.gef.ConnectionEditPart)
- */
- public ConnectionAnchor getTargetConnectionAnchor(org.eclipse.gef.ConnectionEditPart connEditPart) {
- final org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart connection = (org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart)connEditPart;
-
- String t = ""; //$NON-NLS-1$
- try {
- t = (String)getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
-
- public void run() {
- Anchor a = ((Edge)connection.getModel()).getTargetAnchor();
- if(a instanceof IdentityAnchor)
- setResult(((IdentityAnchor)a).getId());
- else
- setResult(""); //$NON-NLS-1$
- }
- });
- } catch (InterruptedException e) {
- Trace.catching(DiagramUIPlugin.getInstance(), DiagramUIDebugOptions.EXCEPTIONS_CATCHING, getClass(), "getTargetConnectionAnchor", e); //$NON-NLS-1$
- Log.error(DiagramUIPlugin.getInstance(), DiagramUIStatusCodes.IGNORED_EXCEPTION_WARNING, "getTargetConnectionAnchor", e); //$NON-NLS-1$
- }
-
- return getAnchorableFigure().getConnectionAnchor(t);
- }
-
-
-
-
- /*
- * (non-Javadoc)
- * Copied from @see org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart#getTargetConnectionAnchor()
- *
- * @see org.eclipse.gef.NodeEditPart#getTargetConnectionAnchor(org.eclipse.gef.Request)
- */
- public ConnectionAnchor getTargetConnectionAnchor(Request request) {
- if(request instanceof ReconnectRequest) {
- if(((DropRequest)request).getLocation() == null) {
- return getAnchorableFigure().getTargetConnectionAnchorAt(null);
- }
- Point pt = ((DropRequest)request).getLocation().getCopy();
- return getAnchorableFigure().getTargetConnectionAnchorAt(pt);
- } else if(request instanceof DropRequest) {
- return getAnchorableFigure().getTargetConnectionAnchorAt(((DropRequest)request).getLocation());
- }
- return getAnchorableFigure().getTargetConnectionAnchorAt(null);
- }
-
-
- /*
- * (non-Javadoc)
- * Copied from @see org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart#mapConnectionAnchorToTerminal()
- *
- * @see org.eclipse.gmf.runtime.diagram.ui.editparts.INodeEditPart#mapConnectionAnchorToTerminal(org.eclipse.draw2d.ConnectionAnchor)
- */
- final public String mapConnectionAnchorToTerminal(ConnectionAnchor c) {
- return getAnchorableFigure().getConnectionAnchorTerminal(c);
- }
-
- /*
- * (non-Javadoc)
- * Copied from @see org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart#mapTerminalToConnectionAnchor()
- *
- * @see org.eclipse.gmf.runtime.diagram.ui.editparts.INodeEditPart#mapTerminalToConnectionAnchor(java.lang.String)
- */
- final public ConnectionAnchor mapTerminalToConnectionAnchor(String terminal) {
- return getAnchorableFigure().getConnectionAnchor(terminal);
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.gmf.runtime.diagram.ui.editparts.INotableEditPart#canAttachNote()
- * Copied from @see org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart#canAttachNote()
- */
- public boolean canAttachNote() {
- return true;
- }
-
-
-
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ * Arthur Daussy - arthur.daussy@atos.net - 395920: [Block Diagram Definition] All element contained by a block should be able to be linked to constraint or comment
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.edit.part;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.ConnectionAnchor;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.DragTracker;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.requests.DropRequest;
+import org.eclipse.gef.requests.ReconnectRequest;
+import org.eclipse.gef.requests.SelectionRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gef.tools.SelectEditPartTracker;
+import org.eclipse.gmf.runtime.common.core.util.Log;
+import org.eclipse.gmf.runtime.common.core.util.Trace;
+import org.eclipse.gmf.runtime.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.core.util.ViewUtil;
+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.editparts.INodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ConnectionHandleEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ListItemComponentEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIDebugOptions;
+import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIPlugin;
+import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIStatusCodes;
+import org.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.IAnchorableFigure;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.Anchor;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.IdentityAnchor;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.gmf.diagram.common.edit.part.ITextAwareEditPart;
+import org.eclipse.papyrus.gmf.diagram.common.edit.policy.DefaultGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.gmf.diagram.common.edit.policy.LabelDirectEditPolicy;
+import org.eclipse.papyrus.gmf.diagram.common.edit.policy.TextNonResizableEditPolicy;
+import org.eclipse.papyrus.gmf.diagram.common.edit.policy.TextSelectionEditPolicy;
+import org.eclipse.papyrus.gmf.diagram.common.locator.CellEditorLocatorUtil;
+import org.eclipse.papyrus.infra.emf.appearance.helper.NameLabelIconHelper;
+import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusAnchorableWrappingLabel;
+import org.eclipse.papyrus.sysml.diagram.common.Activator;
+import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants;
+import org.eclipse.papyrus.sysml.diagram.common.preferences.LabelPreferenceHelper;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.edit.policy.MaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.common.parser.DefaultParserHintAdapter;
+import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil;
+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;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * Abstract non-diagram specific edit part for child label node.
+ * This class is adapted from edit parts generated by GMF Tooling.
+ */
+public class AbstractElementChildLabelEditPart extends GraphicalEditPart implements ITextAwareEditPart, IPrimaryEditPart, INodeEditPart {
+
+ private DirectEditManager manager;
+
+ protected IParser parser;
+
+ private List<?> parserElements;
+
+ private String defaultText;
+
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ protected IDirectEditorConfiguration configuration;
+
+ /** Constructor */
+ public AbstractElementChildLabelEditPart(View view) {
+ super(view);
+ }
+
+ @Override
+ public DragTracker getDragTracker(Request request) {
+ if(request instanceof SelectionRequest && ((SelectionRequest)request).getLastButtonPressed() == 3) {
+ return null;
+ }
+ //return new DragEditPartsTrackerEx(this);
+ // Disable current child label DnD as this is not correctly handled by Papyrus.
+ return new SelectEditPartTracker(this);
+ }
+
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY, new MaskManagedLabelEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new TextNonResizableEditPolicy());
+ installEditPolicy(EditPolicy.COMPONENT_ROLE, new ListItemComponentEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
+ installEditPolicy(EditPolicyRoles.CONNECTION_HANDLES_ROLE, new ConnectionHandleEditPolicy());
+ }
+
+ protected String getLabelTextHelper(IFigure figure) {
+ if(figure instanceof WrappingLabel) {
+ return ((WrappingLabel)figure).getText();
+ } else if(figure instanceof ILabelFigure) {
+ return ((ILabelFigure)figure).getText();
+ } else {
+ return ((Label)figure).getText();
+ }
+ }
+
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if(figure instanceof WrappingLabel) {
+ ((WrappingLabel)figure).setText(text);
+ } else if(figure instanceof ILabelFigure) {
+ ((ILabelFigure)figure).setText(text);
+ } else {
+ ((Label)figure).setText(text);
+ }
+ }
+
+ protected Image getLabelIconHelper(IFigure figure) {
+ if(figure instanceof WrappingLabel) {
+ return ((WrappingLabel)figure).getIcon();
+ } else if(figure instanceof ILabelFigure) {
+ return ((ILabelFigure)figure).getIcon();
+ } else {
+ return ((Label)figure).getIcon();
+ }
+ }
+
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if(figure instanceof WrappingLabel) {
+ ((WrappingLabel)figure).setIcon(icon);
+ } else if(figure instanceof ILabelFigure) {
+ ((ILabelFigure)figure).setIcon(icon);
+ } else {
+ ((Label)figure).setIcon(icon);
+ }
+ }
+
+ public void setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ @Override
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ public EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ protected Image getLabelIcon() {
+ EObject parserElement = getParserElement();
+ if(parserElement == null) {
+ return null;
+ }
+
+ List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer());
+ for(View view : views) {
+ if(NameLabelIconHelper.showLabelIcon(view)) {
+ return Activator.getInstance().getLabelProvider().getImage(parserElement);
+ }
+ }
+ return null;
+
+ }
+
+ 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;
+ }
+
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if(pdEditPolicy instanceof TextSelectionEditPolicy) {
+ ((TextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ }
+ Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if(sfEditPolicy instanceof TextSelectionEditPolicy) {
+ ((TextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ public String getEditText() {
+ if(getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ 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;
+ }
+ };
+ }
+
+ public IContentAssistProcessor getCompletionProcessor() {
+ if(getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ public ParserOptions getParserOptions() {
+
+ if(getNotationView() == null || getNotationView().getDiagram() == null) {
+ return ParserOptions.NONE;
+ }
+
+ EAnnotation display = getNotationView().getEAnnotation(VisualInformationPapyrusConstants.CUSTOM_APPEARENCE_ANNOTATION);
+ if(display == null) {
+ return getDefaultParserOptions();
+ }
+
+ // display != null
+ int displayOptions = Integer.parseInt(display.getDetails().get(VisualInformationPapyrusConstants.CUSTOM_APPEARANCE_MASK_VALUE));
+ return new ParserOptions(displayOptions);
+ }
+
+ public ParserOptions getDefaultParserOptions() {
+
+ if(getNotationView() == null || getNotationView().getDiagram() == null) {
+ return ParserOptions.NONE;
+ }
+
+ IPreferenceStore store = org.eclipse.papyrus.infra.gmfdiag.preferences.Activator.getDefault().getPreferenceStore();
+ int displayOptions = store.getInt(LabelPreferenceHelper.getPreferenceConstant(getLabelPreferenceKey(), ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE));
+ if(displayOptions == 0) {
+ return ParserOptions.NONE;
+ }
+
+ return new ParserOptions(displayOptions);
+ }
+
+ public IParser getParser() {
+ if(parser == null) {
+ parser = ParserService.getInstance().getParser(new DefaultParserHintAdapter(getNotationView().getDiagram(), resolveSemanticElement(), getNotationView().getType()));
+ }
+ return parser;
+ }
+
+ protected DirectEditManager getManager() {
+ if(manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), CellEditorLocatorUtil.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() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if(getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager)getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void performDirectEditRequest(Request request) {
+
+ final Request theRequest = request;
+
+ if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
+ directEditionMode = getDirectEditionType();
+ }
+ switch(directEditionMode) {
+ case IDirectEdition.NO_DIRECT_EDITION:
+ // no direct edition mode => does nothing
+ return;
+ case IDirectEdition.EXTENDED_DIRECT_EDITOR:
+ updateExtendedEditorConfiguration();
+ if(configuration == null || configuration.getLanguage() == null) {
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if(configuration instanceof IPopupEditorConfiguration) {
+ IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
+ helper.showEditor();
+ return;
+ } else if(configuration instanceof IAdvancedEditorConfiguration) {
+ dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
+ } else if(configuration instanceof IDirectEditorConfiguration) {
+ dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
+ } else {
+ return;
+ }
+ final Dialog finalDialog = dialog;
+
+ if(Window.OK == dialog.open()) {
+ TransactionalEditingDomain domain = getEditingDomain();
+ RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
+
+ @Override
+ protected void doExecute() {
+ configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue());
+
+ }
+ };
+ domain.getCommandStack().execute(command);
+ }
+ }
+ break;
+ case IDirectEdition.DEFAULT_DIRECT_EDITOR:
+
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if(isActive() && isEditable()) {
+ if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest)theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ protected void refreshLabel() {
+
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if(pdEditPolicy instanceof TextSelectionEditPolicy) {
+ ((TextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ }
+ Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if(sfEditPolicy instanceof TextSelectionEditPolicy) {
+ ((TextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle)getView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if(style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle)getView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if(style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ @Override
+ protected void refreshFont() {
+ FontStyle style = (FontStyle)getView().getStyle(NotationPackage.eINSTANCE.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);
+ }
+ }
+
+ @Override
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ @Override
+ protected void addSemanticListeners() {
+ if(getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element);
+ for(int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ @Override
+ protected void removeSemanticListeners() {
+ if(parserElements != null) {
+ for(int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if(accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ private View getView() {
+ return (View)getModel();
+ }
+
+ public int getDirectEditionType() {
+ if(checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if(checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ protected boolean checkExtendedEditor() {
+ if(resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
+ }
+ return false;
+ }
+
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ protected void initExtendedEditorConfiguration() {
+ if(configuration == null) {
+ final String languagePreferred = Activator.getInstance().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if(languagePreferred != null && !languagePreferred.equals("")) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else {
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
+ }
+ }
+ }
+
+ protected void updateExtendedEditorConfiguration() {
+ String languagePreferred = Activator.getInstance().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if(languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ configuration = null;
+ }
+ }
+
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if(isActive() && isEditable()) {
+ if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest)theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ @Override
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ @Override
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer)event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else if(NotationPackage.eINSTANCE.getView_SourceEdges().equals(feature)) {
+ refreshSourceConnections();
+ } else if(NotationPackage.eINSTANCE.getView_TargetEdges().equals(feature)) {
+ refreshTargetConnections();
+ } 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);
+ }
+
+ @Override
+ protected IFigure createFigure() {
+ IFigure label = createFigurePrim();
+ defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ protected IFigure createFigurePrim() {
+ return new FigureDescriptor();
+ }
+
+ static final Font THIS_FONT = new Font(Display.getCurrent(), "Arial", 10, SWT.NORMAL);
+
+ public class FigureDescriptor extends PapyrusAnchorableWrappingLabel {
+
+ public FigureDescriptor() {
+ this.setText("");
+ this.setFont(THIS_FONT);
+ }
+ }
+
+ private String getLabelPreferenceKey() {
+ String diagramType = getNotationView().getDiagram().getType();
+ String labelType = getNotationView().getType();
+ return diagramType + "_" + labelType;
+ }
+
+ /*
+ * (non-Javadoc)
+ * Copied from @see org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart#getModelSourceConnections()
+ *
+ * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#getModelSourceConnections()
+ */
+ protected List getModelSourceConnections() {
+ return ViewUtil.getSourceConnectionsConnectingVisibleViews((View)getModel());
+ }
+
+ /*
+ * (non-Javadoc)
+ * Copied from @see org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart#getModelTargetConnections()
+ *
+ * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#getModelTargetConnections()
+ */
+ protected List getModelTargetConnections() {
+ return ViewUtil.getTargetConnectionsConnectingVisibleViews((View)getModel());
+ }
+
+
+ /*
+ * (non-Javadoc)
+ * Copied from @see org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart#getSourceConnectionAnchor()
+ *
+ * @see org.eclipse.gef.NodeEditPart#getSourceConnectionAnchor(org.eclipse.gef.ConnectionEditPart)
+ */
+ public ConnectionAnchor getSourceConnectionAnchor(org.eclipse.gef.ConnectionEditPart connEditPart) {
+ final org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart connection = (org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart)connEditPart;
+ String t = ""; //$NON-NLS-1$
+ try {
+ t = (String)getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ Anchor a = ((Edge)connection.getModel()).getSourceAnchor();
+ if(a instanceof IdentityAnchor)
+ setResult(((IdentityAnchor)a).getId());
+ else
+ setResult(""); //$NON-NLS-1$
+ }
+ });
+ } catch (InterruptedException e) {
+ Trace.catching(DiagramUIPlugin.getInstance(), DiagramUIDebugOptions.EXCEPTIONS_CATCHING, getClass(), "getSourceConnectionAnchor", e); //$NON-NLS-1$
+ Log.error(DiagramUIPlugin.getInstance(), DiagramUIStatusCodes.IGNORED_EXCEPTION_WARNING, "getSourceConnectionAnchor", e); //$NON-NLS-1$
+ }
+ return getAnchorableFigure().getConnectionAnchor(t);
+ }
+
+ /*
+ * (non-Javadoc)
+ * Copied from @see org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart#getAnchorableFigure()
+ *
+ * @see org.eclipse.gef.NodeEditPart#getSourceConnectionAnchor(org.eclipse.gef.Request)
+ */
+ protected IAnchorableFigure getAnchorableFigure() {
+ IFigure myFigure = getFigure();
+ if(myFigure instanceof IAnchorableFigure) {
+ return (IAnchorableFigure)myFigure;
+ }
+ throw new RuntimeException("The figure of this element should be an IAnchorable Figure");////$NON-NLS-0$
+ }
+
+
+ /*
+ * (non-Javadoc)
+ * Copied from @see org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart#getSourceConnectionAnchor()
+ *
+ * @see org.eclipse.gef.NodeEditPart#getSourceConnectionAnchor(org.eclipse.gef.Request)
+ */
+ public ConnectionAnchor getSourceConnectionAnchor(Request request) {
+ if(request instanceof ReconnectRequest) {
+ if(((DropRequest)request).getLocation() == null) {
+ return getAnchorableFigure().getSourceConnectionAnchorAt(null);
+ }
+ Point pt = ((DropRequest)request).getLocation().getCopy();
+ return getAnchorableFigure().getSourceConnectionAnchorAt(pt);
+ } else if(request instanceof DropRequest) {
+ return getAnchorableFigure().getSourceConnectionAnchorAt(((DropRequest)request).getLocation());
+ }
+ return getAnchorableFigure().getSourceConnectionAnchorAt(null);
+ }
+
+
+ /*
+ * (non-Javadoc)
+ * Copied from @see org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart#getTargetConnectionAnchor()
+ *
+ * @see org.eclipse.gef.NodeEditPart#getTargetConnectionAnchor(org.eclipse.gef.ConnectionEditPart)
+ */
+ public ConnectionAnchor getTargetConnectionAnchor(org.eclipse.gef.ConnectionEditPart connEditPart) {
+ final org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart connection = (org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart)connEditPart;
+
+ String t = ""; //$NON-NLS-1$
+ try {
+ t = (String)getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ Anchor a = ((Edge)connection.getModel()).getTargetAnchor();
+ if(a instanceof IdentityAnchor)
+ setResult(((IdentityAnchor)a).getId());
+ else
+ setResult(""); //$NON-NLS-1$
+ }
+ });
+ } catch (InterruptedException e) {
+ Trace.catching(DiagramUIPlugin.getInstance(), DiagramUIDebugOptions.EXCEPTIONS_CATCHING, getClass(), "getTargetConnectionAnchor", e); //$NON-NLS-1$
+ Log.error(DiagramUIPlugin.getInstance(), DiagramUIStatusCodes.IGNORED_EXCEPTION_WARNING, "getTargetConnectionAnchor", e); //$NON-NLS-1$
+ }
+
+ return getAnchorableFigure().getConnectionAnchor(t);
+ }
+
+
+
+
+ /*
+ * (non-Javadoc)
+ * Copied from @see org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart#getTargetConnectionAnchor()
+ *
+ * @see org.eclipse.gef.NodeEditPart#getTargetConnectionAnchor(org.eclipse.gef.Request)
+ */
+ public ConnectionAnchor getTargetConnectionAnchor(Request request) {
+ if(request instanceof ReconnectRequest) {
+ if(((DropRequest)request).getLocation() == null) {
+ return getAnchorableFigure().getTargetConnectionAnchorAt(null);
+ }
+ Point pt = ((DropRequest)request).getLocation().getCopy();
+ return getAnchorableFigure().getTargetConnectionAnchorAt(pt);
+ } else if(request instanceof DropRequest) {
+ return getAnchorableFigure().getTargetConnectionAnchorAt(((DropRequest)request).getLocation());
+ }
+ return getAnchorableFigure().getTargetConnectionAnchorAt(null);
+ }
+
+
+ /*
+ * (non-Javadoc)
+ * Copied from @see org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart#mapConnectionAnchorToTerminal()
+ *
+ * @see org.eclipse.gmf.runtime.diagram.ui.editparts.INodeEditPart#mapConnectionAnchorToTerminal(org.eclipse.draw2d.ConnectionAnchor)
+ */
+ final public String mapConnectionAnchorToTerminal(ConnectionAnchor c) {
+ return getAnchorableFigure().getConnectionAnchorTerminal(c);
+ }
+
+ /*
+ * (non-Javadoc)
+ * Copied from @see org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart#mapTerminalToConnectionAnchor()
+ *
+ * @see org.eclipse.gmf.runtime.diagram.ui.editparts.INodeEditPart#mapTerminalToConnectionAnchor(java.lang.String)
+ */
+ final public ConnectionAnchor mapTerminalToConnectionAnchor(String terminal) {
+ return getAnchorableFigure().getConnectionAnchor(terminal);
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.gmf.runtime.diagram.ui.editparts.INotableEditPart#canAttachNote()
+ * Copied from @see org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart#canAttachNote()
+ */
+ public boolean canAttachNote() {
+ return true;
+ }
+
+
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementEditPart.java
index 3cd4293daa1..6e2c6550ea0 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementEditPart.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementEditPart.java
@@ -1,183 +1,183 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.edit.part;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.StackLayout;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.editpolicies.LayoutEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
-import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
-import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceConverter;
-import org.eclipse.papyrus.gmf.diagram.common.edit.policy.DefaultCreationEditPolicy;
-import org.eclipse.papyrus.gmf.diagram.common.edit.policy.DefaultGraphicalNodeEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
-import org.eclipse.papyrus.sysml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ClassifierFigure;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.NodeNamedElementFigure;
-import org.eclipse.papyrus.uml.diagram.common.helper.BasicClassifierCompartmentLayoutHelper;
-import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * Abstract non-diagram specific edit part for nodes.
- * This class is adapted from edit parts generated by GMF Tooling.
- */
-public abstract class AbstractElementEditPart extends NamedElementEditPart {
-
- protected IFigure contentPane;
-
- protected IFigure primaryShape;
-
- public AbstractElementEditPart(View view) {
- super(view);
- setCompartmentLayoutHelper(BasicClassifierCompartmentLayoutHelper.getInstances());
- }
-
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
- installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy());
- }
-
- protected abstract LayoutEditPolicy createLayoutEditPolicy();
-
- protected IFigure createNodeShape() {
- return primaryShape = new ClassifierFigure();
- }
-
- public NodeNamedElementFigure getPrimaryShape() {
- return (NodeNamedElementFigure)primaryShape;
- }
-
- protected abstract boolean addFixedChild(EditPart childEditPart);
-
- protected abstract boolean removeFixedChild(EditPart childEditPart);
-
- protected void addChildVisual(EditPart childEditPart, int index) {
- if(addFixedChild(childEditPart)) {
- return;
- }
- super.addChildVisual(childEditPart, -1);
- }
-
- protected void removeChildVisual(EditPart childEditPart) {
- if(removeFixedChild(childEditPart)) {
- return;
- }
- super.removeChildVisual(childEditPart);
- }
-
- protected abstract IFigure getContentPaneFor(IGraphicalEditPart editPart);
-
- protected NodeFigure createNodePlate() {
- String prefElementId = getNotationView().getType();
- IPreferenceStore store = Activator.getInstance().getPreferenceStore();
- String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.WIDTH);
- String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.HEIGHT);
- DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
-
- return result;
- }
-
- protected NodeFigure createMainFigure() {
- NodeFigure figure = createNodePlate();
- figure.setLayoutManager(new StackLayout());
- IFigure shape = createNodeShape();
- figure.add(shape);
- contentPane = setupContentPane(shape);
- return figure;
- }
-
- protected IFigure setupContentPane(IFigure nodeShape) {
- if(nodeShape.getLayoutManager() == null) {
- ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
- layout.setSpacing(5);
- nodeShape.setLayoutManager(layout);
- }
- return nodeShape; // use nodeShape itself as contentPane
- }
-
- public IFigure getContentPane() {
- if(contentPane != null) {
- return contentPane;
- }
- return super.getContentPane();
- }
-
- protected void setForegroundColor(Color color) {
- if(primaryShape != null) {
- primaryShape.setForegroundColor(color);
- }
- }
-
- public abstract EditPart getPrimaryChildEditPart();
-
- public EditPart getTargetEditPart(Request request) {
- return super.getTargetEditPart(request);
- }
-
- @Override
- public Object getPreferredValue(EStructuralFeature feature) {
- String prefKey = getNotationView().getType();
-
- IPreferenceStore store = (IPreferenceStore)getDiagramPreferencesHint().getPreferenceStore();
- Object result = null;
-
- if(feature == NotationPackage.eINSTANCE.getLineStyle_LineColor() || feature == NotationPackage.eINSTANCE.getFontStyle_FontColor() || feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
-
- String prefColor = null;
- if(feature == NotationPackage.eINSTANCE.getLineStyle_LineColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant(prefKey, PreferenceConstantHelper.COLOR_LINE);
-
- } else if(feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant(prefKey, PreferenceConstantHelper.COLOR_FONT);
-
- } else if(feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant(prefKey, PreferenceConstantHelper.COLOR_FILL);
-
- }
- result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor((IPreferenceStore)store, prefColor));
-
- } else if(feature == NotationPackage.eINSTANCE.getFillStyle_Transparency() || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
-
- String prefGradient = PreferenceConstantHelper.getElementConstant(prefKey, PreferenceConstantHelper.COLOR_GRADIENT);
- GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(store.getString(prefGradient));
- if(feature == NotationPackage.eINSTANCE.getFillStyle_Transparency()) {
- result = new Integer(gradientPreferenceConverter.getTransparency());
-
- } else if(feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
- result = gradientPreferenceConverter.getGradientData();
-
- }
- }
-
- if(result == null) {
- result = getStructuralFeatureValue(feature);
- }
- return result;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.edit.part;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.papyrus.gmf.diagram.common.edit.policy.DefaultCreationEditPolicy;
+import org.eclipse.papyrus.gmf.diagram.common.edit.policy.DefaultGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.sysml.diagram.common.Activator;
+import org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ClassifierFigure;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.NodeNamedElementFigure;
+import org.eclipse.papyrus.uml.diagram.common.helper.BasicClassifierCompartmentLayoutHelper;
+import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * Abstract non-diagram specific edit part for nodes.
+ * This class is adapted from edit parts generated by GMF Tooling.
+ */
+public abstract class AbstractElementEditPart extends NamedElementEditPart {
+
+ protected IFigure contentPane;
+
+ protected IFigure primaryShape;
+
+ public AbstractElementEditPart(View view) {
+ super(view);
+ setCompartmentLayoutHelper(BasicClassifierCompartmentLayoutHelper.getInstances());
+ }
+
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy());
+ }
+
+ protected abstract LayoutEditPolicy createLayoutEditPolicy();
+
+ protected IFigure createNodeShape() {
+ return primaryShape = new ClassifierFigure();
+ }
+
+ public NodeNamedElementFigure getPrimaryShape() {
+ return (NodeNamedElementFigure)primaryShape;
+ }
+
+ protected abstract boolean addFixedChild(EditPart childEditPart);
+
+ protected abstract boolean removeFixedChild(EditPart childEditPart);
+
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if(addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ protected void removeChildVisual(EditPart childEditPart) {
+ if(removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ protected abstract IFigure getContentPaneFor(IGraphicalEditPart editPart);
+
+ protected NodeFigure createNodePlate() {
+ String prefElementId = getNotationView().getType();
+ IPreferenceStore store = Activator.getInstance().getPreferenceStore();
+ String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.WIDTH);
+ String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.HEIGHT);
+ DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
+
+ return result;
+ }
+
+ protected NodeFigure createMainFigure() {
+ NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ IFigure shape = createNodeShape();
+ figure.add(shape);
+ contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if(nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(5);
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ public IFigure getContentPane() {
+ if(contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ protected void setForegroundColor(Color color) {
+ if(primaryShape != null) {
+ primaryShape.setForegroundColor(color);
+ }
+ }
+
+ public abstract EditPart getPrimaryChildEditPart();
+
+ public EditPart getTargetEditPart(Request request) {
+ return super.getTargetEditPart(request);
+ }
+
+ @Override
+ public Object getPreferredValue(EStructuralFeature feature) {
+ String prefKey = getNotationView().getType();
+
+ IPreferenceStore store = (IPreferenceStore)getDiagramPreferencesHint().getPreferenceStore();
+ Object result = null;
+
+ if(feature == NotationPackage.eINSTANCE.getLineStyle_LineColor() || feature == NotationPackage.eINSTANCE.getFontStyle_FontColor() || feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
+
+ String prefColor = null;
+ if(feature == NotationPackage.eINSTANCE.getLineStyle_LineColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant(prefKey, PreferenceConstantHelper.COLOR_LINE);
+
+ } else if(feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant(prefKey, PreferenceConstantHelper.COLOR_FONT);
+
+ } else if(feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant(prefKey, PreferenceConstantHelper.COLOR_FILL);
+
+ }
+ result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor((IPreferenceStore)store, prefColor));
+
+ } else if(feature == NotationPackage.eINSTANCE.getFillStyle_Transparency() || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
+
+ String prefGradient = PreferenceConstantHelper.getElementConstant(prefKey, PreferenceConstantHelper.COLOR_GRADIENT);
+ GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(store.getString(prefGradient));
+ if(feature == NotationPackage.eINSTANCE.getFillStyle_Transparency()) {
+ result = new Integer(gradientPreferenceConverter.getTransparency());
+
+ } else if(feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
+ result = gradientPreferenceConverter.getGradientData();
+
+ }
+ }
+
+ if(result == null) {
+ result = getStructuralFeatureValue(feature);
+ }
+ return result;
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementLabelEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementLabelEditPart.java
index cad3b2531dd..5a3c68781eb 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementLabelEditPart.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementLabelEditPart.java
@@ -1,671 +1,671 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.edit.part;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.ConnectionLocator;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.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.core.util.ViewUtil;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.gmf.diagram.common.edit.part.ITextAwareEditPart;
-import org.eclipse.papyrus.gmf.diagram.common.edit.policy.DefaultSnapBackEditPolicy;
-import org.eclipse.papyrus.gmf.diagram.common.edit.policy.LabelDefaultSemanticEditPolicy;
-import org.eclipse.papyrus.gmf.diagram.common.edit.policy.LabelDirectEditPolicy;
-import org.eclipse.papyrus.gmf.diagram.common.edit.policy.TextSelectionEditPolicy;
-import org.eclipse.papyrus.gmf.diagram.common.locator.TextCellEditorLocator;
-import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
-import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants;
-import org.eclipse.papyrus.sysml.diagram.common.preferences.LabelPreferenceHelper;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.edit.policy.MaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editparts.ILabelRoleProvider;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.common.parser.DefaultParserHintAdapter;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Abstract non-diagram specific edit part for labels.
- * This class is adapted from edit parts generated by GMF Tooling.
- */
-public abstract class AbstractElementLabelEditPart extends LabelEditPart implements ITextAwareEditPart, ILabelRoleProvider {
-
- private DirectEditManager manager;
-
- private IParser parser;
-
- private List<?> parserElements;
-
- protected String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- */
- protected IDirectEditorConfiguration configuration;
-
- /** Constructor */
- public AbstractElementLabelEditPart(View view) {
- super(view);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY, new MaskManagedLabelEditPolicy());
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new TextSelectionEditPolicy());
- installEditPolicy(EditPolicyRoles.SNAP_FEEDBACK_ROLE, new DefaultSnapBackEditPolicy());
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new LabelDefaultSemanticEditPolicy());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int getKeyPoint() {
- return ConnectionLocator.MIDDLE;
- }
-
- protected String getLabelTextHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getText();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getText();
- } else {
- return ((Label)figure).getText();
- }
- }
-
- protected void setLabelTextHelper(IFigure figure, String text) {
- if(figure instanceof WrappingLabel) {
- ((WrappingLabel)figure).setText(text);
- } else if(figure instanceof ILabelFigure) {
- ((ILabelFigure)figure).setText(text);
- } else {
- ((Label)figure).setText(text);
- }
- }
-
- protected Image getLabelIconHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getIcon();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getIcon();
- } else {
- return ((Label)figure).getIcon();
- }
- }
-
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if(figure instanceof WrappingLabel) {
- ((WrappingLabel)figure).setIcon(icon);
- } else if(figure instanceof ILabelFigure) {
- ((ILabelFigure)figure).setIcon(icon);
- } else {
- ((Label)figure).setIcon(icon);
- }
- }
-
- public void setLabel(WrappingLabel figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- @Override
- protected List getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- public EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- protected Image getLabelIcon() {
- return null;
- }
-
- 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;
- }
-
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof TextSelectionEditPolicy) {
- ((TextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof TextSelectionEditPolicy) {
- ((TextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
- }
-
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- 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;
- }
- };
- }
-
- public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- public ParserOptions getParserOptions() {
-
- if(getNotationView() == null || getNotationView().getDiagram() == null) {
- return ParserOptions.NONE;
- }
-
- EAnnotation display = getNotationView().getEAnnotation(VisualInformationPapyrusConstants.CUSTOM_APPEARENCE_ANNOTATION);
- if(display == null) {
- return getDefaultParserOptions();
- }
-
- // display != null
- int displayOptions = Integer.parseInt(display.getDetails().get(VisualInformationPapyrusConstants.CUSTOM_APPEARANCE_MASK_VALUE));
- return new ParserOptions(displayOptions);
- }
-
- public ParserOptions getDefaultParserOptions() {
-
- if(getNotationView() == null || getNotationView().getDiagram() == null) {
- return ParserOptions.NONE;
- }
-
- IPreferenceStore store = org.eclipse.papyrus.infra.gmfdiag.preferences.Activator.getDefault().getPreferenceStore();
- int displayOptions = store.getInt(LabelPreferenceHelper.getPreferenceConstant(getLabelPreferenceKey(), ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE));
- if(displayOptions == 0) {
- return ParserOptions.NONE;
- }
-
- return new ParserOptions(displayOptions);
- }
-
- public IParser getParser() {
- if(parser == null) {
- parser = ParserService.getInstance().getParser(new DefaultParserHintAdapter(getNotationView().getDiagram(), getParserElement(), getNotationView().getType()));
- }
- return parser;
- }
-
- protected DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), new TextCellEditorLocator((WrappingLabel)this.getFigure())));
- }
- return manager;
- }
-
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- protected void performDirectEdit() {
- getManager().show();
- }
-
- protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- @Override
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch(directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if(configuration == null || configuration.getLanguage() == null) {
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
- helper.showEditor();
- return;
- } else if(configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if(configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if(Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
-
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- public void run() {
- if(isActive() && isEditable()) {
- if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- break;
- default:
- break;
- }
- }
-
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- protected void refreshLabel() {
-
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
-
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof TextSelectionEditPolicy) {
- ((TextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof TextSelectionEditPolicy) {
- ((TextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- protected void refreshUnderline() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline());
- }
- }
-
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- @Override
- protected void refreshFont() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null) {
- FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- @Override
- protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
- EObject element = getParserElement();
- 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();
- }
- }
-
- @Override
- protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- */
- public int getDirectEditionType() {
- if(checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if(checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- */
- protected boolean checkExtendedEditor() {
- if(resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- */
- protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
- }
- }
- }
-
- /**
- * Updates the preference configuration
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- public void run() {
- if(isActive() && isEditable()) {
- if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- @Override
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer)event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if(getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if(resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
-
- super.handleNotificationEvent(event);
- }
-
- @Override
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-
- protected void addSnapBackLocation() {
- // Use default view position as snap back position
- IPreferenceStore store = org.eclipse.papyrus.infra.gmfdiag.preferences.Activator.getDefault().getPreferenceStore();
-
- String xKey = PreferenceConstantHelper.getElementConstant(getLabelPreferenceKey(), PreferenceConstantHelper.LOCATION_X);
- String yKey = PreferenceConstantHelper.getElementConstant(getLabelPreferenceKey(), PreferenceConstantHelper.LOCATION_Y);
-
- Point snapBackPosition = new Point(store.getInt(xKey), store.getInt(yKey));
-
- registerSnapBackPosition(getLabelPreferenceKey(), snapBackPosition);
- }
-
- private String getLabelPreferenceKey() {
- String diagramType = getNotationView().getDiagram().getType();
- String parentType = ViewUtil.getViewContainer(getNotationView()).getType();
- String labelType = getNotationView().getType();
- return diagramType + "_" + parentType + "-" + labelType;
- }
-
- /**
- * {@inheritDoc}
- */
- public abstract String getLabelRole();
-
- /**
- * {@inheritDoc}
- */
- public abstract String getIconPathRole();
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.edit.part;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.ConnectionLocator;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.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.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.gmf.diagram.common.edit.part.ITextAwareEditPart;
+import org.eclipse.papyrus.gmf.diagram.common.edit.policy.DefaultSnapBackEditPolicy;
+import org.eclipse.papyrus.gmf.diagram.common.edit.policy.LabelDefaultSemanticEditPolicy;
+import org.eclipse.papyrus.gmf.diagram.common.edit.policy.LabelDirectEditPolicy;
+import org.eclipse.papyrus.gmf.diagram.common.edit.policy.TextSelectionEditPolicy;
+import org.eclipse.papyrus.gmf.diagram.common.locator.TextCellEditorLocator;
+import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants;
+import org.eclipse.papyrus.sysml.diagram.common.preferences.LabelPreferenceHelper;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.edit.policy.MaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editparts.ILabelRoleProvider;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.common.parser.DefaultParserHintAdapter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * Abstract non-diagram specific edit part for labels.
+ * This class is adapted from edit parts generated by GMF Tooling.
+ */
+public abstract class AbstractElementLabelEditPart extends LabelEditPart implements ITextAwareEditPart, ILabelRoleProvider {
+
+ private DirectEditManager manager;
+
+ private IParser parser;
+
+ private List<?> parserElements;
+
+ protected String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /** Constructor */
+ public AbstractElementLabelEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY, new MaskManagedLabelEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new TextSelectionEditPolicy());
+ installEditPolicy(EditPolicyRoles.SNAP_FEEDBACK_ROLE, new DefaultSnapBackEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new LabelDefaultSemanticEditPolicy());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int getKeyPoint() {
+ return ConnectionLocator.MIDDLE;
+ }
+
+ protected String getLabelTextHelper(IFigure figure) {
+ if(figure instanceof WrappingLabel) {
+ return ((WrappingLabel)figure).getText();
+ } else if(figure instanceof ILabelFigure) {
+ return ((ILabelFigure)figure).getText();
+ } else {
+ return ((Label)figure).getText();
+ }
+ }
+
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if(figure instanceof WrappingLabel) {
+ ((WrappingLabel)figure).setText(text);
+ } else if(figure instanceof ILabelFigure) {
+ ((ILabelFigure)figure).setText(text);
+ } else {
+ ((Label)figure).setText(text);
+ }
+ }
+
+ protected Image getLabelIconHelper(IFigure figure) {
+ if(figure instanceof WrappingLabel) {
+ return ((WrappingLabel)figure).getIcon();
+ } else if(figure instanceof ILabelFigure) {
+ return ((ILabelFigure)figure).getIcon();
+ } else {
+ return ((Label)figure).getIcon();
+ }
+ }
+
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if(figure instanceof WrappingLabel) {
+ ((WrappingLabel)figure).setIcon(icon);
+ } else if(figure instanceof ILabelFigure) {
+ ((ILabelFigure)figure).setIcon(icon);
+ } else {
+ ((Label)figure).setIcon(icon);
+ }
+ }
+
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ @Override
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ public EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ 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;
+ }
+
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if(pdEditPolicy instanceof TextSelectionEditPolicy) {
+ ((TextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ }
+ Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if(sfEditPolicy instanceof TextSelectionEditPolicy) {
+ ((TextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ public String getEditText() {
+ if(getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ 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;
+ }
+ };
+ }
+
+ public IContentAssistProcessor getCompletionProcessor() {
+ if(getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ public ParserOptions getParserOptions() {
+
+ if(getNotationView() == null || getNotationView().getDiagram() == null) {
+ return ParserOptions.NONE;
+ }
+
+ EAnnotation display = getNotationView().getEAnnotation(VisualInformationPapyrusConstants.CUSTOM_APPEARENCE_ANNOTATION);
+ if(display == null) {
+ return getDefaultParserOptions();
+ }
+
+ // display != null
+ int displayOptions = Integer.parseInt(display.getDetails().get(VisualInformationPapyrusConstants.CUSTOM_APPEARANCE_MASK_VALUE));
+ return new ParserOptions(displayOptions);
+ }
+
+ public ParserOptions getDefaultParserOptions() {
+
+ if(getNotationView() == null || getNotationView().getDiagram() == null) {
+ return ParserOptions.NONE;
+ }
+
+ IPreferenceStore store = org.eclipse.papyrus.infra.gmfdiag.preferences.Activator.getDefault().getPreferenceStore();
+ int displayOptions = store.getInt(LabelPreferenceHelper.getPreferenceConstant(getLabelPreferenceKey(), ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE));
+ if(displayOptions == 0) {
+ return ParserOptions.NONE;
+ }
+
+ return new ParserOptions(displayOptions);
+ }
+
+ public IParser getParser() {
+ if(parser == null) {
+ parser = ParserService.getInstance().getParser(new DefaultParserHintAdapter(getNotationView().getDiagram(), getParserElement(), getNotationView().getType()));
+ }
+ return parser;
+ }
+
+ protected DirectEditManager getManager() {
+ if(manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), new TextCellEditorLocator((WrappingLabel)this.getFigure())));
+ }
+ return manager;
+ }
+
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ protected void performDirectEdit(Point eventLocation) {
+ if(getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ private void performDirectEdit(char initialCharacter) {
+ if(getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager)getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ @Override
+ protected void performDirectEditRequest(Request request) {
+
+ final Request theRequest = request;
+
+ if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
+ directEditionMode = getDirectEditionType();
+ }
+ switch(directEditionMode) {
+ case IDirectEdition.NO_DIRECT_EDITION:
+ // no direct edition mode => does nothing
+ return;
+ case IDirectEdition.EXTENDED_DIRECT_EDITOR:
+ updateExtendedEditorConfiguration();
+ if(configuration == null || configuration.getLanguage() == null) {
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if(configuration instanceof IPopupEditorConfiguration) {
+ IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
+ helper.showEditor();
+ return;
+ } else if(configuration instanceof IAdvancedEditorConfiguration) {
+ dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
+ } else if(configuration instanceof IDirectEditorConfiguration) {
+ dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
+ } else {
+ return;
+ }
+ final Dialog finalDialog = dialog;
+
+ if(Window.OK == dialog.open()) {
+ TransactionalEditingDomain domain = getEditingDomain();
+ RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
+
+ @Override
+ protected void doExecute() {
+ configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue());
+
+ }
+ };
+ domain.getCommandStack().execute(command);
+ }
+ }
+ break;
+ case IDirectEdition.DEFAULT_DIRECT_EDITOR:
+
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if(isActive() && isEditable()) {
+ if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest)theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ protected void refreshLabel() {
+
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if(pdEditPolicy instanceof TextSelectionEditPolicy) {
+ ((TextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ }
+ Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if(sfEditPolicy instanceof TextSelectionEditPolicy) {
+ ((TextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if(style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if(style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ @Override
+ protected void refreshFont() {
+ FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if(style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ @Override
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ @Override
+ protected void addSemanticListeners() {
+ if(getParser() instanceof ISemanticParser) {
+ EObject element = getParserElement();
+ 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();
+ }
+ }
+
+ @Override
+ protected void removeSemanticListeners() {
+ if(parserElements != null) {
+ for(int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if(accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ */
+ public int getDirectEditionType() {
+ if(checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if(checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ */
+ protected boolean checkExtendedEditor() {
+ if(resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ */
+ protected void initExtendedEditorConfiguration() {
+ if(configuration == null) {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if(languagePreferred != null && !languagePreferred.equals("")) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else {
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
+ }
+ }
+ }
+
+ /**
+ * Updates the preference configuration
+ */
+ protected void updateExtendedEditorConfiguration() {
+ String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if(languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if(isActive() && isEditable()) {
+ if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest)theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer)event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if(getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser)getParser();
+ if(modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if(resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+
+ super.handleNotificationEvent(event);
+ }
+
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ protected void addSnapBackLocation() {
+ // Use default view position as snap back position
+ IPreferenceStore store = org.eclipse.papyrus.infra.gmfdiag.preferences.Activator.getDefault().getPreferenceStore();
+
+ String xKey = PreferenceConstantHelper.getElementConstant(getLabelPreferenceKey(), PreferenceConstantHelper.LOCATION_X);
+ String yKey = PreferenceConstantHelper.getElementConstant(getLabelPreferenceKey(), PreferenceConstantHelper.LOCATION_Y);
+
+ Point snapBackPosition = new Point(store.getInt(xKey), store.getInt(yKey));
+
+ registerSnapBackPosition(getLabelPreferenceKey(), snapBackPosition);
+ }
+
+ private String getLabelPreferenceKey() {
+ String diagramType = getNotationView().getDiagram().getType();
+ String parentType = ViewUtil.getViewContainer(getNotationView()).getType();
+ String labelType = getNotationView().getType();
+ return diagramType + "_" + parentType + "-" + labelType;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public abstract String getLabelRole();
+
+ /**
+ * {@inheritDoc}
+ */
+ public abstract String getIconPathRole();
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementLinkEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementLinkEditPart.java
index 8ca3e9494f4..69c328e45b5 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementLinkEditPart.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementLinkEditPart.java
@@ -1,245 +1,245 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.edit.part;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.PolygonDecoration;
-import org.eclipse.draw2d.PolylineDecoration;
-import org.eclipse.draw2d.RotatableDecoration;
-import org.eclipse.draw2d.geometry.PointList;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.gmf.diagram.common.edit.policy.DefaultGraphicalNodeEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editparts.UMLConnectionNodeEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.EdgeDecorationType;
-
-/**
- * Abstract non-diagram specific edit part for links.
- * This class is adapted from edit parts generated by GMF Tooling.
- */
-public abstract class AbstractElementLinkEditPart extends UMLConnectionNodeEditPart {
-
- /**
- * Constructor.
- */
- public AbstractElementLinkEditPart(View view) {
- super(view);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
- installEditPolicy(AppliedStereotypeLinkLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeLinkLabelDisplayEditPolicy());
- }
-
- /**
- * Add fixed child edit part.
- */
- protected boolean addFixedChild(EditPart childEditPart) {
- if(childEditPart instanceof AppliedStereotypeLinkLabelEditPart) {
- ((AppliedStereotypeLinkLabelEditPart)childEditPart).setLabel(getPrimaryShape().getAppliedStereotypeLabel());
- return true;
- }
- return false;
- }
-
- /**
- * Remove fixed child edit part.
- */
- protected boolean removeFixedChild(EditPart childEditPart) {
- if(childEditPart instanceof AppliedStereotypeLinkLabelEditPart) {
- return true;
- }
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void addChildVisual(EditPart childEditPart, int index) {
- if(addFixedChild(childEditPart)) {
- return;
- }
- super.addChildVisual(childEditPart, -1);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void removeChildVisual(EditPart childEditPart) {
- if(removeFixedChild(childEditPart)) {
- return;
- }
- super.removeChildVisual(childEditPart);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void handleNotificationEvent(Notification event) {
- super.handleNotificationEvent(event);
-
- // Update the figure when the line width changes
- Object feature = event.getFeature();
- if((getModel() != null) && (getModel() == event.getNotifier())) {
-
- if(NotationPackage.eINSTANCE.getLineStyle_LineWidth().equals(feature)) {
- refreshLineWidth();
- refreshArrowSource();
- refreshArrowTarget();
- } else if(NotationPackage.eINSTANCE.getLineTypeStyle_LineType().equals(feature)) {
- refreshLineType();
- }
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLineType();
- refreshLineWidth();
- refreshArrowSource();
- refreshArrowTarget();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void setLineWidth(int width) {
- if(width < 0) {
- width = 1;
- }
- getPrimaryShape().setLineWidth(width);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void setLineType(int style) {
- getPrimaryShape().setLineStyle(style);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void setArrowSource(RotatableDecoration arrowDecoration) {
- getPrimaryShape().setSourceDecoration(arrowDecoration);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void setArrowTarget(RotatableDecoration arrowDecoration) {
- getPrimaryShape().setTargetDecoration(arrowDecoration);
- }
-
- /**
- * <pre>
- * {@inheritDoc}
- *
- * This method override parent implementation to add a new set of
- * predefined decoration type.
- *
- * The arrowType available constants are given in {@link EdgeDecorationType}.
- * </pre>
- */
- @Override
- protected RotatableDecoration getArrowDecoration(int arrowType) {
- RotatableDecoration decoration = null;
- int width = getLineWidth();
- if(width < 0) {
- width = 1;
- }
- if(arrowType == EdgeDecorationType.OPEN_ARROW) {
- IMapMode mm = getMapMode();
- decoration = new PolylineDecoration();
- ((PolylineDecoration)decoration).setScale(mm.DPtoLP(15 + width), mm.DPtoLP(5 + width));
- ((PolylineDecoration)decoration).setTemplate(PolylineDecoration.TRIANGLE_TIP);
- ((PolylineDecoration)decoration).setLineWidth(mm.DPtoLP(width));
-
- } else if(arrowType == EdgeDecorationType.SOLID_ARROW_FILLED) {
- IMapMode mm = getMapMode();
- decoration = new PolygonDecoration();
- ((PolygonDecoration)decoration).setScale(mm.DPtoLP(15 + width), mm.DPtoLP(5 + width));
- ((PolygonDecoration)decoration).setTemplate(PolygonDecoration.TRIANGLE_TIP);
- ((PolygonDecoration)decoration).setLineWidth(mm.DPtoLP(width));
- ((PolygonDecoration)decoration).setFill(true);
-
- } else if(arrowType == EdgeDecorationType.SOLID_ARROW_EMPTY) {
- IMapMode mm = getMapMode();
- decoration = new PolygonDecoration();
- ((PolygonDecoration)decoration).setScale(mm.DPtoLP(15 + width), mm.DPtoLP(5 + width));
- ((PolygonDecoration)decoration).setTemplate(PolygonDecoration.TRIANGLE_TIP);
- ((PolygonDecoration)decoration).setLineWidth(mm.DPtoLP(width));
-
- // Not really empty... filled with white color.
- ((PolygonDecoration)decoration).setFill(true);
- ((PolygonDecoration)decoration).setBackgroundColor(ColorConstants.white);
-
- } else if(arrowType == EdgeDecorationType.SOLID_DIAMOND_FILLED) {
- IMapMode mm = getMapMode();
- decoration = new PolygonDecoration();
- ((PolygonDecoration)decoration).setScale(mm.DPtoLP(12 + width), mm.DPtoLP(6 + width));
-
- PointList diamondPointList = new PointList();
- diamondPointList.addPoint(0, 0);
- diamondPointList.addPoint(-1, 1);
- diamondPointList.addPoint(-2, 0);
- diamondPointList.addPoint(-1, -1);
-
- ((PolygonDecoration)decoration).setTemplate(diamondPointList);
- ((PolygonDecoration)decoration).setLineWidth(mm.DPtoLP(width));
- ((PolygonDecoration)decoration).setFill(true);
-
- } else if(arrowType == EdgeDecorationType.SOLID_DIAMOND_EMPTY) {
- IMapMode mm = getMapMode();
- decoration = new PolygonDecoration();
- ((PolygonDecoration)decoration).setScale(mm.DPtoLP(12 + width), mm.DPtoLP(6 + width));
-
- PointList diamondPointList = new PointList();
- diamondPointList.addPoint(0, 0);
- diamondPointList.addPoint(-1, 1);
- diamondPointList.addPoint(-2, 0);
- diamondPointList.addPoint(-1, -1);
-
- ((PolygonDecoration)decoration).setTemplate(diamondPointList);
- ((PolygonDecoration)decoration).setLineWidth(mm.DPtoLP(width));
-
- // Not really empty... filled with white color.
- ((PolygonDecoration)decoration).setFill(true);
- ((PolygonDecoration)decoration).setBackgroundColor(ColorConstants.white);
- }
-
- return decoration;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.edit.part;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.PolygonDecoration;
+import org.eclipse.draw2d.PolylineDecoration;
+import org.eclipse.draw2d.RotatableDecoration;
+import org.eclipse.draw2d.geometry.PointList;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.gmf.diagram.common.edit.policy.DefaultGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editparts.UMLConnectionNodeEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.figure.EdgeDecorationType;
+
+/**
+ * Abstract non-diagram specific edit part for links.
+ * This class is adapted from edit parts generated by GMF Tooling.
+ */
+public abstract class AbstractElementLinkEditPart extends UMLConnectionNodeEditPart {
+
+ /**
+ * Constructor.
+ */
+ public AbstractElementLinkEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
+ installEditPolicy(AppliedStereotypeLinkLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeLinkLabelDisplayEditPolicy());
+ }
+
+ /**
+ * Add fixed child edit part.
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if(childEditPart instanceof AppliedStereotypeLinkLabelEditPart) {
+ ((AppliedStereotypeLinkLabelEditPart)childEditPart).setLabel(getPrimaryShape().getAppliedStereotypeLabel());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Remove fixed child edit part.
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+ if(childEditPart instanceof AppliedStereotypeLinkLabelEditPart) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if(addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void removeChildVisual(EditPart childEditPart) {
+ if(removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void handleNotificationEvent(Notification event) {
+ super.handleNotificationEvent(event);
+
+ // Update the figure when the line width changes
+ Object feature = event.getFeature();
+ if((getModel() != null) && (getModel() == event.getNotifier())) {
+
+ if(NotationPackage.eINSTANCE.getLineStyle_LineWidth().equals(feature)) {
+ refreshLineWidth();
+ refreshArrowSource();
+ refreshArrowTarget();
+ } else if(NotationPackage.eINSTANCE.getLineTypeStyle_LineType().equals(feature)) {
+ refreshLineType();
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLineType();
+ refreshLineWidth();
+ refreshArrowSource();
+ refreshArrowTarget();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void setLineWidth(int width) {
+ if(width < 0) {
+ width = 1;
+ }
+ getPrimaryShape().setLineWidth(width);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void setLineType(int style) {
+ getPrimaryShape().setLineStyle(style);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void setArrowSource(RotatableDecoration arrowDecoration) {
+ getPrimaryShape().setSourceDecoration(arrowDecoration);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void setArrowTarget(RotatableDecoration arrowDecoration) {
+ getPrimaryShape().setTargetDecoration(arrowDecoration);
+ }
+
+ /**
+ * <pre>
+ * {@inheritDoc}
+ *
+ * This method override parent implementation to add a new set of
+ * predefined decoration type.
+ *
+ * The arrowType available constants are given in {@link EdgeDecorationType}.
+ * </pre>
+ */
+ @Override
+ protected RotatableDecoration getArrowDecoration(int arrowType) {
+ RotatableDecoration decoration = null;
+ int width = getLineWidth();
+ if(width < 0) {
+ width = 1;
+ }
+ if(arrowType == EdgeDecorationType.OPEN_ARROW) {
+ IMapMode mm = getMapMode();
+ decoration = new PolylineDecoration();
+ ((PolylineDecoration)decoration).setScale(mm.DPtoLP(15 + width), mm.DPtoLP(5 + width));
+ ((PolylineDecoration)decoration).setTemplate(PolylineDecoration.TRIANGLE_TIP);
+ ((PolylineDecoration)decoration).setLineWidth(mm.DPtoLP(width));
+
+ } else if(arrowType == EdgeDecorationType.SOLID_ARROW_FILLED) {
+ IMapMode mm = getMapMode();
+ decoration = new PolygonDecoration();
+ ((PolygonDecoration)decoration).setScale(mm.DPtoLP(15 + width), mm.DPtoLP(5 + width));
+ ((PolygonDecoration)decoration).setTemplate(PolygonDecoration.TRIANGLE_TIP);
+ ((PolygonDecoration)decoration).setLineWidth(mm.DPtoLP(width));
+ ((PolygonDecoration)decoration).setFill(true);
+
+ } else if(arrowType == EdgeDecorationType.SOLID_ARROW_EMPTY) {
+ IMapMode mm = getMapMode();
+ decoration = new PolygonDecoration();
+ ((PolygonDecoration)decoration).setScale(mm.DPtoLP(15 + width), mm.DPtoLP(5 + width));
+ ((PolygonDecoration)decoration).setTemplate(PolygonDecoration.TRIANGLE_TIP);
+ ((PolygonDecoration)decoration).setLineWidth(mm.DPtoLP(width));
+
+ // Not really empty... filled with white color.
+ ((PolygonDecoration)decoration).setFill(true);
+ ((PolygonDecoration)decoration).setBackgroundColor(ColorConstants.white);
+
+ } else if(arrowType == EdgeDecorationType.SOLID_DIAMOND_FILLED) {
+ IMapMode mm = getMapMode();
+ decoration = new PolygonDecoration();
+ ((PolygonDecoration)decoration).setScale(mm.DPtoLP(12 + width), mm.DPtoLP(6 + width));
+
+ PointList diamondPointList = new PointList();
+ diamondPointList.addPoint(0, 0);
+ diamondPointList.addPoint(-1, 1);
+ diamondPointList.addPoint(-2, 0);
+ diamondPointList.addPoint(-1, -1);
+
+ ((PolygonDecoration)decoration).setTemplate(diamondPointList);
+ ((PolygonDecoration)decoration).setLineWidth(mm.DPtoLP(width));
+ ((PolygonDecoration)decoration).setFill(true);
+
+ } else if(arrowType == EdgeDecorationType.SOLID_DIAMOND_EMPTY) {
+ IMapMode mm = getMapMode();
+ decoration = new PolygonDecoration();
+ ((PolygonDecoration)decoration).setScale(mm.DPtoLP(12 + width), mm.DPtoLP(6 + width));
+
+ PointList diamondPointList = new PointList();
+ diamondPointList.addPoint(0, 0);
+ diamondPointList.addPoint(-1, 1);
+ diamondPointList.addPoint(-2, 0);
+ diamondPointList.addPoint(-1, -1);
+
+ ((PolygonDecoration)decoration).setTemplate(diamondPointList);
+ ((PolygonDecoration)decoration).setLineWidth(mm.DPtoLP(width));
+
+ // Not really empty... filled with white color.
+ ((PolygonDecoration)decoration).setFill(true);
+ ((PolygonDecoration)decoration).setBackgroundColor(ColorConstants.white);
+ }
+
+ return decoration;
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementNodeLabelEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementNodeLabelEditPart.java
index ad94d8ff198..7ffbbe8e246 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementNodeLabelEditPart.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementNodeLabelEditPart.java
@@ -1,727 +1,727 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.edit.part;
-
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.DragTracker;
-import org.eclipse.gef.EditPart;
-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.core.util.ViewUtil;
-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.editparts.TopGraphicEditPart;
-import org.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.gef.ui.internal.tools.DelegatingDragEditPartsTracker;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.gmf.diagram.common.edit.part.ITextAwareEditPart;
-import org.eclipse.papyrus.gmf.diagram.common.edit.policy.LabelDirectEditPolicy;
-import org.eclipse.papyrus.gmf.diagram.common.edit.policy.TextNonResizableEditPolicy;
-import org.eclipse.papyrus.gmf.diagram.common.edit.policy.TextSelectionEditPolicy;
-import org.eclipse.papyrus.gmf.diagram.common.locator.TextCellEditorLocator;
-import org.eclipse.papyrus.infra.emf.appearance.helper.NameLabelIconHelper;
-import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants;
-import org.eclipse.papyrus.sysml.diagram.common.preferences.LabelPreferenceHelper;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.edit.policy.MaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editparts.ILabelRoleProvider;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.common.parser.DefaultParserHintAdapter;
-import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Abstract non-diagram specific edit part for labels.
- * This class is adapted from edit parts generated by GMF Tooling.
- */
-public abstract class AbstractElementNodeLabelEditPart extends GraphicalEditPart implements ITextAwareEditPart, ILabelRoleProvider {
-
- private DirectEditManager manager;
-
- private IParser parser;
-
- private List<?> parserElements;
-
- protected String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- */
- protected IDirectEditorConfiguration configuration;
-
- /** Constructor */
- public AbstractElementNodeLabelEditPart(View view) {
- super(view);
- }
-
- /**
- * Compartment-like isSelectable implementation.
- *
- * By default, the edit parts get selectable only if
- * the compartment's top level container matches the top level
- * container of the editpart that currently has the keyboard focus
- * i.e: you need to select the shape first before selecting a this label.
- *
- * @see CompartmentEditPart#isSelectable()
- */
- @Override
- public boolean isSelectable() {
- if(super.isSelectable()) {
- EditPart focusPart = getViewer().getFocusEditPart();
- if(focusPart instanceof IGraphicalEditPart) {
- TopGraphicEditPart focusTopEP = ((IGraphicalEditPart)focusPart).getTopGraphicEditPart();
- TopGraphicEditPart myTopEP = getTopGraphicEditPart();
- if(myTopEP == focusTopEP) {
- // check if the selection contains only editparts belonging to
- // the same top level editpart
- Iterator<?> selection = getViewer().getSelectedEditParts().iterator();
- while(selection.hasNext()) {
- Object editPart = selection.next();
- if(editPart instanceof IGraphicalEditPart && (((IGraphicalEditPart)editPart).getTopGraphicEditPart() != myTopEP)) {
- return false;
- }
- }
- return true;
- }
- }
- }
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public DragTracker getDragTracker(Request request) {
- if(request instanceof SelectionRequest && ((SelectionRequest)request).getLastButtonPressed() == 3) {
- return null;
- }
- // Delegate to the main edit part.
- return new DelegatingDragEditPartsTracker(this, getTopGraphicEditPart());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY, new MaskManagedLabelEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new TextNonResizableEditPolicy());
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- }
-
- protected String getLabelTextHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getText();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getText();
- } else {
- return ((Label)figure).getText();
- }
- }
-
- protected void setLabelTextHelper(IFigure figure, String text) {
- if(figure instanceof WrappingLabel) {
- ((WrappingLabel)figure).setText(text);
- } else if(figure instanceof ILabelFigure) {
- ((ILabelFigure)figure).setText(text);
- } else {
- ((Label)figure).setText(text);
- }
- }
-
- protected Image getLabelIconHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getIcon();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getIcon();
- } else {
- return ((Label)figure).getIcon();
- }
- }
-
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if(figure instanceof WrappingLabel) {
- ((WrappingLabel)figure).setIcon(icon);
- } else if(figure instanceof ILabelFigure) {
- ((ILabelFigure)figure).setIcon(icon);
- } else {
- ((Label)figure).setIcon(icon);
- }
- }
-
- public void setLabel(WrappingLabel figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- @Override
- protected List getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- public EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- protected Image getLabelIcon() {
- EObject parserElement = getParserElement();
- if(parserElement == null) {
- return null;
- }
-
- List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer());
- for(View view : views) {
- if(NameLabelIconHelper.showLabelIcon(view)) {
- return org.eclipse.papyrus.sysml.diagram.common.Activator.getInstance().getLabelProvider().getImage(parserElement);
- }
- }
- return null;
-
- }
-
- 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;
- }
-
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof TextSelectionEditPolicy) {
- ((TextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof TextSelectionEditPolicy) {
- ((TextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
- }
-
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- 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;
- }
- };
- }
-
- public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- public ParserOptions getParserOptions() {
-
- if(getNotationView() == null || getNotationView().getDiagram() == null) {
- return ParserOptions.NONE;
- }
-
- EAnnotation display = getNotationView().getEAnnotation(VisualInformationPapyrusConstants.CUSTOM_APPEARENCE_ANNOTATION);
- if(display == null) {
- return getDefaultParserOptions();
- }
-
- // display != null
- int displayOptions = Integer.parseInt(display.getDetails().get(VisualInformationPapyrusConstants.CUSTOM_APPEARANCE_MASK_VALUE));
- return new ParserOptions(displayOptions);
- }
-
- public ParserOptions getDefaultParserOptions() {
-
- if(getNotationView() == null || getNotationView().getDiagram() == null) {
- return ParserOptions.NONE;
- }
-
- IPreferenceStore store = org.eclipse.papyrus.infra.gmfdiag.preferences.Activator.getDefault().getPreferenceStore();
- int displayOptions = store.getInt(LabelPreferenceHelper.getPreferenceConstant(getLabelPreferenceKey(), ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE));
- if(displayOptions == 0) {
- return ParserOptions.NONE;
- }
-
- return new ParserOptions(displayOptions);
- }
-
- public IParser getParser() {
- if(parser == null) {
- parser = ParserService.getInstance().getParser(new DefaultParserHintAdapter(getNotationView().getDiagram(), getParserElement(), getNotationView().getType()));
- }
- return parser;
- }
-
- protected DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), new TextCellEditorLocator((WrappingLabel)this.getFigure())));
- }
- return manager;
- }
-
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- protected void performDirectEdit() {
- getManager().show();
- }
-
- protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- @Override
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch(directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if(configuration == null || configuration.getLanguage() == null) {
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
- helper.showEditor();
- return;
- } else if(configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if(configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if(Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
-
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- public void run() {
- if(isActive() && isEditable()) {
- if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- break;
- default:
- break;
- }
- }
-
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- protected void refreshLabel() {
-
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
-
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof TextSelectionEditPolicy) {
- ((TextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof TextSelectionEditPolicy) {
- ((TextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- protected void refreshUnderline() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline());
- }
- }
-
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- @Override
- protected void refreshFont() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null) {
- FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- @Override
- protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
- EObject element = getParserElement();
- 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();
- }
- }
-
- @Override
- protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- */
- public int getDirectEditionType() {
- if(checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if(checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- */
- protected boolean checkExtendedEditor() {
- if(resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- */
- protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
- }
- }
- }
-
- /**
- * Updates the preference configuration
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- public void run() {
- if(isActive() && isEditable()) {
- if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- @Override
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer)event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if(getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if(resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
-
- if(event.getNewValue() instanceof EAnnotation && VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON.equals(((EAnnotation)event.getNewValue()).getSource())) {
- refreshLabel();
- }
-
- super.handleNotificationEvent(event);
- }
-
- @Override
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
- }
-
- @Override
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); //$NON-NLS-1$
- }
-
- @Override
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-
- public String getLabelPreferenceKey() {
- String diagramType = getNotationView().getDiagram().getType();
- String parentType = ViewUtil.getViewContainer(getNotationView()).getType();
- String labelType = getNotationView().getType();
- return diagramType + "_" + parentType + "-" + labelType;
- }
-
- /**
- * {@inheritDoc}
- */
- public abstract String getLabelRole();
-
- /**
- * {@inheritDoc}
- */
- public abstract String getIconPathRole();
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.edit.part;
+
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.DragTracker;
+import org.eclipse.gef.EditPart;
+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.core.util.ViewUtil;
+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.editparts.TopGraphicEditPart;
+import org.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.gef.ui.internal.tools.DelegatingDragEditPartsTracker;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.gmf.diagram.common.edit.part.ITextAwareEditPart;
+import org.eclipse.papyrus.gmf.diagram.common.edit.policy.LabelDirectEditPolicy;
+import org.eclipse.papyrus.gmf.diagram.common.edit.policy.TextNonResizableEditPolicy;
+import org.eclipse.papyrus.gmf.diagram.common.edit.policy.TextSelectionEditPolicy;
+import org.eclipse.papyrus.gmf.diagram.common.locator.TextCellEditorLocator;
+import org.eclipse.papyrus.infra.emf.appearance.helper.NameLabelIconHelper;
+import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants;
+import org.eclipse.papyrus.sysml.diagram.common.preferences.LabelPreferenceHelper;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.edit.policy.MaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editparts.ILabelRoleProvider;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.common.parser.DefaultParserHintAdapter;
+import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * Abstract non-diagram specific edit part for labels.
+ * This class is adapted from edit parts generated by GMF Tooling.
+ */
+public abstract class AbstractElementNodeLabelEditPart extends GraphicalEditPart implements ITextAwareEditPart, ILabelRoleProvider {
+
+ private DirectEditManager manager;
+
+ private IParser parser;
+
+ private List<?> parserElements;
+
+ protected String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /** Constructor */
+ public AbstractElementNodeLabelEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * Compartment-like isSelectable implementation.
+ *
+ * By default, the edit parts get selectable only if
+ * the compartment's top level container matches the top level
+ * container of the editpart that currently has the keyboard focus
+ * i.e: you need to select the shape first before selecting a this label.
+ *
+ * @see CompartmentEditPart#isSelectable()
+ */
+ @Override
+ public boolean isSelectable() {
+ if(super.isSelectable()) {
+ EditPart focusPart = getViewer().getFocusEditPart();
+ if(focusPart instanceof IGraphicalEditPart) {
+ TopGraphicEditPart focusTopEP = ((IGraphicalEditPart)focusPart).getTopGraphicEditPart();
+ TopGraphicEditPart myTopEP = getTopGraphicEditPart();
+ if(myTopEP == focusTopEP) {
+ // check if the selection contains only editparts belonging to
+ // the same top level editpart
+ Iterator<?> selection = getViewer().getSelectedEditParts().iterator();
+ while(selection.hasNext()) {
+ Object editPart = selection.next();
+ if(editPart instanceof IGraphicalEditPart && (((IGraphicalEditPart)editPart).getTopGraphicEditPart() != myTopEP)) {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public DragTracker getDragTracker(Request request) {
+ if(request instanceof SelectionRequest && ((SelectionRequest)request).getLastButtonPressed() == 3) {
+ return null;
+ }
+ // Delegate to the main edit part.
+ return new DelegatingDragEditPartsTracker(this, getTopGraphicEditPart());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY, new MaskManagedLabelEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new TextNonResizableEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ protected String getLabelTextHelper(IFigure figure) {
+ if(figure instanceof WrappingLabel) {
+ return ((WrappingLabel)figure).getText();
+ } else if(figure instanceof ILabelFigure) {
+ return ((ILabelFigure)figure).getText();
+ } else {
+ return ((Label)figure).getText();
+ }
+ }
+
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if(figure instanceof WrappingLabel) {
+ ((WrappingLabel)figure).setText(text);
+ } else if(figure instanceof ILabelFigure) {
+ ((ILabelFigure)figure).setText(text);
+ } else {
+ ((Label)figure).setText(text);
+ }
+ }
+
+ protected Image getLabelIconHelper(IFigure figure) {
+ if(figure instanceof WrappingLabel) {
+ return ((WrappingLabel)figure).getIcon();
+ } else if(figure instanceof ILabelFigure) {
+ return ((ILabelFigure)figure).getIcon();
+ } else {
+ return ((Label)figure).getIcon();
+ }
+ }
+
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if(figure instanceof WrappingLabel) {
+ ((WrappingLabel)figure).setIcon(icon);
+ } else if(figure instanceof ILabelFigure) {
+ ((ILabelFigure)figure).setIcon(icon);
+ } else {
+ ((Label)figure).setIcon(icon);
+ }
+ }
+
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ @Override
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ public EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ protected Image getLabelIcon() {
+ EObject parserElement = getParserElement();
+ if(parserElement == null) {
+ return null;
+ }
+
+ List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer());
+ for(View view : views) {
+ if(NameLabelIconHelper.showLabelIcon(view)) {
+ return org.eclipse.papyrus.sysml.diagram.common.Activator.getInstance().getLabelProvider().getImage(parserElement);
+ }
+ }
+ return null;
+
+ }
+
+ 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;
+ }
+
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if(pdEditPolicy instanceof TextSelectionEditPolicy) {
+ ((TextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ }
+ Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if(sfEditPolicy instanceof TextSelectionEditPolicy) {
+ ((TextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ public String getEditText() {
+ if(getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ 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;
+ }
+ };
+ }
+
+ public IContentAssistProcessor getCompletionProcessor() {
+ if(getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ public ParserOptions getParserOptions() {
+
+ if(getNotationView() == null || getNotationView().getDiagram() == null) {
+ return ParserOptions.NONE;
+ }
+
+ EAnnotation display = getNotationView().getEAnnotation(VisualInformationPapyrusConstants.CUSTOM_APPEARENCE_ANNOTATION);
+ if(display == null) {
+ return getDefaultParserOptions();
+ }
+
+ // display != null
+ int displayOptions = Integer.parseInt(display.getDetails().get(VisualInformationPapyrusConstants.CUSTOM_APPEARANCE_MASK_VALUE));
+ return new ParserOptions(displayOptions);
+ }
+
+ public ParserOptions getDefaultParserOptions() {
+
+ if(getNotationView() == null || getNotationView().getDiagram() == null) {
+ return ParserOptions.NONE;
+ }
+
+ IPreferenceStore store = org.eclipse.papyrus.infra.gmfdiag.preferences.Activator.getDefault().getPreferenceStore();
+ int displayOptions = store.getInt(LabelPreferenceHelper.getPreferenceConstant(getLabelPreferenceKey(), ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE));
+ if(displayOptions == 0) {
+ return ParserOptions.NONE;
+ }
+
+ return new ParserOptions(displayOptions);
+ }
+
+ public IParser getParser() {
+ if(parser == null) {
+ parser = ParserService.getInstance().getParser(new DefaultParserHintAdapter(getNotationView().getDiagram(), getParserElement(), getNotationView().getType()));
+ }
+ return parser;
+ }
+
+ protected DirectEditManager getManager() {
+ if(manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), new TextCellEditorLocator((WrappingLabel)this.getFigure())));
+ }
+ return manager;
+ }
+
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ protected void performDirectEdit(Point eventLocation) {
+ if(getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ private void performDirectEdit(char initialCharacter) {
+ if(getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager)getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ @Override
+ protected void performDirectEditRequest(Request request) {
+
+ final Request theRequest = request;
+
+ if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
+ directEditionMode = getDirectEditionType();
+ }
+ switch(directEditionMode) {
+ case IDirectEdition.NO_DIRECT_EDITION:
+ // no direct edition mode => does nothing
+ return;
+ case IDirectEdition.EXTENDED_DIRECT_EDITOR:
+ updateExtendedEditorConfiguration();
+ if(configuration == null || configuration.getLanguage() == null) {
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if(configuration instanceof IPopupEditorConfiguration) {
+ IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
+ helper.showEditor();
+ return;
+ } else if(configuration instanceof IAdvancedEditorConfiguration) {
+ dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
+ } else if(configuration instanceof IDirectEditorConfiguration) {
+ dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
+ } else {
+ return;
+ }
+ final Dialog finalDialog = dialog;
+
+ if(Window.OK == dialog.open()) {
+ TransactionalEditingDomain domain = getEditingDomain();
+ RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
+
+ @Override
+ protected void doExecute() {
+ configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue());
+
+ }
+ };
+ domain.getCommandStack().execute(command);
+ }
+ }
+ break;
+ case IDirectEdition.DEFAULT_DIRECT_EDITOR:
+
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if(isActive() && isEditable()) {
+ if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest)theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ protected void refreshLabel() {
+
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if(pdEditPolicy instanceof TextSelectionEditPolicy) {
+ ((TextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ }
+ Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if(sfEditPolicy instanceof TextSelectionEditPolicy) {
+ ((TextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if(style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if(style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ @Override
+ protected void refreshFont() {
+ FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if(style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ @Override
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ @Override
+ protected void addSemanticListeners() {
+ if(getParser() instanceof ISemanticParser) {
+ EObject element = getParserElement();
+ 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();
+ }
+ }
+
+ @Override
+ protected void removeSemanticListeners() {
+ if(parserElements != null) {
+ for(int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if(accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ */
+ public int getDirectEditionType() {
+ if(checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if(checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ */
+ protected boolean checkExtendedEditor() {
+ if(resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ */
+ protected void initExtendedEditorConfiguration() {
+ if(configuration == null) {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if(languagePreferred != null && !languagePreferred.equals("")) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else {
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
+ }
+ }
+ }
+
+ /**
+ * Updates the preference configuration
+ */
+ protected void updateExtendedEditorConfiguration() {
+ String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if(languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if(isActive() && isEditable()) {
+ if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest)theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer)event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if(getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser)getParser();
+ if(modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if(resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+
+ if(event.getNewValue() instanceof EAnnotation && VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON.equals(((EAnnotation)event.getNewValue()).getSource())) {
+ refreshLabel();
+ }
+
+ super.handleNotificationEvent(event);
+ }
+
+ @Override
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ @Override
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ public String getLabelPreferenceKey() {
+ String diagramType = getNotationView().getDiagram().getType();
+ String parentType = ViewUtil.getViewContainer(getNotationView()).getType();
+ String labelType = getNotationView().getType();
+ return diagramType + "_" + parentType + "-" + labelType;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public abstract String getLabelRole();
+
+ /**
+ * {@inheritDoc}
+ */
+ public abstract String getIconPathRole();
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractShapeCompartmentEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractShapeCompartmentEditPart.java
index b11eb8c95f3..7202aa4da9e 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractShapeCompartmentEditPart.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractShapeCompartmentEditPart.java
@@ -1,116 +1,116 @@
-package org.eclipse.papyrus.uml.diagram.common.edit.part;
-
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.gef.DragTracker;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.RequestConstants;
-import org.eclipse.gef.requests.SelectionRequest;
-import org.eclipse.gef.tools.DeselectAllTracker;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeCompartmentEditPart;
-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.internal.tools.RubberbandDragTracker;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.gmf.diagram.common.edit.policy.CompartmentSemanticEditPolicy;
-import org.eclipse.papyrus.gmf.diagram.common.edit.policy.DefaultCreationEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.DuplicatePasteEditPolicy;
-
-/**
- * Abstract non-diagram specific edit part for shape compartment.
- * This class is adapted from edit parts generated by GMF Tooling.
- */
-public abstract class AbstractShapeCompartmentEditPart extends ShapeCompartmentEditPart {
-
- public AbstractShapeCompartmentEditPart(View view) {
- super(view);
- }
-
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CompartmentSemanticEditPolicy());
- installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy());
- installEditPolicy(DuplicatePasteEditPolicy.PASTE_ROLE, new DuplicatePasteEditPolicy());
- installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomContainerEditPolicy());
- }
-
- @Override
- protected void setRatio(Double ratio) {
- if(getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
- super.setRatio(ratio);
- }
- }
-
- @Override
- protected void handleNotificationEvent(Notification notification) {
- Object feature = notification.getFeature();
- if(NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature) || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
- refreshBounds();
- }
- super.handleNotificationEvent(notification);
- }
-
- protected void refreshBounds() {
- int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- Dimension size = new Dimension(width, height);
- int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- Point loc = new Point(x, y);
- ((GraphicalEditPart)getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size));
- }
-
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshBounds();
- }
-
- /**
- * Install a drag tracker supporting double click (necessary for navigation).
- */
- public DragTracker getDragTracker(Request req) {
- if (!supportsDragSelection())
- return super.getDragTracker(req);
-
- if (req instanceof SelectionRequest
- && ((SelectionRequest) req).getLastButtonPressed() == 3)
- return new DeselectAllTracker(this) {
-
- protected boolean handleButtonDown(int button) {
- getCurrentViewer().select(AbstractShapeCompartmentEditPart.this);
- return true;
- }
- };
-
- return new RubberbandDragTracker() {
-
- /* this method has been respecified in order to allow double click
- * on the compartment.
- * hence it allows the navigation by double click
- */
- protected boolean handleDoubleClick(int button) {
- SelectionRequest request = new SelectionRequest();
- request.setLocation(getLocation());
- request.setType(RequestConstants.REQ_OPEN);
- performRequest(request);
- return true;
- }
-
- protected void handleFinished() {
- if (getViewer().getSelectedEditParts().isEmpty())
- getViewer().select(AbstractShapeCompartmentEditPart.this);
- }
-
- };
- }
-}
+package org.eclipse.papyrus.uml.diagram.common.edit.part;
+
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.gef.DragTracker;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.RequestConstants;
+import org.eclipse.gef.requests.SelectionRequest;
+import org.eclipse.gef.tools.DeselectAllTracker;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeCompartmentEditPart;
+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.internal.tools.RubberbandDragTracker;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.gmf.diagram.common.edit.policy.CompartmentSemanticEditPolicy;
+import org.eclipse.papyrus.gmf.diagram.common.edit.policy.DefaultCreationEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.DuplicatePasteEditPolicy;
+
+/**
+ * Abstract non-diagram specific edit part for shape compartment.
+ * This class is adapted from edit parts generated by GMF Tooling.
+ */
+public abstract class AbstractShapeCompartmentEditPart extends ShapeCompartmentEditPart {
+
+ public AbstractShapeCompartmentEditPart(View view) {
+ super(view);
+ }
+
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CompartmentSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy());
+ installEditPolicy(DuplicatePasteEditPolicy.PASTE_ROLE, new DuplicatePasteEditPolicy());
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomContainerEditPolicy());
+ }
+
+ @Override
+ protected void setRatio(Double ratio) {
+ if(getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ }
+
+ @Override
+ protected void handleNotificationEvent(Notification notification) {
+ Object feature = notification.getFeature();
+ if(NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature) || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
+ refreshBounds();
+ }
+ super.handleNotificationEvent(notification);
+ }
+
+ protected void refreshBounds() {
+ int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
+ int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
+ Dimension size = new Dimension(width, height);
+ int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ Point loc = new Point(x, y);
+ ((GraphicalEditPart)getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size));
+ }
+
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshBounds();
+ }
+
+ /**
+ * Install a drag tracker supporting double click (necessary for navigation).
+ */
+ public DragTracker getDragTracker(Request req) {
+ if (!supportsDragSelection())
+ return super.getDragTracker(req);
+
+ if (req instanceof SelectionRequest
+ && ((SelectionRequest) req).getLastButtonPressed() == 3)
+ return new DeselectAllTracker(this) {
+
+ protected boolean handleButtonDown(int button) {
+ getCurrentViewer().select(AbstractShapeCompartmentEditPart.this);
+ return true;
+ }
+ };
+
+ return new RubberbandDragTracker() {
+
+ /* this method has been respecified in order to allow double click
+ * on the compartment.
+ * hence it allows the navigation by double click
+ */
+ protected boolean handleDoubleClick(int button) {
+ SelectionRequest request = new SelectionRequest();
+ request.setLocation(getLocation());
+ request.setType(RequestConstants.REQ_OPEN);
+ performRequest(request);
+ return true;
+ }
+
+ protected void handleFinished() {
+ if (getViewer().getSelectedEditParts().isEmpty())
+ getViewer().select(AbstractShapeCompartmentEditPart.this);
+ }
+
+ };
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AppliedStereotypeAffixedLabelEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AppliedStereotypeAffixedLabelEditPart.java
index 17af6b88407..8e8baf3814f 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AppliedStereotypeAffixedLabelEditPart.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AppliedStereotypeAffixedLabelEditPart.java
@@ -1,127 +1,127 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.edit.part;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IPapyrusEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure;
-
-/**
- * This class implements an affixed label edit part for applied stereotype representation on border items.
- */
-public class AppliedStereotypeAffixedLabelEditPart extends AbstractElementLabelEditPart implements IBorderItemEditPart, IPapyrusEditPart {
-
- /** Constructor */
- public AppliedStereotypeAffixedLabelEditPart(View view) {
- super(view);
- addSnapBackLocation();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeExternalNodeEditPolicy());
- }
-
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if(parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator)constraint;
- }
- return null;
- }
-
- public void refreshBounds() {
- int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
-
- // Update locator constraint
- IBorderItemLocator locator = getBorderItemLocator();
- locator.setConstraint(new Rectangle(x, y, width, height));
-
- // Set new constraint on parent figure
- getFigure().getParent().setConstraint(getFigure(), locator);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected IFigure createFigure() {
- IFigure label = createFigurePrim();
- defaultText = getLabelTextHelper(label);
- return label;
- }
-
- protected IFigure createFigurePrim() {
- return new AppliedStereotypeWrappingLabelFigure();
- }
-
- public IFigure getPrimaryShape() {
- return (IFigure)getFigure();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected boolean isEditable() {
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * Forbid direct edition on this label.
- */
- public int getDirectEditionType() {
- // The label is read-only (defined in GMFGen model)
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * {@inheritDoc}
- */
- public String getLabelRole() {
- return "Stereotype";//$NON-NLS-1$
- }
-
- /**
- * {@inheritDoc}
- */
- public String getIconPathRole() {
- return "";//$NON-NLS-1$
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.edit.part;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IPapyrusEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure;
+
+/**
+ * This class implements an affixed label edit part for applied stereotype representation on border items.
+ */
+public class AppliedStereotypeAffixedLabelEditPart extends AbstractElementLabelEditPart implements IBorderItemEditPart, IPapyrusEditPart {
+
+ /** Constructor */
+ public AppliedStereotypeAffixedLabelEditPart(View view) {
+ super(view);
+ addSnapBackLocation();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeExternalNodeEditPolicy());
+ }
+
+ public IBorderItemLocator getBorderItemLocator() {
+ IFigure parentFigure = getFigure().getParent();
+ if(parentFigure != null && parentFigure.getLayoutManager() != null) {
+ Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
+ return (IBorderItemLocator)constraint;
+ }
+ return null;
+ }
+
+ public void refreshBounds() {
+ int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
+ int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
+
+ // Update locator constraint
+ IBorderItemLocator locator = getBorderItemLocator();
+ locator.setConstraint(new Rectangle(x, y, width, height));
+
+ // Set new constraint on parent figure
+ getFigure().getParent().setConstraint(getFigure(), locator);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected IFigure createFigure() {
+ IFigure label = createFigurePrim();
+ defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ protected IFigure createFigurePrim() {
+ return new AppliedStereotypeWrappingLabelFigure();
+ }
+
+ public IFigure getPrimaryShape() {
+ return (IFigure)getFigure();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * Forbid direct edition on this label.
+ */
+ public int getDirectEditionType() {
+ // The label is read-only (defined in GMFGen model)
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getLabelRole() {
+ return "Stereotype";//$NON-NLS-1$
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getIconPathRole() {
+ return "";//$NON-NLS-1$
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AppliedStereotypeLinkLabelEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AppliedStereotypeLinkLabelEditPart.java
index 57a9a3ba613..67b116897ff 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AppliedStereotypeLinkLabelEditPart.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AppliedStereotypeLinkLabelEditPart.java
@@ -1,80 +1,80 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.edit.part;
-
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.gmf.diagram.common.edit.policy.LinkLabelDragEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-
-/**
- * Abstract non-diagram specific edit part for link label representing applied stereotypes.
- * This class is adapted from edit parts generated by GMF Tooling.
- */
-public class AppliedStereotypeLinkLabelEditPart extends AbstractElementLabelEditPart {
-
- /** Constructor */
- public AppliedStereotypeLinkLabelEditPart(View view) {
- super(view);
- addSnapBackLocation();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new LinkLabelDragEditPolicy());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected boolean isEditable() {
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * Forbid direct edition on this label.
- */
- public int getDirectEditionType() {
- // The label is read-only (defined in GMFGen model)
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * {@inheritDoc}
- */
- public String getLabelRole() {
- return "Stereotype";//$NON-NLS-1$
- }
-
- /**
- * {@inheritDoc}
- */
- public String getIconPathRole() {
- return "";//$NON-NLS-1$
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.edit.part;
+
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.gmf.diagram.common.edit.policy.LinkLabelDragEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+
+/**
+ * Abstract non-diagram specific edit part for link label representing applied stereotypes.
+ * This class is adapted from edit parts generated by GMF Tooling.
+ */
+public class AppliedStereotypeLinkLabelEditPart extends AbstractElementLabelEditPart {
+
+ /** Constructor */
+ public AppliedStereotypeLinkLabelEditPart(View view) {
+ super(view);
+ addSnapBackLocation();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new LinkLabelDragEditPolicy());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * Forbid direct edition on this label.
+ */
+ public int getDirectEditionType() {
+ // The label is read-only (defined in GMFGen model)
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getLabelRole() {
+ return "Stereotype";//$NON-NLS-1$
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getIconPathRole() {
+ return "";//$NON-NLS-1$
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AssociationLinkLabelSourceMultiplicityEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AssociationLinkLabelSourceMultiplicityEditPart.java
index b5b946ea73e..43448d1aabd 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AssociationLinkLabelSourceMultiplicityEditPart.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AssociationLinkLabelSourceMultiplicityEditPart.java
@@ -1,91 +1,91 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.edit.part;
-
-import org.eclipse.draw2d.ConnectionLocator;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.gmf.diagram.common.edit.policy.LinkLabelDragEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.utils.AssociationViewUtils;
-import org.eclipse.uml2.uml.Association;
-
-/**
- * Edit Part for link label showing {@link Association} source multiplicity.
- */
-public class AssociationLinkLabelSourceMultiplicityEditPart extends AbstractElementLabelEditPart {
-
- /** Constructor */
- public AssociationLinkLabelSourceMultiplicityEditPart(View view) {
- super(view);
- addSnapBackLocation();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new LinkLabelDragEditPolicy());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int getKeyPoint() {
- return ConnectionLocator.SOURCE;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public EObject getParserElement() {
- Association association = (Association)resolveSemanticElement();
- if((getNotationView() != null) && (ViewUtil.getContainerView(getNotationView()) != null)) {
- View owner = ViewUtil.getContainerView(getNotationView());
-
- if((association != null) && (association.getMemberEnds().size() == 2)) {
- return AssociationViewUtils.getSourceSemanticEnd(owner);
- }
- }
-
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected boolean isEditable() {
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- public String getLabelRole() {
- return "SourceMultiplicity"; //$NON-NLS-1$
- }
-
- /**
- * {@inheritDoc}
- */
- public String getIconPathRole() {
- return ""; //$NON-NLS-1$
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.edit.part;
+
+import org.eclipse.draw2d.ConnectionLocator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.gmf.diagram.common.edit.policy.LinkLabelDragEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.utils.AssociationViewUtils;
+import org.eclipse.uml2.uml.Association;
+
+/**
+ * Edit Part for link label showing {@link Association} source multiplicity.
+ */
+public class AssociationLinkLabelSourceMultiplicityEditPart extends AbstractElementLabelEditPart {
+
+ /** Constructor */
+ public AssociationLinkLabelSourceMultiplicityEditPart(View view) {
+ super(view);
+ addSnapBackLocation();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new LinkLabelDragEditPolicy());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int getKeyPoint() {
+ return ConnectionLocator.SOURCE;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public EObject getParserElement() {
+ Association association = (Association)resolveSemanticElement();
+ if((getNotationView() != null) && (ViewUtil.getContainerView(getNotationView()) != null)) {
+ View owner = ViewUtil.getContainerView(getNotationView());
+
+ if((association != null) && (association.getMemberEnds().size() == 2)) {
+ return AssociationViewUtils.getSourceSemanticEnd(owner);
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getLabelRole() {
+ return "SourceMultiplicity"; //$NON-NLS-1$
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getIconPathRole() {
+ return ""; //$NON-NLS-1$
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AssociationLinkLabelSourceRoleEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AssociationLinkLabelSourceRoleEditPart.java
index bd0ad9e0313..671884e9b8e 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AssociationLinkLabelSourceRoleEditPart.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AssociationLinkLabelSourceRoleEditPart.java
@@ -1,83 +1,83 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.edit.part;
-
-import org.eclipse.draw2d.ConnectionLocator;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.gmf.diagram.common.edit.policy.LinkLabelDragEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.utils.AssociationViewUtils;
-import org.eclipse.uml2.uml.Association;
-
-/**
- * Edit Part for link label showing {@link Association} source role.
- */
-public class AssociationLinkLabelSourceRoleEditPart extends AbstractElementLabelEditPart {
-
- /** Constructor */
- public AssociationLinkLabelSourceRoleEditPart(View view) {
- super(view);
- addSnapBackLocation();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new LinkLabelDragEditPolicy());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int getKeyPoint() {
- return ConnectionLocator.SOURCE;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public EObject getParserElement() {
- Association association = (Association)resolveSemanticElement();
- if((getNotationView() != null) && (ViewUtil.getContainerView(getNotationView()) != null)) {
- View owner = ViewUtil.getContainerView(getNotationView());
-
- if((association != null) && (association.getMemberEnds().size() == 2)) {
- return AssociationViewUtils.getSourceSemanticEnd(owner);
- }
- }
-
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- public String getLabelRole() {
- return "SourceRole"; //$NON-NLS-1$
- }
-
- /**
- * {@inheritDoc}
- */
- public String getIconPathRole() {
- return ""; //$NON-NLS-1$
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.edit.part;
+
+import org.eclipse.draw2d.ConnectionLocator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.gmf.diagram.common.edit.policy.LinkLabelDragEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.utils.AssociationViewUtils;
+import org.eclipse.uml2.uml.Association;
+
+/**
+ * Edit Part for link label showing {@link Association} source role.
+ */
+public class AssociationLinkLabelSourceRoleEditPart extends AbstractElementLabelEditPart {
+
+ /** Constructor */
+ public AssociationLinkLabelSourceRoleEditPart(View view) {
+ super(view);
+ addSnapBackLocation();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new LinkLabelDragEditPolicy());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int getKeyPoint() {
+ return ConnectionLocator.SOURCE;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public EObject getParserElement() {
+ Association association = (Association)resolveSemanticElement();
+ if((getNotationView() != null) && (ViewUtil.getContainerView(getNotationView()) != null)) {
+ View owner = ViewUtil.getContainerView(getNotationView());
+
+ if((association != null) && (association.getMemberEnds().size() == 2)) {
+ return AssociationViewUtils.getSourceSemanticEnd(owner);
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getLabelRole() {
+ return "SourceRole"; //$NON-NLS-1$
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getIconPathRole() {
+ return ""; //$NON-NLS-1$
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AssociationLinkLabelTargetMultiplicityEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AssociationLinkLabelTargetMultiplicityEditPart.java
index 215c28c24a1..0a43778ac63 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AssociationLinkLabelTargetMultiplicityEditPart.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AssociationLinkLabelTargetMultiplicityEditPart.java
@@ -1,91 +1,91 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.edit.part;
-
-import org.eclipse.draw2d.ConnectionLocator;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.gmf.diagram.common.edit.policy.LinkLabelDragEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.utils.AssociationViewUtils;
-import org.eclipse.uml2.uml.Association;
-
-/**
- * Edit Part for link label showing {@link Association} target multiplicity.
- */
-public class AssociationLinkLabelTargetMultiplicityEditPart extends AbstractElementLabelEditPart {
-
- /** Constructor */
- public AssociationLinkLabelTargetMultiplicityEditPart(View view) {
- super(view);
- addSnapBackLocation();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new LinkLabelDragEditPolicy());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int getKeyPoint() {
- return ConnectionLocator.TARGET;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public EObject getParserElement() {
- Association association = (Association)resolveSemanticElement();
- if((getNotationView() != null) && (ViewUtil.getContainerView(getNotationView()) != null)) {
- View owner = ViewUtil.getContainerView(getNotationView());
-
- if((association != null) && (association.getMemberEnds().size() == 2)) {
- return AssociationViewUtils.getTargetSemanticEnd(owner);
- }
- }
-
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected boolean isEditable() {
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- public String getLabelRole() {
- return "TargetMultiplicity"; //$NON-NLS-1$
- }
-
- /**
- * {@inheritDoc}
- */
- public String getIconPathRole() {
- return ""; //$NON-NLS-1$
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.edit.part;
+
+import org.eclipse.draw2d.ConnectionLocator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.gmf.diagram.common.edit.policy.LinkLabelDragEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.utils.AssociationViewUtils;
+import org.eclipse.uml2.uml.Association;
+
+/**
+ * Edit Part for link label showing {@link Association} target multiplicity.
+ */
+public class AssociationLinkLabelTargetMultiplicityEditPart extends AbstractElementLabelEditPart {
+
+ /** Constructor */
+ public AssociationLinkLabelTargetMultiplicityEditPart(View view) {
+ super(view);
+ addSnapBackLocation();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new LinkLabelDragEditPolicy());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int getKeyPoint() {
+ return ConnectionLocator.TARGET;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public EObject getParserElement() {
+ Association association = (Association)resolveSemanticElement();
+ if((getNotationView() != null) && (ViewUtil.getContainerView(getNotationView()) != null)) {
+ View owner = ViewUtil.getContainerView(getNotationView());
+
+ if((association != null) && (association.getMemberEnds().size() == 2)) {
+ return AssociationViewUtils.getTargetSemanticEnd(owner);
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getLabelRole() {
+ return "TargetMultiplicity"; //$NON-NLS-1$
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getIconPathRole() {
+ return ""; //$NON-NLS-1$
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AssociationLinkLabelTargetRoleEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AssociationLinkLabelTargetRoleEditPart.java
index 662f7999e76..fa7651eccf5 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AssociationLinkLabelTargetRoleEditPart.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AssociationLinkLabelTargetRoleEditPart.java
@@ -1,83 +1,83 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.edit.part;
-
-import org.eclipse.draw2d.ConnectionLocator;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.gmf.diagram.common.edit.policy.LinkLabelDragEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.utils.AssociationViewUtils;
-import org.eclipse.uml2.uml.Association;
-
-/**
- * Edit Part for link label showing {@link Association} target role.
- */
-public class AssociationLinkLabelTargetRoleEditPart extends AbstractElementLabelEditPart {
-
- /** Constructor */
- public AssociationLinkLabelTargetRoleEditPart(View view) {
- super(view);
- addSnapBackLocation();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new LinkLabelDragEditPolicy());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int getKeyPoint() {
- return ConnectionLocator.TARGET;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public EObject getParserElement() {
- Association association = (Association)resolveSemanticElement();
- if((getNotationView() != null) && (ViewUtil.getContainerView(getNotationView()) != null)) {
- View owner = ViewUtil.getContainerView(getNotationView());
-
- if((association != null) && (association.getMemberEnds().size() == 2)) {
- return AssociationViewUtils.getTargetSemanticEnd(owner);
- }
- }
-
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- public String getLabelRole() {
- return "TargetRole"; //$NON-NLS-1$
- }
-
- /**
- * {@inheritDoc}
- */
- public String getIconPathRole() {
- return ""; //$NON-NLS-1$
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.edit.part;
+
+import org.eclipse.draw2d.ConnectionLocator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.gmf.diagram.common.edit.policy.LinkLabelDragEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.utils.AssociationViewUtils;
+import org.eclipse.uml2.uml.Association;
+
+/**
+ * Edit Part for link label showing {@link Association} target role.
+ */
+public class AssociationLinkLabelTargetRoleEditPart extends AbstractElementLabelEditPart {
+
+ /** Constructor */
+ public AssociationLinkLabelTargetRoleEditPart(View view) {
+ super(view);
+ addSnapBackLocation();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new LinkLabelDragEditPolicy());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int getKeyPoint() {
+ return ConnectionLocator.TARGET;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public EObject getParserElement() {
+ Association association = (Association)resolveSemanticElement();
+ if((getNotationView() != null) && (ViewUtil.getContainerView(getNotationView()) != null)) {
+ View owner = ViewUtil.getContainerView(getNotationView());
+
+ if((association != null) && (association.getMemberEnds().size() == 2)) {
+ return AssociationViewUtils.getTargetSemanticEnd(owner);
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getLabelRole() {
+ return "TargetRole"; //$NON-NLS-1$
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getIconPathRole() {
+ return ""; //$NON-NLS-1$
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorLinkLabelEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorLinkLabelEditPart.java
index eeeacc84599..a4e327cf875 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorLinkLabelEditPart.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorLinkLabelEditPart.java
@@ -1,53 +1,53 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.edit.part;
-
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.gmf.diagram.common.edit.policy.LinkLabelDragEditPolicy;
-
-/**
- * Edit Part for link label showing {@link Connector} label.
- */
-public class ConnectorLinkLabelEditPart extends AbstractElementLabelEditPart {
-
- /** Constructor */
- public ConnectorLinkLabelEditPart(View view) {
- super(view);
- addSnapBackLocation();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new LinkLabelDragEditPolicy());
- }
-
- /**
- * {@inheritDoc}
- */
- public String getLabelRole() {
- return "Label"; //$NON-NLS-1$
- }
-
- /**
- * {@inheritDoc}
- */
- public String getIconPathRole() {
- return ""; //$NON-NLS-1$
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.edit.part;
+
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.gmf.diagram.common.edit.policy.LinkLabelDragEditPolicy;
+
+/**
+ * Edit Part for link label showing {@link Connector} label.
+ */
+public class ConnectorLinkLabelEditPart extends AbstractElementLabelEditPart {
+
+ /** Constructor */
+ public ConnectorLinkLabelEditPart(View view) {
+ super(view);
+ addSnapBackLocation();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new LinkLabelDragEditPolicy());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getLabelRole() {
+ return "Label"; //$NON-NLS-1$
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getIconPathRole() {
+ return ""; //$NON-NLS-1$
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorLinkLabelSourceMultiplicityEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorLinkLabelSourceMultiplicityEditPart.java
index 9e0f8a406e8..d007ac11ad8 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorLinkLabelSourceMultiplicityEditPart.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorLinkLabelSourceMultiplicityEditPart.java
@@ -1,90 +1,90 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.edit.part;
-
-import org.eclipse.draw2d.ConnectionLocator;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.gmf.diagram.common.edit.policy.LinkLabelDragEditPolicy;
-import org.eclipse.uml2.uml.Connector;
-
-/**
- * Edit Part for link label showing {@link Connector} source {@link ConnectorEnd} multiplicity.
- */
-public class ConnectorLinkLabelSourceMultiplicityEditPart extends AbstractElementLabelEditPart {
-
- /** Constructor */
- public ConnectorLinkLabelSourceMultiplicityEditPart(View view) {
- super(view);
- addSnapBackLocation();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new LinkLabelDragEditPolicy());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int getKeyPoint() {
- return ConnectionLocator.SOURCE;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public EObject getParserElement() {
- Connector connector = (Connector)resolveSemanticElement();
- if((getNotationView() != null) && (ViewUtil.getContainerView(getNotationView()) != null)) {
- View owner = ViewUtil.getContainerView(getNotationView());
-
- if((connector != null) && (connector.getEnds().size() == 2)) {
- return connector.getEnds().get(0);
- }
- }
-
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected boolean isEditable() {
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- public String getLabelRole() {
- return "SourceMultiplicity"; //$NON-NLS-1$
- }
-
- /**
- * {@inheritDoc}
- */
- public String getIconPathRole() {
- return ""; //$NON-NLS-1$
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.edit.part;
+
+import org.eclipse.draw2d.ConnectionLocator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.gmf.diagram.common.edit.policy.LinkLabelDragEditPolicy;
+import org.eclipse.uml2.uml.Connector;
+
+/**
+ * Edit Part for link label showing {@link Connector} source {@link ConnectorEnd} multiplicity.
+ */
+public class ConnectorLinkLabelSourceMultiplicityEditPart extends AbstractElementLabelEditPart {
+
+ /** Constructor */
+ public ConnectorLinkLabelSourceMultiplicityEditPart(View view) {
+ super(view);
+ addSnapBackLocation();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new LinkLabelDragEditPolicy());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int getKeyPoint() {
+ return ConnectionLocator.SOURCE;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public EObject getParserElement() {
+ Connector connector = (Connector)resolveSemanticElement();
+ if((getNotationView() != null) && (ViewUtil.getContainerView(getNotationView()) != null)) {
+ View owner = ViewUtil.getContainerView(getNotationView());
+
+ if((connector != null) && (connector.getEnds().size() == 2)) {
+ return connector.getEnds().get(0);
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getLabelRole() {
+ return "SourceMultiplicity"; //$NON-NLS-1$
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getIconPathRole() {
+ return ""; //$NON-NLS-1$
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorLinkLabelTargetMultiplicityEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorLinkLabelTargetMultiplicityEditPart.java
index 888977f319d..189a7163b72 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorLinkLabelTargetMultiplicityEditPart.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorLinkLabelTargetMultiplicityEditPart.java
@@ -1,90 +1,90 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.edit.part;
-
-import org.eclipse.draw2d.ConnectionLocator;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.gmf.diagram.common.edit.policy.LinkLabelDragEditPolicy;
-import org.eclipse.uml2.uml.Connector;
-
-/**
- * Edit Part for link label showing {@link Connector} target {@link ConnectorEnd} multiplicity.
- */
-public class ConnectorLinkLabelTargetMultiplicityEditPart extends AbstractElementLabelEditPart {
-
- /** Constructor */
- public ConnectorLinkLabelTargetMultiplicityEditPart(View view) {
- super(view);
- addSnapBackLocation();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new LinkLabelDragEditPolicy());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int getKeyPoint() {
- return ConnectionLocator.TARGET;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public EObject getParserElement() {
- Connector connector = (Connector)resolveSemanticElement();
- if((getNotationView() != null) && (ViewUtil.getContainerView(getNotationView()) != null)) {
- View owner = ViewUtil.getContainerView(getNotationView());
-
- if((connector != null) && (connector.getEnds().size() == 2)) {
- connector.getEnds().get(1);
- }
- }
-
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected boolean isEditable() {
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- public String getLabelRole() {
- return "TargetMultiplicity"; //$NON-NLS-1$
- }
-
- /**
- * {@inheritDoc}
- */
- public String getIconPathRole() {
- return ""; //$NON-NLS-1$
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.edit.part;
+
+import org.eclipse.draw2d.ConnectionLocator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.gmf.diagram.common.edit.policy.LinkLabelDragEditPolicy;
+import org.eclipse.uml2.uml.Connector;
+
+/**
+ * Edit Part for link label showing {@link Connector} target {@link ConnectorEnd} multiplicity.
+ */
+public class ConnectorLinkLabelTargetMultiplicityEditPart extends AbstractElementLabelEditPart {
+
+ /** Constructor */
+ public ConnectorLinkLabelTargetMultiplicityEditPart(View view) {
+ super(view);
+ addSnapBackLocation();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new LinkLabelDragEditPolicy());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int getKeyPoint() {
+ return ConnectionLocator.TARGET;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public EObject getParserElement() {
+ Connector connector = (Connector)resolveSemanticElement();
+ if((getNotationView() != null) && (ViewUtil.getContainerView(getNotationView()) != null)) {
+ View owner = ViewUtil.getContainerView(getNotationView());
+
+ if((connector != null) && (connector.getEnds().size() == 2)) {
+ connector.getEnds().get(1);
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getLabelRole() {
+ return "TargetMultiplicity"; //$NON-NLS-1$
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getIconPathRole() {
+ return ""; //$NON-NLS-1$
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConstraintNodeLabelEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConstraintNodeLabelEditPart.java
new file mode 100644
index 00000000000..6609dcb8f8d
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConstraintNodeLabelEditPart.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.edit.part;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil;
+import org.eclipse.uml2.uml.Constraint;
+
+/**
+ * Abstract non-diagram specific edit part for node label representing {@link Constraint}.
+ * This class is adapted from edit parts generated by GMF Tooling.
+ */
+public class ConstraintNodeLabelEditPart extends AbstractElementNodeLabelEditPart {
+
+ protected static final String LEFT_BRACE = "{";
+ protected static final String RIGHT_BRACE = "}";
+
+ public ConstraintNodeLabelEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getLabelRole() {
+ return "Label"; //$NON-NLS-1$
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getIconPathRole() {
+ return ""; //$NON-NLS-1$
+ }
+
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ IFigure figure = getFigure();
+ if (figure instanceof WrappingLabel) {
+ EObject resolveSemanticElement = resolveSemanticElement();
+ if (resolveSemanticElement instanceof Constraint) {
+ String specificationValue = ValueSpecificationUtil.getSpecificationValue(((Constraint) resolveSemanticElement).getSpecification());
+ specificationValue = (specificationValue == null ? "" : specificationValue);
+ ((WrappingLabel) figure).setText(LEFT_BRACE + specificationValue + RIGHT_BRACE);
+ }
+ }
+ }
+
+ @Override
+ protected void handleNotificationEvent(Notification event) {
+ // do nothing else refresh
+ refresh();
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/DefaultChildLabelEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/DefaultChildLabelEditPart.java
index ba8fbcd03f6..1007e6ea660 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/DefaultChildLabelEditPart.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/DefaultChildLabelEditPart.java
@@ -1,35 +1,35 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.edit.part;
-
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.gmf.diagram.common.edit.policy.DefaultSemanticEditPolicy;
-
-/**
- * Default implementation for child label node.
- */
-public class DefaultChildLabelEditPart extends AbstractElementChildLabelEditPart {
-
- /** Constructor */
- public DefaultChildLabelEditPart(View view) {
- super(view);
- }
-
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.edit.part;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.gmf.diagram.common.edit.policy.DefaultSemanticEditPolicy;
+
+/**
+ * Default implementation for child label node.
+ */
+public class DefaultChildLabelEditPart extends AbstractElementChildLabelEditPart {
+
+ /** Constructor */
+ public DefaultChildLabelEditPart(View view) {
+ super(view);
+ }
+
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/NamedElementAffixedLabelNameEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/NamedElementAffixedLabelNameEditPart.java
index 46f35bcf19d..686ca733116 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/NamedElementAffixedLabelNameEditPart.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/NamedElementAffixedLabelNameEditPart.java
@@ -1,121 +1,121 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.edit.part;
-
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.emf.appearance.helper.NameLabelIconHelper;
-import org.eclipse.papyrus.sysml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusWrappingLabel;
-import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * Abstract non-diagram specific edit part for border node label representing {@link NamedElement}.
- * This class is adapted from edit parts generated by GMF Tooling.
- */
-public class NamedElementAffixedLabelNameEditPart extends AbstractElementLabelEditPart implements IBorderItemEditPart {
-
- /** Constructor */
- public NamedElementAffixedLabelNameEditPart(View view) {
- super(view);
- addSnapBackLocation();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- }
-
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if(parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator)constraint;
- }
- return null;
- }
-
- public void refreshBounds() {
- int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
-
- // Update locator constraint
- IBorderItemLocator locator = getBorderItemLocator();
- locator.setConstraint(new Rectangle(x, y, width, height));
-
- // Set new constraint on parent figure
- getFigure().getParent().setConstraint(getFigure(), locator);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected Image getLabelIcon() {
- EObject parserElement = getParserElement();
- if(parserElement == null) {
- return null;
- }
-
- List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer());
- for(View view : views) {
- if(NameLabelIconHelper.showLabelIcon(view)) {
- return Activator.getInstance().getImage(parserElement.eClass());
- }
- }
- return null;
-
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected IFigure createFigure() {
- IFigure label = createFigurePrim();
- defaultText = getLabelTextHelper(label);
- return label;
- }
-
- protected IFigure createFigurePrim() {
- return new PapyrusWrappingLabel();
- }
-
- /**
- * {@inheritDoc}
- */
- public String getLabelRole() {
- return "Name"; //$NON-NLS-1$
- }
-
- /**
- * {@inheritDoc}
- */
- public String getIconPathRole() {
- return ""; //$NON-NLS-1$
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.edit.part;
+
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.emf.appearance.helper.NameLabelIconHelper;
+import org.eclipse.papyrus.sysml.diagram.common.Activator;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusWrappingLabel;
+import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * Abstract non-diagram specific edit part for border node label representing {@link NamedElement}.
+ * This class is adapted from edit parts generated by GMF Tooling.
+ */
+public class NamedElementAffixedLabelNameEditPart extends AbstractElementLabelEditPart implements IBorderItemEditPart {
+
+ /** Constructor */
+ public NamedElementAffixedLabelNameEditPart(View view) {
+ super(view);
+ addSnapBackLocation();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ }
+
+ public IBorderItemLocator getBorderItemLocator() {
+ IFigure parentFigure = getFigure().getParent();
+ if(parentFigure != null && parentFigure.getLayoutManager() != null) {
+ Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
+ return (IBorderItemLocator)constraint;
+ }
+ return null;
+ }
+
+ public void refreshBounds() {
+ int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
+ int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
+
+ // Update locator constraint
+ IBorderItemLocator locator = getBorderItemLocator();
+ locator.setConstraint(new Rectangle(x, y, width, height));
+
+ // Set new constraint on parent figure
+ getFigure().getParent().setConstraint(getFigure(), locator);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Image getLabelIcon() {
+ EObject parserElement = getParserElement();
+ if(parserElement == null) {
+ return null;
+ }
+
+ List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer());
+ for(View view : views) {
+ if(NameLabelIconHelper.showLabelIcon(view)) {
+ return Activator.getInstance().getImage(parserElement.eClass());
+ }
+ }
+ return null;
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected IFigure createFigure() {
+ IFigure label = createFigurePrim();
+ defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ protected IFigure createFigurePrim() {
+ return new PapyrusWrappingLabel();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getLabelRole() {
+ return "Name"; //$NON-NLS-1$
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getIconPathRole() {
+ return ""; //$NON-NLS-1$
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/NamedElementLinkLabelNameEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/NamedElementLinkLabelNameEditPart.java
index 19146e0d83c..804b3a2f8d9 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/NamedElementLinkLabelNameEditPart.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/NamedElementLinkLabelNameEditPart.java
@@ -1,53 +1,53 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.edit.part;
-
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.gmf.diagram.common.edit.policy.LinkLabelDragEditPolicy;
-
-/**
- * Edit Part for link label showing {@link NamedElement} name.
- */
-public class NamedElementLinkLabelNameEditPart extends AbstractElementLabelEditPart {
-
- /** Constructor */
- public NamedElementLinkLabelNameEditPart(View view) {
- super(view);
- addSnapBackLocation();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new LinkLabelDragEditPolicy());
- }
-
- /**
- * {@inheritDoc}
- */
- public String getLabelRole() {
- return "Name"; //$NON-NLS-1$
- }
-
- /**
- * {@inheritDoc}
- */
- public String getIconPathRole() {
- return ""; //$NON-NLS-1$
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.edit.part;
+
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.gmf.diagram.common.edit.policy.LinkLabelDragEditPolicy;
+
+/**
+ * Edit Part for link label showing {@link NamedElement} name.
+ */
+public class NamedElementLinkLabelNameEditPart extends AbstractElementLabelEditPart {
+
+ /** Constructor */
+ public NamedElementLinkLabelNameEditPart(View view) {
+ super(view);
+ addSnapBackLocation();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new LinkLabelDragEditPolicy());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getLabelRole() {
+ return "Name"; //$NON-NLS-1$
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getIconPathRole() {
+ return ""; //$NON-NLS-1$
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/NamedElementNodeLabelNameEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/NamedElementNodeLabelNameEditPart.java
index 51376fb423a..4579e5d48fc 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/NamedElementNodeLabelNameEditPart.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/NamedElementNodeLabelNameEditPart.java
@@ -1,49 +1,49 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.edit.part;
-
-import org.eclipse.gmf.runtime.notation.View;
-
-/**
- * Abstract non-diagram specific edit part for node label representing {@link NamedElement}.
- * This class is adapted from edit parts generated by GMF Tooling.
- */
-public class NamedElementNodeLabelNameEditPart extends AbstractElementNodeLabelEditPart {
-
- public NamedElementNodeLabelNameEditPart(View view) {
- super(view);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- }
-
- /**
- * {@inheritDoc}
- */
- public String getLabelRole() {
- return "Name"; //$NON-NLS-1$
- }
-
- /**
- * {@inheritDoc}
- */
- public String getIconPathRole() {
- return ""; //$NON-NLS-1$
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.edit.part;
+
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * Abstract non-diagram specific edit part for node label representing {@link NamedElement}.
+ * This class is adapted from edit parts generated by GMF Tooling.
+ */
+public class NamedElementNodeLabelNameEditPart extends AbstractElementNodeLabelEditPart {
+
+ public NamedElementNodeLabelNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getLabelRole() {
+ return "Name"; //$NON-NLS-1$
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getIconPathRole() {
+ return ""; //$NON-NLS-1$
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/PortAffixedLabelNameEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/PortAffixedLabelNameEditPart.java
index 760a7e51f50..6834dc1ad6b 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/PortAffixedLabelNameEditPart.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/PortAffixedLabelNameEditPart.java
@@ -1,120 +1,120 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.edit.part;
-
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.emf.appearance.helper.NameLabelIconHelper;
-import org.eclipse.papyrus.sysml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusWrappingLabel;
-import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * This class implements a {@link Port} affixed label edit part.
- */
-public class PortAffixedLabelNameEditPart extends AbstractElementLabelEditPart implements IBorderItemEditPart {
-
- /** Constructor */
- public PortAffixedLabelNameEditPart(View view) {
- super(view);
- addSnapBackLocation();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- }
-
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if(parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator)constraint;
- }
- return null;
- }
-
- public void refreshBounds() {
- int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
-
- // Update locator constraint
- IBorderItemLocator locator = getBorderItemLocator();
- locator.setConstraint(new Rectangle(x, y, width, height));
-
- // Set new constraint on parent figure
- getFigure().getParent().setConstraint(getFigure(), locator);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected Image getLabelIcon() {
- EObject parserElement = getParserElement();
- if(parserElement == null) {
- return null;
- }
-
- List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer());
- for(View view : views) {
- if(NameLabelIconHelper.showLabelIcon(view)) {
- return Activator.getInstance().getLabelProvider().getImage(parserElement);
- }
- }
- return null;
-
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected IFigure createFigure() {
- IFigure label = createFigurePrim();
- defaultText = getLabelTextHelper(label);
- return label;
- }
-
- protected IFigure createFigurePrim() {
- return new PapyrusWrappingLabel();
- }
-
- /**
- * {@inheritDoc}
- */
- public String getLabelRole() {
- return "Label"; //$NON-NLS-1$
- }
-
- /**
- * {@inheritDoc}
- */
- public String getIconPathRole() {
- return ""; //$NON-NLS-1$
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.edit.part;
+
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.emf.appearance.helper.NameLabelIconHelper;
+import org.eclipse.papyrus.sysml.diagram.common.Activator;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusWrappingLabel;
+import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * This class implements a {@link Port} affixed label edit part.
+ */
+public class PortAffixedLabelNameEditPart extends AbstractElementLabelEditPart implements IBorderItemEditPart {
+
+ /** Constructor */
+ public PortAffixedLabelNameEditPart(View view) {
+ super(view);
+ addSnapBackLocation();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ }
+
+ public IBorderItemLocator getBorderItemLocator() {
+ IFigure parentFigure = getFigure().getParent();
+ if(parentFigure != null && parentFigure.getLayoutManager() != null) {
+ Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
+ return (IBorderItemLocator)constraint;
+ }
+ return null;
+ }
+
+ public void refreshBounds() {
+ int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
+ int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
+
+ // Update locator constraint
+ IBorderItemLocator locator = getBorderItemLocator();
+ locator.setConstraint(new Rectangle(x, y, width, height));
+
+ // Set new constraint on parent figure
+ getFigure().getParent().setConstraint(getFigure(), locator);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Image getLabelIcon() {
+ EObject parserElement = getParserElement();
+ if(parserElement == null) {
+ return null;
+ }
+
+ List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer());
+ for(View view : views) {
+ if(NameLabelIconHelper.showLabelIcon(view)) {
+ return Activator.getInstance().getLabelProvider().getImage(parserElement);
+ }
+ }
+ return null;
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected IFigure createFigure() {
+ IFigure label = createFigurePrim();
+ defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ protected IFigure createFigurePrim() {
+ return new PapyrusWrappingLabel();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getLabelRole() {
+ return "Label"; //$NON-NLS-1$
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getIconPathRole() {
+ return ""; //$NON-NLS-1$
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/PropertyNodeLabelEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/PropertyNodeLabelEditPart.java
index a5920c09eda..1f828e0f627 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/PropertyNodeLabelEditPart.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/PropertyNodeLabelEditPart.java
@@ -1,49 +1,49 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.edit.part;
-
-import org.eclipse.gmf.runtime.notation.View;
-
-/**
- * Abstract non-diagram specific edit part for node label representing {@link Property}.
- * This class is adapted from edit parts generated by GMF Tooling.
- */
-public class PropertyNodeLabelEditPart extends AbstractElementNodeLabelEditPart {
-
- public PropertyNodeLabelEditPart(View view) {
- super(view);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- }
-
- /**
- * {@inheritDoc}
- */
- public String getLabelRole() {
- return "Label"; //$NON-NLS-1$
- }
-
- /**
- * {@inheritDoc}
- */
- public String getIconPathRole() {
- return ""; //$NON-NLS-1$
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.edit.part;
+
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * Abstract non-diagram specific edit part for node label representing {@link Property}.
+ * This class is adapted from edit parts generated by GMF Tooling.
+ */
+public class PropertyNodeLabelEditPart extends AbstractElementNodeLabelEditPart {
+
+ public PropertyNodeLabelEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getLabelRole() {
+ return "Label"; //$NON-NLS-1$
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getIconPathRole() {
+ return ""; //$NON-NLS-1$
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/SlotChildLabelEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/SlotChildLabelEditPart.java
index 3c314be121a..effec08a44f 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/SlotChildLabelEditPart.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/SlotChildLabelEditPart.java
@@ -1,35 +1,35 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.edit.part;
-
-import org.eclipse.gmf.runtime.notation.View;
-
-/**
- * Edit part for {@link Slot} used as Child label node.
- */
-public class SlotChildLabelEditPart extends AbstractElementChildLabelEditPart {
-
- /** Constructor */
- public SlotChildLabelEditPart(View view) {
- super(view);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.edit.part;
+
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * Edit part for {@link Slot} used as Child label node.
+ */
+public class SlotChildLabelEditPart extends AbstractElementChildLabelEditPart {
+
+ /** Constructor */
+ public SlotChildLabelEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/EncapsulatedClassifierResizableShapeEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/EncapsulatedClassifierResizableShapeEditPolicy.java
index 6418c5b76c4..b20af1110d0 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/EncapsulatedClassifierResizableShapeEditPolicy.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/EncapsulatedClassifierResizableShapeEditPolicy.java
@@ -1,126 +1,126 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.edit.policy;
-
-import java.util.Iterator;
-
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.CompoundCommand;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gef.requests.ChangeBoundsRequest;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-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.IBorderItemEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableShapeEditPolicy;
-import org.eclipse.gmf.runtime.notation.Shape;
-import org.eclipse.papyrus.uml.diagram.common.commands.FixPortLocationCommand;
-import org.eclipse.papyrus.uml.diagram.common.commands.UpdatePortLocationCommand;
-
-/**
- * <pre>
- * This class modifies EncapsulatedClassifier default resize command in order to move
- * any Port IBorderItem possibly attached.
- * See. bug. https://bugs.eclipse.org/bugs/show_bug.cgi?id=354814
- * Could not find a more general way to do this without making any assumption about
- * the kind of attached IBorderItem and that would only rely on its IBorderItemLocator.
- * </pre>
- */
-public class EncapsulatedClassifierResizableShapeEditPolicy extends ResizableShapeEditPolicy {
-
- /**
- * <pre>
- * {@inheritDoc}
- *
- * Forbid AutoSize for elements that can hold Port, it currently
- * leads to Port (FlowPort) with incorrect location stored in notation,
- * and possible incorrect visual representation (FlowPort).
- * </pre>
- */
- @Override
- protected Command getAutoSizeCommand(Request request) {
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- * <pre>
- * {@inheritDoc}
- *
- * Extends the default resize command by :
- * - fixing possible Port location issues before resizing parent
- * - make the default parent resize
- * - update the Port location after resize (uses the side of the parent where the Port is attached before resize)
- * </pre>
- */
- @Override
- protected Command getResizeCommand(ChangeBoundsRequest request) {
-
- // Prepare command to move the affixed children as well (and an optional fix command)
- CompoundCommand updatePortLocationsCommand = new CompoundCommand("Update border items location");
- CompoundCommand fixPortLocationsCommand = new CompoundCommand("Fix border items location");
-
- Iterator<?> it = getHost().getChildren().iterator();
- while(it.hasNext()) {
- Object tmp = it.next();
- if(!(tmp instanceof IBorderItemEditPart)) {
- continue;
- }
-
- IBorderItemEditPart borderItem = (IBorderItemEditPart)tmp;
- Shape borderItemView = (Shape)borderItem.getNotationView();
- TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(borderItemView);
-
- // Fix possible location issue in BorderItem bounds in notation model
- ICommand fixPortLocationCommand = new FixPortLocationCommand(editingDomain, borderItem, (GraphicalEditPart)getHost());
- if(fixPortLocationCommand.canExecute()) {
- fixPortLocationsCommand.add(new ICommandProxy(fixPortLocationCommand));
- }
-
- ICommand updatePortLocationCommand = new UpdatePortLocationCommand(editingDomain, (GraphicalEditPart)getHost(), borderItem, borderItem.getBorderItemLocator().getCurrentSideOfParent());
- if(updatePortLocationCommand.canExecute()) {
- updatePortLocationsCommand.add(new ICommandProxy(updatePortLocationCommand));
- }
- }
-
-
- // Create the complete resize command
- CompoundCommand resizeCommand = new CompoundCommand("Resize command");
-
- // Add command to fix border item locations.
- // The role of this command is to make sure that the Port is correctly located (here this means
- // that the figure and the view have the same location) before resizing its parent.
- // See bug. https://bugs.eclipse.org/bugs/show_bug.cgi?id=354814.
- if(!fixPortLocationsCommand.isEmpty()) {
- resizeCommand.add(fixPortLocationsCommand);
- }
-
- // Add command to update locations
- resizeCommand.add(super.getResizeCommand(request));
-
- // Add command to update border item locations.
- // This command uses the border side of the border item before the resize action, and thus
- // requires that the Port location is correct. Previous versions did not move the IBorderItem, this is the reason
- // why a fix on the fly may be required.
- // See bug. https://bugs.eclipse.org/bugs/show_bug.cgi?id=354814.
- if(!updatePortLocationsCommand.isEmpty()) {
- resizeCommand.add(updatePortLocationsCommand);
- }
-
- return resizeCommand;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.edit.policy;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gef.requests.ChangeBoundsRequest;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+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.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableShapeEditPolicy;
+import org.eclipse.gmf.runtime.notation.Shape;
+import org.eclipse.papyrus.uml.diagram.common.commands.FixPortLocationCommand;
+import org.eclipse.papyrus.uml.diagram.common.commands.UpdatePortLocationCommand;
+
+/**
+ * <pre>
+ * This class modifies EncapsulatedClassifier default resize command in order to move
+ * any Port IBorderItem possibly attached.
+ * See. bug. https://bugs.eclipse.org/bugs/show_bug.cgi?id=354814
+ * Could not find a more general way to do this without making any assumption about
+ * the kind of attached IBorderItem and that would only rely on its IBorderItemLocator.
+ * </pre>
+ */
+public class EncapsulatedClassifierResizableShapeEditPolicy extends ResizableShapeEditPolicy {
+
+ /**
+ * <pre>
+ * {@inheritDoc}
+ *
+ * Forbid AutoSize for elements that can hold Port, it currently
+ * leads to Port (FlowPort) with incorrect location stored in notation,
+ * and possible incorrect visual representation (FlowPort).
+ * </pre>
+ */
+ @Override
+ protected Command getAutoSizeCommand(Request request) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * <pre>
+ * {@inheritDoc}
+ *
+ * Extends the default resize command by :
+ * - fixing possible Port location issues before resizing parent
+ * - make the default parent resize
+ * - update the Port location after resize (uses the side of the parent where the Port is attached before resize)
+ * </pre>
+ */
+ @Override
+ protected Command getResizeCommand(ChangeBoundsRequest request) {
+
+ // Prepare command to move the affixed children as well (and an optional fix command)
+ CompoundCommand updatePortLocationsCommand = new CompoundCommand("Update border items location");
+ CompoundCommand fixPortLocationsCommand = new CompoundCommand("Fix border items location");
+
+ Iterator<?> it = getHost().getChildren().iterator();
+ while(it.hasNext()) {
+ Object tmp = it.next();
+ if(!(tmp instanceof IBorderItemEditPart)) {
+ continue;
+ }
+
+ IBorderItemEditPart borderItem = (IBorderItemEditPart)tmp;
+ Shape borderItemView = (Shape)borderItem.getNotationView();
+ TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(borderItemView);
+
+ // Fix possible location issue in BorderItem bounds in notation model
+ ICommand fixPortLocationCommand = new FixPortLocationCommand(editingDomain, borderItem, (GraphicalEditPart)getHost());
+ if(fixPortLocationCommand.canExecute()) {
+ fixPortLocationsCommand.add(new ICommandProxy(fixPortLocationCommand));
+ }
+
+ ICommand updatePortLocationCommand = new UpdatePortLocationCommand(editingDomain, (GraphicalEditPart)getHost(), borderItem, borderItem.getBorderItemLocator().getCurrentSideOfParent());
+ if(updatePortLocationCommand.canExecute()) {
+ updatePortLocationsCommand.add(new ICommandProxy(updatePortLocationCommand));
+ }
+ }
+
+
+ // Create the complete resize command
+ CompoundCommand resizeCommand = new CompoundCommand("Resize command");
+
+ // Add command to fix border item locations.
+ // The role of this command is to make sure that the Port is correctly located (here this means
+ // that the figure and the view have the same location) before resizing its parent.
+ // See bug. https://bugs.eclipse.org/bugs/show_bug.cgi?id=354814.
+ if(!fixPortLocationsCommand.isEmpty()) {
+ resizeCommand.add(fixPortLocationsCommand);
+ }
+
+ // Add command to update locations
+ resizeCommand.add(super.getResizeCommand(request));
+
+ // Add command to update border item locations.
+ // This command uses the border side of the border item before the resize action, and thus
+ // requires that the Port location is correct. Previous versions did not move the IBorderItem, this is the reason
+ // why a fix on the fly may be required.
+ // See bug. https://bugs.eclipse.org/bugs/show_bug.cgi?id=354814.
+ if(!updatePortLocationsCommand.isEmpty()) {
+ resizeCommand.add(updatePortLocationsCommand);
+ }
+
+ return resizeCommand;
+ }
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/MaskManagedLabelEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/MaskManagedLabelEditPolicy.java
index 3f07f190931..016d9c0ced1 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/MaskManagedLabelEditPolicy.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/MaskManagedLabelEditPolicy.java
@@ -1,126 +1,126 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.edit.policy;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.emf.ecore.EModelElement;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.editpolicies.GraphicalEditPolicy;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.papyrus.gmf.diagram.common.edit.part.ITextAwareEditPart;
-import org.eclipse.papyrus.gmf.diagram.common.parser.IMaskManagedSemanticParser;
-import org.eclipse.papyrus.infra.emf.appearance.commands.AddMaskManagedLabelDisplayCommand;
-import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants;
-import org.eclipse.papyrus.infra.emf.commands.RemoveEAnnotationCommand;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-
-
-/**
- * <pre>
- * Generic mask manage edit policy for {@link ITextAwareEditPart}, managed masks are assumed to be given by the
- * {@link ITextAwareEditPart} parser (must implement {@link IMaskManagedSemanticParser}).
- * </pre>
- */
-public class MaskManagedLabelEditPolicy extends GraphicalEditPolicy implements IMaskManagedLabelEditPolicy {
-
- /**
- * {@inheritDoc}
- */
- public Map<Integer, String> getMasks() {
- Map<Integer, String> masks = new HashMap<Integer, String>();
-
- IParser parser = getHostLabelEditPart().getParser();
- if(parser instanceof IMaskManagedSemanticParser) {
- masks = ((IMaskManagedSemanticParser)parser).getMasks();
- }
-
- return masks;
- }
-
- /**
- * {@inheritDoc}
- */
- public int getCurrentDisplayValue() {
- return getHostLabelEditPart().getParserOptions().intValue();
- }
-
- /**
- * {@inheritDoc}
- */
- public int getDefaultDisplayValue() {
- return getHostLabelEditPart().getDefaultParserOptions().intValue();
- }
-
- /**
- * {@inheritDoc}
- */
- public void updateDisplayValue(int newValue) {
- TransactionalEditingDomain editingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
- if(editingDomain != null) {
- editingDomain.getCommandStack().execute(new AddMaskManagedLabelDisplayCommand(editingDomain, (EModelElement)getHost().getModel(), newValue));
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void setDefaultDisplayValue() {
- TransactionalEditingDomain editingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
- if(editingDomain != null) {
- editingDomain.getCommandStack().execute(new RemoveEAnnotationCommand(editingDomain, (EModelElement)getHost().getModel(), VisualInformationPapyrusConstants.CUSTOM_APPEARENCE_ANNOTATION));
- }
- }
-
- // @unused.
- public String getMaskLabel(int value) {
- // Not implemented.
- return null;
- }
-
- // @unused.
- public Collection<String> getMaskLabels() {
- // Not implemented.
- return null;
- }
-
- // @unused.
- public Collection<Integer> getMaskValues() {
- // Not implemented.
- return null;
- }
-
- // @unused.
- public void refreshDisplay() {
- // Not implemented.
- }
-
- // @unused.
- public String getPreferencePageID() {
- // Not implemented.
- return null;
- }
-
- /**
- * Get the host label edit part (has to implement {@link ITextAwareEditPart}).
- *
- * @return the host label edit part.
- */
- private ITextAwareEditPart getHostLabelEditPart() {
- return (ITextAwareEditPart)getHost();
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.edit.policy;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.emf.ecore.EModelElement;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.editpolicies.GraphicalEditPolicy;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.papyrus.gmf.diagram.common.edit.part.ITextAwareEditPart;
+import org.eclipse.papyrus.gmf.diagram.common.parser.IMaskManagedSemanticParser;
+import org.eclipse.papyrus.infra.emf.appearance.commands.AddMaskManagedLabelDisplayCommand;
+import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants;
+import org.eclipse.papyrus.infra.emf.commands.RemoveEAnnotationCommand;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+
+
+/**
+ * <pre>
+ * Generic mask manage edit policy for {@link ITextAwareEditPart}, managed masks are assumed to be given by the
+ * {@link ITextAwareEditPart} parser (must implement {@link IMaskManagedSemanticParser}).
+ * </pre>
+ */
+public class MaskManagedLabelEditPolicy extends GraphicalEditPolicy implements IMaskManagedLabelEditPolicy {
+
+ /**
+ * {@inheritDoc}
+ */
+ public Map<Integer, String> getMasks() {
+ Map<Integer, String> masks = new HashMap<Integer, String>();
+
+ IParser parser = getHostLabelEditPart().getParser();
+ if(parser instanceof IMaskManagedSemanticParser) {
+ masks = ((IMaskManagedSemanticParser)parser).getMasks();
+ }
+
+ return masks;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int getCurrentDisplayValue() {
+ return getHostLabelEditPart().getParserOptions().intValue();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int getDefaultDisplayValue() {
+ return getHostLabelEditPart().getDefaultParserOptions().intValue();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void updateDisplayValue(int newValue) {
+ TransactionalEditingDomain editingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
+ if(editingDomain != null) {
+ editingDomain.getCommandStack().execute(new AddMaskManagedLabelDisplayCommand(editingDomain, (EModelElement)getHost().getModel(), newValue));
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setDefaultDisplayValue() {
+ TransactionalEditingDomain editingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
+ if(editingDomain != null) {
+ editingDomain.getCommandStack().execute(new RemoveEAnnotationCommand(editingDomain, (EModelElement)getHost().getModel(), VisualInformationPapyrusConstants.CUSTOM_APPEARENCE_ANNOTATION));
+ }
+ }
+
+ // @unused.
+ public String getMaskLabel(int value) {
+ // Not implemented.
+ return null;
+ }
+
+ // @unused.
+ public Collection<String> getMaskLabels() {
+ // Not implemented.
+ return null;
+ }
+
+ // @unused.
+ public Collection<Integer> getMaskValues() {
+ // Not implemented.
+ return null;
+ }
+
+ // @unused.
+ public void refreshDisplay() {
+ // Not implemented.
+ }
+
+ // @unused.
+ public String getPreferencePageID() {
+ // Not implemented.
+ return null;
+ }
+
+ /**
+ * Get the host label edit part (has to implement {@link ITextAwareEditPart}).
+ *
+ * @return the host label edit part.
+ */
+ private ITextAwareEditPart getHostLabelEditPart() {
+ return (ITextAwareEditPart)getHost();
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/StructuredClassifierCreationEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/StructuredClassifierCreationEditPolicy.java
index 2fd52d215d0..258fa384432 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/StructuredClassifierCreationEditPolicy.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/StructuredClassifierCreationEditPolicy.java
@@ -1,140 +1,140 @@
-/*****************************************************************************
- * Copyright (c) 2011-2012 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.edit.policy;
-
-import java.util.Iterator;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gef.requests.ChangeBoundsRequest;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.gmf.diagram.common.commands.CreateViewCommand;
-import org.eclipse.papyrus.uml.diagram.common.locator.PortPositionLocator;
-
-/**
- * Replaces the {@link DefaultCreationEditPolicy} in order to manage Affixed Port position on creation or on drop.
- */
-public class StructuredClassifierCreationEditPolicy extends CreationEditPolicy {
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected Command getReparentCommand(ChangeBoundsRequest request) {
- // Forbid re-parent in this edit policy (to be used by compartment)
- // in order to avoid node to be moved in compartments.
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- * <pre>
- * {@inheritDoc}
- *
- * The goal here is to create the view and to move it at the mouse location,
- * respecting a given locator. It is assumed that only affixed Port can be created on
- * edit part that have this edit policy, and the locator is a {@link PortPositionLocator}.
- *
- * @see DefaultCreationEditPolicy#getCreateCommand().
- * </pre>
- */
- @Override
- protected Command getCreateCommand(CreateViewRequest request) {
-
- // This overrides getCreateCommand in order to use a specific CreateViewCommand (instead of
- // org.eclipse.gmf.runtime.diagram.ui.commands.CreateCommand.
-
- // The original CreateCommand#canExecute() implementation rely on ViewProvider#provides(CreateViewForKindOperation op)
- // method to know if a view can be created. The problem is that this method is incorrectly generated by GMF Tooling and should be avoided.
-
- // CreateViewCommand replace the semantic adapter in its call to ViewService to know if a provider exists.
-
- TransactionalEditingDomain editingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
- CompositeTransactionalCommand cc = new CompositeTransactionalCommand(editingDomain, DiagramUIMessages.AddCommand_Label);
-
- Iterator<? extends ViewDescriptor> descriptors = request.getViewDescriptors().iterator();
- while(descriptors.hasNext()) {
-
- CreateViewRequest.ViewDescriptor descriptor = (CreateViewRequest.ViewDescriptor)descriptors.next();
- ICommand createCommand = new CreateViewCommand(editingDomain, descriptor, (View)(getHost().getModel()));
-
- // Add SetBounds
- createCommand = CompositeCommand.compose(createCommand, getSetBoundsCommand(request, descriptor));
- //
-
- cc.compose(createCommand);
-
- }
-
- return new ICommandProxy(cc.reduce());
-
- }
-
- /**
- * Get a SetBoundsCommand to move a new view at current mouse position.
- *
- * @param request
- * The creation request.
- * @param descriptor
- * The descriptor of the new element.
- * @return The set bounds command.
- */
- private ICommand getSetBoundsCommand(CreateViewRequest request, CreateViewRequest.ViewDescriptor descriptor) {
- ICommand setBoundsCommand = null;
- TransactionalEditingDomain editingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
-
- // Retrieve parent location
- Point parentLoc = getHostFigure().getBounds().getLocation().getCopy();
-
- // Compute relative creation location
- Point requestedLocation = request.getLocation().getCopy();
- getHostFigure().translateToRelative(requestedLocation);
-
- // Create proposed creation bounds and use the locator to find the expected position
- PortPositionLocator locator = new PortPositionLocator(getHostFigure(), PositionConstants.NONE);
- Rectangle proposedBounds = new Rectangle(requestedLocation, new Dimension(20, 20));
- Rectangle preferredBounds = locator.getPreferredLocation(proposedBounds);
-
- // Convert the calculated preferred bounds as relative to parent location
- Rectangle creationBounds = preferredBounds.getTranslated(parentLoc.getNegated());
- setBoundsCommand = new SetBoundsCommand(editingDomain, DiagramUIMessages.SetLocationCommand_Label_Resize, descriptor, creationBounds);
-
- return setBoundsCommand;
- }
-
- /**
- * Convenience method to return the host's Figure.
- *
- * @return The host GraphicalEditPart's Figure
- */
- private IFigure getHostFigure() {
- return ((GraphicalEditPart)getHost()).getFigure();
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011-2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.edit.policy;
+
+import java.util.Iterator;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gef.requests.ChangeBoundsRequest;
+import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor;
+import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.gmf.diagram.common.commands.CreateViewCommand;
+import org.eclipse.papyrus.uml.diagram.common.locator.PortPositionLocator;
+
+/**
+ * Replaces the {@link DefaultCreationEditPolicy} in order to manage Affixed Port position on creation or on drop.
+ */
+public class StructuredClassifierCreationEditPolicy extends CreationEditPolicy {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Command getReparentCommand(ChangeBoundsRequest request) {
+ // Forbid re-parent in this edit policy (to be used by compartment)
+ // in order to avoid node to be moved in compartments.
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * <pre>
+ * {@inheritDoc}
+ *
+ * The goal here is to create the view and to move it at the mouse location,
+ * respecting a given locator. It is assumed that only affixed Port can be created on
+ * edit part that have this edit policy, and the locator is a {@link PortPositionLocator}.
+ *
+ * @see DefaultCreationEditPolicy#getCreateCommand().
+ * </pre>
+ */
+ @Override
+ protected Command getCreateCommand(CreateViewRequest request) {
+
+ // This overrides getCreateCommand in order to use a specific CreateViewCommand (instead of
+ // org.eclipse.gmf.runtime.diagram.ui.commands.CreateCommand.
+
+ // The original CreateCommand#canExecute() implementation rely on ViewProvider#provides(CreateViewForKindOperation op)
+ // method to know if a view can be created. The problem is that this method is incorrectly generated by GMF Tooling and should be avoided.
+
+ // CreateViewCommand replace the semantic adapter in its call to ViewService to know if a provider exists.
+
+ TransactionalEditingDomain editingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
+ CompositeTransactionalCommand cc = new CompositeTransactionalCommand(editingDomain, DiagramUIMessages.AddCommand_Label);
+
+ Iterator<? extends ViewDescriptor> descriptors = request.getViewDescriptors().iterator();
+ while(descriptors.hasNext()) {
+
+ CreateViewRequest.ViewDescriptor descriptor = (CreateViewRequest.ViewDescriptor)descriptors.next();
+ ICommand createCommand = new CreateViewCommand(editingDomain, descriptor, (View)(getHost().getModel()));
+
+ // Add SetBounds
+ createCommand = CompositeCommand.compose(createCommand, getSetBoundsCommand(request, descriptor));
+ //
+
+ cc.compose(createCommand);
+
+ }
+
+ return new ICommandProxy(cc.reduce());
+
+ }
+
+ /**
+ * Get a SetBoundsCommand to move a new view at current mouse position.
+ *
+ * @param request
+ * The creation request.
+ * @param descriptor
+ * The descriptor of the new element.
+ * @return The set bounds command.
+ */
+ private ICommand getSetBoundsCommand(CreateViewRequest request, CreateViewRequest.ViewDescriptor descriptor) {
+ ICommand setBoundsCommand = null;
+ TransactionalEditingDomain editingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
+
+ // Retrieve parent location
+ Point parentLoc = getHostFigure().getBounds().getLocation().getCopy();
+
+ // Compute relative creation location
+ Point requestedLocation = request.getLocation().getCopy();
+ getHostFigure().translateToRelative(requestedLocation);
+
+ // Create proposed creation bounds and use the locator to find the expected position
+ PortPositionLocator locator = new PortPositionLocator(getHostFigure(), PositionConstants.NONE);
+ Rectangle proposedBounds = new Rectangle(requestedLocation, new Dimension(20, 20));
+ Rectangle preferredBounds = locator.getPreferredLocation(proposedBounds);
+
+ // Convert the calculated preferred bounds as relative to parent location
+ Rectangle creationBounds = preferredBounds.getTranslated(parentLoc.getNegated());
+ setBoundsCommand = new SetBoundsCommand(editingDomain, DiagramUIMessages.SetLocationCommand_Label_Resize, descriptor, creationBounds);
+
+ return setBoundsCommand;
+ }
+
+ /**
+ * Convenience method to return the host's Figure.
+ *
+ * @return The host GraphicalEditPart's Figure
+ */
+ private IFigure getHostFigure() {
+ return ((GraphicalEditPart)getHost()).getFigure();
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/figure/ConnectorEdgeFigure.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/figure/ConnectorEdgeFigure.java
index 2b26fabdf65..a23a64ba4f3 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/figure/ConnectorEdgeFigure.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/figure/ConnectorEdgeFigure.java
@@ -1,83 +1,83 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.figure;
-
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusWrappingLabel;
-
-/**
- * Figure for UML {@link Connector} Edges.
- */
-public class ConnectorEdgeFigure extends NamedElementEdgeFigure {
-
- /** The multiplicity source label. */
- private WrappingLabel fSourceMultiplicityLabel;
-
- /** The multiplicity target label. */
- private WrappingLabel fTargetMultiplicityLabel;
-
- /**
- * Instantiates a new association figure.
- */
- public ConnectorEdgeFigure() {
- super();
- createContents();
- }
-
- /**
- * Creates the contents.
- */
- protected void createContents() {
- super.createContents();
-
- fSourceMultiplicityLabel = new PapyrusWrappingLabel();
- fSourceMultiplicityLabel.setText("");
-
- this.add(fSourceMultiplicityLabel);
-
- fTargetMultiplicityLabel = new PapyrusWrappingLabel();
- fTargetMultiplicityLabel.setText("");
-
- this.add(fTargetMultiplicityLabel);
-
- }
-
- /**
- * Gets the applied stereotype association label.
- *
- * @return the applied stereotype association label
- */
- public WrappingLabel getAppliedStereotypeLabel() {
- return appliedStereotypeLabel;
- }
-
- /**
- * Gets the multiplicity source label.
- *
- * @return the multiplicity source label
- */
- public WrappingLabel getSourceMultiplicityLabel() {
- return fSourceMultiplicityLabel;
- }
-
- /**
- * Gets the multiplicity target label.
- *
- * @return the multiplicity target label
- */
- public WrappingLabel getTargetMultiplicityLabel() {
- return fTargetMultiplicityLabel;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.figure;
+
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusWrappingLabel;
+
+/**
+ * Figure for UML {@link Connector} Edges.
+ */
+public class ConnectorEdgeFigure extends NamedElementEdgeFigure {
+
+ /** The multiplicity source label. */
+ private WrappingLabel fSourceMultiplicityLabel;
+
+ /** The multiplicity target label. */
+ private WrappingLabel fTargetMultiplicityLabel;
+
+ /**
+ * Instantiates a new association figure.
+ */
+ public ConnectorEdgeFigure() {
+ super();
+ createContents();
+ }
+
+ /**
+ * Creates the contents.
+ */
+ protected void createContents() {
+ super.createContents();
+
+ fSourceMultiplicityLabel = new PapyrusWrappingLabel();
+ fSourceMultiplicityLabel.setText("");
+
+ this.add(fSourceMultiplicityLabel);
+
+ fTargetMultiplicityLabel = new PapyrusWrappingLabel();
+ fTargetMultiplicityLabel.setText("");
+
+ this.add(fTargetMultiplicityLabel);
+
+ }
+
+ /**
+ * Gets the applied stereotype association label.
+ *
+ * @return the applied stereotype association label
+ */
+ public WrappingLabel getAppliedStereotypeLabel() {
+ return appliedStereotypeLabel;
+ }
+
+ /**
+ * Gets the multiplicity source label.
+ *
+ * @return the multiplicity source label
+ */
+ public WrappingLabel getSourceMultiplicityLabel() {
+ return fSourceMultiplicityLabel;
+ }
+
+ /**
+ * Gets the multiplicity target label.
+ *
+ * @return the multiplicity target label
+ */
+ public WrappingLabel getTargetMultiplicityLabel() {
+ return fTargetMultiplicityLabel;
+ }
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/figure/EdgeDecorationType.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/figure/EdgeDecorationType.java
index cca2b77d2f6..c6b19b64614 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/figure/EdgeDecorationType.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/figure/EdgeDecorationType.java
@@ -1,39 +1,39 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.figure;
-
-import org.eclipse.gmf.runtime.notation.ArrowType;
-
-/**
- * <pre>
- * The class provides a list of predefined ids to create edge decorations.
- *
- * Also see : org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementLinkEditPart#getArrowDecoration().
- * </pre>
- */
-public final class EdgeDecorationType {
-
- public static final int NONE = ArrowType.NONE; //0
-
- public static final int OPEN_ARROW = ArrowType.OPEN_ARROW; // 1
-
- public static final int SOLID_ARROW_FILLED = ArrowType.SOLID_ARROW; // 2
-
- public static final int SOLID_ARROW_EMPTY = 3;
-
- public static final int SOLID_DIAMOND_FILLED = 4;
-
- public static final int SOLID_DIAMOND_EMPTY = 5;
-
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.figure;
+
+import org.eclipse.gmf.runtime.notation.ArrowType;
+
+/**
+ * <pre>
+ * The class provides a list of predefined ids to create edge decorations.
+ *
+ * Also see : org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementLinkEditPart#getArrowDecoration().
+ * </pre>
+ */
+public final class EdgeDecorationType {
+
+ public static final int NONE = ArrowType.NONE; //0
+
+ public static final int OPEN_ARROW = ArrowType.OPEN_ARROW; // 1
+
+ public static final int SOLID_ARROW_FILLED = ArrowType.SOLID_ARROW; // 2
+
+ public static final int SOLID_ARROW_EMPTY = 3;
+
+ public static final int SOLID_DIAMOND_FILLED = 4;
+
+ public static final int SOLID_DIAMOND_EMPTY = 5;
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/figure/GeneralizationFigure.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/figure/GeneralizationFigure.java
index c966821252d..78e43a20bf9 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/figure/GeneralizationFigure.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/figure/GeneralizationFigure.java
@@ -1,26 +1,26 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.figure;
-
-import org.eclipse.papyrus.uml.diagram.common.figure.edge.UMLEdgeFigure;
-
-/**
- * Figure for UML Generalization Edges.
- */
-public class GeneralizationFigure extends UMLEdgeFigure {
-
- public GeneralizationFigure() {
- super();
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.figure;
+
+import org.eclipse.papyrus.uml.diagram.common.figure.edge.UMLEdgeFigure;
+
+/**
+ * Figure for UML Generalization Edges.
+ */
+public class GeneralizationFigure extends UMLEdgeFigure {
+
+ public GeneralizationFigure() {
+ super();
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/figure/InterfaceRealizationFigure.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/figure/InterfaceRealizationFigure.java
index 83e671d5c56..f18f823633f 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/figure/InterfaceRealizationFigure.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/figure/InterfaceRealizationFigure.java
@@ -1,24 +1,24 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.figure;
-
-/**
- * Figure for UML InterfaceRealization Edges.
- */
-public class InterfaceRealizationFigure extends NamedElementEdgeFigure {
-
- public InterfaceRealizationFigure() {
- super();
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.figure;
+
+/**
+ * Figure for UML InterfaceRealization Edges.
+ */
+public class InterfaceRealizationFigure extends NamedElementEdgeFigure {
+
+ public InterfaceRealizationFigure() {
+ super();
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/figure/NamedElementEdgeFigure.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/figure/NamedElementEdgeFigure.java
index e66121a4923..2d0b95a3dec 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/figure/NamedElementEdgeFigure.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/figure/NamedElementEdgeFigure.java
@@ -1,64 +1,64 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.figure;
-
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.papyrus.uml.diagram.common.figure.edge.UMLEdgeFigure;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusWrappingLabel;
-
-/**
- * <pre>
- * This edge figure support stereotype application and name labels,
- * and does not make any assumption on style, decorations, and width.
- * These properties are managed by the edit part.
- *
- * This figure also provides its own custom dash pattern that can be use calling
- * setLineType(Graphics.LINE_CUSTOM);
- * </pre>
- */
-public class NamedElementEdgeFigure extends UMLEdgeFigure {
-
- private WrappingLabel nameLabel;
-
- /** Dashes used to paint line. */
- private final int[] dashes = new int[10];
-
- public NamedElementEdgeFigure() {
- super();
-
- // set dashes
- for(int i = 0; i < 10; i++) {
- dashes[i] = 5;
- }
- setLineDash(dashes);
-
- createContents();
- }
-
- public WrappingLabel getNameLabel() {
- return nameLabel;
- }
-
- /**
- * @generated
- */
- @Override
- protected void createContents() {
- super.createContents();
- nameLabel = new PapyrusWrappingLabel();
- nameLabel.setText("");
-
- this.add(nameLabel);
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.figure;
+
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.papyrus.uml.diagram.common.figure.edge.UMLEdgeFigure;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusWrappingLabel;
+
+/**
+ * <pre>
+ * This edge figure support stereotype application and name labels,
+ * and does not make any assumption on style, decorations, and width.
+ * These properties are managed by the edit part.
+ *
+ * This figure also provides its own custom dash pattern that can be use calling
+ * setLineType(Graphics.LINE_CUSTOM);
+ * </pre>
+ */
+public class NamedElementEdgeFigure extends UMLEdgeFigure {
+
+ private WrappingLabel nameLabel;
+
+ /** Dashes used to paint line. */
+ private final int[] dashes = new int[10];
+
+ public NamedElementEdgeFigure() {
+ super();
+
+ // set dashes
+ for(int i = 0; i < 10; i++) {
+ dashes[i] = 5;
+ }
+ setLineDash(dashes);
+
+ createContents();
+ }
+
+ public WrappingLabel getNameLabel() {
+ return nameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createContents() {
+ super.createContents();
+ nameLabel = new PapyrusWrappingLabel();
+ nameLabel.setText("");
+
+ this.add(nameLabel);
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/AssociationEndLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/AssociationEndLabelParser.java
index 03a21c5fca4..3714a8a30c5 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/AssociationEndLabelParser.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/AssociationEndLabelParser.java
@@ -1,169 +1,169 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.parser;
-
-import java.util.Collections;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants;
-import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil;
-import org.eclipse.uml2.uml.InstanceValue;
-import org.eclipse.uml2.uml.Property;
-import org.eclipse.uml2.uml.ValueSpecification;
-import org.eclipse.uml2.uml.VisibilityKind;
-
-/**
- * Semantic Parser for {@link Property} used as {@link Association} end.
- */
-public class AssociationEndLabelParser extends PropertyLabelParser {
-
- /** The String format for displaying a {@link Property} label with modifiers */
- protected static final String ALT_MODIFIER_FORMAT = "{%s}%s";
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getPrintString(IAdaptable element, int flags) {
-
- if(flags == 0) {
- return MaskedLabel;
- }
-
- String result = "";
- EObject eObject = (EObject)element.getAdapter(EObject.class);
-
- if((eObject != null) && (eObject instanceof Property)) {
-
- Property property = (Property)eObject;
-
- // manage visibility
- if((flags & ILabelPreferenceConstants.DISP_VISIBILITY) == ILabelPreferenceConstants.DISP_VISIBILITY) {
- String visibility;
- switch(property.getVisibility().getValue()) {
- case VisibilityKind.PACKAGE:
- visibility = "~";
- break;
- case VisibilityKind.PUBLIC:
- visibility = "+";
- break;
- case VisibilityKind.PROTECTED:
- visibility = "#";
- break;
- case VisibilityKind.PRIVATE:
- visibility = "-";
- break;
- default:
- visibility = "+";
- break;
- }
- result = String.format(VISIBILITY_FORMAT, visibility, result);
- }
-
- // manage derived modifier
- if(((flags & ILabelPreferenceConstants.DISP_DERIVE) == ILabelPreferenceConstants.DISP_DERIVE) && (property.isDerived())) {
- result = String.format(DERIVED_FORMAT, result);
- }
-
- // manage name
- if(((flags & ILabelPreferenceConstants.DISP_NAME) == ILabelPreferenceConstants.DISP_NAME) && (property.isSetName())) {
- String name = property.getName();
-
- // If property is owned by Association (non navigable) only show the name when explicitly asked.
-
- if(((flags & ILabelPreferenceConstants.DISP_NON_NAVIGABLE_ROLE) == ILabelPreferenceConstants.DISP_NON_NAVIGABLE_ROLE) || !((property.getOwningAssociation() != null) && (property.getOwningAssociation().getOwnedEnds().contains(property)))) {
-
- result = String.format(NAME_FORMAT, result, name);
- }
- }
-
- // manage type
- if(((flags & ILabelPreferenceConstants.DISP_TYPE) == ILabelPreferenceConstants.DISP_TYPE)) {
- String type = "<Undefined>";
- if(property.getType() != null) {
- type = property.getType().getName();
- }
-
- // If type is undefined only show "<Undefined>" when explicitly asked.
-
- if(((flags & ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) == ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) || (!"<Undefined>".equals(type))) {
-
- result = String.format(TYPE_FORMAT, result, type);
- }
- }
-
- // manage multiplicity
- if(((flags & ILabelPreferenceConstants.DISP_MULTIPLICITY) == ILabelPreferenceConstants.DISP_MULTIPLICITY)) {
-
- // If multiplicity is [1] (SysML default), only show when explicitly asked.
- String lower = (property.getLowerValue() != null) ? ValueSpecificationUtil.getSpecificationValue(property.getLowerValue()) : "1";
- String upper = (property.getLowerValue() != null) ? ValueSpecificationUtil.getSpecificationValue(property.getUpperValue()) : "1";
- if(((flags & ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY) == ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY) || !("1".equals(lower) && "1".equals(upper))) {
-
- if(lower.equals(upper)) {
- result = String.format(MULTIPLICITY_FORMAT_ALT, result, lower, upper);
- } else {
- result = String.format(MULTIPLICITY_FORMAT, result, lower, upper);
- }
- }
- }
-
- // manage default value
- if(((flags & ILabelPreferenceConstants.DISP_DEFAULTVALUE) == ILabelPreferenceConstants.DISP_DEFAULTVALUE) && ((property.getDefaultValue() != null))) {
- ValueSpecification valueSpecification = property.getDefaultValue();
- if((valueSpecification instanceof InstanceValue && property.getType().equals(valueSpecification.getType())) || !(valueSpecification instanceof InstanceValue)) {
- result = String.format(DEFAULT_VALUE_FORMAT, result, ValueSpecificationUtil.getSpecificationValue(valueSpecification));
- }
- }
-
- // manage modifier
- if((flags & ILabelPreferenceConstants.DISP_MODIFIERS) == ILabelPreferenceConstants.DISP_MODIFIERS) {
- StringBuffer sb = new StringBuffer();
- if(property.isReadOnly()) {
- sb.append(sb.length() == 0 ? "readOnly" : ", readOnly");
- }
- if(property.isOrdered()) {
- sb.append(sb.length() == 0 ? "ordered" : ", ordered");
- }
- if(property.isUnique()) {
- sb.append(sb.length() == 0 ? "unique" : ", unique");
- }
- if(property.isDerivedUnion()) {
- sb.append(sb.length() == 0 ? "union" : ", union");
- }
- EList<Property> redefinedProperties = property.getRedefinedProperties();
- if(redefinedProperties != null && !redefinedProperties.isEmpty()) {
- for(Property p : redefinedProperties) {
- sb.append(sb.length() == 0 ? p.getName() : ", redefines " + p.getName());
- }
- }
- if(sb.length() != 0) {
- result = String.format(ALT_MODIFIER_FORMAT, sb.toString(), result);
- }
- }
- }
- return result;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Map<Integer, String> getMasks() {
- return Collections.emptyMap();
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.parser;
+
+import java.util.Collections;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants;
+import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil;
+import org.eclipse.uml2.uml.InstanceValue;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.ValueSpecification;
+import org.eclipse.uml2.uml.VisibilityKind;
+
+/**
+ * Semantic Parser for {@link Property} used as {@link Association} end.
+ */
+public class AssociationEndLabelParser extends PropertyLabelParser {
+
+ /** The String format for displaying a {@link Property} label with modifiers */
+ protected static final String ALT_MODIFIER_FORMAT = "{%s}%s";
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getPrintString(IAdaptable element, int flags) {
+
+ if(flags == 0) {
+ return MaskedLabel;
+ }
+
+ String result = "";
+ EObject eObject = (EObject)element.getAdapter(EObject.class);
+
+ if((eObject != null) && (eObject instanceof Property)) {
+
+ Property property = (Property)eObject;
+
+ // manage visibility
+ if((flags & ILabelPreferenceConstants.DISP_VISIBILITY) == ILabelPreferenceConstants.DISP_VISIBILITY) {
+ String visibility;
+ switch(property.getVisibility().getValue()) {
+ case VisibilityKind.PACKAGE:
+ visibility = "~";
+ break;
+ case VisibilityKind.PUBLIC:
+ visibility = "+";
+ break;
+ case VisibilityKind.PROTECTED:
+ visibility = "#";
+ break;
+ case VisibilityKind.PRIVATE:
+ visibility = "-";
+ break;
+ default:
+ visibility = "+";
+ break;
+ }
+ result = String.format(VISIBILITY_FORMAT, visibility, result);
+ }
+
+ // manage derived modifier
+ if(((flags & ILabelPreferenceConstants.DISP_DERIVE) == ILabelPreferenceConstants.DISP_DERIVE) && (property.isDerived())) {
+ result = String.format(DERIVED_FORMAT, result);
+ }
+
+ // manage name
+ if(((flags & ILabelPreferenceConstants.DISP_NAME) == ILabelPreferenceConstants.DISP_NAME) && (property.isSetName())) {
+ String name = property.getName();
+
+ // If property is owned by Association (non navigable) only show the name when explicitly asked.
+
+ if(((flags & ILabelPreferenceConstants.DISP_NON_NAVIGABLE_ROLE) == ILabelPreferenceConstants.DISP_NON_NAVIGABLE_ROLE) || !((property.getOwningAssociation() != null) && (property.getOwningAssociation().getOwnedEnds().contains(property)))) {
+
+ result = String.format(NAME_FORMAT, result, name);
+ }
+ }
+
+ // manage type
+ if(((flags & ILabelPreferenceConstants.DISP_TYPE) == ILabelPreferenceConstants.DISP_TYPE)) {
+ String type = "<Undefined>";
+ if(property.getType() != null) {
+ type = property.getType().getName();
+ }
+
+ // If type is undefined only show "<Undefined>" when explicitly asked.
+
+ if(((flags & ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) == ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) || (!"<Undefined>".equals(type))) {
+
+ result = String.format(TYPE_FORMAT, result, type);
+ }
+ }
+
+ // manage multiplicity
+ if(((flags & ILabelPreferenceConstants.DISP_MULTIPLICITY) == ILabelPreferenceConstants.DISP_MULTIPLICITY)) {
+
+ // If multiplicity is [1] (SysML default), only show when explicitly asked.
+ String lower = (property.getLowerValue() != null) ? ValueSpecificationUtil.getSpecificationValue(property.getLowerValue()) : "1";
+ String upper = (property.getLowerValue() != null) ? ValueSpecificationUtil.getSpecificationValue(property.getUpperValue()) : "1";
+ if(((flags & ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY) == ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY) || !("1".equals(lower) && "1".equals(upper))) {
+
+ if(lower.equals(upper)) {
+ result = String.format(MULTIPLICITY_FORMAT_ALT, result, lower, upper);
+ } else {
+ result = String.format(MULTIPLICITY_FORMAT, result, lower, upper);
+ }
+ }
+ }
+
+ // manage default value
+ if(((flags & ILabelPreferenceConstants.DISP_DEFAULTVALUE) == ILabelPreferenceConstants.DISP_DEFAULTVALUE) && ((property.getDefaultValue() != null))) {
+ ValueSpecification valueSpecification = property.getDefaultValue();
+ if((valueSpecification instanceof InstanceValue && property.getType().equals(valueSpecification.getType())) || !(valueSpecification instanceof InstanceValue)) {
+ result = String.format(DEFAULT_VALUE_FORMAT, result, ValueSpecificationUtil.getSpecificationValue(valueSpecification));
+ }
+ }
+
+ // manage modifier
+ if((flags & ILabelPreferenceConstants.DISP_MODIFIERS) == ILabelPreferenceConstants.DISP_MODIFIERS) {
+ StringBuffer sb = new StringBuffer();
+ if(property.isReadOnly()) {
+ sb.append(sb.length() == 0 ? "readOnly" : ", readOnly");
+ }
+ if(property.isOrdered()) {
+ sb.append(sb.length() == 0 ? "ordered" : ", ordered");
+ }
+ if(property.isUnique()) {
+ sb.append(sb.length() == 0 ? "unique" : ", unique");
+ }
+ if(property.isDerivedUnion()) {
+ sb.append(sb.length() == 0 ? "union" : ", union");
+ }
+ EList<Property> redefinedProperties = property.getRedefinedProperties();
+ if(redefinedProperties != null && !redefinedProperties.isEmpty()) {
+ for(Property p : redefinedProperties) {
+ sb.append(sb.length() == 0 ? p.getName() : ", redefines " + p.getName());
+ }
+ }
+ if(sb.length() != 0) {
+ result = String.format(ALT_MODIFIER_FORMAT, sb.toString(), result);
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Map<Integer, String> getMasks() {
+ return Collections.emptyMap();
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ConnectorLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ConnectorLabelParser.java
index 142c542bda5..96c30980bda 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ConnectorLabelParser.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ConnectorLabelParser.java
@@ -1,121 +1,121 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.parser;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants;
-import org.eclipse.uml2.uml.Connector;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * Semantic Parser for {@link Connector}
- */
-public class ConnectorLabelParser extends NamedElementLabelParser {
-
- /** The String format for displaying a {@link Connector} label with its name */
- protected static final String NAME_FORMAT = "%s";
-
- /** The String format for displaying a {@link Connector} label with its type */
- protected static final String TYPE_FORMAT = "%s: %s";
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getPrintString(IAdaptable element, int flags) {
-
- if (flags == 0) {
- return MaskedLabel;
- }
-
- String result = "";
- EObject eObject = (EObject)element.getAdapter(EObject.class);
-
- if((eObject != null) && (eObject instanceof Connector)) {
-
- Connector connector = (Connector)eObject;
-
- // manage name
- if(((flags & ILabelPreferenceConstants.DISP_NAME) == ILabelPreferenceConstants.DISP_NAME) && (connector.isSetName())) {
- String name = connector.getName();
- result = String.format(NAME_FORMAT, name);
- }
-
- // manage type
- if(((flags & ILabelPreferenceConstants.DISP_TYPE) == ILabelPreferenceConstants.DISP_TYPE)) {
- String type = "<Undefined>";
- if(connector.getType() != null) {
- type = connector.getType().getName();
- }
-
- // If type is undefined only show "<Undefined>" when explicitly asked.
- if(((flags & ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) == ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) || (!"<Undefined>".equals(type))) {
- result = String.format(TYPE_FORMAT, result, type);
- }
- }
-
- }
- return result;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isAffectingEvent(Object event, int flags) {
-
- if(event instanceof Notification) {
- Object feature = ((Notification)event).getFeature();
- if(feature instanceof EStructuralFeature) {
- return UMLPackage.eINSTANCE.getTypedElement_Type().equals(feature) || super.isAffectingEvent(event, flags);
- }
- }
-
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public List<EObject> getSemanticElementsBeingParsed(EObject element) {
- List<EObject> semanticElementsBeingParsed = new ArrayList<EObject>();
-
- if((element != null) && (element instanceof Connector)) {
- Connector semElement = (Connector)element;
-
- semanticElementsBeingParsed.add(semElement);
- if(semElement.getType() != null) {
- semanticElementsBeingParsed.add(semElement.getType());
- }
- }
- return semanticElementsBeingParsed;
- }
-
- public Map<Integer, String> getMasks() {
- Map<Integer, String> masks = new HashMap<Integer, String>(2);
- masks.put(ILabelPreferenceConstants.DISP_NAME, "Name");
- masks.put(ILabelPreferenceConstants.DISP_TYPE, "Type");
- masks.put(ILabelPreferenceConstants.DISP_UNDEFINED_TYPE, "Show <Undefined> type");
- return masks;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.parser;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants;
+import org.eclipse.uml2.uml.Connector;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * Semantic Parser for {@link Connector}
+ */
+public class ConnectorLabelParser extends NamedElementLabelParser {
+
+ /** The String format for displaying a {@link Connector} label with its name */
+ protected static final String NAME_FORMAT = "%s";
+
+ /** The String format for displaying a {@link Connector} label with its type */
+ protected static final String TYPE_FORMAT = "%s: %s";
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getPrintString(IAdaptable element, int flags) {
+
+ if (flags == 0) {
+ return MaskedLabel;
+ }
+
+ String result = "";
+ EObject eObject = (EObject)element.getAdapter(EObject.class);
+
+ if((eObject != null) && (eObject instanceof Connector)) {
+
+ Connector connector = (Connector)eObject;
+
+ // manage name
+ if(((flags & ILabelPreferenceConstants.DISP_NAME) == ILabelPreferenceConstants.DISP_NAME) && (connector.isSetName())) {
+ String name = connector.getName();
+ result = String.format(NAME_FORMAT, name);
+ }
+
+ // manage type
+ if(((flags & ILabelPreferenceConstants.DISP_TYPE) == ILabelPreferenceConstants.DISP_TYPE)) {
+ String type = "<Undefined>";
+ if(connector.getType() != null) {
+ type = connector.getType().getName();
+ }
+
+ // If type is undefined only show "<Undefined>" when explicitly asked.
+ if(((flags & ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) == ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) || (!"<Undefined>".equals(type))) {
+ result = String.format(TYPE_FORMAT, result, type);
+ }
+ }
+
+ }
+ return result;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isAffectingEvent(Object event, int flags) {
+
+ if(event instanceof Notification) {
+ Object feature = ((Notification)event).getFeature();
+ if(feature instanceof EStructuralFeature) {
+ return UMLPackage.eINSTANCE.getTypedElement_Type().equals(feature) || super.isAffectingEvent(event, flags);
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<EObject> getSemanticElementsBeingParsed(EObject element) {
+ List<EObject> semanticElementsBeingParsed = new ArrayList<EObject>();
+
+ if((element != null) && (element instanceof Connector)) {
+ Connector semElement = (Connector)element;
+
+ semanticElementsBeingParsed.add(semElement);
+ if(semElement.getType() != null) {
+ semanticElementsBeingParsed.add(semElement.getType());
+ }
+ }
+ return semanticElementsBeingParsed;
+ }
+
+ public Map<Integer, String> getMasks() {
+ Map<Integer, String> masks = new HashMap<Integer, String>(2);
+ masks.put(ILabelPreferenceConstants.DISP_NAME, "Name");
+ masks.put(ILabelPreferenceConstants.DISP_TYPE, "Type");
+ masks.put(ILabelPreferenceConstants.DISP_UNDEFINED_TYPE, "Show <Undefined> type");
+ return masks;
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ConstraintLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ConstraintLabelParser.java
index 164d737f561..49d7500ce8c 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ConstraintLabelParser.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ConstraintLabelParser.java
@@ -1,207 +1,207 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.parser;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil;
-import org.eclipse.uml2.uml.Constraint;
-import org.eclipse.uml2.uml.UMLPackage;
-import org.eclipse.uml2.uml.ValueSpecification;
-
-/**
- * Semantic Parser for {@link Constraint}.
- */
-public class ConstraintLabelParser extends NamedElementLabelParser {
-
- /** The String format for displaying a Property label with derived modifier */
- protected static final String NAME_FORMAT = "%s";
-
- /** The String format for displaying a Property with visibility */
- protected static final String SPECIFICATION_FORMAT = "%s{%s}";
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getEditString(IAdaptable element, int flags) {
-
- if (flags == 0) {
- return MaskedLabel;
- }
-
- String editString = "";
-
- EObject eObject = (EObject)element.getAdapter(EObject.class);
- if((eObject != null) && (eObject instanceof Constraint)) {
- Constraint semElement = (Constraint)eObject;
-
- // edit name
- if(((flags & ILabelPreferenceConstants.DISP_NAME) == ILabelPreferenceConstants.DISP_NAME)) {
- if(semElement.isSetName()) {
- editString = semElement.getName();
- }
-
- // (try to) edit constraint specification
- } else if(((flags & ILabelPreferenceConstants.DISP_SPECIFICATION) == ILabelPreferenceConstants.DISP_SPECIFICATION)) {
- if(semElement.getSpecification() != null) {
- editString = ValueSpecificationUtil.getSpecificationValue(semElement.getSpecification());
- if(editString == null) {
- editString = "";
- }
- }
- }
- }
- return editString;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getPrintString(IAdaptable element, int flags) {
- String result = "";
- EObject eObject = (EObject)element.getAdapter(EObject.class);
-
- if((eObject != null) && (eObject instanceof Constraint)) {
-
- Constraint semElement = (Constraint)eObject;
-
- // manage name
- if(((flags & ILabelPreferenceConstants.DISP_NAME) == ILabelPreferenceConstants.DISP_NAME) && (semElement.isSetName())) {
- String name = semElement.getName();
- result = String.format(NAME_FORMAT, name);
- }
-
- // manage specification
- if(((flags & ILabelPreferenceConstants.DISP_SPECIFICATION) == ILabelPreferenceConstants.DISP_SPECIFICATION)) {
- String spec = "<Undefined>";
- if(semElement.getSpecification() != null) {
- spec = ValueSpecificationUtil.getSpecificationValue(semElement.getSpecification());
- if(spec == null || "".equals(spec)) {
- spec = "<Undefined>";
- }
- }
- result = String.format(SPECIFICATION_FORMAT, result, spec);
- }
- }
- return result;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public ICommand getParseCommand(IAdaptable element, String newString, int flags) {
-
- ICommand command = UnexecutableCommand.INSTANCE;
- SetRequest updateRequest = null;
-
- Constraint constraint = (Constraint)element.getAdapter(EObject.class);
- if(constraint == null) {
- return UnexecutableCommand.INSTANCE;
- }
-
- // prepare set name request
- if(((flags & ILabelPreferenceConstants.DISP_NAME) == ILabelPreferenceConstants.DISP_NAME)) {
- updateRequest = new SetRequest(constraint, UMLPackage.eINSTANCE.getNamedElement_Name(), newString);
- updateRequest.setLabel("Update Constraint Label");
-
- // prepare set specification request
- } else if(((flags & ILabelPreferenceConstants.DISP_SPECIFICATION) == ILabelPreferenceConstants.DISP_SPECIFICATION)) {
- ValueSpecification spec = constraint.getSpecification();
- if(spec == null) {
- return UnexecutableCommand.INSTANCE;
- }
-
- ValueSpecification specCopy = EcoreUtil.copy(spec);
- ValueSpecificationUtil.restoreSpecificationValue(specCopy, newString);
-
- updateRequest = new SetRequest(constraint, UMLPackage.eINSTANCE.getConstraint_Specification(), specCopy);
- updateRequest.setLabel("Update Constraint Label");
- }
-
- try {
- if(updateRequest != null) {
- command = ElementEditServiceUtils.getEditServiceProvider().getEditService(constraint).getEditCommand(updateRequest);
- }
-
- } catch (ServiceException e) {
- Activator.log.error(e);
- }
-
-
- return command;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isAffectingEvent(Object event, int flags) {
-
- if(event instanceof Notification) {
- Object feature = ((Notification)event).getFeature();
- if(feature instanceof EStructuralFeature) {
- return UMLPackage.eINSTANCE.getValueSpecification__BooleanValue().equals(feature) || UMLPackage.eINSTANCE.getValueSpecification__IntegerValue().equals(feature) || UMLPackage.eINSTANCE.getValueSpecification__StringValue().equals(feature) || UMLPackage.eINSTANCE.getValueSpecification__UnlimitedValue().equals(feature) || UMLPackage.eINSTANCE.getOpaqueExpression_Body().equals(feature) || UMLPackage.eINSTANCE.getOpaqueExpression_Language().equals(feature) || super.isAffectingEvent(event, flags);
- }
- }
-
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public List<EObject> getSemanticElementsBeingParsed(EObject element) {
- List<EObject> semanticElementsBeingParsed = new ArrayList<EObject>();
-
- if((element != null) && (element instanceof Constraint)) {
- Constraint semElement = (Constraint)element;
-
- semanticElementsBeingParsed.add(semElement);
- if(semElement.getSpecification() != null) {
- semanticElementsBeingParsed.add(semElement.getSpecification());
- }
- }
- return semanticElementsBeingParsed;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Map<Integer, String> getMasks() {
- Map<Integer, String> masks = new HashMap<Integer, String>(2);
- masks.put(ILabelPreferenceConstants.DISP_NAME, "Name");
- masks.put(ILabelPreferenceConstants.DISP_SPECIFICATION, "Specification");
- return masks;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.parser;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants;
+import org.eclipse.papyrus.uml.diagram.common.Activator;
+import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil;
+import org.eclipse.uml2.uml.Constraint;
+import org.eclipse.uml2.uml.UMLPackage;
+import org.eclipse.uml2.uml.ValueSpecification;
+
+/**
+ * Semantic Parser for {@link Constraint}.
+ */
+public class ConstraintLabelParser extends NamedElementLabelParser {
+
+ /** The String format for displaying a Property label with derived modifier */
+ protected static final String NAME_FORMAT = "%s";
+
+ /** The String format for displaying a Property with visibility */
+ protected static final String SPECIFICATION_FORMAT = "%s{%s}";
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getEditString(IAdaptable element, int flags) {
+
+ if (flags == 0) {
+ return MaskedLabel;
+ }
+
+ String editString = "";
+
+ EObject eObject = (EObject)element.getAdapter(EObject.class);
+ if((eObject != null) && (eObject instanceof Constraint)) {
+ Constraint semElement = (Constraint)eObject;
+
+ // edit name
+ if(((flags & ILabelPreferenceConstants.DISP_NAME) == ILabelPreferenceConstants.DISP_NAME)) {
+ if(semElement.isSetName()) {
+ editString = semElement.getName();
+ }
+
+ // (try to) edit constraint specification
+ } else if(((flags & ILabelPreferenceConstants.DISP_SPECIFICATION) == ILabelPreferenceConstants.DISP_SPECIFICATION)) {
+ if(semElement.getSpecification() != null) {
+ editString = ValueSpecificationUtil.getSpecificationValue(semElement.getSpecification());
+ if(editString == null) {
+ editString = "";
+ }
+ }
+ }
+ }
+ return editString;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getPrintString(IAdaptable element, int flags) {
+ String result = "";
+ EObject eObject = (EObject)element.getAdapter(EObject.class);
+
+ if((eObject != null) && (eObject instanceof Constraint)) {
+
+ Constraint semElement = (Constraint)eObject;
+
+ // manage name
+ if(((flags & ILabelPreferenceConstants.DISP_NAME) == ILabelPreferenceConstants.DISP_NAME) && (semElement.isSetName())) {
+ String name = semElement.getName();
+ result = String.format(NAME_FORMAT, name);
+ }
+
+ // manage specification
+ if(((flags & ILabelPreferenceConstants.DISP_SPECIFICATION) == ILabelPreferenceConstants.DISP_SPECIFICATION)) {
+ String spec = "<Undefined>";
+ if(semElement.getSpecification() != null) {
+ spec = ValueSpecificationUtil.getSpecificationValue(semElement.getSpecification());
+ if(spec == null || "".equals(spec)) {
+ spec = "<Undefined>";
+ }
+ }
+ result = String.format(SPECIFICATION_FORMAT, result, spec);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ICommand getParseCommand(IAdaptable element, String newString, int flags) {
+
+ ICommand command = UnexecutableCommand.INSTANCE;
+ SetRequest updateRequest = null;
+
+ Constraint constraint = (Constraint)element.getAdapter(EObject.class);
+ if(constraint == null) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ // prepare set name request
+ if(((flags & ILabelPreferenceConstants.DISP_NAME) == ILabelPreferenceConstants.DISP_NAME)) {
+ updateRequest = new SetRequest(constraint, UMLPackage.eINSTANCE.getNamedElement_Name(), newString);
+ updateRequest.setLabel("Update Constraint Label");
+
+ // prepare set specification request
+ } else if(((flags & ILabelPreferenceConstants.DISP_SPECIFICATION) == ILabelPreferenceConstants.DISP_SPECIFICATION)) {
+ ValueSpecification spec = constraint.getSpecification();
+ if(spec == null) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ ValueSpecification specCopy = EcoreUtil.copy(spec);
+ ValueSpecificationUtil.restoreSpecificationValue(specCopy, newString);
+
+ updateRequest = new SetRequest(constraint, UMLPackage.eINSTANCE.getConstraint_Specification(), specCopy);
+ updateRequest.setLabel("Update Constraint Label");
+ }
+
+ try {
+ if(updateRequest != null) {
+ command = ElementEditServiceUtils.getEditServiceProvider().getEditService(constraint).getEditCommand(updateRequest);
+ }
+
+ } catch (ServiceException e) {
+ Activator.log.error(e);
+ }
+
+
+ return command;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isAffectingEvent(Object event, int flags) {
+
+ if(event instanceof Notification) {
+ Object feature = ((Notification)event).getFeature();
+ if(feature instanceof EStructuralFeature) {
+ return UMLPackage.eINSTANCE.getValueSpecification__BooleanValue().equals(feature) || UMLPackage.eINSTANCE.getValueSpecification__IntegerValue().equals(feature) || UMLPackage.eINSTANCE.getValueSpecification__StringValue().equals(feature) || UMLPackage.eINSTANCE.getValueSpecification__UnlimitedValue().equals(feature) || UMLPackage.eINSTANCE.getOpaqueExpression_Body().equals(feature) || UMLPackage.eINSTANCE.getOpaqueExpression_Language().equals(feature) || super.isAffectingEvent(event, flags);
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<EObject> getSemanticElementsBeingParsed(EObject element) {
+ List<EObject> semanticElementsBeingParsed = new ArrayList<EObject>();
+
+ if((element != null) && (element instanceof Constraint)) {
+ Constraint semElement = (Constraint)element;
+
+ semanticElementsBeingParsed.add(semElement);
+ if(semElement.getSpecification() != null) {
+ semanticElementsBeingParsed.add(semElement.getSpecification());
+ }
+ }
+ return semanticElementsBeingParsed;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Map<Integer, String> getMasks() {
+ Map<Integer, String> masks = new HashMap<Integer, String>(2);
+ masks.put(ILabelPreferenceConstants.DISP_NAME, "Name");
+ masks.put(ILabelPreferenceConstants.DISP_SPECIFICATION, "Specification");
+ return masks;
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/DefaultParserHintAdapter.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/DefaultParserHintAdapter.java
index 46ee6f7d289..4ad4430074c 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/DefaultParserHintAdapter.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/DefaultParserHintAdapter.java
@@ -1,43 +1,43 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.parser;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ParserHintAdapter;
-import org.eclipse.gmf.runtime.notation.Diagram;
-
-public class DefaultParserHintAdapter extends ParserHintAdapter {
-
- private Diagram diagram = null;
-
- /** Constructor */
- public DefaultParserHintAdapter(Diagram diagram, EObject element, String parserHint) {
- super(element, parserHint);
- this.diagram = diagram;
- }
-
- /**
- * {@inheritDoc}
- */
- @SuppressWarnings("rawtypes")
- @Override
- public Object getAdapter(Class adapter) {
-
- if(adapter.equals(Diagram.class)) {
- return diagram;
- }
-
- return super.getAdapter(adapter);
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.parser;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ParserHintAdapter;
+import org.eclipse.gmf.runtime.notation.Diagram;
+
+public class DefaultParserHintAdapter extends ParserHintAdapter {
+
+ private Diagram diagram = null;
+
+ /** Constructor */
+ public DefaultParserHintAdapter(Diagram diagram, EObject element, String parserHint) {
+ super(element, parserHint);
+ this.diagram = diagram;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("rawtypes")
+ @Override
+ public Object getAdapter(Class adapter) {
+
+ if(adapter.equals(Diagram.class)) {
+ return diagram;
+ }
+
+ return super.getAdapter(adapter);
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/MultiplicityElementLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/MultiplicityElementLabelParser.java
index ba994405757..93f3ee3cf94 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/MultiplicityElementLabelParser.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/MultiplicityElementLabelParser.java
@@ -1,160 +1,160 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.parser;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.EcorePackage;
-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.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.papyrus.gmf.diagram.common.parser.IMaskManagedSemanticParser;
-import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants;
-import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil;
-import org.eclipse.uml2.uml.MultiplicityElement;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * Semantic Parser for {@link MultiplicityElement}
- */
-public class MultiplicityElementLabelParser implements IMaskManagedSemanticParser {
-
- /** The String format for displaying a {@link Property} label with multiplicity */
- protected static final String MULTIPLICITY_FORMAT = "[%s..%s]";
-
- /** The String format for displaying a {@link Property} label with multiplicity */
- protected static final String MULTIPLICITY_FORMAT_ALT = "[%s]";
-
- /**
- * {@inheritDoc}
- */
- public String getEditString(IAdaptable element, int flags) {
- return getPrintString(element, flags);
- }
-
- /**
- * {@inheritDoc}
- */
- public IParserEditStatus isValidEditString(IAdaptable element, String editString) {
- return ParserEditStatus.UNEDITABLE_STATUS;
- }
-
- /**
- * {@inheritDoc}
- */
- public ICommand getParseCommand(IAdaptable element, String newString, int flags) {
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- * {@inheritDoc}
- */
- public String getPrintString(IAdaptable element, int flags) {
-
- if (flags == 0) {
- return MaskedLabel;
- }
-
- String result = "";
- EObject eObject = (EObject)element.getAdapter(EObject.class);
-
- if((eObject != null) && (eObject instanceof MultiplicityElement)) {
-
- MultiplicityElement multElt = (MultiplicityElement)eObject;
-
- // manage multiplicity
- if(((flags & ILabelPreferenceConstants.DISP_MULTIPLICITY) == ILabelPreferenceConstants.DISP_MULTIPLICITY)) {
-
- // If multiplicity is [1] (SysML default), only show when explicitly asked.
- // TODO : add a case for default with multiplicity not set.
- String lower = (multElt.getLowerValue() != null) ? ValueSpecificationUtil.getSpecificationValue(multElt.getLowerValue()) : "1";
- String upper = (multElt.getLowerValue() != null) ? ValueSpecificationUtil.getSpecificationValue(multElt.getUpperValue()) : "1";
- if(((flags & ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY) == ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY) || !("1".equals(lower) && "1".equals(upper))) {
-
- if(lower.equals(upper)) {
- result = String.format(MULTIPLICITY_FORMAT_ALT, lower, upper);
- } else {
- result = String.format(MULTIPLICITY_FORMAT, lower, upper);
- }
- }
- }
- }
- return result;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isAffectingEvent(Object event, int flags) {
-
- if(event instanceof Notification) {
- Object feature = ((Notification)event).getFeature();
- if(feature instanceof EStructuralFeature) {
- return EcorePackage.eINSTANCE.getEAnnotation_Details().equals(feature) || UMLPackage.eINSTANCE.getMultiplicityElement_LowerValue().equals(feature) || UMLPackage.eINSTANCE.getMultiplicityElement_UpperValue().equals(feature);
- }
- }
-
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- public IContentAssistProcessor getCompletionProcessor(IAdaptable element) {
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- public List<EObject> getSemanticElementsBeingParsed(EObject element) {
- List<EObject> semanticElementsBeingParsed = new ArrayList<EObject>();
-
- if((element != null) && (element instanceof MultiplicityElement)) {
- MultiplicityElement semElement = (MultiplicityElement)element;
-
- semanticElementsBeingParsed.add(semElement);
- if(semElement.getLowerValue() != null) {
- semanticElementsBeingParsed.add(semElement.getLowerValue());
- }
- if(semElement.getUpperValue() != null) {
- semanticElementsBeingParsed.add(semElement.getUpperValue());
- }
- }
- return semanticElementsBeingParsed;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean areSemanticElementsAffected(EObject listener, Object notification) {
- return true;
- }
-
- public Map<Integer, String> getMasks() {
- Map<Integer, String> masks = new HashMap<Integer, String>(2);
- masks.put(ILabelPreferenceConstants.DISP_MULTIPLICITY, "Multiplicity");
- masks.put(ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY, "Show default multiplicity");
- return masks;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.parser;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcorePackage;
+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.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.papyrus.gmf.diagram.common.parser.IMaskManagedSemanticParser;
+import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants;
+import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil;
+import org.eclipse.uml2.uml.MultiplicityElement;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * Semantic Parser for {@link MultiplicityElement}
+ */
+public class MultiplicityElementLabelParser implements IMaskManagedSemanticParser {
+
+ /** The String format for displaying a {@link Property} label with multiplicity */
+ protected static final String MULTIPLICITY_FORMAT = "[%s..%s]";
+
+ /** The String format for displaying a {@link Property} label with multiplicity */
+ protected static final String MULTIPLICITY_FORMAT_ALT = "[%s]";
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getEditString(IAdaptable element, int flags) {
+ return getPrintString(element, flags);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public IParserEditStatus isValidEditString(IAdaptable element, String editString) {
+ return ParserEditStatus.UNEDITABLE_STATUS;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ICommand getParseCommand(IAdaptable element, String newString, int flags) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getPrintString(IAdaptable element, int flags) {
+
+ if (flags == 0) {
+ return MaskedLabel;
+ }
+
+ String result = "";
+ EObject eObject = (EObject)element.getAdapter(EObject.class);
+
+ if((eObject != null) && (eObject instanceof MultiplicityElement)) {
+
+ MultiplicityElement multElt = (MultiplicityElement)eObject;
+
+ // manage multiplicity
+ if(((flags & ILabelPreferenceConstants.DISP_MULTIPLICITY) == ILabelPreferenceConstants.DISP_MULTIPLICITY)) {
+
+ // If multiplicity is [1] (SysML default), only show when explicitly asked.
+ // TODO : add a case for default with multiplicity not set.
+ String lower = (multElt.getLowerValue() != null) ? ValueSpecificationUtil.getSpecificationValue(multElt.getLowerValue()) : "1";
+ String upper = (multElt.getLowerValue() != null) ? ValueSpecificationUtil.getSpecificationValue(multElt.getUpperValue()) : "1";
+ if(((flags & ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY) == ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY) || !("1".equals(lower) && "1".equals(upper))) {
+
+ if(lower.equals(upper)) {
+ result = String.format(MULTIPLICITY_FORMAT_ALT, lower, upper);
+ } else {
+ result = String.format(MULTIPLICITY_FORMAT, lower, upper);
+ }
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isAffectingEvent(Object event, int flags) {
+
+ if(event instanceof Notification) {
+ Object feature = ((Notification)event).getFeature();
+ if(feature instanceof EStructuralFeature) {
+ return EcorePackage.eINSTANCE.getEAnnotation_Details().equals(feature) || UMLPackage.eINSTANCE.getMultiplicityElement_LowerValue().equals(feature) || UMLPackage.eINSTANCE.getMultiplicityElement_UpperValue().equals(feature);
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public IContentAssistProcessor getCompletionProcessor(IAdaptable element) {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public List<EObject> getSemanticElementsBeingParsed(EObject element) {
+ List<EObject> semanticElementsBeingParsed = new ArrayList<EObject>();
+
+ if((element != null) && (element instanceof MultiplicityElement)) {
+ MultiplicityElement semElement = (MultiplicityElement)element;
+
+ semanticElementsBeingParsed.add(semElement);
+ if(semElement.getLowerValue() != null) {
+ semanticElementsBeingParsed.add(semElement.getLowerValue());
+ }
+ if(semElement.getUpperValue() != null) {
+ semanticElementsBeingParsed.add(semElement.getUpperValue());
+ }
+ }
+ return semanticElementsBeingParsed;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean areSemanticElementsAffected(EObject listener, Object notification) {
+ return true;
+ }
+
+ public Map<Integer, String> getMasks() {
+ Map<Integer, String> masks = new HashMap<Integer, String>(2);
+ masks.put(ILabelPreferenceConstants.DISP_MULTIPLICITY, "Multiplicity");
+ masks.put(ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY, "Show default multiplicity");
+ return masks;
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/NamedElementLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/NamedElementLabelParser.java
index ef7385fe4e3..298f5ce826c 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/NamedElementLabelParser.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/NamedElementLabelParser.java
@@ -1,147 +1,147 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.parser;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.EcorePackage;
-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.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.papyrus.gmf.diagram.common.parser.IMaskManagedSemanticParser;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * Semantic Parser for {@link NamedElement} name.
- */
-public class NamedElementLabelParser implements IMaskManagedSemanticParser {
-
- /**
- * {@inheritDoc}
- */
- public String getEditString(IAdaptable element, int flags) {
- String editString = "";
-
- EObject eObject = (EObject)element.getAdapter(EObject.class);
- if((eObject != null) && (eObject instanceof NamedElement)) {
- NamedElement semElement = (NamedElement)eObject;
- if(semElement.isSetName()) {
- editString = semElement.getName();
- }
- }
- return editString;
- }
-
- /**
- * {@inheritDoc}
- */
- public IParserEditStatus isValidEditString(IAdaptable element, String editString) {
- return ParserEditStatus.EDITABLE_STATUS;
- }
-
- /**
- * {@inheritDoc}
- */
- public ICommand getParseCommand(IAdaptable element, String newString, int flags) {
-
- ICommand command = UnexecutableCommand.INSTANCE;
-
- EObject objectToEdit = (EObject)element.getAdapter(EObject.class);
- if(objectToEdit == null) {
- return UnexecutableCommand.INSTANCE;
- }
-
- try {
- command = ElementEditServiceUtils.getEditServiceProvider().getEditService(objectToEdit).getEditCommand(new SetRequest(objectToEdit, UMLPackage.eINSTANCE.getNamedElement_Name(), newString));
- } catch (ServiceException e) {
- Activator.log.error(e);
- }
-
- return command;
- }
-
- /**
- * {@inheritDoc}
- */
- public String getPrintString(IAdaptable element, int flags) {
- String result = "";
- EObject eObject = (EObject)element.getAdapter(EObject.class);
-
- if(eObject instanceof NamedElement) {
- return ((NamedElement)eObject).getName();
- }
-
- return result;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isAffectingEvent(Object event, int flags) {
-
- if(event instanceof Notification) {
- Object feature = ((Notification)event).getFeature();
- if(feature instanceof EStructuralFeature) {
- return EcorePackage.eINSTANCE.getEAnnotation_Details().equals(feature) || UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature);
- }
- }
-
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- public IContentAssistProcessor getCompletionProcessor(IAdaptable element) {
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- public List<EObject> getSemanticElementsBeingParsed(EObject element) {
- List<EObject> semanticElementsBeingParsed = new ArrayList<EObject>();
- semanticElementsBeingParsed.add(element);
-
- return semanticElementsBeingParsed;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean areSemanticElementsAffected(EObject listener, Object notification) {
- return true;
- }
-
- /**
- * {@inheritDoc}
- */
- public Map<Integer, String> getMasks() {
- return Collections.emptyMap();
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.parser;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcorePackage;
+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.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.papyrus.gmf.diagram.common.parser.IMaskManagedSemanticParser;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.uml.diagram.common.Activator;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * Semantic Parser for {@link NamedElement} name.
+ */
+public class NamedElementLabelParser implements IMaskManagedSemanticParser {
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getEditString(IAdaptable element, int flags) {
+ String editString = "";
+
+ EObject eObject = (EObject)element.getAdapter(EObject.class);
+ if((eObject != null) && (eObject instanceof NamedElement)) {
+ NamedElement semElement = (NamedElement)eObject;
+ if(semElement.isSetName()) {
+ editString = semElement.getName();
+ }
+ }
+ return editString;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public IParserEditStatus isValidEditString(IAdaptable element, String editString) {
+ return ParserEditStatus.EDITABLE_STATUS;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ICommand getParseCommand(IAdaptable element, String newString, int flags) {
+
+ ICommand command = UnexecutableCommand.INSTANCE;
+
+ EObject objectToEdit = (EObject)element.getAdapter(EObject.class);
+ if(objectToEdit == null) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ try {
+ command = ElementEditServiceUtils.getEditServiceProvider().getEditService(objectToEdit).getEditCommand(new SetRequest(objectToEdit, UMLPackage.eINSTANCE.getNamedElement_Name(), newString));
+ } catch (ServiceException e) {
+ Activator.log.error(e);
+ }
+
+ return command;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getPrintString(IAdaptable element, int flags) {
+ String result = "";
+ EObject eObject = (EObject)element.getAdapter(EObject.class);
+
+ if(eObject instanceof NamedElement) {
+ return ((NamedElement)eObject).getName();
+ }
+
+ return result;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isAffectingEvent(Object event, int flags) {
+
+ if(event instanceof Notification) {
+ Object feature = ((Notification)event).getFeature();
+ if(feature instanceof EStructuralFeature) {
+ return EcorePackage.eINSTANCE.getEAnnotation_Details().equals(feature) || UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature);
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public IContentAssistProcessor getCompletionProcessor(IAdaptable element) {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public List<EObject> getSemanticElementsBeingParsed(EObject element) {
+ List<EObject> semanticElementsBeingParsed = new ArrayList<EObject>();
+ semanticElementsBeingParsed.add(element);
+
+ return semanticElementsBeingParsed;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean areSemanticElementsAffected(EObject listener, Object notification) {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Map<Integer, String> getMasks() {
+ return Collections.emptyMap();
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/OperationLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/OperationLabelParser.java
index 7e1b157c27b..dffc5c0fadd 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/OperationLabelParser.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/OperationLabelParser.java
@@ -1,198 +1,198 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.parser;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.papyrus.gmf.diagram.common.parser.IMaskManagedSemanticParser;
-import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants;
-import org.eclipse.papyrus.uml.diagram.common.commands.SemanticAdapter;
-import org.eclipse.uml2.uml.Operation;
-import org.eclipse.uml2.uml.Parameter;
-import org.eclipse.uml2.uml.UMLPackage;
-import org.eclipse.uml2.uml.VisibilityKind;
-
-/**
- * Semantic Parser for {@link Operation}
- */
-public class OperationLabelParser extends NamedElementLabelParser {
-
- /** Parameter parser */
- protected IMaskManagedSemanticParser parameterParser = new ParameterLabelParser();
-
- /** The String format for displaying {@link Operation} label with visibility */
- protected static final String VISIBILITY_FORMAT = "%s ";
-
- /** The String format for displaying a {@link Operation} label with its name */
- protected static final String NAME_FORMAT = "%s%s(%s)";
-
- /** The String format for displaying a {@link Operation} label with its type */
- protected static final String TYPE_FORMAT = "%s: %s";
-
- /** The String format for displaying a {@link Operation} label with modifiers */
- protected static final String MODIFIER_FORMAT = "%s{%s}";
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getPrintString(IAdaptable element, int flags) {
-
- if (flags == 0) {
- return MaskedLabel;
- }
-
- String result = "";
- EObject eObject = (EObject)element.getAdapter(EObject.class);
-
- if((eObject != null) && (eObject instanceof Operation)) {
-
- Operation operation = (Operation)eObject;
-
- // manage visibility
- if((flags & ILabelPreferenceConstants.DISP_VISIBILITY) == ILabelPreferenceConstants.DISP_VISIBILITY) {
- String visibility;
- switch(operation.getVisibility().getValue()) {
- case VisibilityKind.PACKAGE:
- visibility = "~";
- break;
- case VisibilityKind.PUBLIC:
- visibility = "+";
- break;
- case VisibilityKind.PROTECTED:
- visibility = "#";
- break;
- case VisibilityKind.PRIVATE:
- visibility = "-";
- break;
- default:
- visibility = "+";
- break;
- }
- result = String.format(VISIBILITY_FORMAT, visibility);
- }
-
- // manage name and parameters
- if(((flags & ILabelPreferenceConstants.DISP_NAME) == ILabelPreferenceConstants.DISP_NAME) && (operation.isSetName())) {
- String name = operation.getName();
-
- StringBuffer params = new StringBuffer();
- for(Parameter parameter : operation.getOwnedParameters()) {
- String currentParamLabel = parameterParser.getPrintString(new SemanticAdapter(parameter, null), flags);
- params.append(params.length() == 0 ? currentParamLabel : ", " + currentParamLabel);
- }
-
- result = String.format(NAME_FORMAT, result, name, params);
- }
-
- // manage type
- if(((flags & ILabelPreferenceConstants.DISP_TYPE) == ILabelPreferenceConstants.DISP_TYPE)) {
- String type = "<Undefined>";
- if(operation.getType() != null) {
- type = operation.getType().getName();
- }
-
- // If type is undefined only show "<Undefined>" when explicitly asked.
- if(((flags & ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) == ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) || (!"<Undefined>".equals(type))) {
- result = String.format(TYPE_FORMAT, result, type);
- }
- }
-
- // manage modifier
- if((flags & ILabelPreferenceConstants.DISP_MODIFIERS) == ILabelPreferenceConstants.DISP_MODIFIERS) {
- StringBuffer sb = new StringBuffer();
- if(operation.isAbstract()) {
- sb.append(sb.length() == 0 ? "abstract" : ", abstract");
- }
- if(operation.isStatic()) {
- sb.append(sb.length() == 0 ? "static" : ", static");
- }
- if(operation.isUnique()) {
- sb.append(sb.length() == 0 ? "unique" : ", unique");
- }
- if(operation.isQuery()) {
- sb.append(sb.length() == 0 ? "query" : ", query");
- }
- if(operation.isLeaf()) {
- sb.append(sb.length() == 0 ? "leaf" : ", leaf");
- }
-
- if(sb.length() != 0) {
- result = String.format(MODIFIER_FORMAT, result, sb.toString());
- }
- }
- }
- return result;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isAffectingEvent(Object event, int flags) {
-
- if(event instanceof Notification) {
- Object feature = ((Notification)event).getFeature();
- if(feature instanceof EStructuralFeature) {
- return UMLPackage.eINSTANCE.getNamedElement_Visibility().equals(feature) || UMLPackage.eINSTANCE.getTypedElement_Type().equals(feature) || UMLPackage.eINSTANCE.getBehavioralFeature_IsAbstract().equals(feature) || UMLPackage.eINSTANCE.getFeature_IsStatic().equals(feature) || UMLPackage.eINSTANCE.getOperation_IsUnique().equals(feature) || UMLPackage.eINSTANCE.getOperation_IsQuery().equals(feature) || UMLPackage.eINSTANCE.getRedefinableElement_IsLeaf().equals(feature) || parameterParser.isAffectingEvent(event, flags) || super.isAffectingEvent(event, flags);
- }
- }
-
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- @SuppressWarnings("unchecked")
- @Override
- public List<EObject> getSemanticElementsBeingParsed(EObject element) {
- List<EObject> semanticElementsBeingParsed = new ArrayList<EObject>();
-
- if((element != null) && (element instanceof Operation)) {
- Operation semElement = (Operation)element;
-
- semanticElementsBeingParsed.add(semElement);
- if(semElement.getType() != null) {
- semanticElementsBeingParsed.add(semElement.getType());
- }
- for(Parameter parameter : semElement.getOwnedParameters()) {
- semanticElementsBeingParsed.addAll(parameterParser.getSemanticElementsBeingParsed(parameter));
- }
- }
- return semanticElementsBeingParsed;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Map<Integer, String> getMasks() {
- Map<Integer, String> masks = new HashMap<Integer, String>(5);
- masks.put(ILabelPreferenceConstants.DISP_VISIBILITY, "Visibility");
- masks.put(ILabelPreferenceConstants.DISP_NAME, "Name");
- masks.put(ILabelPreferenceConstants.DISP_TYPE, "Type");
- masks.put(ILabelPreferenceConstants.DISP_UNDEFINED_TYPE, "Show <Undefined> type");
- masks.put(ILabelPreferenceConstants.DISP_MODIFIERS, "Modifiers");
- masks.putAll(parameterParser.getMasks());
- return masks;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.parser;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.papyrus.gmf.diagram.common.parser.IMaskManagedSemanticParser;
+import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants;
+import org.eclipse.papyrus.uml.diagram.common.commands.SemanticAdapter;
+import org.eclipse.uml2.uml.Operation;
+import org.eclipse.uml2.uml.Parameter;
+import org.eclipse.uml2.uml.UMLPackage;
+import org.eclipse.uml2.uml.VisibilityKind;
+
+/**
+ * Semantic Parser for {@link Operation}
+ */
+public class OperationLabelParser extends NamedElementLabelParser {
+
+ /** Parameter parser */
+ protected IMaskManagedSemanticParser parameterParser = new ParameterLabelParser();
+
+ /** The String format for displaying {@link Operation} label with visibility */
+ protected static final String VISIBILITY_FORMAT = "%s ";
+
+ /** The String format for displaying a {@link Operation} label with its name */
+ protected static final String NAME_FORMAT = "%s%s(%s)";
+
+ /** The String format for displaying a {@link Operation} label with its type */
+ protected static final String TYPE_FORMAT = "%s: %s";
+
+ /** The String format for displaying a {@link Operation} label with modifiers */
+ protected static final String MODIFIER_FORMAT = "%s{%s}";
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getPrintString(IAdaptable element, int flags) {
+
+ if (flags == 0) {
+ return MaskedLabel;
+ }
+
+ String result = "";
+ EObject eObject = (EObject)element.getAdapter(EObject.class);
+
+ if((eObject != null) && (eObject instanceof Operation)) {
+
+ Operation operation = (Operation)eObject;
+
+ // manage visibility
+ if((flags & ILabelPreferenceConstants.DISP_VISIBILITY) == ILabelPreferenceConstants.DISP_VISIBILITY) {
+ String visibility;
+ switch(operation.getVisibility().getValue()) {
+ case VisibilityKind.PACKAGE:
+ visibility = "~";
+ break;
+ case VisibilityKind.PUBLIC:
+ visibility = "+";
+ break;
+ case VisibilityKind.PROTECTED:
+ visibility = "#";
+ break;
+ case VisibilityKind.PRIVATE:
+ visibility = "-";
+ break;
+ default:
+ visibility = "+";
+ break;
+ }
+ result = String.format(VISIBILITY_FORMAT, visibility);
+ }
+
+ // manage name and parameters
+ if(((flags & ILabelPreferenceConstants.DISP_NAME) == ILabelPreferenceConstants.DISP_NAME) && (operation.isSetName())) {
+ String name = operation.getName();
+
+ StringBuffer params = new StringBuffer();
+ for(Parameter parameter : operation.getOwnedParameters()) {
+ String currentParamLabel = parameterParser.getPrintString(new SemanticAdapter(parameter, null), flags);
+ params.append(params.length() == 0 ? currentParamLabel : ", " + currentParamLabel);
+ }
+
+ result = String.format(NAME_FORMAT, result, name, params);
+ }
+
+ // manage type
+ if(((flags & ILabelPreferenceConstants.DISP_TYPE) == ILabelPreferenceConstants.DISP_TYPE)) {
+ String type = "<Undefined>";
+ if(operation.getType() != null) {
+ type = operation.getType().getName();
+ }
+
+ // If type is undefined only show "<Undefined>" when explicitly asked.
+ if(((flags & ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) == ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) || (!"<Undefined>".equals(type))) {
+ result = String.format(TYPE_FORMAT, result, type);
+ }
+ }
+
+ // manage modifier
+ if((flags & ILabelPreferenceConstants.DISP_MODIFIERS) == ILabelPreferenceConstants.DISP_MODIFIERS) {
+ StringBuffer sb = new StringBuffer();
+ if(operation.isAbstract()) {
+ sb.append(sb.length() == 0 ? "abstract" : ", abstract");
+ }
+ if(operation.isStatic()) {
+ sb.append(sb.length() == 0 ? "static" : ", static");
+ }
+ if(operation.isUnique()) {
+ sb.append(sb.length() == 0 ? "unique" : ", unique");
+ }
+ if(operation.isQuery()) {
+ sb.append(sb.length() == 0 ? "query" : ", query");
+ }
+ if(operation.isLeaf()) {
+ sb.append(sb.length() == 0 ? "leaf" : ", leaf");
+ }
+
+ if(sb.length() != 0) {
+ result = String.format(MODIFIER_FORMAT, result, sb.toString());
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isAffectingEvent(Object event, int flags) {
+
+ if(event instanceof Notification) {
+ Object feature = ((Notification)event).getFeature();
+ if(feature instanceof EStructuralFeature) {
+ return UMLPackage.eINSTANCE.getNamedElement_Visibility().equals(feature) || UMLPackage.eINSTANCE.getTypedElement_Type().equals(feature) || UMLPackage.eINSTANCE.getBehavioralFeature_IsAbstract().equals(feature) || UMLPackage.eINSTANCE.getFeature_IsStatic().equals(feature) || UMLPackage.eINSTANCE.getOperation_IsUnique().equals(feature) || UMLPackage.eINSTANCE.getOperation_IsQuery().equals(feature) || UMLPackage.eINSTANCE.getRedefinableElement_IsLeaf().equals(feature) || parameterParser.isAffectingEvent(event, flags) || super.isAffectingEvent(event, flags);
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<EObject> getSemanticElementsBeingParsed(EObject element) {
+ List<EObject> semanticElementsBeingParsed = new ArrayList<EObject>();
+
+ if((element != null) && (element instanceof Operation)) {
+ Operation semElement = (Operation)element;
+
+ semanticElementsBeingParsed.add(semElement);
+ if(semElement.getType() != null) {
+ semanticElementsBeingParsed.add(semElement.getType());
+ }
+ for(Parameter parameter : semElement.getOwnedParameters()) {
+ semanticElementsBeingParsed.addAll(parameterParser.getSemanticElementsBeingParsed(parameter));
+ }
+ }
+ return semanticElementsBeingParsed;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Map<Integer, String> getMasks() {
+ Map<Integer, String> masks = new HashMap<Integer, String>(5);
+ masks.put(ILabelPreferenceConstants.DISP_VISIBILITY, "Visibility");
+ masks.put(ILabelPreferenceConstants.DISP_NAME, "Name");
+ masks.put(ILabelPreferenceConstants.DISP_TYPE, "Type");
+ masks.put(ILabelPreferenceConstants.DISP_UNDEFINED_TYPE, "Show <Undefined> type");
+ masks.put(ILabelPreferenceConstants.DISP_MODIFIERS, "Modifiers");
+ masks.putAll(parameterParser.getMasks());
+ return masks;
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ParameterLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ParameterLabelParser.java
index 5e17b05dd39..307e05a75c9 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ParameterLabelParser.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ParameterLabelParser.java
@@ -1,210 +1,210 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.parser;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants;
-import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil;
-import org.eclipse.uml2.uml.InstanceValue;
-import org.eclipse.uml2.uml.Parameter;
-import org.eclipse.uml2.uml.ParameterDirectionKind;
-import org.eclipse.uml2.uml.UMLPackage;
-import org.eclipse.uml2.uml.ValueSpecification;
-
-/**
- * Semantic Parser for {@link Parameter}
- */
-public class ParameterLabelParser extends NamedElementLabelParser {
-
- /** The String format for displaying a {@link Parameter} with direction */
- protected static final String DIRECTION_FORMAT = "%s %s";
-
- /** The String format for displaying a {@link Parameter} label with its name */
- protected static final String NAME_FORMAT = "%s%s";
-
- /** The String format for displaying a {@link Parameter} label with its type */
- protected static final String TYPE_FORMAT = "%s: %s";
-
- /** The String format for displaying a {@link Parameter} label with its multiplicity */
- protected static final String MULTIPLICITY_FORMAT = "%s [%s..%s]";
-
- /** The String format for displaying a {@link Parameter} label with its default value */
- protected static final String DEFAULT_VALUE_FORMAT = "%s= %s";
-
- /** The String format for displaying a {@link Parameter} label with its modifiers */
- protected static final String MODIFIER_FORMAT = "%s{%s}";
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getPrintString(IAdaptable element, int flags) {
-
- if (flags == 0) {
- return MaskedLabel;
- }
-
- String result = "";
- EObject eObject = (EObject)element.getAdapter(EObject.class);
-
- if((eObject != null) && (eObject instanceof Parameter)) {
-
- Parameter parameter = (Parameter)eObject;
-
- // manage direction
- if((flags & ILabelPreferenceConstants.DISP_PARAM_DIRECTION) == ILabelPreferenceConstants.DISP_PARAM_DIRECTION) {
- String direction;
- switch(parameter.getDirection().getValue()) {
- case ParameterDirectionKind.IN:
- direction = "in";
- break;
- case ParameterDirectionKind.OUT:
- direction = "out";
- break;
- case ParameterDirectionKind.INOUT:
- direction = "inout";
- break;
- case ParameterDirectionKind.RETURN:
- direction = "return";
- break;
- default:
- direction = "in";
- break;
- }
- result = String.format(DIRECTION_FORMAT, direction, result);
-
- // manage name
- if(((flags & ILabelPreferenceConstants.DISP_PARAM_NAME) == ILabelPreferenceConstants.DISP_PARAM_NAME) && (parameter.isSetName())) {
- String name = parameter.getName();
- result = String.format(NAME_FORMAT, result, name);
- }
-
- // manage type
- if(((flags & ILabelPreferenceConstants.DISP_PARAM_TYPE) == ILabelPreferenceConstants.DISP_PARAM_TYPE)) {
- String type = "<Undefined>";
- if(parameter.getType() != null) {
- type = parameter.getType().getName();
- }
-
- // If type is undefined only show "<Undefined>" when explicitly asked.
- if(((flags & ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) == ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) || (!"<Undefined>".equals(type))) {
- result = String.format(TYPE_FORMAT, result, type);
- }
- }
-
- // manage multiplicity
- String lower = (parameter.getLowerValue() != null) ? ValueSpecificationUtil.getSpecificationValue(parameter.getLowerValue()) : "1";
- String upper = (parameter.getLowerValue() != null) ? ValueSpecificationUtil.getSpecificationValue(parameter.getUpperValue()) : "1";
- if(((flags & ILabelPreferenceConstants.DISP_PARAM_MULTIPLICITY) == ILabelPreferenceConstants.DISP_PARAM_MULTIPLICITY) && !("1".equals(lower) && "1".equals(upper))) {
- result = String.format(MULTIPLICITY_FORMAT, result, lower, upper);
- }
-
- // manage default value
- if(((flags & ILabelPreferenceConstants.DISP_PARAM_DEFAULTVALUE) == ILabelPreferenceConstants.DISP_PARAM_DEFAULTVALUE) && ((parameter.getDefaultValue() != null))) {
- ValueSpecification valueSpecification = parameter.getDefaultValue();
- if((valueSpecification instanceof InstanceValue && parameter.getType().equals(valueSpecification.getType())) || !(valueSpecification instanceof InstanceValue)) {
- result = String.format(DEFAULT_VALUE_FORMAT, result, ValueSpecificationUtil.getSpecificationValue(valueSpecification));
- }
- }
-
- // manage modifier
- if((flags & ILabelPreferenceConstants.DISP_PARAM_MODIFIERS) == ILabelPreferenceConstants.DISP_PARAM_MODIFIERS) {
- StringBuffer sb = new StringBuffer();
- if(parameter.isOrdered()) {
- sb.append(sb.length() == 0 ? "ordered" : ", ordered");
- }
- if(parameter.isUnique()) {
- sb.append(sb.length() == 0 ? "unique" : ", unique");
- }
- if(parameter.isStream()) {
- sb.append(sb.length() == 0 ? "stream" : ", stream");
- }
- if(parameter.isException()) {
- sb.append(sb.length() == 0 ? "exception" : ", exception");
- }
- if(sb.length() != 0) {
- result = String.format(MODIFIER_FORMAT, result, sb.toString());
- }
- }
- }
- }
- return result;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isAffectingEvent(Object event, int flags) {
-
- if(event instanceof Notification) {
- Object feature = ((Notification)event).getFeature();
- if(feature instanceof EStructuralFeature) {
- return UMLPackage.eINSTANCE.getTypedElement_Type().equals(feature) || UMLPackage.eINSTANCE.getParameter_Direction().equals(feature) || UMLPackage.eINSTANCE.getParameter_DefaultValue().equals(feature) || UMLPackage.eINSTANCE.getParameter_IsStream().equals(feature) || UMLPackage.eINSTANCE.getParameter_IsException().equals(feature) || UMLPackage.eINSTANCE.getMultiplicityElement_IsOrdered().equals(feature) || UMLPackage.eINSTANCE.getMultiplicityElement_IsUnique().equals(feature) || UMLPackage.eINSTANCE.getMultiplicityElement_LowerValue().equals(feature) || UMLPackage.eINSTANCE.getMultiplicityElement_UpperValue().equals(feature) || super.isAffectingEvent(event, flags);
- }
- }
-
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public List<EObject> getSemanticElementsBeingParsed(EObject element) {
- List<EObject> semanticElementsBeingParsed = new ArrayList<EObject>();
-
- if((element != null) && (element instanceof Parameter)) {
- Parameter semElement = (Parameter)element;
-
- semanticElementsBeingParsed.add(semElement);
- if(semElement.getType() != null) {
- semanticElementsBeingParsed.add(semElement.getType());
- }
- if(semElement.getDefaultValue() != null) {
- semanticElementsBeingParsed.add(semElement.getDefaultValue());
- }
- if(semElement.getLowerValue() != null) {
- semanticElementsBeingParsed.add(semElement.getLowerValue());
- }
- if(semElement.getUpperValue() != null) {
- semanticElementsBeingParsed.add(semElement.getUpperValue());
- }
- }
- return semanticElementsBeingParsed;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Map<Integer, String> getMasks() {
- Map<Integer, String> masks = new HashMap<Integer, String>(6);
- masks.put(ILabelPreferenceConstants.DISP_PARAM_DIRECTION, "Parameter direction");
- masks.put(ILabelPreferenceConstants.DISP_PARAM_NAME, "Parameter name");
- masks.put(ILabelPreferenceConstants.DISP_PARAM_TYPE, "Parameter type");
- masks.put(ILabelPreferenceConstants.DISP_PARAM_MULTIPLICITY, "Parameter multiplicity");
- masks.put(ILabelPreferenceConstants.DISP_PARAM_DEFAULTVALUE, "Parameter default value");
- masks.put(ILabelPreferenceConstants.DISP_PARAM_MODIFIERS, "Parameter modifiers");
- return masks;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.parser;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants;
+import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil;
+import org.eclipse.uml2.uml.InstanceValue;
+import org.eclipse.uml2.uml.Parameter;
+import org.eclipse.uml2.uml.ParameterDirectionKind;
+import org.eclipse.uml2.uml.UMLPackage;
+import org.eclipse.uml2.uml.ValueSpecification;
+
+/**
+ * Semantic Parser for {@link Parameter}
+ */
+public class ParameterLabelParser extends NamedElementLabelParser {
+
+ /** The String format for displaying a {@link Parameter} with direction */
+ protected static final String DIRECTION_FORMAT = "%s %s";
+
+ /** The String format for displaying a {@link Parameter} label with its name */
+ protected static final String NAME_FORMAT = "%s%s";
+
+ /** The String format for displaying a {@link Parameter} label with its type */
+ protected static final String TYPE_FORMAT = "%s: %s";
+
+ /** The String format for displaying a {@link Parameter} label with its multiplicity */
+ protected static final String MULTIPLICITY_FORMAT = "%s [%s..%s]";
+
+ /** The String format for displaying a {@link Parameter} label with its default value */
+ protected static final String DEFAULT_VALUE_FORMAT = "%s= %s";
+
+ /** The String format for displaying a {@link Parameter} label with its modifiers */
+ protected static final String MODIFIER_FORMAT = "%s{%s}";
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getPrintString(IAdaptable element, int flags) {
+
+ if (flags == 0) {
+ return MaskedLabel;
+ }
+
+ String result = "";
+ EObject eObject = (EObject)element.getAdapter(EObject.class);
+
+ if((eObject != null) && (eObject instanceof Parameter)) {
+
+ Parameter parameter = (Parameter)eObject;
+
+ // manage direction
+ if((flags & ILabelPreferenceConstants.DISP_PARAM_DIRECTION) == ILabelPreferenceConstants.DISP_PARAM_DIRECTION) {
+ String direction;
+ switch(parameter.getDirection().getValue()) {
+ case ParameterDirectionKind.IN:
+ direction = "in";
+ break;
+ case ParameterDirectionKind.OUT:
+ direction = "out";
+ break;
+ case ParameterDirectionKind.INOUT:
+ direction = "inout";
+ break;
+ case ParameterDirectionKind.RETURN:
+ direction = "return";
+ break;
+ default:
+ direction = "in";
+ break;
+ }
+ result = String.format(DIRECTION_FORMAT, direction, result);
+
+ // manage name
+ if(((flags & ILabelPreferenceConstants.DISP_PARAM_NAME) == ILabelPreferenceConstants.DISP_PARAM_NAME) && (parameter.isSetName())) {
+ String name = parameter.getName();
+ result = String.format(NAME_FORMAT, result, name);
+ }
+
+ // manage type
+ if(((flags & ILabelPreferenceConstants.DISP_PARAM_TYPE) == ILabelPreferenceConstants.DISP_PARAM_TYPE)) {
+ String type = "<Undefined>";
+ if(parameter.getType() != null) {
+ type = parameter.getType().getName();
+ }
+
+ // If type is undefined only show "<Undefined>" when explicitly asked.
+ if(((flags & ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) == ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) || (!"<Undefined>".equals(type))) {
+ result = String.format(TYPE_FORMAT, result, type);
+ }
+ }
+
+ // manage multiplicity
+ String lower = (parameter.getLowerValue() != null) ? ValueSpecificationUtil.getSpecificationValue(parameter.getLowerValue()) : "1";
+ String upper = (parameter.getLowerValue() != null) ? ValueSpecificationUtil.getSpecificationValue(parameter.getUpperValue()) : "1";
+ if(((flags & ILabelPreferenceConstants.DISP_PARAM_MULTIPLICITY) == ILabelPreferenceConstants.DISP_PARAM_MULTIPLICITY) && !("1".equals(lower) && "1".equals(upper))) {
+ result = String.format(MULTIPLICITY_FORMAT, result, lower, upper);
+ }
+
+ // manage default value
+ if(((flags & ILabelPreferenceConstants.DISP_PARAM_DEFAULTVALUE) == ILabelPreferenceConstants.DISP_PARAM_DEFAULTVALUE) && ((parameter.getDefaultValue() != null))) {
+ ValueSpecification valueSpecification = parameter.getDefaultValue();
+ if((valueSpecification instanceof InstanceValue && parameter.getType().equals(valueSpecification.getType())) || !(valueSpecification instanceof InstanceValue)) {
+ result = String.format(DEFAULT_VALUE_FORMAT, result, ValueSpecificationUtil.getSpecificationValue(valueSpecification));
+ }
+ }
+
+ // manage modifier
+ if((flags & ILabelPreferenceConstants.DISP_PARAM_MODIFIERS) == ILabelPreferenceConstants.DISP_PARAM_MODIFIERS) {
+ StringBuffer sb = new StringBuffer();
+ if(parameter.isOrdered()) {
+ sb.append(sb.length() == 0 ? "ordered" : ", ordered");
+ }
+ if(parameter.isUnique()) {
+ sb.append(sb.length() == 0 ? "unique" : ", unique");
+ }
+ if(parameter.isStream()) {
+ sb.append(sb.length() == 0 ? "stream" : ", stream");
+ }
+ if(parameter.isException()) {
+ sb.append(sb.length() == 0 ? "exception" : ", exception");
+ }
+ if(sb.length() != 0) {
+ result = String.format(MODIFIER_FORMAT, result, sb.toString());
+ }
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isAffectingEvent(Object event, int flags) {
+
+ if(event instanceof Notification) {
+ Object feature = ((Notification)event).getFeature();
+ if(feature instanceof EStructuralFeature) {
+ return UMLPackage.eINSTANCE.getTypedElement_Type().equals(feature) || UMLPackage.eINSTANCE.getParameter_Direction().equals(feature) || UMLPackage.eINSTANCE.getParameter_DefaultValue().equals(feature) || UMLPackage.eINSTANCE.getParameter_IsStream().equals(feature) || UMLPackage.eINSTANCE.getParameter_IsException().equals(feature) || UMLPackage.eINSTANCE.getMultiplicityElement_IsOrdered().equals(feature) || UMLPackage.eINSTANCE.getMultiplicityElement_IsUnique().equals(feature) || UMLPackage.eINSTANCE.getMultiplicityElement_LowerValue().equals(feature) || UMLPackage.eINSTANCE.getMultiplicityElement_UpperValue().equals(feature) || super.isAffectingEvent(event, flags);
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<EObject> getSemanticElementsBeingParsed(EObject element) {
+ List<EObject> semanticElementsBeingParsed = new ArrayList<EObject>();
+
+ if((element != null) && (element instanceof Parameter)) {
+ Parameter semElement = (Parameter)element;
+
+ semanticElementsBeingParsed.add(semElement);
+ if(semElement.getType() != null) {
+ semanticElementsBeingParsed.add(semElement.getType());
+ }
+ if(semElement.getDefaultValue() != null) {
+ semanticElementsBeingParsed.add(semElement.getDefaultValue());
+ }
+ if(semElement.getLowerValue() != null) {
+ semanticElementsBeingParsed.add(semElement.getLowerValue());
+ }
+ if(semElement.getUpperValue() != null) {
+ semanticElementsBeingParsed.add(semElement.getUpperValue());
+ }
+ }
+ return semanticElementsBeingParsed;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Map<Integer, String> getMasks() {
+ Map<Integer, String> masks = new HashMap<Integer, String>(6);
+ masks.put(ILabelPreferenceConstants.DISP_PARAM_DIRECTION, "Parameter direction");
+ masks.put(ILabelPreferenceConstants.DISP_PARAM_NAME, "Parameter name");
+ masks.put(ILabelPreferenceConstants.DISP_PARAM_TYPE, "Parameter type");
+ masks.put(ILabelPreferenceConstants.DISP_PARAM_MULTIPLICITY, "Parameter multiplicity");
+ masks.put(ILabelPreferenceConstants.DISP_PARAM_DEFAULTVALUE, "Parameter default value");
+ masks.put(ILabelPreferenceConstants.DISP_PARAM_MODIFIERS, "Parameter modifiers");
+ return masks;
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/PropertyLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/PropertyLabelParser.java
index 618b7701015..d2f57ade3b0 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/PropertyLabelParser.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/PropertyLabelParser.java
@@ -1,242 +1,242 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.parser;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants;
-import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil;
-import org.eclipse.uml2.uml.InstanceValue;
-import org.eclipse.uml2.uml.Property;
-import org.eclipse.uml2.uml.UMLPackage;
-import org.eclipse.uml2.uml.ValueSpecification;
-import org.eclipse.uml2.uml.VisibilityKind;
-
-/**
- * Semantic Parser for {@link Property}
- */
-public class PropertyLabelParser extends NamedElementLabelParser {
-
- /** The String format for displaying a {@link Property} with visibility */
- protected static final String VISIBILITY_FORMAT = "%s %s";
-
- /** The String format for displaying a {@link Property} label with derived modifier */
- protected static final String DERIVED_FORMAT = "%s/";
-
- /** The String format for displaying a {@link Property} label with its name */
- protected static final String NAME_FORMAT = "%s%s";
-
- /** The String format for displaying a {@link Property} label with its type */
- protected static final String TYPE_FORMAT = "%s: %s";
-
- /** The String format for displaying a {@link Property} label with multiplicity */
- protected static final String MULTIPLICITY_FORMAT = "%s [%s..%s]";
-
- /** The String format for displaying a {@link Property} label with multiplicity */
- protected static final String MULTIPLICITY_FORMAT_ALT = "%s [%s]";
-
- /** The String format for displaying a {@link Property} label with default value */
- protected static final String DEFAULT_VALUE_FORMAT = "%s= %s";
-
- /** The String format for displaying a {@link Property} label with modifiers */
- protected static final String MODIFIER_FORMAT = "%s{%s}";
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getPrintString(IAdaptable element, int flags) {
-
- if(flags == 0) {
- return MaskedLabel;
- }
-
- String result = "";
- EObject eObject = (EObject)element.getAdapter(EObject.class);
-
- if((eObject != null) && (eObject instanceof Property)) {
-
- Property property = (Property)eObject;
-
- // manage visibility
- if((flags & ILabelPreferenceConstants.DISP_VISIBILITY) == ILabelPreferenceConstants.DISP_VISIBILITY) {
- String visibility;
- switch(property.getVisibility().getValue()) {
- case VisibilityKind.PACKAGE:
- visibility = "~";
- break;
- case VisibilityKind.PUBLIC:
- visibility = "+";
- break;
- case VisibilityKind.PROTECTED:
- visibility = "#";
- break;
- case VisibilityKind.PRIVATE:
- visibility = "-";
- break;
- default:
- visibility = "+";
- break;
- }
- result = String.format(VISIBILITY_FORMAT, visibility, result);
- }
-
- // manage derived modifier
- if(((flags & ILabelPreferenceConstants.DISP_DERIVE) == ILabelPreferenceConstants.DISP_DERIVE) && (property.isDerived())) {
- result = String.format(DERIVED_FORMAT, result);
- }
-
- // manage name
- if(((flags & ILabelPreferenceConstants.DISP_NAME) == ILabelPreferenceConstants.DISP_NAME) && (property.isSetName())) {
- String name = property.getName();
- result = String.format(NAME_FORMAT, result, name);
- }
-
- // manage type
- if(((flags & ILabelPreferenceConstants.DISP_TYPE) == ILabelPreferenceConstants.DISP_TYPE)) {
- String type = "<Undefined>";
- if(property.getType() != null) {
- type = property.getType().getName();
- }
-
- // If type is undefined only show "<Undefined>" when explicitly asked.
- if(((flags & ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) == ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) || (!"<Undefined>".equals(type))) {
- result = String.format(TYPE_FORMAT, result, type);
- }
- }
-
- // manage multiplicity
- if(((flags & ILabelPreferenceConstants.DISP_MULTIPLICITY) == ILabelPreferenceConstants.DISP_MULTIPLICITY)) {
-
- // If multiplicity is [1] (SysML default), only show when explicitly asked.
- // TODO : add a case for default with multiplicity not set.
- String lower = (property.getLowerValue() != null) ? ValueSpecificationUtil.getSpecificationValue(property.getLowerValue()) : "1";
- String upper = (property.getLowerValue() != null) ? ValueSpecificationUtil.getSpecificationValue(property.getUpperValue()) : "1";
- if(((flags & ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY) == ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY) || !("1".equals(lower) && "1".equals(upper))) {
-
- if(lower.equals(upper)) {
- result = String.format(MULTIPLICITY_FORMAT_ALT, result, lower, upper);
- } else {
- result = String.format(MULTIPLICITY_FORMAT, result, lower, upper);
- }
- }
- }
-
- // manage default value
- if(((flags & ILabelPreferenceConstants.DISP_DEFAULTVALUE) == ILabelPreferenceConstants.DISP_DEFAULTVALUE) && ((property.getDefaultValue() != null))) {
- ValueSpecification valueSpecification = property.getDefaultValue();
- if((valueSpecification instanceof InstanceValue && property.getType().equals(valueSpecification.getType())) || !(valueSpecification instanceof InstanceValue)) {
- result = String.format(DEFAULT_VALUE_FORMAT, result, ValueSpecificationUtil.getSpecificationValue(valueSpecification));
- }
- }
-
- // manage modifier
- if((flags & ILabelPreferenceConstants.DISP_MODIFIERS) == ILabelPreferenceConstants.DISP_MODIFIERS) {
- StringBuffer sb = new StringBuffer();
- if(property.isReadOnly()) {
- sb.append(sb.length() == 0 ? "readOnly" : ", readOnly");
- }
- if(property.isOrdered()) {
- sb.append(sb.length() == 0 ? "ordered" : ", ordered");
- }
- if(property.isUnique()) {
- sb.append(sb.length() == 0 ? "unique" : ", unique");
- }
- if(property.isDerivedUnion()) {
- sb.append(sb.length() == 0 ? "union" : ", union");
- }
- EList<Property> redefinedProperties = property.getRedefinedProperties();
- if(redefinedProperties != null && !redefinedProperties.isEmpty()) {
- for(Property p : redefinedProperties) {
- sb.append(sb.length() == 0 ? p.getName() : ", redefines " + p.getName());
- }
- }
- if(sb.length() != 0) {
- result = String.format(MODIFIER_FORMAT, result, sb.toString());
- }
- }
- }
- return result;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isAffectingEvent(Object event, int flags) {
-
- if(event instanceof Notification) {
- Object feature = ((Notification)event).getFeature();
-
- if(feature instanceof EStructuralFeature) { // UMLPackage.eINSTANCE.getLiteralString_Value().equals(feature) ||
- return UMLPackage.eINSTANCE.getTypedElement_Type().equals(feature) || UMLPackage.eINSTANCE.getInstanceValue_Instance().equals(feature) || UMLPackage.eINSTANCE.getMultiplicityElement_IsOrdered().equals(feature) || UMLPackage.eINSTANCE.getMultiplicityElement_IsUnique().equals(feature) || UMLPackage.eINSTANCE.getMultiplicityElement_LowerValue().equals(feature) || UMLPackage.eINSTANCE.getMultiplicityElement_UpperValue().equals(feature) || UMLPackage.eINSTANCE.getStructuralFeature_IsReadOnly().equals(feature) || UMLPackage.eINSTANCE.getFeature_IsStatic().equals(feature) || UMLPackage.eINSTANCE.getProperty_IsDerived().equals(feature) || UMLPackage.eINSTANCE.getProperty_IsDerivedUnion().equals(feature) || UMLPackage.eINSTANCE.getProperty_RedefinedProperty().equals(feature) || super.isAffectingEvent(event, flags);
- }
- }
-
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public List<EObject> getSemanticElementsBeingParsed(EObject element) {
- List<EObject> semanticElementsBeingParsed = new ArrayList<EObject>();
-
- if((element != null) && (element instanceof Property)) {
- Property semElement = (Property)element;
-
- semanticElementsBeingParsed.add(semElement);
- if(semElement.getType() != null) {
- semanticElementsBeingParsed.add(semElement.getType());
- }
- if(semElement.getLowerValue() != null) {
- semanticElementsBeingParsed.add(semElement.getLowerValue());
- }
- if(semElement.getUpperValue() != null) {
- semanticElementsBeingParsed.add(semElement.getUpperValue());
- }
- if(semElement.getDefaultValue() != null) {
- semanticElementsBeingParsed.add(semElement.getDefaultValue());
- }
- }
- return semanticElementsBeingParsed;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Map<Integer, String> getMasks() {
- Map<Integer, String> masks = new HashMap<Integer, String>(9);
- masks.put(ILabelPreferenceConstants.DISP_VISIBILITY, "Visibility");
- masks.put(ILabelPreferenceConstants.DISP_DERIVE, "Is Derived");
- masks.put(ILabelPreferenceConstants.DISP_NAME, "Name");
- masks.put(ILabelPreferenceConstants.DISP_TYPE, "Type");
- masks.put(ILabelPreferenceConstants.DISP_UNDEFINED_TYPE, "Show <Undefined> type");
- masks.put(ILabelPreferenceConstants.DISP_MULTIPLICITY, "Multiplicity");
- masks.put(ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY, "Show default multiplicity");
- masks.put(ILabelPreferenceConstants.DISP_DEFAULTVALUE, "Default Value");
- masks.put(ILabelPreferenceConstants.DISP_MODIFIERS, "Modifiers");
- return masks;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.parser;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants;
+import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil;
+import org.eclipse.uml2.uml.InstanceValue;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.UMLPackage;
+import org.eclipse.uml2.uml.ValueSpecification;
+import org.eclipse.uml2.uml.VisibilityKind;
+
+/**
+ * Semantic Parser for {@link Property}
+ */
+public class PropertyLabelParser extends NamedElementLabelParser {
+
+ /** The String format for displaying a {@link Property} with visibility */
+ protected static final String VISIBILITY_FORMAT = "%s %s";
+
+ /** The String format for displaying a {@link Property} label with derived modifier */
+ protected static final String DERIVED_FORMAT = "%s/";
+
+ /** The String format for displaying a {@link Property} label with its name */
+ protected static final String NAME_FORMAT = "%s%s";
+
+ /** The String format for displaying a {@link Property} label with its type */
+ protected static final String TYPE_FORMAT = "%s: %s";
+
+ /** The String format for displaying a {@link Property} label with multiplicity */
+ protected static final String MULTIPLICITY_FORMAT = "%s [%s..%s]";
+
+ /** The String format for displaying a {@link Property} label with multiplicity */
+ protected static final String MULTIPLICITY_FORMAT_ALT = "%s [%s]";
+
+ /** The String format for displaying a {@link Property} label with default value */
+ protected static final String DEFAULT_VALUE_FORMAT = "%s= %s";
+
+ /** The String format for displaying a {@link Property} label with modifiers */
+ protected static final String MODIFIER_FORMAT = "%s{%s}";
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getPrintString(IAdaptable element, int flags) {
+
+ if(flags == 0) {
+ return MaskedLabel;
+ }
+
+ String result = "";
+ EObject eObject = (EObject)element.getAdapter(EObject.class);
+
+ if((eObject != null) && (eObject instanceof Property)) {
+
+ Property property = (Property)eObject;
+
+ // manage visibility
+ if((flags & ILabelPreferenceConstants.DISP_VISIBILITY) == ILabelPreferenceConstants.DISP_VISIBILITY) {
+ String visibility;
+ switch(property.getVisibility().getValue()) {
+ case VisibilityKind.PACKAGE:
+ visibility = "~";
+ break;
+ case VisibilityKind.PUBLIC:
+ visibility = "+";
+ break;
+ case VisibilityKind.PROTECTED:
+ visibility = "#";
+ break;
+ case VisibilityKind.PRIVATE:
+ visibility = "-";
+ break;
+ default:
+ visibility = "+";
+ break;
+ }
+ result = String.format(VISIBILITY_FORMAT, visibility, result);
+ }
+
+ // manage derived modifier
+ if(((flags & ILabelPreferenceConstants.DISP_DERIVE) == ILabelPreferenceConstants.DISP_DERIVE) && (property.isDerived())) {
+ result = String.format(DERIVED_FORMAT, result);
+ }
+
+ // manage name
+ if(((flags & ILabelPreferenceConstants.DISP_NAME) == ILabelPreferenceConstants.DISP_NAME) && (property.isSetName())) {
+ String name = property.getName();
+ result = String.format(NAME_FORMAT, result, name);
+ }
+
+ // manage type
+ if(((flags & ILabelPreferenceConstants.DISP_TYPE) == ILabelPreferenceConstants.DISP_TYPE)) {
+ String type = "<Undefined>";
+ if(property.getType() != null) {
+ type = property.getType().getName();
+ }
+
+ // If type is undefined only show "<Undefined>" when explicitly asked.
+ if(((flags & ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) == ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) || (!"<Undefined>".equals(type))) {
+ result = String.format(TYPE_FORMAT, result, type);
+ }
+ }
+
+ // manage multiplicity
+ if(((flags & ILabelPreferenceConstants.DISP_MULTIPLICITY) == ILabelPreferenceConstants.DISP_MULTIPLICITY)) {
+
+ // If multiplicity is [1] (SysML default), only show when explicitly asked.
+ // TODO : add a case for default with multiplicity not set.
+ String lower = (property.getLowerValue() != null) ? ValueSpecificationUtil.getSpecificationValue(property.getLowerValue()) : "1";
+ String upper = (property.getLowerValue() != null) ? ValueSpecificationUtil.getSpecificationValue(property.getUpperValue()) : "1";
+ if(((flags & ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY) == ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY) || !("1".equals(lower) && "1".equals(upper))) {
+
+ if(lower.equals(upper)) {
+ result = String.format(MULTIPLICITY_FORMAT_ALT, result, lower, upper);
+ } else {
+ result = String.format(MULTIPLICITY_FORMAT, result, lower, upper);
+ }
+ }
+ }
+
+ // manage default value
+ if(((flags & ILabelPreferenceConstants.DISP_DEFAULTVALUE) == ILabelPreferenceConstants.DISP_DEFAULTVALUE) && ((property.getDefaultValue() != null))) {
+ ValueSpecification valueSpecification = property.getDefaultValue();
+ if((valueSpecification instanceof InstanceValue && property.getType().equals(valueSpecification.getType())) || !(valueSpecification instanceof InstanceValue)) {
+ result = String.format(DEFAULT_VALUE_FORMAT, result, ValueSpecificationUtil.getSpecificationValue(valueSpecification));
+ }
+ }
+
+ // manage modifier
+ if((flags & ILabelPreferenceConstants.DISP_MODIFIERS) == ILabelPreferenceConstants.DISP_MODIFIERS) {
+ StringBuffer sb = new StringBuffer();
+ if(property.isReadOnly()) {
+ sb.append(sb.length() == 0 ? "readOnly" : ", readOnly");
+ }
+ if(property.isOrdered()) {
+ sb.append(sb.length() == 0 ? "ordered" : ", ordered");
+ }
+ if(property.isUnique()) {
+ sb.append(sb.length() == 0 ? "unique" : ", unique");
+ }
+ if(property.isDerivedUnion()) {
+ sb.append(sb.length() == 0 ? "union" : ", union");
+ }
+ EList<Property> redefinedProperties = property.getRedefinedProperties();
+ if(redefinedProperties != null && !redefinedProperties.isEmpty()) {
+ for(Property p : redefinedProperties) {
+ sb.append(sb.length() == 0 ? p.getName() : ", redefines " + p.getName());
+ }
+ }
+ if(sb.length() != 0) {
+ result = String.format(MODIFIER_FORMAT, result, sb.toString());
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isAffectingEvent(Object event, int flags) {
+
+ if(event instanceof Notification) {
+ Object feature = ((Notification)event).getFeature();
+
+ if(feature instanceof EStructuralFeature) { // UMLPackage.eINSTANCE.getLiteralString_Value().equals(feature) ||
+ return UMLPackage.eINSTANCE.getTypedElement_Type().equals(feature) || UMLPackage.eINSTANCE.getInstanceValue_Instance().equals(feature) || UMLPackage.eINSTANCE.getMultiplicityElement_IsOrdered().equals(feature) || UMLPackage.eINSTANCE.getMultiplicityElement_IsUnique().equals(feature) || UMLPackage.eINSTANCE.getMultiplicityElement_LowerValue().equals(feature) || UMLPackage.eINSTANCE.getMultiplicityElement_UpperValue().equals(feature) || UMLPackage.eINSTANCE.getStructuralFeature_IsReadOnly().equals(feature) || UMLPackage.eINSTANCE.getFeature_IsStatic().equals(feature) || UMLPackage.eINSTANCE.getProperty_IsDerived().equals(feature) || UMLPackage.eINSTANCE.getProperty_IsDerivedUnion().equals(feature) || UMLPackage.eINSTANCE.getProperty_RedefinedProperty().equals(feature) || super.isAffectingEvent(event, flags);
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<EObject> getSemanticElementsBeingParsed(EObject element) {
+ List<EObject> semanticElementsBeingParsed = new ArrayList<EObject>();
+
+ if((element != null) && (element instanceof Property)) {
+ Property semElement = (Property)element;
+
+ semanticElementsBeingParsed.add(semElement);
+ if(semElement.getType() != null) {
+ semanticElementsBeingParsed.add(semElement.getType());
+ }
+ if(semElement.getLowerValue() != null) {
+ semanticElementsBeingParsed.add(semElement.getLowerValue());
+ }
+ if(semElement.getUpperValue() != null) {
+ semanticElementsBeingParsed.add(semElement.getUpperValue());
+ }
+ if(semElement.getDefaultValue() != null) {
+ semanticElementsBeingParsed.add(semElement.getDefaultValue());
+ }
+ }
+ return semanticElementsBeingParsed;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Map<Integer, String> getMasks() {
+ Map<Integer, String> masks = new HashMap<Integer, String>(9);
+ masks.put(ILabelPreferenceConstants.DISP_VISIBILITY, "Visibility");
+ masks.put(ILabelPreferenceConstants.DISP_DERIVE, "Is Derived");
+ masks.put(ILabelPreferenceConstants.DISP_NAME, "Name");
+ masks.put(ILabelPreferenceConstants.DISP_TYPE, "Type");
+ masks.put(ILabelPreferenceConstants.DISP_UNDEFINED_TYPE, "Show <Undefined> type");
+ masks.put(ILabelPreferenceConstants.DISP_MULTIPLICITY, "Multiplicity");
+ masks.put(ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY, "Show default multiplicity");
+ masks.put(ILabelPreferenceConstants.DISP_DEFAULTVALUE, "Default Value");
+ masks.put(ILabelPreferenceConstants.DISP_MODIFIERS, "Modifiers");
+ return masks;
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ReceptionLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ReceptionLabelParser.java
index c0d696db8fc..b5a7b690391 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ReceptionLabelParser.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ReceptionLabelParser.java
@@ -1,124 +1,124 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.parser;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.papyrus.gmf.diagram.common.parser.IMaskManagedSemanticParser;
-import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants;
-import org.eclipse.uml2.uml.Reception;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * Semantic Parser for {@link Reception}
- */
-public class ReceptionLabelParser extends NamedElementLabelParser implements IMaskManagedSemanticParser {
-
- /** The String format for displaying a Property with visibility */
- protected static final String PREFIX = "\u00ABsignal\u00BB ";
-
- /** The String format for displaying a Property label with its name */
- protected static final String NAME_FORMAT = "%s%s";
-
- /** The String format for displaying a Property label with its type */
- protected static final String TYPE_FORMAT = "%s: %s";
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getPrintString(IAdaptable element, int flags) {
-
- if (flags == 0) {
- return MaskedLabel;
- }
-
- String result = PREFIX;
- EObject eObject = (EObject)element.getAdapter(EObject.class);
-
- if((eObject != null) && (eObject instanceof Reception)) {
-
- Reception reception = (Reception)eObject;
-
- // manage name
- if(((flags & ILabelPreferenceConstants.DISP_NAME) == ILabelPreferenceConstants.DISP_NAME) && (reception.isSetName())) {
- String name = reception.getName();
- result = String.format(NAME_FORMAT, result, name);
- }
-
- // manage signal
- if(((flags & ILabelPreferenceConstants.DISP_SIGNAL) == ILabelPreferenceConstants.DISP_SIGNAL)) {
- String type = "<Undefined>";
- if(reception.getSignal() != null) {
- type = reception.getSignal().getName();
- }
- result = String.format(TYPE_FORMAT, result, type);
- }
- }
-
- return result;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isAffectingEvent(Object event, int flags) {
-
- if(event instanceof Notification) {
- Object feature = ((Notification)event).getFeature();
- if(feature instanceof EStructuralFeature) {
- return UMLPackage.eINSTANCE.getReception_Signal().equals(feature) || super.isAffectingEvent(event, flags);
- }
- }
-
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public List<EObject> getSemanticElementsBeingParsed(EObject element) {
- List<EObject> semanticElementsBeingParsed = new ArrayList<EObject>();
-
- if((element != null) && (element instanceof Reception)) {
- Reception semElement = (Reception)element;
-
- semanticElementsBeingParsed.add(semElement);
- if(semElement.getSignal() != null) {
- semanticElementsBeingParsed.add(semElement.getSignal());
- }
- }
- return semanticElementsBeingParsed;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Map<Integer, String> getMasks() {
- Map<Integer, String> masks = new HashMap<Integer, String>(2);
- masks.put(ILabelPreferenceConstants.DISP_NAME, "Name");
- masks.put(ILabelPreferenceConstants.DISP_SIGNAL, "Signel");
- return masks;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.parser;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.papyrus.gmf.diagram.common.parser.IMaskManagedSemanticParser;
+import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants;
+import org.eclipse.uml2.uml.Reception;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * Semantic Parser for {@link Reception}
+ */
+public class ReceptionLabelParser extends NamedElementLabelParser implements IMaskManagedSemanticParser {
+
+ /** The String format for displaying a Property with visibility */
+ protected static final String PREFIX = "\u00ABsignal\u00BB ";
+
+ /** The String format for displaying a Property label with its name */
+ protected static final String NAME_FORMAT = "%s%s";
+
+ /** The String format for displaying a Property label with its type */
+ protected static final String TYPE_FORMAT = "%s: %s";
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getPrintString(IAdaptable element, int flags) {
+
+ if (flags == 0) {
+ return MaskedLabel;
+ }
+
+ String result = PREFIX;
+ EObject eObject = (EObject)element.getAdapter(EObject.class);
+
+ if((eObject != null) && (eObject instanceof Reception)) {
+
+ Reception reception = (Reception)eObject;
+
+ // manage name
+ if(((flags & ILabelPreferenceConstants.DISP_NAME) == ILabelPreferenceConstants.DISP_NAME) && (reception.isSetName())) {
+ String name = reception.getName();
+ result = String.format(NAME_FORMAT, result, name);
+ }
+
+ // manage signal
+ if(((flags & ILabelPreferenceConstants.DISP_SIGNAL) == ILabelPreferenceConstants.DISP_SIGNAL)) {
+ String type = "<Undefined>";
+ if(reception.getSignal() != null) {
+ type = reception.getSignal().getName();
+ }
+ result = String.format(TYPE_FORMAT, result, type);
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isAffectingEvent(Object event, int flags) {
+
+ if(event instanceof Notification) {
+ Object feature = ((Notification)event).getFeature();
+ if(feature instanceof EStructuralFeature) {
+ return UMLPackage.eINSTANCE.getReception_Signal().equals(feature) || super.isAffectingEvent(event, flags);
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<EObject> getSemanticElementsBeingParsed(EObject element) {
+ List<EObject> semanticElementsBeingParsed = new ArrayList<EObject>();
+
+ if((element != null) && (element instanceof Reception)) {
+ Reception semElement = (Reception)element;
+
+ semanticElementsBeingParsed.add(semElement);
+ if(semElement.getSignal() != null) {
+ semanticElementsBeingParsed.add(semElement.getSignal());
+ }
+ }
+ return semanticElementsBeingParsed;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Map<Integer, String> getMasks() {
+ Map<Integer, String> masks = new HashMap<Integer, String>(2);
+ masks.put(ILabelPreferenceConstants.DISP_NAME, "Name");
+ masks.put(ILabelPreferenceConstants.DISP_SIGNAL, "Signel");
+ return masks;
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/SlotLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/SlotLabelParser.java
index bc88f2128cc..bd13fef47b3 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/SlotLabelParser.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/SlotLabelParser.java
@@ -1,142 +1,142 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.parser;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.notify.Notification;
-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.core.command.UnexecutableCommand;
-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.ui.services.parser.ISemanticParser;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.uml2.uml.InstanceValue;
-import org.eclipse.uml2.uml.Slot;
-import org.eclipse.uml2.uml.UMLPackage;
-import org.eclipse.uml2.uml.ValueSpecification;
-
-/**
- * Semantic Parser for {@link Slot}
- */
-public class SlotLabelParser implements ISemanticParser {
-
- /**
- * {@inheritDoc}
- */
- public String getEditString(IAdaptable element, int flags) {
- return getPrintString(element, flags);
- }
-
- /**
- * {@inheritDoc}
- */
- public IParserEditStatus isValidEditString(IAdaptable element, String editString) {
- return ParserEditStatus.UNEDITABLE_STATUS;
- }
-
- /**
- * {@inheritDoc}
- */
- public ICommand getParseCommand(IAdaptable element, String newString, int flags) {
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- * {@inheritDoc}
- */
- public String getPrintString(IAdaptable element, int flags) {
- String result = "";
- EObject eObject = (EObject)element.getAdapter(EObject.class);
-
- if(eObject instanceof Slot) {
- Slot slot = (Slot)eObject;
- result = "<UNDEFINED>";
-
- if(slot.getDefiningFeature() != null) {
-
- // Add defining feature
- result = slot.getDefiningFeature().getName();
-
- // Add values
- if(!slot.getValues().isEmpty()) {
-
- String values = "";
- Iterator<ValueSpecification> iter = slot.getValues().iterator();
- while(iter.hasNext()) {
- ValueSpecification currentSpecification = iter.next();
-
- String currentValue = currentSpecification.stringValue();
- if((currentSpecification instanceof InstanceValue) && ((InstanceValue)currentSpecification).getInstance() != null) {
- currentValue = ((InstanceValue)currentSpecification).getInstance().getName();
- }
-
- values = values + currentValue;
- if(iter.hasNext()) {
- result = result + ", ";
- }
- }
-
- result = result + ": " + values;
- }
- }
- }
-
- return result;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isAffectingEvent(Object event, int flags) {
- if(event instanceof Notification) {
- Object feature = ((Notification)event).getFeature();
- if(feature instanceof EStructuralFeature) {
- return UMLPackage.eINSTANCE.getSlot_DefiningFeature().equals(feature);
- }
- }
-
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- public IContentAssistProcessor getCompletionProcessor(IAdaptable element) {
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- public List<EObject> getSemanticElementsBeingParsed(EObject element) {
- List<EObject> semanticElementsBeingParsed = new ArrayList<EObject>();
- semanticElementsBeingParsed.add(element);
-
- return semanticElementsBeingParsed;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean areSemanticElementsAffected(EObject listener, Object notification) {
- return true;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.parser;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.common.notify.Notification;
+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.core.command.UnexecutableCommand;
+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.ui.services.parser.ISemanticParser;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.uml2.uml.InstanceValue;
+import org.eclipse.uml2.uml.Slot;
+import org.eclipse.uml2.uml.UMLPackage;
+import org.eclipse.uml2.uml.ValueSpecification;
+
+/**
+ * Semantic Parser for {@link Slot}
+ */
+public class SlotLabelParser implements ISemanticParser {
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getEditString(IAdaptable element, int flags) {
+ return getPrintString(element, flags);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public IParserEditStatus isValidEditString(IAdaptable element, String editString) {
+ return ParserEditStatus.UNEDITABLE_STATUS;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ICommand getParseCommand(IAdaptable element, String newString, int flags) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getPrintString(IAdaptable element, int flags) {
+ String result = "";
+ EObject eObject = (EObject)element.getAdapter(EObject.class);
+
+ if(eObject instanceof Slot) {
+ Slot slot = (Slot)eObject;
+ result = "<UNDEFINED>";
+
+ if(slot.getDefiningFeature() != null) {
+
+ // Add defining feature
+ result = slot.getDefiningFeature().getName();
+
+ // Add values
+ if(!slot.getValues().isEmpty()) {
+
+ String values = "";
+ Iterator<ValueSpecification> iter = slot.getValues().iterator();
+ while(iter.hasNext()) {
+ ValueSpecification currentSpecification = iter.next();
+
+ String currentValue = currentSpecification.stringValue();
+ if((currentSpecification instanceof InstanceValue) && ((InstanceValue)currentSpecification).getInstance() != null) {
+ currentValue = ((InstanceValue)currentSpecification).getInstance().getName();
+ }
+
+ values = values + currentValue;
+ if(iter.hasNext()) {
+ result = result + ", ";
+ }
+ }
+
+ result = result + ": " + values;
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isAffectingEvent(Object event, int flags) {
+ if(event instanceof Notification) {
+ Object feature = ((Notification)event).getFeature();
+ if(feature instanceof EStructuralFeature) {
+ return UMLPackage.eINSTANCE.getSlot_DefiningFeature().equals(feature);
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public IContentAssistProcessor getCompletionProcessor(IAdaptable element) {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public List<EObject> getSemanticElementsBeingParsed(EObject element) {
+ List<EObject> semanticElementsBeingParsed = new ArrayList<EObject>();
+ semanticElementsBeingParsed.add(element);
+
+ return semanticElementsBeingParsed;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean areSemanticElementsAffected(EObject listener, Object notification) {
+ return true;
+ }
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/utils/AssociationViewUtils.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/utils/AssociationViewUtils.java
index c98ad4b68b4..e1fbb0682f6 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/utils/AssociationViewUtils.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/utils/AssociationViewUtils.java
@@ -1,81 +1,81 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.utils;
-
-import org.eclipse.gmf.runtime.notation.EObjectValueStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.uml2.uml.Property;
-
-/**
- * Utility class for Association graphical end - property mapping.
- */
-public class AssociationViewUtils {
-
- /** ID for the source end - property mapping of an association */
- public static final String SEMANTIC_SOURCE_END = "semantic_source_end";
-
- /** ID for the target end - property mapping of an association */
- public static final String SEMANTIC_TARGET_END = "semantic_target_end";
-
- /**
- * Get the semantic end from the source of an edge representing an Association.
- *
- * @param view
- * the Association view.
- * @return the Property corresponding to the source of the graphical end.
- */
- public static Property getSourceSemanticEnd(View view) {
- EObjectValueStyle semanticStyle = (EObjectValueStyle)view.getNamedStyle(NotationPackage.eINSTANCE.getEObjectValueStyle(), SEMANTIC_SOURCE_END);
- return semanticStyle == null ? null : (Property)semanticStyle.getEObjectValue();
- }
-
- /**
- * Get the semantic end from the target of an edge representing an Association.
- *
- * @param view
- * the Association view.
- * @return the Property corresponding to the target of the graphical end.
- */
- public static Property getTargetSemanticEnd(View view) {
- EObjectValueStyle semanticStyle = (EObjectValueStyle)view.getNamedStyle(NotationPackage.eINSTANCE.getEObjectValueStyle(), SEMANTIC_TARGET_END);
- return semanticStyle == null ? null : (Property)semanticStyle.getEObjectValue();
- }
-
- /**
- * Set the semantic end for the source of an edge representing an Association.
- *
- * @param view
- * the Association view.
- * @param end
- * the Property corresponding to the source of the graphical end.
- */
- public static void setSourceSemanticEnd(View view, Property end) {
- EObjectValueStyle semanticStyle = (EObjectValueStyle)view.getNamedStyle(NotationPackage.eINSTANCE.getEObjectValueStyle(), SEMANTIC_SOURCE_END);
- semanticStyle.setEObjectValue(end);
- }
-
- /**
- * Set the semantic end for the target of an edge representing an Association.
- *
- * @param view
- * the Association view.
- * @param end
- * the Property corresponding to the target of the graphical end.
- */
- public static void setTargetSemanticEnd(View view, Property end) {
- EObjectValueStyle semanticStyle = (EObjectValueStyle)view.getNamedStyle(NotationPackage.eINSTANCE.getEObjectValueStyle(), SEMANTIC_TARGET_END);
- semanticStyle.setEObjectValue(end);
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.utils;
+
+import org.eclipse.gmf.runtime.notation.EObjectValueStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.uml2.uml.Property;
+
+/**
+ * Utility class for Association graphical end - property mapping.
+ */
+public class AssociationViewUtils {
+
+ /** ID for the source end - property mapping of an association */
+ public static final String SEMANTIC_SOURCE_END = "semantic_source_end";
+
+ /** ID for the target end - property mapping of an association */
+ public static final String SEMANTIC_TARGET_END = "semantic_target_end";
+
+ /**
+ * Get the semantic end from the source of an edge representing an Association.
+ *
+ * @param view
+ * the Association view.
+ * @return the Property corresponding to the source of the graphical end.
+ */
+ public static Property getSourceSemanticEnd(View view) {
+ EObjectValueStyle semanticStyle = (EObjectValueStyle)view.getNamedStyle(NotationPackage.eINSTANCE.getEObjectValueStyle(), SEMANTIC_SOURCE_END);
+ return semanticStyle == null ? null : (Property)semanticStyle.getEObjectValue();
+ }
+
+ /**
+ * Get the semantic end from the target of an edge representing an Association.
+ *
+ * @param view
+ * the Association view.
+ * @return the Property corresponding to the target of the graphical end.
+ */
+ public static Property getTargetSemanticEnd(View view) {
+ EObjectValueStyle semanticStyle = (EObjectValueStyle)view.getNamedStyle(NotationPackage.eINSTANCE.getEObjectValueStyle(), SEMANTIC_TARGET_END);
+ return semanticStyle == null ? null : (Property)semanticStyle.getEObjectValue();
+ }
+
+ /**
+ * Set the semantic end for the source of an edge representing an Association.
+ *
+ * @param view
+ * the Association view.
+ * @param end
+ * the Property corresponding to the source of the graphical end.
+ */
+ public static void setSourceSemanticEnd(View view, Property end) {
+ EObjectValueStyle semanticStyle = (EObjectValueStyle)view.getNamedStyle(NotationPackage.eINSTANCE.getEObjectValueStyle(), SEMANTIC_SOURCE_END);
+ semanticStyle.setEObjectValue(end);
+ }
+
+ /**
+ * Set the semantic end for the target of an edge representing an Association.
+ *
+ * @param view
+ * the Association view.
+ * @param end
+ * the Property corresponding to the target of the graphical end.
+ */
+ public static void setTargetSemanticEnd(View view, Property end) {
+ EObjectValueStyle semanticStyle = (EObjectValueStyle)view.getNamedStyle(NotationPackage.eINSTANCE.getEObjectValueStyle(), SEMANTIC_TARGET_END);
+ semanticStyle.setEObjectValue(end);
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/factory/ConstraintBlockPropertyCompositeClassifierViewFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/factory/ConstraintBlockPropertyCompositeClassifierViewFactory.java
new file mode 100644
index 00000000000..203ac674fe6
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/factory/ConstraintBlockPropertyCompositeClassifierViewFactory.java
@@ -0,0 +1,83 @@
+package org.eclipse.papyrus.sysml.diagram.common.factory;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.diagram.core.services.ViewService;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.gmf.diagram.common.factory.ShapeViewFactory;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
+import org.eclipse.papyrus.sysml.constraints.ConstraintBlock;
+import org.eclipse.papyrus.sysml.constraints.ConstraintProperty;
+import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes;
+import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Constraint;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.Type;
+import org.eclipse.uml2.uml.util.UMLUtil;
+
+public class ConstraintBlockPropertyCompositeClassifierViewFactory extends ShapeViewFactory {
+
+ /**
+ * Creates ConstraintBlockPropertyComposite view and add Label and Compartment nodes
+ */
+ @Override
+ protected void decorateView(View containerView, View view, IAdaptable element, String semanticHint, int index, boolean persisted) {
+
+ getViewService().createNode(element, view, UMLGraphicalTypes.LABEL_UML_PROPERTY_LABEL_ID, ViewUtil.APPEND, persisted, getPreferencesHint());
+ getViewService().createNode(element, view, SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID, ViewUtil.APPEND, persisted, getPreferencesHint());
+
+ if (element != null) {
+ EObject newElement = EMFHelper.getEObject(element);
+ if (newElement instanceof Property && UMLUtil.getStereotypeApplication((Property)newElement, ConstraintProperty.class) != null) {
+ Property constraintProperty = (Property) newElement;
+
+ ViewService.createNode(view, getConstraint(constraintProperty), UMLGraphicalTypes.SHAPE_UML_CONSTRAINT_AS_LABEL_ID, getPreferencesHint());
+
+
+ List<Property> constraintParameters = getConstraintParameters(constraintProperty);
+ for (Property constraintParameter : constraintParameters) {
+ ViewService.createNode(view, constraintParameter, UMLGraphicalTypes.SHAPE_UML_PROPERTY_AS_AFFIXED_ID, getPreferencesHint());
+ }
+ }
+ }
+
+ // this action needs to be done after the compartments creation
+ super.decorateView(containerView, view, element, semanticHint, index, persisted);
+ }
+
+ private List<Property> getConstraintParameters(Property constraintProperty) {
+ List<Property> constraintParameters = new ArrayList<Property>();
+ Type type = constraintProperty.getType();
+ if (type instanceof Class && UMLUtil.getStereotypeApplication(type, ConstraintBlock.class) != null) { // instanceof ensure type is not null
+ Class constraintBlock = (Class)type;
+ EList<Property> ownedAttributes = constraintBlock.getOwnedAttributes();
+ for (Property property : ownedAttributes) {
+ if (property.getAppliedStereotypes().isEmpty()) {
+ constraintParameters.add(property);
+ }
+ }
+ }
+ return constraintParameters;
+ }
+
+ private Constraint getConstraint(Property constraintProperty) {
+ Type type = constraintProperty.getType();
+ if (type instanceof Class && UMLUtil.getStereotypeApplication(type, ConstraintBlock.class) != null) { // instanceof ensure type is not null
+ Class constraintBlock = (Class)type;
+ EList<Constraint> ownedRules = constraintBlock.getOwnedRules();
+ for (Constraint constraint : ownedRules) {
+ return constraint;
+ }
+ }
+ return null;
+ }
+
+ // Start of user code preferences
+ // End of user code
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/figure/ConstraintBlockPropertyCompositeFigure.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/figure/ConstraintBlockPropertyCompositeFigure.java
new file mode 100644
index 00000000000..8d4475ccc55
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/figure/ConstraintBlockPropertyCompositeFigure.java
@@ -0,0 +1,49 @@
+package org.eclipse.papyrus.sysml.diagram.common.figure;
+
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.text.FlowPage;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusRoundedNodeFigure;
+
+public class ConstraintBlockPropertyCompositeFigure extends PapyrusRoundedNodeFigure {
+
+ protected WrappingLabel constraintLabel;
+
+ /** main flow page */
+ protected FlowPage page;
+
+ public ConstraintBlockPropertyCompositeFigure() {
+ super();
+ corner = 50;
+
+ nameLabel = new WrappingLabel();
+ nameLabel.setOpaque(false);
+ nameLabel.setAlignment(PositionConstants.MIDDLE);
+ add(nameLabel);
+
+
+ constraintLabel = new WrappingLabel();
+ constraintLabel.setAlignment(PositionConstants.RIGHT);
+ add(constraintLabel);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusNodeNamedElementFigure#getNameLabel()
+ *
+ * @return
+ */
+ public WrappingLabel getNameLabel() {
+ return nameLabel;
+ }
+
+ /**
+ *
+ * @return the textflow of the constraint that contain the string of the
+ * specification
+ */
+ public WrappingLabel getConstraintLabel() {
+ return constraintLabel;
+ }
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/figure/SysMLDiagramFrameFigure.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/figure/SysMLDiagramFrameFigure.java
new file mode 100644
index 00000000000..f9f739f4675
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/figure/SysMLDiagramFrameFigure.java
@@ -0,0 +1,151 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.common.figure;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.MarginBorder;
+import org.eclipse.draw2d.OrderedLayout;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.ToolbarLayout;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.papyrus.uml.diagram.common.draw2d.InteractionFigure;
+import org.eclipse.papyrus.uml.diagram.common.draw2d.LeftToolbarLayout;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.AutomaticCompartmentLayoutManager;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.NodeNamedElementFigure;
+
+public class SysMLDiagramFrameFigure extends NodeNamedElementFigure {
+
+ private WrappingLabel frameLabel;
+
+ private RectangleFigure frameLabelContainerFigure;
+
+ private RectangleFigure structureCompartmentFigure;
+
+
+ public SysMLDiagramFrameFigure() {
+ super();
+ createContents();
+ }
+
+ protected void createContents() {
+ add(createInteractionFigureHeader());
+ add(createStructureCompartmentFigures());
+ setLayoutManager(new SysMLLayoutLayoutManager());
+ }
+
+ protected RectangleFigure createInteractionFigureHeader() {
+ if (this.frameLabel == null) {
+ this.frameLabel = new WrappingLabel() {
+
+ @Override
+ public Dimension getPreferredSize(final int wHint, final int hHint) {
+ final Dimension preferredSize = super.getPreferredSize(wHint, hHint);
+ if(preferredSize.width == 0) {
+ return preferredSize;
+ }
+ return new Dimension(preferredSize.width + 2, preferredSize.height + 2);
+ }
+ };
+ }
+
+ final InteractionFigure interactionFigure = new InteractionFigure();
+ interactionFigure.setBorder(new MarginBorder(3, 3, 3, 3));
+ interactionFigure.setLayoutManager(new LeftToolbarLayout());
+ interactionFigure.add(frameLabel);
+
+ frameLabelContainerFigure = new RectangleFigure();
+ frameLabelContainerFigure.setOutline(false);
+ frameLabelContainerFigure.setFill(false);
+ frameLabelContainerFigure.setLayoutManager(new ToolbarLayout(false));
+ frameLabelContainerFigure.setLineStyle(Graphics.LINE_DASHDOTDOT);
+ frameLabelContainerFigure.add(interactionFigure, OrderedLayout.ALIGN_CENTER);
+ return frameLabelContainerFigure;
+ }
+
+ @Override
+ public WrappingLabel getNameLabel() {
+ if (frameLabel == null) {
+ createInteractionFigureHeader();
+ }
+ return frameLabel;
+ }
+
+ public RectangleFigure getLabelContainer() {
+ return frameLabelContainerFigure;
+ }
+
+ public IFigure getStructureCompartmentFigure() {
+ if (structureCompartmentFigure == null) {
+ createStructureCompartmentFigures();
+ }
+ return structureCompartmentFigure;
+ }
+
+ public IFigure createStructureCompartmentFigures() {
+ structureCompartmentFigure = new RectangleFigure();
+ structureCompartmentFigure.setFill(false);
+
+ return structureCompartmentFigure;
+ }
+
+ /**
+ * this is the layout manager in charge to place element in the enumeration
+ *
+ */
+ private class SysMLLayoutLayoutManager extends AutomaticCompartmentLayoutManager {
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ public void layout(final IFigure container) {
+ List<IFigure> figuresToRemove = new ArrayList<IFigure>();
+ for(int i = 0; i < container.getChildren().size(); i++) {
+ IFigure currentCompartment = (IFigure)container.getChildren().get(i);
+ // this is a visible compartment
+ if(currentCompartment == structureCompartmentFigure) {
+ Rectangle bound = new Rectangle(currentCompartment.getBounds());
+ currentCompartment.invalidate();
+ Dimension pref = currentCompartment.getPreferredSize();
+ currentCompartment.invalidate();
+ Dimension prefConstraint = currentCompartment.getPreferredSize(container.getBounds().width - 40, -1);
+ if(pref.width < prefConstraint.width) {
+ bound.setSize(pref);
+ } else {
+ bound.setSize(prefConstraint);
+ }
+ int offset = 24;
+ bound.x = container.getBounds().x;
+ bound.y = container.getBounds().y + offset;
+ bound.width = container.getBounds().width;
+ bound.height = container.getBounds().height - offset;
+ currentCompartment.setBounds(bound);
+ } else if (currentCompartment == frameLabelContainerFigure) {
+ Rectangle boundLabel = new Rectangle(frameLabelContainerFigure.getBounds());
+ boundLabel.setSize(frameLabelContainerFigure.getPreferredSize());
+ frameLabelContainerFigure.setBounds(boundLabel);
+ } else {
+ // remove other figure
+ figuresToRemove.add(currentCompartment);
+ }
+ }
+ for (IFigure iFigure : figuresToRemove) {
+ container.getChildren().remove(iFigure);
+ }
+ }
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/utils/SysMLGraphicalTypes.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/utils/SysMLGraphicalTypes.java
index f43a4ddcc98..eaa7b094cc9 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/utils/SysMLGraphicalTypes.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/utils/SysMLGraphicalTypes.java
@@ -25,6 +25,8 @@ public class SysMLGraphicalTypes {
public static final String SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID = "shape_sysml_blockproperty_as_composite"; //$NON-NLS-1$
+ public static final String SHAPE_SYSML_CONSTRAINTBLOCKPROPERTY_AS_COMPOSITE_ID = "shape_sysml_constraintblockproperty_as_composite"; //$NON-NLS-1$
+
public static final String SHAPE_SYSML_DIMENSION_AS_CLASSIFIER_ID = "shape_sysml_dimension_as_classifier"; //$NON-NLS-1$
public static final String SHAPE_SYSML_CONSTRAINTBLOCK_AS_CLASSIFIER_ID = "shape_sysml_constraintblock_as_classifier"; //$NON-NLS-1$
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorEditPart.java
index 1728af01197..78884083e9f 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorEditPart.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorEditPart.java
@@ -17,8 +17,13 @@ import org.eclipse.draw2d.Connection;
import org.eclipse.gef.EditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.gmf.diagram.common.edit.policy.DefaultSemanticEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
+import org.eclipse.papyrus.sysml.blocks.BindingConnector;
+import org.eclipse.papyrus.sysml.blocks.BlocksPackage;
import org.eclipse.papyrus.uml.diagram.common.figure.ConnectorEdgeFigure;
+import org.eclipse.papyrus.uml.tools.utils.UMLUtil;
+import org.eclipse.uml2.uml.Connector;
+import org.eclipse.uml2.uml.Element;
public class ConnectorEditPart extends AbstractElementLinkEditPart {
@@ -91,33 +96,14 @@ public class ConnectorEditPart extends AbstractElementLinkEditPart {
return (ConnectorEdgeFigure)getFigure();
}
- /**
- * {@inheritDoc}
- */
- @Override
- protected void refreshLineType() {
- // Start of user code custom line type
- super.refreshLineType();
- // End of user code
- }
-
- /**
- * {@inheritDoc}
- */
@Override
- protected void refreshArrowSource() {
- // Start of user code custom source decoration
- super.refreshArrowSource();
- // End of user code
+ protected void refreshLineWidth() {
+ if (org.eclipse.uml2.uml.util.UMLUtil.getStereotypeApplication((Element)resolveSemanticElement(), BindingConnector.class) != null) {
+ setLineWidth(2);
+ }
+ else {
+ setLineWidth(1);
+ }
}
- /**
- * {@inheritDoc}
- */
- @Override
- protected void refreshArrowTarget() {
- // Start of user code custom target decoration
- super.refreshArrowTarget();
- // End of user code
- }
}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/ConstraintParameterAffixedNodeEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/ConstraintParameterAffixedNodeEditPart.java
new file mode 100644
index 00000000000..a450a7d041e
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/ConstraintParameterAffixedNodeEditPart.java
@@ -0,0 +1,201 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.edit.part;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.LayoutListener;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.MoveHandle;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.gmf.diagram.common.edit.policy.ExternalLabelPrimaryDragRoleEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IPapyrusEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeIconlDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.AffixedNamedElementFigure;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusUMLElementFigure;
+import org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator;
+import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes;
+
+public class ConstraintParameterAffixedNodeEditPart extends AbstractElementBorderEditPart {
+
+ private LayoutListener.Stub layoutInitializationListener;
+
+ public ConstraintParameterAffixedNodeEditPart(View view) {
+ super(view);
+ }
+
+
+ @Override
+ protected EditPart createChild(Object model) {
+ return super.createChild(model);
+ }
+
+
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeIconlDisplayEditPolicy() {
+
+ /**
+ * <pre>
+ * {@inheritDoc}
+ *
+ * This modifies the edit policy in order to call refreshVisuals() whenever the stereotype image to show is null.
+ * (required to show the Port default image correctly).
+ * </pre>
+ */
+ @Override
+ protected void refreshStereotypeDisplay() {
+ if(getHost() instanceof IPapyrusEditPart) {
+ IFigure figure = ((IPapyrusEditPart)getHost()).getPrimaryShape();
+
+ if((figure instanceof IPapyrusUMLElementFigure) && (stereotypeIconToDisplay() != null)) {
+ ((IPapyrusUMLElementFigure)figure).setStereotypeDisplay(null, stereotypeIconToDisplay());
+ } else {
+ refreshVisuals();
+ }
+ }
+ }
+
+ });
+
+ installEditPolicy(ShowHideLabelEditPolicy.SHOW_HIDE_LABEL_ROLE, new ShowHideLabelEditPolicy());
+ }
+
+ @Override
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+ org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() {
+
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ if(child instanceof IBorderItemEditPart) { // External labels
+ return new ExternalLabelPrimaryDragRoleEditPolicy() {
+
+ @SuppressWarnings("rawtypes")
+ protected List createSelectionHandles() {
+ MoveHandle mh = new MoveHandle((GraphicalEditPart)getHost());
+ mh.setBorder(null);
+ return Collections.singletonList(mh);
+ }
+ };
+ }
+
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if(result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ @Override
+ protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) {
+ IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure());
+ borderItemContainer.add(borderItemEditPart.getFigure(), locator);
+ return;
+ }
+
+ @Override
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLGraphicalTypes.AFFIXEDLABEL_UML_PORT_LABEL_ID);
+ }
+
+ /**
+ * <pre>
+ * Calls the figure refresh when a change event is detected on
+ * UMLPackage.eINSTANCE.getProperty_Aggregation().
+ *
+ * {@inheritDoc}
+ * </pre>
+ */
+ @Override
+ protected void handleNotificationEvent(Notification event) {
+
+ // When the constraint parameter position changes, its position on parent side may change and requires a visual refresh.
+ Object feature = event.getFeature();
+ if(NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature) || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
+ refreshVisuals();
+ }
+
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected IFigure createNodeShape() {
+ return primaryShape = new AffixedNamedElementFigure();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public AffixedNamedElementFigure getPrimaryShape() {
+ return (AffixedNamedElementFigure)primaryShape;
+ }
+
+ /**
+ * <pre>
+ * A post layout listener is added during activate and remove the first time the layout occurs.
+ * This is required in order to be able to find the side of this border item on its parent when opening the model.
+ * Without this, the locator is unable to guess the parent side because the parent constraint is not set yet.
+ *
+ * Once the initialization is done, the listener become useless and can be removed.
+ *
+ * {@inheritDoc}
+ * </pre>
+ */
+ @Override
+ public void activate() {
+
+ layoutInitializationListener = new LayoutListener.Stub() {
+
+ @Override
+ public void postLayout(IFigure container) {
+ refreshVisuals();
+ //getBorderedFigure().getBorderItemContainer().removeLayoutListener(layoutInitializationListener);
+ layoutInitializationListener = null;
+ }
+ };
+ getBorderedFigure().getBorderItemContainer().addLayoutListener(layoutInitializationListener);
+
+ super.activate();
+ }
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/DeleteElementAction.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/factory/ConstraintPropertyAffixedNodeViewFactory.java
index 58f3349fcd1..7e61a306410 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/DeleteElementAction.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/factory/ConstraintPropertyAffixedNodeViewFactory.java
@@ -1,16 +1,19 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.part;
-
-
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.factory;
+
+
+
+public class ConstraintPropertyAffixedNodeViewFactory extends PortAffixedNodeViewFactory {
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/utils/UMLGraphicalTypes.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/utils/UMLGraphicalTypes.java
index 6cec91a75e4..068f7c04bd6 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/utils/UMLGraphicalTypes.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/utils/UMLGraphicalTypes.java
@@ -33,6 +33,8 @@ public class UMLGraphicalTypes {
public static final String SHAPE_UML_PORT_AS_AFFIXED_ID = "shape_uml_port_as_affixed"; //$NON-NLS-1$
+ public static final String SHAPE_UML_PROPERTY_AS_AFFIXED_ID = "shape_uml_property_as_affixed"; //$NON-NLS-1$
+
/** Custom label nodes */
public static final String SHAPE_UML_CONSTRAINT_AS_LABEL_ID = "shape_uml_constraint_as_label"; //$NON-NLS-1$
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/Activator.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/Activator.java
index ecb3127afa8..d5c54840e24 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/Activator.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/Activator.java
@@ -1,306 +1,306 @@
-package org.eclipse.papyrus.sysml.diagram.common;
-
-import java.util.ArrayList;
-
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.emf.common.notify.AdapterFactory;
-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.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.jface.preference.IPreferenceStore;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.papyrus.infra.core.log.LogHelper;
-import org.eclipse.papyrus.sysml.portandflows.FlowDirection;
-import org.eclipse.papyrus.sysml.portandflows.FlowPort;
-import org.eclipse.papyrus.uml.tools.providers.UMLLabelProvider;
-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;
-//import org.eclipse.papyrus.sysml.activities.provider.ActivitiesItemProviderAdapterFactory;
-//import org.eclipse.papyrus.sysml.allocations.provider.AllocationsItemProviderAdapterFactory;
-//import org.eclipse.papyrus.sysml.blocks.provider.BlocksItemProviderAdapterFactory;
-//import org.eclipse.papyrus.sysml.constraints.provider.ConstraintsItemProviderAdapterFactory;
-//import org.eclipse.papyrus.sysml.modelelements.provider.ModelelementsItemProviderAdapterFactory;
-//import org.eclipse.papyrus.sysml.portandflows.provider.PortandflowsItemProviderAdapterFactory;
-//import org.eclipse.papyrus.sysml.requirements.provider.RequirementsItemProviderAdapterFactory;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends AbstractUIPlugin {
-
- /** The Constant ID. */
- public static final String PLUGIN_ID = "org.eclipse.papyrus.sysml.diagram.common"; //$NON-NLS-1$
-
- /** Shared instance of the plug-in (singleton pattern) */
- private static Activator plugin;
-
- /** Logging helper */
- public static LogHelper log;
-
- /** The composed adapter factory */
- private ComposedAdapterFactory adapterFactory;
-
- /** generic label provider based on EMF facet */
- private UMLLabelProvider labelProvider;
-
- /** Default constructor */
- public Activator() {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
-
- // register the login helper
- log = new LogHelper(plugin);
-
- // prepare the composed adapter factory
- adapterFactory = createAdapterFactory();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- adapterFactory.dispose();
- adapterFactory = null;
- if(labelProvider != null) {
- labelProvider.dispose();
- labelProvider = null;
- }
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getInstance() {
- return plugin;
- }
-
- /**
- * 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(PLUGIN_ID, path);
- }
-
- /**
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#getPreferenceStore()
- *
- * @return Shared Preference Store.
- */
- @Override
- public IPreferenceStore getPreferenceStore() {
- IPreferenceStore store = org.eclipse.papyrus.infra.gmfdiag.preferences.Activator.getDefault().getPreferenceStore();
- return store;
- }
-
- /**
- * Get the item provider adapter factory.
- *
- * @return the adapter factory.
- */
- public AdapterFactory getItemProvidersAdapterFactory() {
- return adapterFactory;
- }
-
- /**
- * Get an image descriptor for current item.
- *
- * @param item
- * the item for which an image descriptor searched.
- * @return the image descriptor.
- */
- 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;
- }
-
- /**
- * Get an image for a ENamedElement in plug-in image registry.
- *
- * @param element
- * the element.
- * @return the image.
- */
- public Image getImage(ENamedElement element) {
-
- String imageKey = element.getName();
-
- Image image = getImageRegistry().get(imageKey);
- if(image == null) {
- ImageDescriptor imageDescriptor = getProvidedImageDescriptor(element);
- if(imageDescriptor == null) {
- imageDescriptor = ImageDescriptor.getMissingImageDescriptor();
- }
- getImageRegistry().put(imageKey, imageDescriptor);
- image = getImageRegistry().get(imageKey);
- }
- return image;
- }
-
- /**
- * <pre>
- * Provide a FlowPort image for border edit part that take the border item position
- * into account.
- *
- * The image is not rotated, but predefined.
- *
- * The side of the image (relatively to the parent figure) can be:
- * <ul>
- * <li>{@linkplain PositionConstants#NORTH}</li>
- * <li> {@linkplain PositionConstants#SOUTH}</li>
- * <li> {@linkplain PositionConstants#EAST}</li>
- * <li> {@linkplain PositionConstants#WEST}</li>
- * <li> {@linkplain PositionConstants#NORTH_EAST}</li>
- * <li> {@linkplain PositionConstants#NORTH_WEST}</li>
- * <li> {@linkplain PositionConstants#SOUTH_EAST}</li>
- * <li> {@linkplain PositionConstants#SOUTH_WEST}</li>
- * </ul>
- *
- * </pre>
- */
- public Image getFlowPortImage(FlowPort flowport, int side) {
-
- // Prepare the image key
- String imageKey = "FlowPort_";
- if(flowport.isAtomic()) {
- if(flowport.getDirection() == FlowDirection.IN) {
- imageKey = imageKey + "IN_";
- } else if(flowport.getDirection() == FlowDirection.OUT) {
- imageKey = imageKey + "OUT_";
- } else if(flowport.getDirection() == FlowDirection.INOUT) {
- imageKey = imageKey + "INOUT_";
- }
-
- imageKey = imageKey + "A_";
- } else {
- imageKey = imageKey + "NA_";
- }
-
- if(side == PositionConstants.WEST) {
- imageKey = imageKey + "WEST";
- } else if(side == PositionConstants.NORTH) {
- imageKey = imageKey + "NORTH";
- } else if(side == PositionConstants.SOUTH) {
- imageKey = imageKey + "SOUTH";
- } else if(side == PositionConstants.EAST) {
- imageKey = imageKey + "EAST";
- } else if(side == PositionConstants.NORTH_WEST) {
- imageKey = imageKey + "NORTH_WEST";
- } else if(side == PositionConstants.NORTH_EAST) {
- imageKey = imageKey + "NORTH_EAST";
- } else if(side == PositionConstants.SOUTH_EAST) {
- imageKey = imageKey + "SOUTH_EAST";
- } else if(side == PositionConstants.SOUTH_WEST) {
- imageKey = imageKey + "SOUTH_WEST";
- }
-
- // Retrieve image from registry or add it in the registry
- Image image = getImageRegistry().get(imageKey);
- if(image == null) {
-
- ImageDescriptor imageDescriptor = imageDescriptorFromPlugin(PLUGIN_ID, "/icons/flowports/" + imageKey + ".gif");
-
- if(imageDescriptor == null) {
- imageDescriptor = ImageDescriptor.getMissingImageDescriptor();
- }
- getImageRegistry().put(imageKey, imageDescriptor);
- image = getImageRegistry().get(imageKey);
- }
-
- return image;
- }
-
- /**
- * Returns a label provider supported by EMF Facet
- *
- * @return a label provider supported by EMF Facet
- */
- public ILabelProvider getLabelProvider() {
- if(labelProvider == null) {
- // add a generic label provider for sysml elements
- labelProvider = new UMLLabelProvider();
- }
- return labelProvider;
- }
-
- /**
- * Create a new Composed adapter factory for this plug-in.
- */
- protected ComposedAdapterFactory createAdapterFactory() {
- ArrayList<AdapterFactory> factories = new ArrayList<AdapterFactory>();
-
- // Add SysML adapters
-// factories.add(new ActivitiesItemProviderAdapterFactory());
-// factories.add(new AllocationsItemProviderAdapterFactory());
-// factories.add(new BlocksItemProviderAdapterFactory());
-// factories.add(new ConstraintsItemProviderAdapterFactory());
-// factories.add(new ModelelementsItemProviderAdapterFactory());
-// factories.add(new PortandflowsItemProviderAdapterFactory());
-// factories.add(new RequirementsItemProviderAdapterFactory());
- // Add UML adapter
- factories.add(new UMLItemProviderAdapterFactory());
-
- // Other adapters
- factories.add(new EcoreItemProviderAdapterFactory());
- factories.add(new ResourceItemProviderAdapterFactory());
- factories.add(new ReflectiveItemProviderAdapterFactory());
- return new ComposedAdapterFactory(factories);
- }
-
- private 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 getItemImageDescriptor(eClass.getEPackage().getEFactoryInstance().create(eClass));
- }
- }
- // TODO : support structural features
- return null;
- }
-
-
-}
+package org.eclipse.papyrus.sysml.diagram.common;
+
+import java.util.ArrayList;
+
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.emf.common.notify.AdapterFactory;
+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.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.jface.preference.IPreferenceStore;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.papyrus.infra.core.log.LogHelper;
+import org.eclipse.papyrus.sysml.portandflows.FlowDirection;
+import org.eclipse.papyrus.sysml.portandflows.FlowPort;
+import org.eclipse.papyrus.uml.tools.providers.UMLLabelProvider;
+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;
+//import org.eclipse.papyrus.sysml.activities.provider.ActivitiesItemProviderAdapterFactory;
+//import org.eclipse.papyrus.sysml.allocations.provider.AllocationsItemProviderAdapterFactory;
+//import org.eclipse.papyrus.sysml.blocks.provider.BlocksItemProviderAdapterFactory;
+//import org.eclipse.papyrus.sysml.constraints.provider.ConstraintsItemProviderAdapterFactory;
+//import org.eclipse.papyrus.sysml.modelelements.provider.ModelelementsItemProviderAdapterFactory;
+//import org.eclipse.papyrus.sysml.portandflows.provider.PortandflowsItemProviderAdapterFactory;
+//import org.eclipse.papyrus.sysml.requirements.provider.RequirementsItemProviderAdapterFactory;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ /** The Constant ID. */
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.sysml.diagram.common"; //$NON-NLS-1$
+
+ /** Shared instance of the plug-in (singleton pattern) */
+ private static Activator plugin;
+
+ /** Logging helper */
+ public static LogHelper log;
+
+ /** The composed adapter factory */
+ private ComposedAdapterFactory adapterFactory;
+
+ /** generic label provider based on EMF facet */
+ private UMLLabelProvider labelProvider;
+
+ /** Default constructor */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+
+ // register the login helper
+ log = new LogHelper(plugin);
+
+ // prepare the composed adapter factory
+ adapterFactory = createAdapterFactory();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ adapterFactory.dispose();
+ adapterFactory = null;
+ if(labelProvider != null) {
+ labelProvider.dispose();
+ labelProvider = null;
+ }
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getInstance() {
+ return plugin;
+ }
+
+ /**
+ * 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(PLUGIN_ID, path);
+ }
+
+ /**
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#getPreferenceStore()
+ *
+ * @return Shared Preference Store.
+ */
+ @Override
+ public IPreferenceStore getPreferenceStore() {
+ IPreferenceStore store = org.eclipse.papyrus.infra.gmfdiag.preferences.Activator.getDefault().getPreferenceStore();
+ return store;
+ }
+
+ /**
+ * Get the item provider adapter factory.
+ *
+ * @return the adapter factory.
+ */
+ public AdapterFactory getItemProvidersAdapterFactory() {
+ return adapterFactory;
+ }
+
+ /**
+ * Get an image descriptor for current item.
+ *
+ * @param item
+ * the item for which an image descriptor searched.
+ * @return the image descriptor.
+ */
+ 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;
+ }
+
+ /**
+ * Get an image for a ENamedElement in plug-in image registry.
+ *
+ * @param element
+ * the element.
+ * @return the image.
+ */
+ public Image getImage(ENamedElement element) {
+
+ String imageKey = element.getName();
+
+ Image image = getImageRegistry().get(imageKey);
+ if(image == null) {
+ ImageDescriptor imageDescriptor = getProvidedImageDescriptor(element);
+ if(imageDescriptor == null) {
+ imageDescriptor = ImageDescriptor.getMissingImageDescriptor();
+ }
+ getImageRegistry().put(imageKey, imageDescriptor);
+ image = getImageRegistry().get(imageKey);
+ }
+ return image;
+ }
+
+ /**
+ * <pre>
+ * Provide a FlowPort image for border edit part that take the border item position
+ * into account.
+ *
+ * The image is not rotated, but predefined.
+ *
+ * The side of the image (relatively to the parent figure) can be:
+ * <ul>
+ * <li>{@linkplain PositionConstants#NORTH}</li>
+ * <li> {@linkplain PositionConstants#SOUTH}</li>
+ * <li> {@linkplain PositionConstants#EAST}</li>
+ * <li> {@linkplain PositionConstants#WEST}</li>
+ * <li> {@linkplain PositionConstants#NORTH_EAST}</li>
+ * <li> {@linkplain PositionConstants#NORTH_WEST}</li>
+ * <li> {@linkplain PositionConstants#SOUTH_EAST}</li>
+ * <li> {@linkplain PositionConstants#SOUTH_WEST}</li>
+ * </ul>
+ *
+ * </pre>
+ */
+ public Image getFlowPortImage(FlowPort flowport, int side) {
+
+ // Prepare the image key
+ String imageKey = "FlowPort_";
+ if(flowport.isAtomic()) {
+ if(flowport.getDirection() == FlowDirection.IN) {
+ imageKey = imageKey + "IN_";
+ } else if(flowport.getDirection() == FlowDirection.OUT) {
+ imageKey = imageKey + "OUT_";
+ } else if(flowport.getDirection() == FlowDirection.INOUT) {
+ imageKey = imageKey + "INOUT_";
+ }
+
+ imageKey = imageKey + "A_";
+ } else {
+ imageKey = imageKey + "NA_";
+ }
+
+ if(side == PositionConstants.WEST) {
+ imageKey = imageKey + "WEST";
+ } else if(side == PositionConstants.NORTH) {
+ imageKey = imageKey + "NORTH";
+ } else if(side == PositionConstants.SOUTH) {
+ imageKey = imageKey + "SOUTH";
+ } else if(side == PositionConstants.EAST) {
+ imageKey = imageKey + "EAST";
+ } else if(side == PositionConstants.NORTH_WEST) {
+ imageKey = imageKey + "NORTH_WEST";
+ } else if(side == PositionConstants.NORTH_EAST) {
+ imageKey = imageKey + "NORTH_EAST";
+ } else if(side == PositionConstants.SOUTH_EAST) {
+ imageKey = imageKey + "SOUTH_EAST";
+ } else if(side == PositionConstants.SOUTH_WEST) {
+ imageKey = imageKey + "SOUTH_WEST";
+ }
+
+ // Retrieve image from registry or add it in the registry
+ Image image = getImageRegistry().get(imageKey);
+ if(image == null) {
+
+ ImageDescriptor imageDescriptor = imageDescriptorFromPlugin(PLUGIN_ID, "/icons/flowports/" + imageKey + ".gif");
+
+ if(imageDescriptor == null) {
+ imageDescriptor = ImageDescriptor.getMissingImageDescriptor();
+ }
+ getImageRegistry().put(imageKey, imageDescriptor);
+ image = getImageRegistry().get(imageKey);
+ }
+
+ return image;
+ }
+
+ /**
+ * Returns a label provider supported by EMF Facet
+ *
+ * @return a label provider supported by EMF Facet
+ */
+ public ILabelProvider getLabelProvider() {
+ if(labelProvider == null) {
+ // add a generic label provider for sysml elements
+ labelProvider = new UMLLabelProvider();
+ }
+ return labelProvider;
+ }
+
+ /**
+ * Create a new Composed adapter factory for this plug-in.
+ */
+ protected ComposedAdapterFactory createAdapterFactory() {
+ ArrayList<AdapterFactory> factories = new ArrayList<AdapterFactory>();
+
+ // Add SysML adapters
+// factories.add(new ActivitiesItemProviderAdapterFactory());
+// factories.add(new AllocationsItemProviderAdapterFactory());
+// factories.add(new BlocksItemProviderAdapterFactory());
+// factories.add(new ConstraintsItemProviderAdapterFactory());
+// factories.add(new ModelelementsItemProviderAdapterFactory());
+// factories.add(new PortandflowsItemProviderAdapterFactory());
+// factories.add(new RequirementsItemProviderAdapterFactory());
+ // Add UML adapter
+ factories.add(new UMLItemProviderAdapterFactory());
+
+ // Other adapters
+ factories.add(new EcoreItemProviderAdapterFactory());
+ factories.add(new ResourceItemProviderAdapterFactory());
+ factories.add(new ReflectiveItemProviderAdapterFactory());
+ return new ComposedAdapterFactory(factories);
+ }
+
+ private 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 getItemImageDescriptor(eClass.getEPackage().getEFactoryInstance().create(eClass));
+ }
+ }
+ // TODO : support structural features
+ return null;
+ }
+
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/commands/CreateSysMLModelCommand.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/commands/CreateSysMLModelCommand.java
index c312cecf7e8..fa291b14c1a 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/commands/CreateSysMLModelCommand.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/commands/CreateSysMLModelCommand.java
@@ -1,69 +1,69 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tatiana Fesenko (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.common.commands;
-
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.papyrus.sysml.util.SysmlResource;
-import org.eclipse.papyrus.uml.diagram.common.commands.ModelCreationCommandBase;
-import org.eclipse.papyrus.uml.tools.utils.PackageUtil;
-import org.eclipse.uml2.uml.Profile;
-import org.eclipse.uml2.uml.UMLFactory;
-
-
-/**
- * The Class CreateSysMLModelCommand.
- */
-public class CreateSysMLModelCommand extends ModelCreationCommandBase {
-
- public static final String COMMAND_ID = "sysml";
-
- /**
- * @see org.eclipse.papyrus.infra.core.extension.commands.ModelCreationCommandBase#createRootElement()
- *
- * @return
- */
-
- @Override
- protected EObject createRootElement() {
- return UMLFactory.eINSTANCE.createModel();
- }
-
- /**
- * @see org.eclipse.papyrus.infra.core.extension.commands.ModelCreationCommandBase#initializeModel(org.eclipse.emf.ecore.EObject)
- *
- * @param owner
- */
-
- @Override
- protected void initializeModel(EObject owner) {
- super.initializeModel(owner);
- ((org.eclipse.uml2.uml.Package)owner).setName(getModelName());
-
- // Retrieve SysML profile and apply with Sub-profile
- Profile sysml = (Profile)PackageUtil.loadPackage(URI.createURI(SysmlResource.SYSML_PROFILE_URI), owner.eResource().getResourceSet());
- if(sysml != null) {
- PackageUtil.applyProfile(((org.eclipse.uml2.uml.Package)owner), sysml, true);
- }
- }
-
- /**
- * Gets the model name.
- *
- * @return the model name
- */
- protected String getModelName() {
- return "SysMLmodel";
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tatiana Fesenko (CEA LIST) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.common.commands;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.sysml.util.SysmlResource;
+import org.eclipse.papyrus.uml.diagram.common.commands.ModelCreationCommandBase;
+import org.eclipse.papyrus.uml.tools.utils.PackageUtil;
+import org.eclipse.uml2.uml.Profile;
+import org.eclipse.uml2.uml.UMLFactory;
+
+
+/**
+ * The Class CreateSysMLModelCommand.
+ */
+public class CreateSysMLModelCommand extends ModelCreationCommandBase {
+
+ public static final String COMMAND_ID = "sysml";
+
+ /**
+ * @see org.eclipse.papyrus.infra.core.extension.commands.ModelCreationCommandBase#createRootElement()
+ *
+ * @return
+ */
+
+ @Override
+ protected EObject createRootElement() {
+ return UMLFactory.eINSTANCE.createModel();
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.core.extension.commands.ModelCreationCommandBase#initializeModel(org.eclipse.emf.ecore.EObject)
+ *
+ * @param owner
+ */
+
+ @Override
+ protected void initializeModel(EObject owner) {
+ super.initializeModel(owner);
+ ((org.eclipse.uml2.uml.Package)owner).setName(getModelName());
+
+ // Retrieve SysML profile and apply with Sub-profile
+ Profile sysml = (Profile)PackageUtil.loadPackage(URI.createURI(SysmlResource.SYSML_PROFILE_URI), owner.eResource().getResourceSet());
+ if(sysml != null) {
+ PackageUtil.applyProfile(((org.eclipse.uml2.uml.Package)owner), sysml, true);
+ }
+ }
+
+ /**
+ * Gets the model name.
+ *
+ * @return the model name
+ */
+ protected String getModelName() {
+ return "SysMLmodel";
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/utils/SysMLSelectionTester.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/utils/SysMLSelectionTester.java
index 9f57ecb282b..bdf8a3f464c 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/utils/SysMLSelectionTester.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/utils/SysMLSelectionTester.java
@@ -1,143 +1,143 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.common.utils;
-
-import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.papyrus.infra.core.resource.NotFoundException;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForSelection;
-import org.eclipse.papyrus.sysml.SysmlPackage;
-import org.eclipse.papyrus.sysml.blocks.BlocksPackage;
-import org.eclipse.papyrus.sysml.diagram.common.Activator;
-import org.eclipse.papyrus.sysml.requirements.RequirementsPackage;
-import org.eclipse.papyrus.uml.tools.model.UmlModel;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.Profile;
-import org.eclipse.uml2.uml.util.UMLUtil;
-
-/**
- * This class is a Property tester used to check is current model (meaning the model currently opened in Papyrus) is a SysML Model.
- * This class is used in order to create test for deciding whether a diagram creation command should be visible or not.
- * This property tester assumes that currently active editor is Papyrus, it should be used with care (simultaneously with a test to ensure Papyrus is
- * currently opened and active).
- *
- */
-public class SysMLSelectionTester extends PropertyTester {
-
- /** Tester ID for SysML Model nature. This is currently a test on: is this a blocks profiles package... */
- public final static String IS_SYSML_MODEL = "isSysMLModel";
-
- /** Tester ID for SysML Requirements Model nature */
- public final static String IS_SYSML_REQUIREMENTS_MODEL = "isSysMLRequirementsModel";
-
- /** Tester ID for SysML Blocks Model nature */
- public final static String IS_SYSML_BLOCKS_MODEL = "isSysMLBlocksModel";
-
- /** Default constructor */
- public SysMLSelectionTester() {
- }
-
- /** Test the receiver against the selected property */
- public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
-
- // Ensure Papyrus is the active editor
- Object currentValue = null;
- if(IS_SYSML_MODEL.equals(property)) {
- currentValue = testSysMLModelNature(receiver);
- return (currentValue == expectedValue);
- } else if(IS_SYSML_BLOCKS_MODEL.equals(property)) {
- currentValue = testSysMLBlocksModelNature(receiver);
- return (currentValue == expectedValue);
- } else if(IS_SYSML_REQUIREMENTS_MODEL.equals(property)) {
- currentValue = testSysMLRequirementsModelNature(receiver);
- return (currentValue == expectedValue);
- }
-
- return false;
- }
-
- /** True is root object is a UML Model with SysML Profile (and sub profiles) applied */
- protected boolean testSysMLModelNature(Object receiver) {
- boolean isSysMLModel = false;
-
- EObject root = getRoot(receiver);
- if(root instanceof Package) {
- Profile sysml = UMLUtil.getProfile(SysmlPackage.eINSTANCE, root);
- if(((Package)root).isProfileApplied(sysml)) {
- isSysMLModel = true;
- }
- }
-
- return isSysMLModel;
- }
-
- /** True is root object is a UML Model with SysML Requirements Profile applied */
- protected boolean testSysMLRequirementsModelNature(Object receiver) {
- boolean isSysMLModel = false;
-
- EObject root = getRoot(receiver);
- if(root instanceof Package) {
- Profile sysml = UMLUtil.getProfile(RequirementsPackage.eINSTANCE, root);
- if(((Package)root).isProfileApplied(sysml)) {
- isSysMLModel = true;
- }
- }
-
- return isSysMLModel;
- }
-
- /** True is root object is a UML Model with SysML Blocks Profile applied */
- protected boolean testSysMLBlocksModelNature(Object receiver) {
- boolean isSysMLModel = false;
-
- EObject root = getRoot(receiver);
- if(root instanceof Package) {
- Profile sysml = UMLUtil.getProfile(BlocksPackage.eINSTANCE, root);
- if(((Package)root).isProfileApplied(sysml)) {
- isSysMLModel = true;
- }
- }
-
- return isSysMLModel;
- }
-
- /** Returns the root EObject of currently opened model */
- private EObject getRoot(Object receiver) {
- EObject root = null;
-
- if(receiver instanceof ISelection) {
- ISelection selection = (ISelection)receiver;
- if(selection.isEmpty()) {
- return null;
- }
-
- try {
- ServiceUtilsForSelection serviceUtils = ServiceUtilsForSelection.getInstance();
- UmlModel openedModel = (UmlModel)serviceUtils.getModelSet(selection).getModel(UmlModel.MODEL_ID);
- if(openedModel != null) {
- root = openedModel.lookupRoot();
- }
- } catch (ServiceException e) {
- //Ignored: The selection cannot be used to retrieve the ServicesRegistry
- } catch (NotFoundException e) {
- Activator.log.error(e);
- }
- }
-
- return root;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.common.utils;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.papyrus.infra.core.resource.NotFoundException;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForSelection;
+import org.eclipse.papyrus.sysml.SysmlPackage;
+import org.eclipse.papyrus.sysml.blocks.BlocksPackage;
+import org.eclipse.papyrus.sysml.diagram.common.Activator;
+import org.eclipse.papyrus.sysml.requirements.RequirementsPackage;
+import org.eclipse.papyrus.uml.tools.model.UmlModel;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.Profile;
+import org.eclipse.uml2.uml.util.UMLUtil;
+
+/**
+ * This class is a Property tester used to check is current model (meaning the model currently opened in Papyrus) is a SysML Model.
+ * This class is used in order to create test for deciding whether a diagram creation command should be visible or not.
+ * This property tester assumes that currently active editor is Papyrus, it should be used with care (simultaneously with a test to ensure Papyrus is
+ * currently opened and active).
+ *
+ */
+public class SysMLSelectionTester extends PropertyTester {
+
+ /** Tester ID for SysML Model nature. This is currently a test on: is this a blocks profiles package... */
+ public final static String IS_SYSML_MODEL = "isSysMLModel";
+
+ /** Tester ID for SysML Requirements Model nature */
+ public final static String IS_SYSML_REQUIREMENTS_MODEL = "isSysMLRequirementsModel";
+
+ /** Tester ID for SysML Blocks Model nature */
+ public final static String IS_SYSML_BLOCKS_MODEL = "isSysMLBlocksModel";
+
+ /** Default constructor */
+ public SysMLSelectionTester() {
+ }
+
+ /** Test the receiver against the selected property */
+ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
+
+ // Ensure Papyrus is the active editor
+ Object currentValue = null;
+ if(IS_SYSML_MODEL.equals(property)) {
+ currentValue = testSysMLModelNature(receiver);
+ return (currentValue == expectedValue);
+ } else if(IS_SYSML_BLOCKS_MODEL.equals(property)) {
+ currentValue = testSysMLBlocksModelNature(receiver);
+ return (currentValue == expectedValue);
+ } else if(IS_SYSML_REQUIREMENTS_MODEL.equals(property)) {
+ currentValue = testSysMLRequirementsModelNature(receiver);
+ return (currentValue == expectedValue);
+ }
+
+ return false;
+ }
+
+ /** True is root object is a UML Model with SysML Profile (and sub profiles) applied */
+ protected boolean testSysMLModelNature(Object receiver) {
+ boolean isSysMLModel = false;
+
+ EObject root = getRoot(receiver);
+ if(root instanceof Package) {
+ Profile sysml = UMLUtil.getProfile(SysmlPackage.eINSTANCE, root);
+ if(((Package)root).isProfileApplied(sysml)) {
+ isSysMLModel = true;
+ }
+ }
+
+ return isSysMLModel;
+ }
+
+ /** True is root object is a UML Model with SysML Requirements Profile applied */
+ protected boolean testSysMLRequirementsModelNature(Object receiver) {
+ boolean isSysMLModel = false;
+
+ EObject root = getRoot(receiver);
+ if(root instanceof Package) {
+ Profile sysml = UMLUtil.getProfile(RequirementsPackage.eINSTANCE, root);
+ if(((Package)root).isProfileApplied(sysml)) {
+ isSysMLModel = true;
+ }
+ }
+
+ return isSysMLModel;
+ }
+
+ /** True is root object is a UML Model with SysML Blocks Profile applied */
+ protected boolean testSysMLBlocksModelNature(Object receiver) {
+ boolean isSysMLModel = false;
+
+ EObject root = getRoot(receiver);
+ if(root instanceof Package) {
+ Profile sysml = UMLUtil.getProfile(BlocksPackage.eINSTANCE, root);
+ if(((Package)root).isProfileApplied(sysml)) {
+ isSysMLModel = true;
+ }
+ }
+
+ return isSysMLModel;
+ }
+
+ /** Returns the root EObject of currently opened model */
+ private EObject getRoot(Object receiver) {
+ EObject root = null;
+
+ if(receiver instanceof ISelection) {
+ ISelection selection = (ISelection)receiver;
+ if(selection.isEmpty()) {
+ return null;
+ }
+
+ try {
+ ServiceUtilsForSelection serviceUtils = ServiceUtilsForSelection.getInstance();
+ UmlModel openedModel = (UmlModel)serviceUtils.getModelSet(selection).getModel(UmlModel.MODEL_ID);
+ if(openedModel != null) {
+ root = openedModel.lookupRoot();
+ }
+ } catch (ServiceException e) {
+ //Ignored: The selection cannot be used to retrieve the ServicesRegistry
+ } catch (NotFoundException e) {
+ Activator.log.error(e);
+ }
+ }
+
+ return root;
+ }
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/.classpath b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/.classpath
index f6326c88c74..59cf3977c7e 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/.classpath
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/.classpath
@@ -1,8 +1,8 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="custom-src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="src-gen"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/.options b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/.options
deleted file mode 100644
index 429092f38cf..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/.options
+++ /dev/null
@@ -1,7 +0,0 @@
-# Tracing options for the org.eclipse.papyrus.sysml.diagram.parametric plug-in
-
-# Common issues
-org.eclipse.papyrus.sysml.diagram.parametric/debug=false
-
-# Visual IDs
-org.eclipse.papyrus.sysml.diagram.parametric/debug/visualID=false
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/.project b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/.project
index b331235c1b0..00bd1cbfb8f 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/.project
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/.project
@@ -1,28 +1,28 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.papyrus.sysml.diagram.parametric</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.sysml.diagram.parametric</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/.settings/Parametric.gmfgen.prefs b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/.settings/Parametric.gmfgen.prefs
deleted file mode 100644
index 1bf41606aa9..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/.settings/Parametric.gmfgen.prefs
+++ /dev/null
@@ -1,8 +0,0 @@
-#Fri Apr 22 15:21:30 CEST 2011
-dynamic_figure_templates=platform\:/resource/org.eclipse.papyrus.def/dynamic-templates3.5/codegen
-eclipse.preferences.version=1
-generate_rcp=false
-ignore_gmfgen_validation=true
-ignore_mapmodel_validation=true
-use_map_mode=true
-use_runtime_figures=true
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/.settings/org.eclipse.jdt.core.prefs b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/.settings/org.eclipse.jdt.core.prefs
index 86564f572aa..af0f20f97a5 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/.settings/org.eclipse.jdt.core.prefs
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/.settings/org.eclipse.jdt.core.prefs
@@ -1,8 +1,7 @@
-#Tue Dec 01 16:58:52 CET 2009
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/.svnignore b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/.svnignore
deleted file mode 100644
index c5e82d74585..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/.svnignore
+++ /dev/null
@@ -1 +0,0 @@
-bin \ No newline at end of file
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/META-INF/MANIFEST.MF b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/META-INF/MANIFEST.MF
index 418680d8468..a7a0d4d5a1c 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/META-INF/MANIFEST.MF
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/META-INF/MANIFEST.MF
@@ -1,69 +1,54 @@
-Manifest-Version: 1.0
-Export-Package: org.eclipse.papyrus.sysml.diagram.parametric,
- org.eclipse.papyrus.sysml.diagram.parametric.edit.commands,
- org.eclipse.papyrus.sysml.diagram.parametric.edit.helpers,
- org.eclipse.papyrus.sysml.diagram.parametric.edit.parts,
- org.eclipse.papyrus.sysml.diagram.parametric.edit.policies,
- org.eclipse.papyrus.sysml.diagram.parametric.navigator,
- org.eclipse.papyrus.sysml.diagram.parametric.parsers,
- org.eclipse.papyrus.sysml.diagram.parametric.part,
- org.eclipse.papyrus.sysml.diagram.parametric.preferences,
- org.eclipse.papyrus.sysml.diagram.parametric.providers,
- org.eclipse.papyrus.sysml.diagram.parametric.sheet
-Bundle-ActivationPolicy: lazy
-Bundle-ClassPath: .
-Bundle-Name: %pluginName
-Bundle-Localization: plugin
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.core.resources,
- org.eclipse.core.expressions,
- org.eclipse.jface,
- org.eclipse.ui.ide,
- org.eclipse.ui.views,
- org.eclipse.ui.navigator,
- org.eclipse.ui.navigator.resources,
- org.eclipse.emf.ecore,
- org.eclipse.emf.ecore.xmi,
- org.eclipse.emf.edit.ui,
- org.eclipse.gmf.runtime.emf.core,
- org.eclipse.gmf.runtime.emf.commands.core,
- org.eclipse.gmf.runtime.emf.ui.properties,
- org.eclipse.gmf.runtime.diagram.ui,
- org.eclipse.gmf.runtime.diagram.ui.properties,
- org.eclipse.gmf.runtime.diagram.ui.providers,
- org.eclipse.gmf.runtime.diagram.ui.providers.ide,
- org.eclipse.gmf.runtime.diagram.ui.render,
- org.eclipse.gmf.runtime.diagram.ui.resources.editor,
- org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide,
- org.eclipse.draw2d;visibility:=reexport,
- org.eclipse.papyrus.sysml;bundle-version="0.10.1";visibility:=reexport,
- org.eclipse.papyrus.sysml.edit;bundle-version="0.10.1";visibility:=reexport,
- org.eclipse.emf.ecore;visibility:=reexport,
- org.eclipse.emf.ecore.edit;visibility:=reexport,
- org.eclipse.uml2.uml;visibility:=reexport,
- org.eclipse.uml2.uml.edit;visibility:=reexport,
- org.eclipse.papyrus.resource;bundle-version="0.10.1";visibility:=reexport,
- org.eclipse.papyrus.resource.edit;bundle-version="0.10.1";visibility:=reexport,
- org.eclipse.gef,
- org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="0.10.1",
- org.eclipse.papyrus.extensionpoints.editors;bundle-version="0.10.1",
- org.eclipse.papyrus.uml.diagram.common;bundle-version="0.10.1",
- org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="0.10.1",
- org.eclipse.papyrus.uml.standard;bundle-version="0.10.1";visibility:=reexport,
- org.eclipse.papyrus.uml.standard.edit;bundle-version="0.10.1";visibility:=reexport,
- org.eclipse.gmf.runtime.draw2d.ui;visibility:=reexport,
- org.eclipse.papyrus.parsers;bundle-version="0.10.1",
- org.eclipse.ocl.ecore;visibility:=reexport,
- org.eclipse.emf.validation;visibility:=reexport,
- org.eclipse.papyrus.infra.emf.appearance;bundle-version="0.10.1"
-Bundle-Vendor: %providerName
-Eclipse-LazyStart: true
-Bundle-Version: 0.10.1.qualifier
-Bundle-ManifestVersion: 2
-Bundle-Activator: org.eclipse.papyrus.sysml.diagram.parametric.part.Sy
- smlDiagramEditorPlugin
-Bundle-SymbolicName: org.eclipse.papyrus.sysml.diagram.parametric;sing
- leton:=true
-
+Manifest-Version: 1.0
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.papyrus.sysml;bundle-version="0.10.1",
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="0.10.1",
+ org.eclipse.emf.common.ui;bundle-version="2.5.0",
+ org.eclipse.gmf.runtime.diagram.ui.resources.editor;bundle-version="1.2.0",
+ org.eclipse.papyrus.uml.diagram.composite;bundle-version="0.10.1",
+ org.eclipse.gmf.runtime.diagram.ui.providers;bundle-version="1.3.0",
+ org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="0.10.1",
+ org.eclipse.core.expressions,
+ org.eclipse.papyrus.sysml.service.types;bundle-version="0.10.1",
+ org.eclipse.papyrus.uml.service.types;bundle-version="0.10.1",
+ org.eclipse.papyrus.infra.widgets;bundle-version="0.10.1",
+ org.eclipse.gmf.runtime.diagram.core;bundle-version="1.4.1",
+ org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.5.0",
+ org.eclipse.papyrus.uml.tools;bundle-version="0.10.1",
+ org.eclipse.papyrus.infra.core.log;bundle-version="0.10.1",
+ org.eclipse.papyrus.infra.core;bundle-version="0.10.1",
+ org.eclipse.papyrus.infra.core.sasheditor;bundle-version="0.10.1",
+ org.eclipse.papyrus.infra.services.edit;bundle-version="0.10.1",
+ org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="0.10.1",
+ org.eclipse.ui.ide;bundle-version="3.8.0",
+ org.eclipse.papyrus.uml.tools.utils;bundle-version="0.10.1",
+ org.eclipse.papyrus.infra.emf;bundle-version="0.10.1",
+ org.eclipse.uml2.uml;bundle-version="4.0.0",
+ org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.2.0",
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.1",
+ org.eclipse.papyrus.infra.services.labelprovider;bundle-version="0.10.1",
+ org.eclipse.gmf.tooling.runtime;bundle-version="3.1.0",
+ org.eclipse.papyrus.sysml.diagram.internalblock;bundle-version="0.10.1",
+ org.eclipse.papyrus.uml.diagram.common;bundle-version="0.10.1",
+ org.eclipse.papyrus.sysml.diagram.common;bundle-version="0.10.1"
+Bundle-ManifestVersion: 2
+Bundle-ActivationPolicy: lazy
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-SymbolicName: org.eclipse.papyrus.sysml.diagram.parametric;singleton:=true
+Bundle-Version: 0.10.1.qualifier
+Bundle-Vendor: %providerName
+Bundle-Activator: org.eclipse.papyrus.sysml.diagram.parametric.Activator
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Export-Package: org.eclipse.papyrus.sysml.diagram.parametric,
+ org.eclipse.papyrus.sysml.diagram.parametric.commands,
+ org.eclipse.papyrus.sysml.diagram.parametric.edit.part,
+ org.eclipse.papyrus.sysml.diagram.parametric.edit.policy,
+ org.eclipse.papyrus.sysml.diagram.parametric.factory,
+ org.eclipse.papyrus.sysml.diagram.parametric.figures,
+ org.eclipse.papyrus.sysml.diagram.parametric.parser,
+ org.eclipse.papyrus.sysml.diagram.parametric.part,
+ org.eclipse.papyrus.sysml.diagram.parametric.policies,
+ org.eclipse.papyrus.sysml.diagram.parametric.preferences,
+ org.eclipse.papyrus.sysml.diagram.parametric.provider,
+ org.eclipse.papyrus.sysml.diagram.parametric.utils
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/about.html b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/about.html
index 50d9eae0154..d35d5aed64c 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/about.html
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/about.html
@@ -1,28 +1,28 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
-<title>About</title>
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>December 15, 2009</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
-
-</body>
-</html> \ No newline at end of file
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/build.properties b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/build.properties
index 5dc0d74d81c..4874aad550f 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/build.properties
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/build.properties
@@ -1,15 +1,11 @@
-#
-#Mon Sep 12 09:30:14 CEST 2011
-bin.includes = META-INF/,\
- .,\
- plugin.xml,\
- messages.properties,\
- icons/,\
- plugin.properties,\
- .options,\
- about.html
-output..=bin/
-jars.compile.order=.
-src.includes = about.html
-source..=src/,custom-src/
-bin..=bin/
+source.. = src/,\
+ src-gen/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.properties,\
+ plugin.xml,\
+ palettes/,\
+ icons/,\
+ about.html
+src.includes = model/
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/CreateParametricDiagramCommand.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/CreateParametricDiagramCommand.java
deleted file mode 100644
index 545b68c8839..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/CreateParametricDiagramCommand.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric;
-
-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.gmf.runtime.diagram.core.preferences.PreferencesHint;
-import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
-import org.eclipse.gmf.runtime.diagram.ui.commands.CreateCommand;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor;
-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.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
-import org.eclipse.papyrus.infra.gmfdiag.common.AbstractPapyrusGmfCreateDiagramCommandHandler;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ParametricEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlDiagramEditorPlugin;
-import org.eclipse.papyrus.sysml.util.SysmlResource;
-import org.eclipse.papyrus.uml.tools.utils.PackageUtil;
-import org.eclipse.uml2.uml.Class;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Model;
-import org.eclipse.uml2.uml.Profile;
-
-public class CreateParametricDiagramCommand extends AbstractPapyrusGmfCreateDiagramCommandHandler {
-
- /** the Block containing the diagram */
- private Class selectedElement = null;
-
- @Override
- protected String getDiagramNotationID() {
- return ParametricEditPart.MODEL_ID;
- }
-
- @Override
- protected PreferencesHint getPreferenceHint() {
- return SysmlDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT;
- }
-
- @Override
- protected String getDefaultDiagramName() {
- return "ParametricDiagram";
- }
-
- // @Override
- // protected EObject createRootElement() {
- // return UMLFactory.eINSTANCE.createModel();
- // }
- //
- // @Override
- // protected void initializeModel(EObject owner) {
- // EObject eObject = getSelectedElement();
- // if(eObject == null) {
- // eObject = owner;
- // }
- //
- // if(eObject instanceof Class) {
- // this.selectedElement = (Class)eObject;
- // }
- // }
-
- @Override
- protected void initializeDiagram(EObject diagram) {
- if(diagram instanceof Diagram) {
- Diagram diag = (Diagram)diagram;
- // test if the selected class is a block
- if(selectedElement != null && selectedElement.getAppliedStereotype(SysmlResource.BLOCK_ID) != null) {
- // YT : Not sure to understand why the selected element is tested to be a Block instead of Block || BlockConstraint
- diag.setElement(selectedElement);
- createParametricGraph(selectedElement, diag);
- }
- }
- }
-
- @Override
- protected Diagram createDiagram(Resource diagramResource, EObject owner, String name) {
- Diagram diagram = null;
-
- // FIXME : Dead code below, owner cannot be a Model due to ParametricDiagramCondition
- // which restricts possible owner to Class only (Block or ConstraintBlock).
- if(owner instanceof Model) {
- Model model = (Model)owner;
-
- if((model.getAppliedProfile(SysmlResource.SYSML_ID, true) == null) || (model.getAppliedProfile(SysmlResource.BLOCKS_ID, true) == null)) {
- // Retrieve SysML profile and apply with sub-profiles
- Profile sysml = (Profile)PackageUtil.loadPackage(URI.createURI(SysmlResource.SYSML_PROFILE_URI), model.eResource().getResourceSet());
- PackageUtil.applyProfile(model, sysml, true);
- }
-
- Class ownedClass = model.createOwnedClass("Parametric", false);
- ownedClass.applyStereotype(ownedClass.getApplicableStereotype(SysmlResource.BLOCK_ID));
- diagram = super.createDiagram(diagramResource, ownedClass, name);
-
- } else if(owner instanceof Class) {
- diagram = super.createDiagram(diagramResource, owner, name);
- }
- return diagram;
- }
-
- /**
- * Complete a Parametric diagram with required graphical elements.
- *
- * @param element
- * the element to which the diagram is associated
- * @param diagram
- * the diagram to complete
- */
- private void createParametricGraph(Element element, Diagram diagram) {
- /*
- * This method implementation allow you to create graphical nodes if required. You may
- * delete it if not necessary.
- */
- TransactionalEditingDomain editingdomain = EditorUtils.getTransactionalEditingDomain();
- IAdaptable elementAdapter = new EObjectAdapter(element);
- ViewDescriptor descriptor = new ViewDescriptor(elementAdapter, Node.class, null, ViewUtil.APPEND, true, SysmlDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
-
- CreateCommand nodeCreationCommand = new CreateCommand(editingdomain, descriptor, diagram);
-
- editingdomain.getCommandStack().execute(new GMFtoEMFCommandWrapper(nodeCreationCommand));
- }
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/ParametricDiagramEditorFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/ParametricDiagramEditorFactory.java
deleted file mode 100644
index 9f55e97aad4..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/ParametricDiagramEditorFactory.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric;
-
-import org.eclipse.papyrus.infra.gmfdiag.common.GmfEditorFactory;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ParametricEditPart;
-
-public class ParametricDiagramEditorFactory extends GmfEditorFactory {
-
- /**
- * Instantiates a new use case diagram editor factory.
- */
- public ParametricDiagramEditorFactory() {
- super(ParametricDiagramForMultiEditor.class, ParametricEditPart.MODEL_ID);
- }
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/actions/RestoreRelatedLinksAction.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/actions/RestoreRelatedLinksAction.java
deleted file mode 100644
index 153c2d30d09..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/actions/RestoreRelatedLinksAction.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.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.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.sysml.diagram.parametric.command.RestoreRelatedLinksCommand;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ParametricEditPart;
-import org.eclipse.papyrus.uml.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 ParametricEditPart.MODEL_ID;
- }
-
- /**
- * @see org.eclipse.jface.action.Action#isEnabled()
- */
- @Override
- public boolean isEnabled() {
- Diagram currentDiagram = getCurrentDiagram();
- if(currentDiagram != null) {
- return (!getSelection().isEmpty() && getDiagramNotationID().equals(currentDiagram.getType()));
- }
- return false;
- }
-
- /**
- * @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/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/command/CreateConstraintPropertyCommand.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/command/CreateConstraintPropertyCommand.java
deleted file mode 100644
index c2d5a2f2112..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/command/CreateConstraintPropertyCommand.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.eclipse.papyrus.sysml.diagram.parametric.command;
-
-import java.util.List;
-
-import org.eclipse.gmf.runtime.diagram.ui.commands.CreateOrSelectElementCommand;
-import org.eclipse.swt.widgets.Shell;
-
-
-public class CreateConstraintPropertyCommand extends CreateOrSelectElementCommand {
-
- public CreateConstraintPropertyCommand(Shell parentShell, List content) {
- super(parentShell, content);
- // TODO Auto-generated constructor stub
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/command/CreateParameterViewCommand.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/command/CreateParameterViewCommand.java
deleted file mode 100644
index 6291c5014d1..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/command/CreateParameterViewCommand.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.command;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.CompoundCommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.commands.Property2CreateCommand;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ConstraintPropertyEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.providers.SysmlElementTypes;
-
-public class CreateParameterViewCommand extends Command {
-
- /** The compartment which graphically contains the Constraint to create */
- private ConstraintPropertyEditPart compartment = null;
-
- /** The command to create the Constraint element */
- private ICommandProxy elementCreationCommand = null;
-
- /** The command to create corresponding views (constraint view and link view) */
- private CompoundCommand viewsCreationCommand = null;
-
- /** The type of local condition to create */
- private IHintedType type;
-
- public CreateParameterViewCommand() {
- super();
- }
-
- public CreateParameterViewCommand(String label) {
- super(label);
- }
-
- /**
- * Constructor a new action to create the local condition and corresponding views.
- *
- * @param conditionType
- * the type of the local condition : precondition (Constraint_3011) or postcondition
- * (Constraint_3012)
- * @param graphicalParent
- * the parent edit part which graphically contains the condition
- * @param containerAction
- * the action which owns the local condition to create
- * @param actionPart
- * the part of the action owning the condition
- */
- public CreateParameterViewCommand(IHintedType conditionType, ConstraintPropertyEditPart graphicalParent, EObject containerAction, EditPart actionPart) {
- elementCreationCommand = getElementCreationCommand(containerAction, conditionType);
- compartment = graphicalParent;
- type = conditionType;
- }
-
- /**
- * Get the Command to create the constraint element
- *
- * @param containerAction
- * the action which owns the local condition to create
- * @param conditionType
- * the type of the local condition : precondition (Constraint_3011) or postcondition
- * (Constraint_3012)
- * @return the command to create model element or null
- */
- private static ICommandProxy getElementCreationCommand(EObject containerAction, IHintedType conditionType) {
- CreateElementRequest createElementReq = new CreateElementRequest(containerAction, conditionType);
- if(SysmlElementTypes.Property_3002.equals(conditionType)) {
- Property2CreateCommand cmd = new Property2CreateCommand(createElementReq);
- return new ICommandProxy(cmd);
- } else {
- return null;
- }
- }
-
- @Override
- public boolean canExecute() {
- return elementCreationCommand != null && elementCreationCommand.canExecute();
- }
-
- /**
- * Execute the command : create the model element, then the corresponding views
- *
- * @see org.eclipse.gef.commands.Command#execute()
- */
- @Override
- public void execute() {
- super.execute();
- // Object property = null;
- // if (elementCreationCommand != null) {
- // elementCreationCommand.execute();
- // property = elementCreationCommand.getICommand().getCommandResult().getReturnValue();
- // }
- }
-
- /**
- * Undo model and views creation
- *
- * @see org.eclipse.gef.commands.Command#undo()
- */
- @Override
- public void undo() {
- if(viewsCreationCommand != null) {
- viewsCreationCommand.undo();
- }
- if(elementCreationCommand != null) {
- elementCreationCommand.undo();
- }
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/command/RestoreRelatedLinksCommand.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/command/RestoreRelatedLinksCommand.java
deleted file mode 100644
index c06ca614951..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/command/RestoreRelatedLinksCommand.java
+++ /dev/null
@@ -1,335 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.command;
-
-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.sysml.diagram.parametric.edit.parts.ParametricEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlDiagramUpdater;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlLinkDescriptor;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.common.util.CommandUtil;
-
-/**
- * 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 {
-
- 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<SysmlLinkDescriptor> result, View view, List<?> descriptors) {
- for(Object object : descriptors) {
- if(false == object instanceof SysmlLinkDescriptor) {
- continue;
- }
- SysmlLinkDescriptor descriptor = (SysmlLinkDescriptor)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 collection
- * the collection of unique ingoing and outgoing links descriptors
- * @param sysmlLinkDescriptor
- * the descriptor to search
- * @return true if already exist
- */
- private boolean cleanContains(Collection<? extends SysmlLinkDescriptor> collection, SysmlLinkDescriptor sysmlLinkDescriptor) {
- for(Object object : collection) {
- if(object instanceof SysmlLinkDescriptor) {
- SysmlLinkDescriptor descriptor = (SysmlLinkDescriptor)object;
- if(descriptor.getModelElement() == sysmlLinkDescriptor.getModelElement() && descriptor.getSource() == sysmlLinkDescriptor.getSource() && descriptor.getDestination() == sysmlLinkDescriptor.getDestination() && descriptor.getVisualID() == sysmlLinkDescriptor.getVisualID()) {
- return true;
- }
- }
- }
-
- return false;
- }
-
- /**
- * Collects all related links for view
- *
- * @param view
- * @param domain2NotationMap
- *
- * @return linkdescriptors
- */
- protected Collection<? extends SysmlLinkDescriptor> collectPartRelatedLinks(View view, Map<EObject, View> domain2NotationMap) {
- Collection<SysmlLinkDescriptor> result = new LinkedList<SysmlLinkDescriptor>();
- if(!domain2NotationMap.containsKey(view.getElement())) {
- // We must prevent duplicate descriptors
- List<?> outgoingDescriptors = SysmlDiagramUpdater.getOutgoingLinks(view);
- cleanAdd(result, view, outgoingDescriptors);
-
- List<?> incomingDescriptors = SysmlDiagramUpdater.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 SysmlLinkDescriptor> linkDescriptors, Map<EObject, View> domain2NotationMap) {
- // map diagram
- mapModel(diagram, domain2NotationMap);
-
- for(SysmlLinkDescriptor 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 SysmlLinkDescriptor> getLinkDescriptorToProcess(View notationView, Map<EObject, View> domain2NotationMap) {
- // Collect all related link from semantic model
- Collection<? extends SysmlLinkDescriptor> 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 = SysmlVisualIDRegistry.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 SysmlLinkDescriptor> LinkDescriptorsIterator = linkDescriptors.iterator(); LinkDescriptorsIterator.hasNext();) {
- SysmlLinkDescriptor 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, SysmlLinkDescriptor 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(!ParametricEditPart.MODEL_ID.equals(SysmlVisualIDRegistry.getModelID(view))) {
- return;
- }
-
- // register the view if its type allows incoming or outgoing links
- if(!SysmlDiagramUpdater.getOutgoingLinks(view).isEmpty() || !SysmlDiagramUpdater.getIncomingLinks(view).isEmpty()) {
- 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 SysmlLinkDescriptor> 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/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/CreateParameterEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/CreateParameterEditPolicy.java
deleted file mode 100644
index 37d33140b36..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/CreateParameterEditPolicy.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.edit.policies;
-
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.RequestConstants;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gef.editpolicies.AbstractEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifiedTypeRequest;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ConstraintPropertyEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.providers.SysmlElementTypes;
-
-/**
- * Custom CreateParameterEditPolicy.
- */
-public class CreateParameterEditPolicy extends AbstractEditPolicy {
-
- public CreateParameterEditPolicy() {
- super();
- }
-
- @Override
- public Command getCommand(Request request) {
- if(RequestConstants.REQ_CREATE.equals(request.getType()) && request instanceof CreateUnspecifiedTypeRequest) {
- CreateUnspecifiedTypeRequest creationRequest = (CreateUnspecifiedTypeRequest)request;
- EditPart parentEditPart = getHost();
- if(parentEditPart instanceof ConstraintPropertyEditPart) {
- //ConstraintPropertyEditPart compartementPart = (ConstraintPropertyEditPart) parentEditPart;
- //EObject action = ViewUtil.resolveSemanticElement((View) getHost().getModel());
- for(Object obj : creationRequest.getElementTypes()) {
- if(SysmlElementTypes.Property_3002.equals(obj)) {
- // do nothing or display WarningAndLinkDialog
- return UnexecutableCommand.INSTANCE;
- // return new CreateParameterViewCommand((IHintedType) SysmlElementTypes.Property_3002,
- // compartementPart, action, getHost());
- }
- }
- }
- }
- return super.getCommand(request);
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/CustomDiagramDragDropEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/CustomDiagramDragDropEditPolicy.java
deleted file mode 100644
index 1dc70ffbf77..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/CustomDiagramDragDropEditPolicy.java
+++ /dev/null
@@ -1,258 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.edit.policies;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-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.LabelEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.sysml.constraints.ConstraintProperty;
-import org.eclipse.papyrus.sysml.constraints.ConstraintsPackage;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ConnectorEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ConstraintPropertyEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.PropertyEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.helper.ConnectorLinkMappingHelper;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlVisualIDRegistry;
-import org.eclipse.papyrus.sysml.diagram.parametric.providers.SysmlElementTypes;
-import org.eclipse.papyrus.sysml.diagram.parametric.utils.PropertyLinkedToClassifier;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.OldCommonDiagramDragDropEditPolicy;
-import org.eclipse.uml2.uml.Classifier;
-import org.eclipse.uml2.uml.ConnectableElement;
-import org.eclipse.uml2.uml.ConnectorEnd;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Property;
-
-/**
- * This class is used to execute the drag and drop from the outline. It can manage the drop of nodes
- * and binary links. To manage specific drop the method
- * CommonDiagramDragDropEditPolicy.getSpecificDropCommand has to be implemented
- */
-public class CustomDiagramDragDropEditPolicy extends OldCommonDiagramDragDropEditPolicy {
-
- /** The container view where the drop is done */
- private View containerView;
-
- /**
- * Instantiates a new custom diagram drag drop edit policy with the right link mapping helper.
- */
- public CustomDiagramDragDropEditPolicy() {
- super(ConnectorLinkMappingHelper.getInstance());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected Set<Integer> getDroppableElementVisualId() {
- Set<Integer> droppableElementsVisualId = new HashSet<Integer>();
- droppableElementsVisualId.add(ConnectorEditPart.VISUAL_ID);
- droppableElementsVisualId.add(ConstraintPropertyEditPart.VISUAL_ID);
- droppableElementsVisualId.add(PropertyEditPart.VISUAL_ID);
- return droppableElementsVisualId;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public IElementType getUMLElementType(int elementID) {
- return SysmlElementTypes.getElementType(elementID);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int getNodeVisualID(View containerView, EObject domainElement) {
- this.containerView = containerView;
- if(domainElement instanceof Element) {
- EObject e = getApplication(domainElement);
- if(e != null) {
- if(e instanceof ConstraintProperty) {
- return ConstraintPropertyEditPart.VISUAL_ID;
- }
- // others cases for stereotyped elements
- }
- }
- return SysmlVisualIDRegistry.getNodeVisualID(containerView, domainElement);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int getLinkWithClassVisualID(EObject domainElement) {
- return SysmlVisualIDRegistry.getLinkWithClassVisualID(domainElement);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected Command getSpecificDropCommand(DropObjectsRequest dropRequest, Element semanticLink, int nodeVISUALID, int linkVISUALID) {
- if(nodeVISUALID != -1) {
- switch(nodeVISUALID) {
- case ConstraintPropertyEditPart.VISUAL_ID:
- return dropConstraintProperty(dropRequest, semanticLink, nodeVISUALID);
- case PropertyEditPart.VISUAL_ID:
- return dropProperty(dropRequest, semanticLink, nodeVISUALID);
- default:
- return super.getSpecificDropCommand(dropRequest, semanticLink, nodeVISUALID, linkVISUALID);
- }
- } else if(linkVISUALID != -1) {
- switch(linkVISUALID) {
- case ConnectorEditPart.VISUAL_ID:
- return dropConnector(dropRequest, semanticLink, linkVISUALID);
- default:
- return super.getSpecificDropCommand(dropRequest, semanticLink, nodeVISUALID, linkVISUALID);
- }
- } else {
- return UnexecutableCommand.INSTANCE;
- }
- }
-
- /**
- * Specific drop action for connector.
- *
- * @param dropRequest
- * the drop request
- * @param semanticLink
- * the semantic link
- * @param linkVISUALID
- * the link visual Sid
- *
- * @return the command for connector
- */
- protected Command dropConnector(DropObjectsRequest dropRequest, Element semanticLink, int linkVISUALID) {
- Collection<?> sources = ConnectorLinkMappingHelper.getInstance().getSource(semanticLink);
- Collection<?> targets = ConnectorLinkMappingHelper.getInstance().getTarget(semanticLink);
- if(sources.size() == 1 && targets.size() == 1) {
- ConnectorEnd sourceConnector = (ConnectorEnd)sources.toArray()[0];
- ConnectorEnd targetConnector = (ConnectorEnd)targets.toArray()[0];
- ConnectableElement source = sourceConnector.getRole();
- ConnectableElement target = targetConnector.getRole();
- return new ICommandProxy(dropBinaryLink(new CompositeCommand("drop Connector"), source, target, linkVISUALID, dropRequest.getLocation(), semanticLink));
- } else {
- return UnexecutableCommand.INSTANCE;
- }
- }
-
- /**
- * Specific drop for constraint property.
- *
- * @param dropRequest
- * the drop request
- * @param semanticElement
- * the semantic link
- * @param nodeVISUALID
- * the node visual id
- *
- * @return the default drop node command for Constraint Property object
- */
- private Command dropConstraintProperty(DropObjectsRequest dropRequest, Element semanticElement, int nodeVISUALID) {
- CompositeCommand cc = new CompositeCommand("Drop");
- EObject droppedObject = getApplication(semanticElement);
- if(droppedObject != null) {
- cc = getDefaultDropNodeCommand(nodeVISUALID, dropRequest.getLocation(), droppedObject);
- return new ICommandProxy(cc);
- }
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- * Specific drop for property. Check if the property is linked to the classifier we want to
- * drag&drop on
- *
- * @param dropRequest
- * the drop request
- * @param semanticElement
- * the semantic element
- * @param nodeVISUALID
- * the node visual id
- *
- * @return the command
- */
- private Command dropProperty(DropObjectsRequest dropRequest, Element semanticElement, int nodeVISUALID) {
- EObject eObject = containerView.getElement();
- if(eObject instanceof Classifier) {
- PropertyLinkedToClassifier propertyLinkedToClassifier = new PropertyLinkedToClassifier((Classifier)eObject, (Property)semanticElement);
- if(propertyLinkedToClassifier.isLinkedToClassifier()) {
- CompositeCommand cc = new CompositeCommand("Drop");
- cc = getDefaultDropNodeCommand(nodeVISUALID, dropRequest.getLocation(), semanticElement);
- return new ICommandProxy(cc);
- }
- }
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected boolean isEditPartTypeSuitableForEClass(Class<? extends GraphicalEditPart> editPartClass, EClass eClass) {
- // avoid selecting a label instead of the activity node
- return !LabelEditPart.class.isAssignableFrom(editPartClass);
- }
-
- /**
- * Gets stereotype application element for a specified domain element.
- *
- * @param domainElement
- * the domain element
- *
- * @return the stereotype application object
- */
- private EObject getApplication(EObject domainElement) {
- if(getStereotypeAvailable(domainElement) != null && domainElement instanceof Element) {
- Element element = (Element)domainElement;
- List<EObject> applications = element.getStereotypeApplications();
- for(EObject eObject : applications) {
- if(getStereotypeAvailable(domainElement).equals(eObject.eClass())) {
- return eObject;
- }
- }
- }
- return null;
- }
-
- /**
- * Gets the available stereotype EClass for a specified EObject
- *
- * @param eObject
- * the e object
- *
- * @return the stereotype available
- */
- private EClass getStereotypeAvailable(EObject eObject) {
- if(eObject instanceof Property) {
- return ConstraintsPackage.Literals.CONSTRAINT_PROPERTY;
- }
- return null;
- }
-
-
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/NoDeleteFromDiagramEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/NoDeleteFromDiagramEditPolicy.java
deleted file mode 100644
index 603177f4747..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/NoDeleteFromDiagramEditPolicy.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.edit.policies;
-
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gef.editpolicies.AbstractEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-
-/**
- * This edit policy disables the graphical deletion of a diagram element.
- */
-public class NoDeleteFromDiagramEditPolicy extends AbstractEditPolicy {
-
- /**
- * Returns true when the request is a graphical delete
- *
- * @see org.eclipse.gef.EditPolicy#understandsRequest(Request)
- */
- @Override
- public boolean understandsRequest(Request req) {
- return RequestConstants.REQ_DELETE.equals(req.getType());
- }
-
- /**
- * Returns an unexecutable command for graphical delete.
- *
- * @see org.eclipse.gef.EditPolicy#getCommand(Request)
- */
- @Override
- public Command getCommand(Request request) {
- if(RequestConstants.REQ_DELETE.equals(request.getType())) {
- return UnexecutableCommand.INSTANCE;
- } else if(EditPolicy.DIRECT_EDIT_ROLE.equals(request.getType())) {
- return UnexecutableCommand.INSTANCE;
- }
- return super.getCommand(request);
- }
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/NoDeleteFromModelEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/NoDeleteFromModelEditPolicy.java
deleted file mode 100644
index 5f348e1f301..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/NoDeleteFromModelEditPolicy.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.edit.policies;
-
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gef.editpolicies.AbstractEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandRequestWrapper;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
-
-/**
- * This edit policy disables the graphical deletion of a diagram element.
- */
-public class NoDeleteFromModelEditPolicy extends AbstractEditPolicy {
-
- /**
- * Returns true when the request is a graphical delete
- *
- * @see org.eclipse.gef.EditPolicy#understandsRequest(Request)
- */
- @Override
- public boolean understandsRequest(Request req) {
- if(RequestConstants.REQ_SEMANTIC_WRAPPER.equals(req.getType()) && req instanceof EditCommandRequestWrapper) {
- IEditCommandRequest wrappedRequest = ((EditCommandRequestWrapper)req).getEditCommandRequest();
- if(wrappedRequest instanceof DestroyElementRequest) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Returns an unexecutable command for graphical delete.
- *
- * @see org.eclipse.gef.EditPolicy#getCommand(Request)
- */
- @Override
- public Command getCommand(Request request) {
- if(RequestConstants.REQ_SEMANTIC_WRAPPER.equals(request.getType()) && request instanceof EditCommandRequestWrapper) {
- IEditCommandRequest wrappedRequest = ((EditCommandRequestWrapper)request).getEditCommandRequest();
- if(wrappedRequest instanceof DestroyElementRequest) {
- return UnexecutableCommand.INSTANCE;
- }
- }
- return super.getCommand(request);
- }
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/figures/CenteredWrappedLabel.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/figures/CenteredWrappedLabel.java
deleted file mode 100644
index 8c3527909da..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/figures/CenteredWrappedLabel.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.figures;
-
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-
-/**
- * This class is a {@link WrappingLabel}, which default behavior is set differently :
- *
- * The text is centered and automatically wraps on several lines.
- */
-public class CenteredWrappedLabel extends WrappingLabel {
-
- /**
- * Construct an empty wrapping label with customized alignment.
- */
- public CenteredWrappedLabel() {
- super();
- setTextJustification(WrappingLabel.CENTER);
- setAlignment(WrappingLabel.CENTER);
- setTextWrap(true);
- }
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/helper/ConnectorLinkMappingHelper.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/helper/ConnectorLinkMappingHelper.java
deleted file mode 100644
index 2db374f7d99..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/helper/ConnectorLinkMappingHelper.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.helper;
-
-import java.util.Collection;
-import java.util.Collections;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.papyrus.uml.diagram.common.helper.ILinkMappingHelper;
-import org.eclipse.papyrus.uml.diagram.common.helper.LinkMappingHelper;
-import org.eclipse.papyrus.uml.diagram.common.helper.LinkMappingHelper.CommonSourceUMLSwitch;
-import org.eclipse.papyrus.uml.diagram.common.helper.LinkMappingHelper.CommonTargetUMLSwitch;
-import org.eclipse.uml2.uml.ConnectorEnd;
-import org.eclipse.uml2.uml.Element;
-
-/**
- * Specialization of the link mapping helper for the Connector
- *
- * @author eperico
- */
-public class ConnectorLinkMappingHelper implements ILinkMappingHelper {
-
- /**
- * SingletonHolder is loaded at the first execution of getInstance() method
- */
- private static class SingletonHolder {
-
- private final static ConnectorLinkMappingHelper instance = new ConnectorLinkMappingHelper();
- }
-
- /**
- * Gets the single instance of ConnectorLinkMappingHelper.
- *
- * @return single instance of ConnectorLinkMappingHelper
- */
- public static ConnectorLinkMappingHelper getInstance() {
- return SingletonHolder.instance;
- }
-
- /**
- * private constructor
- */
- private ConnectorLinkMappingHelper() {
- // do nothing
- }
-
- /**
- * {@inheritDoc}
- */
- public Collection<?> getSource(Element link) {
- return LinkMappingHelper.getSource(link, new CommonSourceUMLSwitch() {
-
- public java.util.Collection<?> caseConnector(org.eclipse.uml2.uml.Connector object) {
- EList<ConnectorEnd> ends = object.getEnds();
- if(ends != null && !ends.isEmpty()) {
- return Collections.singleton(object.getEnds().get(0));
- }
- return Collections.emptyList();
- };
- });
- }
-
- /**
- * {@inheritDoc}
- */
- public Collection<?> getTarget(Element link) {
- return LinkMappingHelper.getTarget(link, new CommonTargetUMLSwitch() {
-
- public java.util.Collection<?> caseConnector(org.eclipse.uml2.uml.Connector object) {
- EList<ConnectorEnd> ends = object.getEnds();
- if(ends != null && !ends.isEmpty() && ends.size() > 0) {
- return Collections.singleton(object.getEnds().get(1));
- }
- return Collections.emptyList();
- };
- });
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/helper/ModelValidationHelper.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/helper/ModelValidationHelper.java
deleted file mode 100644
index 500961026fc..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/helper/ModelValidationHelper.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.helper;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.emf.validation.EMFEventType;
-import org.eclipse.emf.validation.IValidationContext;
-import org.eclipse.papyrus.resource.Resource;
-import org.eclipse.papyrus.resource.util.ResourceUtil;
-import org.eclipse.papyrus.sysml.blocks.BlocksFactory;
-import org.eclipse.papyrus.sysml.blocks.NestedConnectorEnd;
-import org.eclipse.papyrus.sysml.diagram.parametric.utils.PropertyLinkedToClassifier;
-import org.eclipse.uml2.uml.Classifier;
-import org.eclipse.uml2.uml.ConnectableElement;
-import org.eclipse.uml2.uml.Connector;
-import org.eclipse.uml2.uml.ConnectorEnd;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Property;
-import org.eclipse.uml2.uml.Stereotype;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * The Class ModelValidationHelper
- */
-public class ModelValidationHelper {
-
- private static final String NESTED_CONNECTOR_END_STEREOTYPE = "SysML::Blocks::NestedConnectorEnd";
-
- /**
- * Validate connector end.
- *
- * @param connector
- * @param ctx
- * @return the status
- */
- public static IStatus validateConnector(Connector connector, IValidationContext ctx) {
- if((EMFEventType.ADD.equals(ctx.getEventType()) || EMFEventType.ADD_MANY.equals(ctx.getEventType())) && UMLPackage.eINSTANCE.getConnector_End().equals(ctx.getFeature())) {
- // do nothing
- }
- return ctx.createSuccessStatus();
- }
-
- /**
- * Validate property.
- *
- * @param property
- * @param ctx
- * @return the status
- */
- public static IStatus validateProperty(Property property, IValidationContext ctx) {
- // TODO this validator will manage connectorEnd update when source/target property is moved into and IBD
- if((EMFEventType.MOVE.equals(ctx.getEventType())) || (EMFEventType.SET.equals(ctx.getEventType()))) {
- // only update if property is linked to connector end
- for(ConnectorEnd end : property.getEnds()) {
- if(end.getOwner() != null && end.getOwner() instanceof Connector) {
- Element owner = ((Connector)end.getOwner()).getOwner();
- if(owner instanceof Classifier) {
- PropertyLinkedToClassifier link = new PropertyLinkedToClassifier((Classifier)owner, property);
- if(link.isLinkedWithMultiLevelPath()) {
- createNestedConnectorEnd(end);
- } else {
- Stereotype appliedStereotype = end.getAppliedStereotype(NESTED_CONNECTOR_END_STEREOTYPE);
- if(appliedStereotype != null) {
- end.unapplyStereotype(appliedStereotype);
- }
- }
- }
- }
- }
- }
- return ctx.createSuccessStatus();
- }
-
- /**
- * Validate connector end.
- *
- * @param connectorEnd
- * @param ctx
- * @return the status
- */
- public static IStatus validateConnectorEnd(ConnectorEnd connectorEnd, IValidationContext ctx) {
- if((EMFEventType.SET.equals(ctx.getEventType())) && UMLPackage.eINSTANCE.getConnectorEnd_Role().equals(ctx.getFeature())) {
- ConnectableElement connectableElement = connectorEnd.getRole();
- Element connector = connectorEnd.getOwner();
- if(connector != null && connector.getOwner() instanceof Classifier) {
- Classifier owner = (Classifier)connector.getOwner();
- PropertyLinkedToClassifier link = new PropertyLinkedToClassifier((Classifier)owner, (Property)connectableElement);
- if(link.isLinkedWithMultiLevelPath()) {
- // create a nested connector end
- NestedConnectorEnd end = createNestedConnectorEnd(connectorEnd);
- if(!link.getAvailableRoutes().isEmpty()) {
- end.getPropertyPath().addAll(link.getAvailableRoutes().get(0).getProperties());
- }
- } else {
- Stereotype appliedStereotype = connectorEnd.getAppliedStereotype(NESTED_CONNECTOR_END_STEREOTYPE);
- if(appliedStereotype != null) {
- connectorEnd.unapplyStereotype(appliedStereotype);
- }
- }
- }
- }
- return ctx.createSuccessStatus();
- }
-
- /**
- * Validate nested connector end.
- *
- * @param connectorEnd
- * @param ctx
- * @return the status
- */
- public static IStatus validateNestedConnectorEnd(NestedConnectorEnd connectorEnd, IValidationContext ctx) {
- // TODO setBase_ConnectorEnd should be set to null when connector is deleted, fix problem
- // with delete from model command
- // there are dangling references after this command
- // if (EMFEventType.SET.equals(ctx.getEventType())) {
- // ResourceUtil.getResource(connectorEnd).getEobjects().remove(connectorEnd);
- // }
- return ctx.createSuccessStatus();
- }
-
- /**
- * Creates the nested connector end for a connector end
- *
- * @param connectorEnd
- * the connector end
- * @return the nested connector end
- */
- private static NestedConnectorEnd createNestedConnectorEnd(ConnectorEnd connectorEnd) {
- NestedConnectorEnd nested = BlocksFactory.eINSTANCE.createNestedConnectorEnd();
- Resource res = ResourceUtil.getResource(connectorEnd);
- if(res != null) {
- res.getEobjects().add(nested);
- nested.setBase_ConnectorEnd(connectorEnd);
- }
- return nested;
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/helper/SelfCompartmentNotificationHelper.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/helper/SelfCompartmentNotificationHelper.java
deleted file mode 100644
index 0b14d5d7605..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/helper/SelfCompartmentNotificationHelper.java
+++ /dev/null
@@ -1,223 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.helper;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gmf.runtime.common.core.command.ICompositeCommand;
-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.CreateCommand;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
-import org.eclipse.gmf.runtime.notation.Edge;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
-import org.eclipse.papyrus.sysml.constraints.ConstraintProperty;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ConnectorEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ConstraintPropertyEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.Property2EditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.common.helper.NotificationHelper;
-import org.eclipse.papyrus.uml.diagram.common.providers.UIAdapterImpl;
-import org.eclipse.uml2.uml.Property;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * SelfCompartmentNotificationHelper is a particular NotificationHelper which manages the editparts
- * drawn in a particular compartment for a particular feature. It automatically add or remove
- * appropriate parts when model is modified, so that all contained elements are represented once.
- */
-public class SelfCompartmentNotificationHelper extends NotificationHelper {
-
- /** The UI adapter that listens model update */
- private UIAdapter adapter = new UIAdapter();
-
- /** The compartment part. */
- private final ConstraintPropertyEditPart compartmentPart;
-
- /** The child feature. */
- private final EStructuralFeature childFeature;
-
- /** The child type. */
- private final IHintedType childType;
-
- private static CompositeTransactionalCommand command;
-
- /**
- * Instantiates a new self compartment notification helper.
- *
- * @param compartmentPart
- * the compartment part
- * @param childFeature
- * the child feature
- * @param childType
- * the child type
- */
- public SelfCompartmentNotificationHelper(final ConstraintPropertyEditPart compartmentPart, final EStructuralFeature childFeature, final IHintedType childType) {
- this.compartmentPart = compartmentPart;
- this.childFeature = childFeature;
- this.childType = childType;
- this.setModelListener(adapter);
- }
-
- /**
- * private class UIAdapter.
- */
- private class UIAdapter extends UIAdapterImpl {
-
- @Override
- protected void safeNotifyChanged(Notification msg) {
- if(UMLPackage.eINSTANCE.getTypedElement_Type().equals(msg.getFeature())) {
- // listen type once it's set
- listenObject((Notifier)msg.getNewValue());
- updatePropertiesParts(compartmentPart, childFeature, childType);
- } else if(UMLPackage.eINSTANCE.getStructuredClassifier_OwnedAttribute().equals(msg.getFeature())) {
- updatePropertiesParts(compartmentPart, childFeature, childType);
- }
- }
- }
-
- /**
- * Update children edit parts so that each child is represented once
- *
- * @param compartmentPart
- * the compartment part containing children
- * @param childFeature
- * the feature containing children
- * @param childType
- * the children's IHintedType represented as Node
- */
- // TODO refactor this method
- public static void updatePropertiesParts(ConstraintPropertyEditPart compartmentPart, EStructuralFeature childFeature, IHintedType childType) {
- if(compartmentPart == null || childFeature == null || childType == null) {
- return;
- }
- command = new CompositeTransactionalCommand(EditorUtils.getTransactionalEditingDomain(), "update children");
- command.setTransactionNestingEnabled(false);
- if(compartmentPart.getModel() instanceof View) {
- View compartmentView = (View)compartmentPart.getModel();
- EObject containerObject = compartmentView.getElement();
- if(containerObject instanceof ConstraintProperty) {
- Property baseProperty = ((ConstraintProperty)containerObject).getBase_Property();
- if(baseProperty != null && baseProperty.getType() != null) {
- Object untypedOwnedObjects = baseProperty.getType().eGet(childFeature);
- if(untypedOwnedObjects instanceof List<?>) {
- List<?> ownedEObjectChildren = (List<?>)untypedOwnedObjects;
- Set<EObject> drawnEObjectChildren = new HashSet<EObject>(ownedEObjectChildren.size());
-
- // list children already drawn and remove old children
- for(Iterator<?> iterator = compartmentView.getPersistedChildren().iterator(); iterator.hasNext();) {
- EObject childView = (EObject)iterator.next();
- if(childView instanceof View && ((View)childView).getElement() != null) {
- EObject child = ((View)childView).getElement();
- switch(SysmlVisualIDRegistry.getVisualID((View)childView)) {
-
- case Property2EditPart.VISUAL_ID:
- // property already drawn
- if(ownedEObjectChildren.contains(child)) {
- drawnEObjectChildren.add(child);
- } else {
- // delete old connectors
- deleteConnectorsViews(command, (View)childView);
- // remove remaining property if any
- iterator.remove();
- }
- break;
-
- case ConstraintPropertyEditPart.VISUAL_ID:
- // property doesn't exist in the model, remove the view
- iterator.remove();
- break;
-
- default:
- break;
- }
- }
- }
- // draw remaining children
- List<Object> childrenToDraw = new ArrayList<Object>(ownedEObjectChildren);
- childrenToDraw.removeAll(drawnEObjectChildren);
- for(Object child : childrenToDraw) {
- if(child instanceof EObject) {
- IAdaptable adapter = new EObjectAdapter((EObject)child);
- ViewDescriptor descriptor = new ViewDescriptor(adapter, Node.class, childType.getSemanticHint(), ViewUtil.APPEND, true, compartmentPart.getDiagramPreferencesHint());
- CreateCommand nodeCreationCommand = new CreateCommand(compartmentPart.getEditingDomain(), descriptor, compartmentView);
- command.add(nodeCreationCommand);
- }
- }
- }
- } else {
- // constraint property type is set to null, remove old children
- for(Iterator<?> iterator = compartmentView.getPersistedChildren().iterator(); iterator.hasNext();) {
- EObject childView = (EObject)iterator.next();
- if((childView instanceof View) && SysmlVisualIDRegistry.getVisualID((View)childView) == Property2EditPart.VISUAL_ID) {
- // delete old connectors
- deleteConnectorsViews(command, (View)childView);
- // delete parameter view
- iterator.remove();
- }
- }
- }
- // execute transactional command
- execute();
- }
- }
- }
-
- /**
- * Execute command.
- */
- private static void execute() {
- if(!command.isEmpty()) {
- command.getEditingDomain().getCommandStack().execute(new GMFtoEMFCommandWrapper(command));
- }
- }
-
- /**
- * Delete source and target connectors of the deleted parameter view
- *
- * @param cmd
- * the cmd
- * @param propertyView
- * the property view
- */
- private static void deleteConnectorsViews(ICompositeCommand cmd, View propertyView) {
- for(Iterator<?> it = propertyView.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge)it.next();
- if(SysmlVisualIDRegistry.getVisualID(incomingLink) == ConnectorEditPart.VISUAL_ID) {
- cmd.add(new DeleteCommand(incomingLink));
- }
- }
- for(Iterator<?> it = propertyView.getSourceEdges().iterator(); it.hasNext();) {
- Edge outgoingLink = (Edge)it.next();
- if(SysmlVisualIDRegistry.getVisualID(outgoingLink) == ConnectorEditPart.VISUAL_ID) {
- cmd.add(new DeleteCommand(outgoingLink));
- }
- }
- }
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/locator/ParameterPositionLocator.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/locator/ParameterPositionLocator.java
deleted file mode 100644
index 8716abfaf2c..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/locator/ParameterPositionLocator.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.locator;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.papyrus.uml.diagram.common.locator.AdvancedBorderItemLocator;
-
-/**
- * The Class ParameterPositionLocator that manages position of property on constraint property
- */
-public class ParameterPositionLocator extends AdvancedBorderItemLocator {
-
- /** Constructor **/
- public ParameterPositionLocator(IFigure parentFigure) {
- super(parentFigure);
- }
-
- /** Constructor **/
- public ParameterPositionLocator(IFigure borderItem, IFigure parentFigure, Rectangle constraint) {
- super(borderItem, parentFigure, constraint);
- }
-
- /** Constructor **/
- public ParameterPositionLocator(IFigure parentFigure, int preferredSide) {
- super(parentFigure, preferredSide);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Rectangle getValidLocation(Rectangle proposedLocation, IFigure borderItem) {
- Rectangle realLocation = new Rectangle(proposedLocation);
- realLocation.width = Math.max(realLocation.width, realLocation.height);
- realLocation.height = realLocation.width;
- int side = findClosestSideOfParent(proposedLocation, getParentBorder());
- Point newTopLeft = locateOnBorder(realLocation.getTopLeft(), side, 0, borderItem);
- realLocation.setLocation(newTopLeft);
- return realLocation;
- }
-
- /**
- * Re-arrange the location of the border item.
- *
- * @see org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator#relocate(org.eclipse.draw2d.IFigure)
- *
- * @param borderItem
- */
- @Override
- public void relocate(IFigure borderItem) {
- // reset bounds of borderItem
- Dimension size = getSize(borderItem);
- Rectangle rectSuggested = getConstraint().getCopy();
- if(rectSuggested.getTopLeft().x == 0 && rectSuggested.getTopLeft().y == 0) {
- rectSuggested.setLocation(getPreferredLocation(borderItem));
- } else {
- // recovered constraint must be translated with the parent location to be absolute
- rectSuggested.setLocation(rectSuggested.getLocation().translate(getParentBorder().getTopLeft()));
- }
- rectSuggested.setSize(size);
- Rectangle validLocation = getValidLocation(rectSuggested, borderItem);
- // the constraint is not reset, but the item bounds are
- borderItem.setBounds(validLocation);
- // ensure the side property is correctly set
- setCurrentSideOfParent(findClosestSideOfParent(borderItem.getBounds(), getParentBorder()));
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/parsers/ConnectorLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/parsers/ConnectorLabelParser.java
deleted file mode 100644
index dbabe0c4218..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/parsers/ConnectorLabelParser.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.parsers;
-
-import java.text.FieldPosition;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.uml2.uml.Connector;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * A specific parser for displaying a connector. This parser refreshes the text
- * displayed for the connector.
- */
-public class ConnectorLabelParser extends MessageFormatParser implements ISemanticParser {
-
- /** The String format for displaying a parameter with its type */
- private static final String TYPED_PARAMETER_FORMAT = "%s: %s";
-
- /** The String format for displaying a parameter with no type */
- private static final String UNTYPED_PARAMETER_FORMAT = "%s";
-
- public ConnectorLabelParser(EAttribute[] features, EAttribute[] editableFeatures) {
- super(features, editableFeatures);
- }
-
- public ConnectorLabelParser(EAttribute[] features) {
- super(features);
- }
-
- public ConnectorLabelParser() {
- super(new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() });
- }
-
- protected EStructuralFeature getEStructuralFeature(Object notification) {
- EStructuralFeature featureImpl = null;
- if(notification instanceof Notification) {
- Object feature = ((Notification)notification).getFeature();
- if(feature instanceof EStructuralFeature) {
- featureImpl = (EStructuralFeature)feature;
- }
- }
- return featureImpl;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isAffectingEvent(Object event, int flags) {
- EStructuralFeature feature = getEStructuralFeature(event);
- return isValidFeature(feature);
-
- }
-
- /**
- * {@inheritDoc}
- */
- public String getPrintString(IAdaptable element, int flags) {
- Object obj = element.getAdapter(EObject.class);
- Connector connector = (Connector)obj;
- String name = connector.getName();
- if(name == null) {
- name = " ";
- }
- if(connector.getType() != null) {
- String type = connector.getType().getName();
- if(type == null) {
- type = "";
- }
- return String.format(TYPED_PARAMETER_FORMAT, name, type);
- } else {
- return String.format(UNTYPED_PARAMETER_FORMAT, name);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean areSemanticElementsAffected(EObject listener, Object notification) {
- EStructuralFeature feature = getEStructuralFeature(notification);
- return isValidFeature(feature);
- }
-
- /**
- * {@inheritDoc}
- */
- public List<?> getSemanticElementsBeingParsed(EObject element) {
- List<Element> semanticElementsBeingParsed = new ArrayList<Element>();
- Connector connector = (Connector)element;
- semanticElementsBeingParsed.add(connector);
- if(connector.getType() != null) {
- semanticElementsBeingParsed.add(connector.getType());
- }
- return semanticElementsBeingParsed;
- }
-
- /**
- * Determines if the given feature has to be taken into account in this parser
- *
- * @param feature
- * the feature to test
- * @return true if is valid, false otherwise
- */
- private boolean isValidFeature(EStructuralFeature feature) {
- return UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature) || UMLPackage.eINSTANCE.getConnector_Type().equals(feature);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getEditString(IAdaptable adapter, int flags) {
- EObject element = (EObject)adapter.getAdapter(EObject.class);
- return getEditorProcessor().format(getEditableValues(element), new StringBuffer(), new FieldPosition(0)).toString();
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/parsers/ConstraintLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/parsers/ConstraintLabelParser.java
deleted file mode 100644
index 44833a123bd..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/parsers/ConstraintLabelParser.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.parsers;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-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.diagram.ui.commands.CommandProxy;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.papyrus.sysml.constraints.ConstraintProperty;
-import org.eclipse.papyrus.uml.diagram.common.commands.SetValueSpecificationValueCommand;
-import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Property;
-import org.eclipse.uml2.uml.UMLPackage;
-import org.eclipse.uml2.uml.ValueSpecification;
-
-/**
- * The Class ConstraintLabelParser that manages constraint label of a constraintProperty
- */
-public class ConstraintLabelParser extends MessageFormatParser implements ISemanticParser {
-
- /** The String format for displaying a ConstraintProperty with no type */
- private static final String CONSTRAINT_LABEL__FORMAT = "{%s}";
-
- public ConstraintLabelParser(EAttribute[] features, EAttribute[] editableFeatures) {
- super(features, editableFeatures);
- }
-
- public ConstraintLabelParser(EAttribute[] features) {
- super(features);
- }
-
- public ConstraintLabelParser() {
- super(new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() });
- }
-
- /**
- * Gets the e structural feature.
- *
- * @param notification
- * the notification
- * @return the e structural feature
- */
- protected EStructuralFeature getEStructuralFeature(Object notification) {
- EStructuralFeature featureImpl = null;
- if(notification instanceof Notification) {
- Object feature = ((Notification)notification).getFeature();
- if(feature instanceof EStructuralFeature) {
- featureImpl = (EStructuralFeature)feature;
- }
- }
- return featureImpl;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isAffectingEvent(Object event, int flags) {
- EStructuralFeature feature = getEStructuralFeature(event);
- return isValidFeature(feature);
- }
-
- /**
- * {@inheritDoc}
- */
- public String getPrintString(IAdaptable element, int flags) {
- String result = "";
- Object obj = element.getAdapter(EObject.class);
- if(obj instanceof ConstraintProperty) {
- Property property = ((ConstraintProperty)obj).getBase_Property();
- if(property != null) {
- // manage constraint
- if(property.getDefaultValue() != null) {
- ValueSpecification valueSpecification = property.getDefaultValue();
- String specificationValue = ValueSpecificationUtil.getSpecificationValue(valueSpecification);
- if(specificationValue != null && specificationValue.length() > 0) {
- result = String.format(CONSTRAINT_LABEL__FORMAT, specificationValue);
- }
- }
- }
- }
- return result;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean areSemanticElementsAffected(EObject listener, Object notification) {
- EStructuralFeature feature = getEStructuralFeature(notification);
- return isValidFeature(feature);
- }
-
- /**
- * {@inheritDoc}
- */
- public List<?> getSemanticElementsBeingParsed(EObject element) {
- List<Element> semanticElementsBeingParsed = new ArrayList<Element>();
- if(element instanceof ConstraintProperty) {
- Property property = ((ConstraintProperty)element).getBase_Property();
- if(property != null) {
- semanticElementsBeingParsed.add(property);
- if(property.getDefaultValue() != null) {
- semanticElementsBeingParsed.add(property.getDefaultValue());
- }
- }
- }
- return semanticElementsBeingParsed;
- }
-
- /**
- * Determines if the given feature has to be taken into account in this parser
- *
- * @param feature
- * the feature to test
- * @return true if is valid, false otherwise
- */
- private boolean isValidFeature(EStructuralFeature feature) {
- return UMLPackage.eINSTANCE.getProperty_DefaultValue().equals(feature) || UMLPackage.eINSTANCE.getProperty_DefaultValue().equals(feature);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getEditString(IAdaptable adapter, int flags) {
- String result = "";
- EObject element = (EObject)adapter.getAdapter(EObject.class);
- if(element instanceof ConstraintProperty) {
- element = ((ConstraintProperty)element).getBase_Property();
- if(element instanceof Property) {
- ValueSpecification defaultValue = ((Property)element).getDefaultValue();
- result = ValueSpecificationUtil.getSpecificationValue(defaultValue);
- }
- }
- return result;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public ICommand getParseCommand(IAdaptable adapter, String newString, int flags) {
- Object obj = adapter.getAdapter(EObject.class);
- TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(obj);
-
- if(editingDomain != null && obj instanceof ConstraintProperty) {
- obj = ((ConstraintProperty)obj).getBase_Property();
- if(obj instanceof Property) {
- ValueSpecification valueSpec = ((Property)obj).getDefaultValue();
- if(valueSpec != null) {
- CompositeTransactionalCommand command = new CompositeTransactionalCommand(editingDomain, "Set Values");
- command.compose(new CommandProxy(new SetValueSpecificationValueCommand(valueSpec, newString)));
- return command;
- }
- }
- }
- return UnexecutableCommand.INSTANCE;
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/parsers/ConstraintPropertyLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/parsers/ConstraintPropertyLabelParser.java
deleted file mode 100644
index 15bf7d80d3f..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/parsers/ConstraintPropertyLabelParser.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.parsers;
-
-import java.text.FieldPosition;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-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.IParserEditStatus;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.papyrus.sysml.constraints.ConstraintProperty;
-import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.InstanceValue;
-import org.eclipse.uml2.uml.Property;
-import org.eclipse.uml2.uml.UMLPackage;
-import org.eclipse.uml2.uml.ValueSpecification;
-
-/**
- * A specific parser for displaying a ConstraintProperty label. This parser refreshes the text
- * displayed for the ConstraintProperty.
- */
-public class ConstraintPropertyLabelParser extends MessageFormatParser implements ISemanticParser {
-
- /** The String format for displaying a ConstraintProperty with no type */
- private static final String UNTYPED_PARAMETER_FORMAT = "%s";
-
- /** The String format for displaying a ConstraintProperty with its type */
- private static final String TYPED_PARAMETER_FORMAT = "%s: %s";
-
- /** The String format for displaying a ConstraintProperty with multiplicity */
- private static final String MULTIPLICITY_PARAMETER_FORMAT = "%s [%s..%s]";
-
- /** The String format for displaying a ConstraintProperty with default value */
- private static final String DEFAULT_VALUE_PARAMETER_FORMAT = "%s= %s";
-
- /** The String format for displaying a ConstraintProperty with attribute */
- private static final String MODIFIER_PARAMETER_FORMAT = "%s{%s}";
-
- public ConstraintPropertyLabelParser(EAttribute[] features, EAttribute[] editableFeatures) {
- super(features, editableFeatures);
- }
-
- public ConstraintPropertyLabelParser(EAttribute[] features) {
- super(features);
- }
-
- public ConstraintPropertyLabelParser() {
- super(new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() });
- }
-
- protected EStructuralFeature getEStructuralFeature(Object notification) {
- EStructuralFeature featureImpl = null;
- if(notification instanceof Notification) {
- Object feature = ((Notification)notification).getFeature();
- if(feature instanceof EStructuralFeature) {
- featureImpl = (EStructuralFeature)feature;
- }
- }
- return featureImpl;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isAffectingEvent(Object event, int flags) {
- EStructuralFeature feature = getEStructuralFeature(event);
- return isValidFeature(feature);
- }
-
- /**
- * {@inheritDoc}
- */
- public String getPrintString(IAdaptable element, int flags) {
- String result = "";
- Object obj = element.getAdapter(EObject.class);
- Property property = null;
- if(obj instanceof ConstraintProperty) {
- property = ((ConstraintProperty)obj).getBase_Property();
- }
- if(property != null) {
- String name = property.isDerived() ? "/ " + property.getName() : property.getName();
- result = String.format(UNTYPED_PARAMETER_FORMAT, name);
- // manage type
- if(property.getType() != null) {
- String type = property.getType().getName();
- result = String.format(TYPED_PARAMETER_FORMAT, name, type);
- }
- // manage multiplicity
- if(property.getLower() != 1 || property.getUpper() != 1) {
- result = String.format(MULTIPLICITY_PARAMETER_FORMAT, result, ValueSpecificationUtil.getSpecificationValue(property.getLowerValue()), ValueSpecificationUtil.getSpecificationValue(property.getUpperValue()));
- }
- // manage initial values
- if(property.getDefaultValue() != null) {
- ValueSpecification valueSpecification = property.getDefaultValue();
- if(valueSpecification instanceof InstanceValue && property.getType().equals(valueSpecification.getType())) {
- result = String.format(DEFAULT_VALUE_PARAMETER_FORMAT, result, ValueSpecificationUtil.getSpecificationValue(valueSpecification));
- }
- }
- // manage modifier
- StringBuffer sb = new StringBuffer();
- if(property.isReadOnly()) {
- sb.append(sb.length() == 0 ? "readOnly" : ", readOnly");
- }
- if(property.isOrdered()) {
- sb.append(sb.length() == 0 ? "ordered" : ", ordered");
- }
- if(property.isUnique()) {
- sb.append(sb.length() == 0 ? "unique" : ", unique");
- }
- if(property.isDerivedUnion()) {
- sb.append(sb.length() == 0 ? "union" : ", union");
- }
- EList<Property> redefinedProperties = property.getRedefinedProperties();
- if(redefinedProperties != null && !redefinedProperties.isEmpty()) {
- for(Property p : redefinedProperties) {
- sb.append(sb.length() == 0 ? p.getName() : ", redefines " + p.getName());
- }
- }
- if(sb.length() != 0) {
- result = String.format(MODIFIER_PARAMETER_FORMAT, result, sb.toString());
- }
- }
- return result;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean areSemanticElementsAffected(EObject listener, Object notification) {
- EStructuralFeature feature = getEStructuralFeature(notification);
- return isValidFeature(feature);
- }
-
- /**
- * {@inheritDoc}
- */
- public List<?> getSemanticElementsBeingParsed(EObject element) {
- List<Element> semanticElementsBeingParsed = new ArrayList<Element>();
- Property property = null;
- if(element instanceof ConstraintProperty) {
- property = ((ConstraintProperty)element).getBase_Property();
- }
- if(property != null) {
- semanticElementsBeingParsed.add(property);
- if(property.getType() != null) {
- semanticElementsBeingParsed.add(property.getType());
- }
- if(property.getLowerValue() != null) {
- semanticElementsBeingParsed.add(property.getLowerValue());
- }
- if(property.getUpperValue() != null) {
- semanticElementsBeingParsed.add(property.getUpperValue());
- }
- if(property.getDefaultValue() != null) {
- semanticElementsBeingParsed.add(property.getDefaultValue());
- }
- }
- return semanticElementsBeingParsed;
- }
-
- /**
- * Determines if the given feature has to be taken into account in this parser
- *
- * @param feature
- * the feature to test
- * @return true if is valid, false otherwise
- */
- private boolean isValidFeature(EStructuralFeature feature) {
- return UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature) || UMLPackage.eINSTANCE.getTypedElement_Type().equals(feature) || UMLPackage.eINSTANCE.getInstanceValue_Instance().equals(feature) || UMLPackage.eINSTANCE.getMultiplicityElement_IsOrdered().equals(feature) || UMLPackage.eINSTANCE.getMultiplicityElement_IsUnique().equals(feature) || UMLPackage.eINSTANCE.getMultiplicityElement_LowerValue().equals(feature) || UMLPackage.eINSTANCE.getMultiplicityElement_UpperValue().equals(feature) || UMLPackage.eINSTANCE.getStructuralFeature_IsReadOnly().equals(feature) || UMLPackage.eINSTANCE.getFeature_IsStatic().equals(feature) || UMLPackage.eINSTANCE.getProperty_IsDerived().equals(feature) || UMLPackage.eINSTANCE.getProperty_IsDerivedUnion().equals(feature) || UMLPackage.eINSTANCE.getProperty_RedefinedProperty().equals(feature);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getEditString(IAdaptable adapter, int flags) {
- EObject element = (EObject)adapter.getAdapter(EObject.class);
- if(element instanceof ConstraintProperty) {
- element = ((ConstraintProperty)element).getBase_Property();
- }
- return getEditorProcessor().format(getEditableValues(element), new StringBuffer(), new FieldPosition(0)).toString();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- 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);
- if(element instanceof ConstraintProperty) {
- element = ((ConstraintProperty)element).getBase_Property();
- }
- TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(element);
- if(editingDomain == null) {
- return UnexecutableCommand.INSTANCE;
- }
- CompositeTransactionalCommand command = new CompositeTransactionalCommand(editingDomain, "Set Values"); //$NON-NLS-1$
- for(int i = 0; i < values.length; i++) {
- command.compose(getModificationCommand(element, editableFeatures[i], values[i]));
- }
- return command;
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/parsers/PropertyLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/parsers/PropertyLabelParser.java
deleted file mode 100644
index e34218f3571..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/parsers/PropertyLabelParser.java
+++ /dev/null
@@ -1,223 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.parsers;
-
-import java.text.FieldPosition;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.papyrus.sysml.diagram.parametric.utils.PropertyLinkedToClassifierNode;
-import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil;
-import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil;
-import org.eclipse.uml2.uml.Classifier;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Property;
-import org.eclipse.uml2.uml.UMLPackage;
-import org.eclipse.uml2.uml.ValueSpecification;
-
-/**
- * A specific parser for displaying an property. This parser refreshes the text displayed for the
- * Property.
- */
-public class PropertyLabelParser extends MessageFormatParser implements ISemanticParser {
-
- /** The String format for displaying a ConstraintProperty with no type */
- private static final String UNTYPED_PARAMETER_FORMAT = "%s";
-
- /** The String format for displaying a ConstraintProperty with its type */
- private static final String TYPED_PARAMETER_FORMAT = "%s: %s";
-
- /** The String format for displaying a ConstraintProperty with multiplicity */
- private static final String MULTIPLICITY_PARAMETER_FORMAT = "%s [%s..%s]";
-
- /** The String format for displaying a ConstraintProperty with default value */
- private static final String DEFAULT_VALUE_PARAMETER_FORMAT = "%s= %s";
-
- /** The String format for displaying a ConstraintProperty with attribute */
- private static final String MODIFIER_PARAMETER_FORMAT = "%s{%s}";
-
- /** Class to compute property name depth */
- PropertyLinkedToClassifierNode propertyLinkedToClassifier;
-
- /** The classifier, container view of the property */
- private Classifier classifier;
-
- public PropertyLabelParser(EAttribute[] features, EAttribute[] editableFeatures) {
- super(features, editableFeatures);
- }
-
- public PropertyLabelParser(EAttribute[] features) {
- super(features);
- }
-
- public PropertyLabelParser() {
- super(new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() });
- }
-
- protected EStructuralFeature getEStructuralFeature(Object notification) {
- EStructuralFeature featureImpl = null;
- if(notification instanceof Notification) {
- Object feature = ((Notification)notification).getFeature();
- if(feature instanceof EStructuralFeature) {
- featureImpl = (EStructuralFeature)feature;
- }
- }
- return featureImpl;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isAffectingEvent(Object event, int flags) {
- EStructuralFeature feature = getEStructuralFeature(event);
- return isValidFeature(feature);
- }
-
- /**
- * {@inheritDoc}
- */
- public String getPrintString(IAdaptable element, int flags) {
- String result = "";
- Property property = null;
- Object adapter = element.getAdapter(EObject.class);
- if(adapter instanceof Property) {
- property = (Property)adapter;
- String name = property.isDerived() ? "/ " + property.getName() : property.getName();
- result = String.format(UNTYPED_PARAMETER_FORMAT, name);
- // Perform property depth to set the name
- for(Object obj : DiagramEditPartsUtil.getEObjectViews(property)) {
- if(obj instanceof Node && classifier != null) {
- propertyLinkedToClassifier = new PropertyLinkedToClassifierNode(classifier, property, (Node)obj);
- propertyLinkedToClassifier.refresh();
- name = propertyLinkedToClassifier.getName();
- result = String.format(UNTYPED_PARAMETER_FORMAT, name);
- }
- }
- // manage type
- if(property.getType() != null) {
- String type = property.getType().getName();
- result = String.format(TYPED_PARAMETER_FORMAT, name, type);
- }
- // manage multiplicity
- if(property.getLower() != 1 || property.getUpper() != 1) {
- result = String.format(MULTIPLICITY_PARAMETER_FORMAT, result, ValueSpecificationUtil.getSpecificationValue(property.getLowerValue()), ValueSpecificationUtil.getSpecificationValue(property.getUpperValue()));
- }
- // manage initial values
- if(property.getDefaultValue() != null) {
- ValueSpecification valueSpecification = property.getDefaultValue();
- String specificationValue = ValueSpecificationUtil.getSpecificationValue(valueSpecification);
- if(specificationValue != null && specificationValue.length() > 0) {
- result = String.format(DEFAULT_VALUE_PARAMETER_FORMAT, result, ValueSpecificationUtil.getSpecificationValue(valueSpecification));
- }
- }
- // manage modifier
- StringBuffer sb = new StringBuffer();
- if(property.isReadOnly()) {
- sb.append(sb.length() == 0 ? "readOnly" : ", readOnly");
- }
- if(property.isOrdered()) {
- sb.append(sb.length() == 0 ? "ordered" : ", ordered");
- }
- if(property.isUnique()) {
- sb.append(sb.length() == 0 ? "unique" : ", unique");
- }
- if(property.isDerivedUnion()) {
- sb.append(sb.length() == 0 ? "union" : ", union");
- }
- EList<Property> redefinedProperties = property.getRedefinedProperties();
- if(redefinedProperties != null && !redefinedProperties.isEmpty()) {
- for(Property p : redefinedProperties) {
- sb.append(sb.length() == 0 ? p.getName() : ", redefines " + p.getName());
- }
- }
- if(sb.length() != 0) {
- result = String.format(MODIFIER_PARAMETER_FORMAT, result, sb.toString());
- }
- }
- return result;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean areSemanticElementsAffected(EObject listener, Object notification) {
- EStructuralFeature feature = getEStructuralFeature(notification);
- return isValidFeature(feature);
- }
-
- /**
- * {@inheritDoc}
- */
- public List<?> getSemanticElementsBeingParsed(EObject element) {
- List<Element> semanticElementsBeingParsed = new ArrayList<Element>();
- Property property = null;
- if(element instanceof Property) {
- property = (Property)element;
- semanticElementsBeingParsed.add(property);
- if(property.getType() != null) {
- semanticElementsBeingParsed.add(property.getType());
- }
- if(property.getLowerValue() != null) {
- semanticElementsBeingParsed.add(property.getLowerValue());
- }
- if(property.getUpperValue() != null) {
- semanticElementsBeingParsed.add(property.getUpperValue());
- }
- if(property.getDefaultValue() != null) {
- semanticElementsBeingParsed.add(property.getDefaultValue());
- }
- }
- return semanticElementsBeingParsed;
- }
-
- /**
- * Determines if the given feature has to be taken into account in this parser
- *
- * @param feature
- * the feature to test
- * @return true if is valid, false otherwise
- */
- private boolean isValidFeature(EStructuralFeature feature) {
- return UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature) || UMLPackage.eINSTANCE.getTypedElement_Type().equals(feature) || UMLPackage.eINSTANCE.getConnector_Type().equals(feature) || UMLPackage.eINSTANCE.getInstanceValue_Instance().equals(feature) || UMLPackage.eINSTANCE.getMultiplicityElement_IsOrdered().equals(feature) || UMLPackage.eINSTANCE.getMultiplicityElement_IsUnique().equals(feature) || UMLPackage.eINSTANCE.getMultiplicityElement_LowerValue().equals(feature) || UMLPackage.eINSTANCE.getMultiplicityElement_UpperValue().equals(feature) || UMLPackage.eINSTANCE.getStructuralFeature_IsReadOnly().equals(feature) || UMLPackage.eINSTANCE.getFeature_IsStatic().equals(feature) || UMLPackage.eINSTANCE.getProperty_IsDerived().equals(feature) || UMLPackage.eINSTANCE.getProperty_IsDerivedUnion().equals(feature) || UMLPackage.eINSTANCE.getProperty_RedefinedProperty().equals(feature);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getEditString(IAdaptable adapter, int flags) {
- EObject element = (EObject)adapter.getAdapter(EObject.class);
- return getEditorProcessor().format(getEditableValues(element), new StringBuffer(), new FieldPosition(0)).toString();
- }
-
- /**
- * Sets the block that is linked to the current property
- *
- * @param element
- */
- public void setBlock(EObject element) {
- if(element instanceof Classifier) {
- this.classifier = (Classifier)element;
- }
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/providers/CustomEditPolicyProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/providers/CustomEditPolicyProvider.java
deleted file mode 100644
index 51741170d2a..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/providers/CustomEditPolicyProvider.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.providers;
-
-import org.eclipse.gef.EditPart;
-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.GraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
-import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.CreateEditPoliciesOperation;
-import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.IEditPolicyProvider;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ParametricEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.HyperLinkPopupBarEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.NavigationEditPolicy;
-
-/**
- * this is an editpolicy provider in charge to install navigation policies
- *
- * @author Patrick Tessier
- */
-public class CustomEditPolicyProvider implements IEditPolicyProvider {
-
- /**
- *
- * {@inheritDoc}
- */
- public void addProviderChangeListener(IProviderChangeListener listener) {
-
- }
-
- /**
- *
- * {@inheritDoc}
- */
- public void createEditPolicies(EditPart editPart) {
- editPart.installEditPolicy(NavigationEditPolicy.NAVIGATION_POLICY, new NavigationEditPolicy());
- if( editPart instanceof IPrimaryEditPart){
- editPart.installEditPolicy(EditPolicyRoles.POPUPBAR_ROLE, new HyperLinkPopupBarEditPolicy());
- }
- }
-
- /**
- *
- * {@inheritDoc}
- */
- public boolean provides(IOperation operation) {
- CreateEditPoliciesOperation epOperation = (CreateEditPoliciesOperation)operation;
- if(!(epOperation.getEditPart() instanceof GraphicalEditPart)) {
- return false;
- }
- GraphicalEditPart gep = (GraphicalEditPart)epOperation.getEditPart();
- String diagramType = gep.getNotationView().getDiagram().getType();
- if(ParametricEditPart.MODEL_ID.equals(diagramType)) {
- return true;
- }
-
-
- return false;
- }
-
- /**
- *
- * {@inheritDoc}
- */
- public void removeProviderChangeListener(IProviderChangeListener listener) {
-
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/providers/ParametricDiagramContributionItemProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/providers/ParametricDiagramContributionItemProvider.java
deleted file mode 100644
index 08146a8e960..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/providers/ParametricDiagramContributionItemProvider.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.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.sysml.diagram.parametric.actions.RestoreRelatedLinksAction;
-
-
-/**
- * The Class uses to contribute item for specific actions
- */
-public class ParametricDiagramContributionItemProvider 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();
- }
- return super.createAction(actionId, partDescriptor);
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/providers/ParametricDiagramContributionPolicyClass.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/providers/ParametricDiagramContributionPolicyClass.java
deleted file mode 100644
index 9cb16bc8659..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/providers/ParametricDiagramContributionPolicyClass.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2011 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.providers;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.IPopupMenuContributionPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ParametricEditPart;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Reduce the scope of the Menu contribution of the Parametric Diagram.
- * implements {@link IPopupMenuContributionPolicy}
- *
- * @author arthur daussy
- */
-public class ParametricDiagramContributionPolicyClass implements IPopupMenuContributionPolicy {
-
- public boolean appliesTo(ISelection selection, IConfigurationElement configuration) {
- IEditorPart editorPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
- if(editorPart instanceof IMultiDiagramEditor) {
- editorPart = ((IMultiDiagramEditor)editorPart).getActiveEditor();
- if(editorPart instanceof DiagramEditor) {
- DiagramEditPart host = ((DiagramEditor)editorPart).getDiagramEditPart();
- return ParametricEditPart.MODEL_ID.equals(host.getDiagramView().getType());
- }
- }
- return false;
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/texteditor/ConstraintPropertyConfiguration.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/texteditor/ConstraintPropertyConfiguration.java
deleted file mode 100644
index 34897634f7e..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/texteditor/ConstraintPropertyConfiguration.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.texteditor;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.dialogs.IInputValidator;
-import org.eclipse.jface.text.source.SourceViewerConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.DefaultDirectEditorConfiguration;
-import org.eclipse.papyrus.parsers.modelgenerator.PropertyGenerator;
-import org.eclipse.papyrus.parsers.texteditor.CompletionFilterSourceViewerConfiguration.ICompletionFilter;
-import org.eclipse.papyrus.parsers.texteditor.propertylabel.IContext;
-import org.eclipse.papyrus.parsers.texteditor.propertylabel.PropertyConfigurationForUML;
-import org.eclipse.papyrus.parsers.texteditor.propertylabel.PropertyLabelSourceViewerConfiguration;
-import org.eclipse.papyrus.sysml.constraints.ConstraintProperty;
-import org.eclipse.papyrus.uml.tools.utils.PropertyUtil;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Property;
-
-/**
- * Configuration Class for the direct edition of a SysML constraint property
- */
-public class ConstraintPropertyConfiguration extends DefaultDirectEditorConfiguration {
-
- /** configuration of the source viewer */
- final private PropertyLabelSourceViewerConfiguration configuration;
-
- /**
- * Creates a new PropertyConfiguration to filter values.
- */
- public ConstraintPropertyConfiguration() {
- configuration = new PropertyLabelSourceViewerConfiguration(new ICompletionFilter() {
-
- public boolean filter(int context, EObject e) {
- switch(context) {
- case IContext.AFTER_COLON:
- if(e instanceof Element) {
- if(((Element)e).getAppliedStereotype("SysML::Constraints::ConstraintBlock") != null) {
- return false;
- }
- }
-
- return true;
- default:
- return false;
- }
- }
- });
- }
-
- /**
- * {@inheritDoc}
- */
- public SourceViewerConfiguration getSourceViewerConfiguration() {
- return configuration;
- }
-
- /**
- * {@inheritDoc}
- */
- public String getTextToEdit(Object editedObject) {
- if(editedObject instanceof ConstraintProperty) {
- Property property = ((ConstraintProperty)editedObject).getBase_Property();
- return PropertyUtil.getLabel(property);
- }
- return "not a Constraint Property";
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object preEditAction(Object objectToEdit) {
- if(objectToEdit instanceof ConstraintProperty) {
- Property property = ((ConstraintProperty)objectToEdit).getBase_Property();
- configuration.setProperty(property);
- }
- return super.preEditAction(objectToEdit);
- }
-
- /**
- * {@inheritDoc}
- */
- public Object postEditAction(Object editedObject, String text) {
- if(editedObject instanceof ConstraintProperty) {
- Property property = ((ConstraintProperty)editedObject).getBase_Property();
- PropertyGenerator generator = new PropertyGenerator(property);
- generator.parseAndModifyProperty(text);
- }
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public IInputValidator getInputValidator() {
- return new IInputValidator() {
-
- public String isValid(String newText) {
- if(getObjectToEdit() instanceof ConstraintProperty) {
- Property property = ((ConstraintProperty)getObjectToEdit()).getBase_Property();
- PropertyGenerator generator = new PropertyGenerator(property);
- return generator.parseAndValidateProperty(newText);
- }
- return null;
- }
- };
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Selection getTextSelection(String value, Object editedObject) {
- if(editedObject instanceof ConstraintProperty) {
- Property property = ((ConstraintProperty)editedObject).getBase_Property();
- return new PropertyConfigurationForUML().getTextSelection(value, property);
- }
- return super.getTextSelection(value, editedObject);
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/utils/PropertyLinkedToClassifier.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/utils/PropertyLinkedToClassifier.java
deleted file mode 100644
index 828f7799dc1..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/utils/PropertyLinkedToClassifier.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 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) thibault.landre@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.utils;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.uml2.uml.Classifier;
-import org.eclipse.uml2.uml.Port;
-import org.eclipse.uml2.uml.Property;
-import org.eclipse.uml2.uml.Type;
-
-/**
- * PropertyLinkedToClassifier checks if a specified property is linked to a classifier
- */
-public class PropertyLinkedToClassifier {
-
- /** The classifier. */
- private final Classifier classifier;
-
- /** The property. */
- private final Property property;
-
- /** The list routes. */
- private List<Route> routes;
-
- /**
- * Instantiates a new property linked to classifier.
- *
- * @param classifier
- * @param property
- */
- public PropertyLinkedToClassifier(Classifier classifier, Property property) {
- this.classifier = classifier;
- this.property = property;
- this.routes = new LinkedList<Route>();
- refresh();
- }
-
- /**
- * Checks if the property is linked to classifier.
- *
- * @return true, if is linked to classifier
- */
- public boolean isLinkedToClassifier() {
- return !routes.isEmpty();
- }
-
- /**
- * Checks if the property is linked to classifier with a multi-level path of accessible property from the classifier
- *
- * @return true, if is linked to classifier with a multi-level path
- */
- public boolean isLinkedWithMultiLevelPath() {
- boolean result = false;
- if(!routes.isEmpty()) {
- for(Route r : routes) {
- result |= r.getRouteDepth() > 1;
- }
- }
- return result;
- }
-
- /**
- * Gets the available routes.
- *
- * @return the available routes
- */
- public List<Route> getAvailableRoutes() {
- return routes;
- }
-
- /**
- * Gets the property.
- *
- * @return the property
- */
- protected Property getProperty() {
- return property;
- }
-
- /**
- * Gets the number available route.
- *
- * @return the number available route
- */
- public int getNumberAvailableRoute() {
- return routes.size();
- }
-
- /**
- * Refresh link to classifier.
- *
- * @param classifierParent
- * @param propertyToFind
- * @param route
- */
- private void refreshLinkToClassifier(Classifier classifierParent, final Property propertyToFind, final Route route) {
- EList<Property> classifierParentAttributes = classifierParent.getAllAttributes();
- // If the property is contained by the classifier
- if(classifierParentAttributes.contains(propertyToFind)) {
- route.addSegment(propertyToFind);
- routes.add(route);
- } else {
- for(Property attribute : classifierParentAttributes) {
- if(!(attribute instanceof Port)) {
- Type attributeType = attribute.getType();
- // stop loop
- if(route.getProperties().contains(attribute)) {
- // Launch a warning ? an error ?
- break;
- }
- if(attributeType instanceof Classifier) {
- Route newRoute = new Route(new LinkedList<Property>(route.getProperties()));
- newRoute.addSegment(attribute);
- refreshLinkToClassifier((Classifier)attributeType, propertyToFind, newRoute);
- }
- }
- }
- }
- }
-
- /**
- * Checks for several routes.
- *
- * @return true, if successful
- */
- public boolean hasSeveralRoutes() {
- return routes.size() > 1;
- }
-
- /**
- * Refresh.
- */
- public void refresh() {
- routes.clear();
- refreshLinkToClassifier(classifier, property, new Route());
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/utils/PropertyLinkedToClassifierNode.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/utils/PropertyLinkedToClassifierNode.java
deleted file mode 100644
index e9186398bdc..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/utils/PropertyLinkedToClassifierNode.java
+++ /dev/null
@@ -1,234 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 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) thibault.landre@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.utils;
-
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EcoreFactory;
-import org.eclipse.gmf.runtime.diagram.ui.commands.CreateOrSelectElementCommand.LabelProvider;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlDiagramEditorPlugin;
-import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.dialogs.ElementListSelectionDialog;
-import org.eclipse.uml2.uml.Classifier;
-import org.eclipse.uml2.uml.Property;
-
-public class PropertyLinkedToClassifierNode extends PropertyLinkedToClassifier {
-
- public static final String PROPERTY_ROUTE_URL_SOURCE = "http://www.eclipse.org/papyrus/propertyRoute";
-
- public static final String SELECTED_ROUTE_KEY = "selectedRoute";
-
- private Node graphNode;
-
- public PropertyLinkedToClassifierNode(Classifier classifier, Property property, Node graphNode) {
- super(classifier, property);
- this.graphNode = graphNode;
- }
-
- /**
- *
- * @return
- */
- public String getName() {
- String lName = "";
- if(getAvailableRoutes().isEmpty()) {
- lName = getProperty().getName();
- } else if(!hasSeveralRoutes()) {
- lName = getAvailableRoutes().get(0).getName();
- } else {
- lName = getSelectedRoute();
- }
- return lName;
- }
-
- private String getSelectedRoute() {
- String result = "";
- if("".equals(getRootingProperty(graphNode))) {
- LinkedList<Route> filteredAvailableRoute = filterAvailableRoute(getAvailableRoutes());
- if(filteredAvailableRoute.size() == 1) {
- result = filteredAvailableRoute.getFirst().getName();
- } else if(!filteredAvailableRoute.isEmpty()) {
- // doesn't display dialog box, only get the first route
- //result = getUserSelectionRoute(filteredAvailableRoute);
- result = filteredAvailableRoute.getFirst().getName();
- }
- } else {
- String oldRouteSelectedValue = getRootingProperty(graphNode);
- Map<String, Route> routeNameAndRoute = getRouteNameAndRoute(getAvailableRoutes());
- if(routeNameAndRoute.containsKey(oldRouteSelectedValue)) {
- result = oldRouteSelectedValue;
- } else {
- result = calculateNewRoute(oldRouteSelectedValue);
- }
- }
- return result;
- }
-
- private String getUserSelectionRoute(LinkedList<Route> filteredAvailableRoute) {
- IWorkbench workBench = SysmlDiagramEditorPlugin.getInstance().getWorkbench();
- Shell shell = workBench.getActiveWorkbenchWindow().getShell();
- ElementListSelectionDialog dialog = new ElementListSelectionDialog(shell, new LabelProvider() {
-
- @Override
- public String getText(Object element) {
- if(element instanceof Route) {
- return ((Route)element).getName();
- }
- return super.getText(element);
- }
- });
- dialog.setTitle("Routing selection");
- dialog.setMessage("Select the route of the property (* = any string, ? = any char):");
- dialog.setElements(filteredAvailableRoute.toArray());
- dialog.setHelpAvailable(false);
- dialog.setMultipleSelection(false);
- dialog.open();
-
- String result = "";
- if(dialog.getResult() != null) {
- result = ((Route)dialog.getFirstResult()).getName();
- } else {
- result = filteredAvailableRoute.getFirst().getName();
- }
- return result;
- }
-
- /**
- * Filter the available route for accessing a property. Remove from the list the property that
- * are already displayed in the diagram.
- *
- * @param availableRoutes
- * the availableRoutes for this property
- * @return the availableRoutes for this property that are not already displayed in the diagram
- */
- private LinkedList<Route> filterAvailableRoute(List<Route> availableRoutes) {
- Map<String, Route> routeNameAndRoute = getRouteNameAndRoute(availableRoutes);
- for(Object view : DiagramEditPartsUtil.getEObjectViews(getProperty())) {
- if(view instanceof Node) {
- String routeNamedSaved = getRootingProperty((Node)view);
- if(routeNameAndRoute.containsKey(routeNamedSaved)) {
- routeNameAndRoute.remove(routeNamedSaved);
- }
- }
- }
- return new LinkedList<Route>(routeNameAndRoute.values());
- }
-
- /**
- * Return a map containing the routes and their associated names from a list of routes
- *
- * @param routes
- * the list of routes
- * @return the map with key the route, and value the name of the route.
- */
- private Map<String, Route> getRouteNameAndRoute(List<Route> routes) {
- Map<String, Route> routeAndName = new HashMap<String, Route>();
- for(Route route : routes) {
- routeAndName.put(route.getName(), route);
- }
- return routeAndName;
- }
-
- private String calculateNewRoute(String oldRouteSelectedValue) {
- List<String> availableSpecificRoute = new LinkedList<String>();
- // If the length of the availableRoutes is bigger than the length of the old route, it means
- // that the property
- // is dragged/dropped to a parent container of its current container
- if(getAvailableRoutes().get(0).getName().length() > oldRouteSelectedValue.length()) {
- for(Route route : getAvailableRoutes()) {
-
- if(route.getName().indexOf(oldRouteSelectedValue) > 0) {
- availableSpecificRoute.add(route.getName());
- }
- }
- // If a unique route is present in the list, it means that there is only a route
- // possible
- if(availableSpecificRoute.size() == 1) {
- return availableSpecificRoute.get(0);
- } else {
- // Otherwise it means there is several routes possible. We need to check the name of
- // the
- // container
- }
- }
- // Otherwise the element is dragged/dropped to a child container of its current container
- else {
- for(Route route : getAvailableRoutes()) {
- if(oldRouteSelectedValue.indexOf(route.getName()) > 0) {
- availableSpecificRoute.add(route.getName());
- }
- }
- if(availableSpecificRoute.size() == 1) {
- return availableSpecificRoute.get(0);
- }
- }
- return "";
- }
-
- /**
- * Creates the rooting property into an eAnnotation
- *
- * @param node
- * @param name
- */
- public void createRootingProperty(Node node, String name) {
- if("".equals(getRootingProperty(node))) {
- EAnnotation annotation = EcoreFactory.eINSTANCE.createEAnnotation();
- annotation.setSource(PROPERTY_ROUTE_URL_SOURCE);
- node.getEAnnotations().add(annotation);
-
- annotation.getDetails().put(SELECTED_ROUTE_KEY, name);
- }
- }
-
- /**
- * Checks if the specified name is an existing route.
- *
- * @param name
- * @return true if it is an existing route
- */
- public boolean isExistingRoute(String name) {
- boolean result = false;
- for(Route r : getAvailableRoutes()) {
- result |= r.getName().equals(name);
- }
- return result;
- }
-
- /**
- * Gets the rooting property.
- *
- * @param node
- * the node
- * @param key
- * the key
- * @return the rooting property
- */
- private String getRootingProperty(Node node) {
- String value = "";
- EAnnotation eAnnotation = node.getEAnnotation(PROPERTY_ROUTE_URL_SOURCE);
- if(eAnnotation != null) {
- value = eAnnotation.getDetails().get(SELECTED_ROUTE_KEY);
- }
- return value;
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/utils/Route.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/utils/Route.java
deleted file mode 100644
index 612b4358fcd..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/utils/Route.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 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) thibault.landre@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.utils;
-
-import java.util.LinkedList;
-
-import org.eclipse.uml2.uml.Property;
-
-/**
- * A class to described a route to access a property from a classifier. This class contains an
- * ordered list of the property contained in the route and a string representing the name of the
- * route.
- */
-public class Route {
-
- /** The properties list. */
- private LinkedList<Property> propertyList;
-
- /** The name of the route */
- private String name;
-
- /**
- * Instantiates a new route.
- */
- public Route() {
- this(new LinkedList<Property>());
- }
-
- /**
- * Instantiates a new route.
- *
- * @param propertyList
- */
- public Route(LinkedList<Property> propertyList) {
- assert propertyList != null;
- this.propertyList = propertyList;
- this.name = "";
- }
-
- /**
- * Adds a property to the list
- *
- * @param property
- */
- protected void addSegment(Property property) {
- propertyList.add(property);
- }
-
- /**
- * Calculate the name of the route. The name is composed of the name of each property which
- * makes up the route separated by coma.
- */
- private void calculateName() {
- name = "";
- for(Property property : propertyList) {
- if(name.length() == 0) {
- name = property.getName();
- } else {
- name = name + "." + property.getName();
- }
- }
- }
-
- /**
- * Gets the name.
- *
- * @return the name
- */
- public String getName() {
- calculateName();
- return name;
- }
-
- /**
- * Gets the properties.
- *
- * @return the properties
- */
- public LinkedList<Property> getProperties() {
- return propertyList;
- }
-
- /**
- * Gets the route depth.
- *
- * @return the route depth
- */
- public int getRouteDepth() {
- return propertyList.size();
- }
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/icons/incomingLinksNavigatorGroup.gif b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/icons/incomingLinksNavigatorGroup.gif
index fca9c53e629..57f02b6f37a 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/icons/incomingLinksNavigatorGroup.gif
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/icons/incomingLinksNavigatorGroup.gif
Binary files differ
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/icons/linkSourceNavigatorGroup.gif b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/icons/linkSourceNavigatorGroup.gif
index fca9c53e629..57f02b6f37a 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/icons/linkSourceNavigatorGroup.gif
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/icons/linkSourceNavigatorGroup.gif
Binary files differ
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/icons/linkTargetNavigatorGroup.gif b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/icons/linkTargetNavigatorGroup.gif
index fca9c53e629..57f02b6f37a 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/icons/linkTargetNavigatorGroup.gif
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/icons/linkTargetNavigatorGroup.gif
Binary files differ
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/icons/linksNavigatorGroup.gif b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/icons/linksNavigatorGroup.gif
index fca9c53e629..57f02b6f37a 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/icons/linksNavigatorGroup.gif
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/icons/linksNavigatorGroup.gif
Binary files differ
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/icons/obj16/Diagram_Parametric.gif b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/icons/obj16/Diagram_Parametric.gif
index 97e8dd3c896..04d0854757f 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/icons/obj16/Diagram_Parametric.gif
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/icons/obj16/Diagram_Parametric.gif
Binary files differ
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/icons/obj16/ResourceDiagramFile.gif b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/icons/obj16/ResourceDiagramFile.gif
index 135bfefa2e3..937bd1f5657 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/icons/obj16/ResourceDiagramFile.gif
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/icons/obj16/ResourceDiagramFile.gif
Binary files differ
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/icons/outgoingLinksNavigatorGroup.gif b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/icons/outgoingLinksNavigatorGroup.gif
index fca9c53e629..57f02b6f37a 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/icons/outgoingLinksNavigatorGroup.gif
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/icons/outgoingLinksNavigatorGroup.gif
Binary files differ
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/messages.properties b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/messages.properties
deleted file mode 100644
index d0e32569e99..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/messages.properties
+++ /dev/null
@@ -1,133 +0,0 @@
-#/*****************************************************************************
-# * Copyright (c) 2009 Atos Origin.
-# *
-# *
-# * All rights reserved. This program and the accompanying materials
-# * are made available under the terms of the Eclipse Public License v1.0
-# * which accompanies this distribution, and is available at
-# * http://www.eclipse.org/legal/epl-v10.html
-# *
-# * Contributors:
-# * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
-# *
-# *****************************************************************************/
-# TODO: manually put keys and values
-SysMLCreationWizardTitle=New SysML Diagram
-SysMLCreationWizard_DiagramModelFilePageTitle=Create SysML Diagram
-SysMLCreationWizard_DiagramModelFilePageDescription=Select file that will contain diagram model.
-SysMLCreationWizard_DomainModelFilePageTitle=Create SysML Domain Model
-SysMLCreationWizard_DomainModelFilePageDescription=Select file that will contain domain model.
-SysMLCreationWizardOpenEditorError=Error opening diagram editor
-SysMLCreationWizardCreationError=Creation Problems
-SysMLCreationWizardPageExtensionError=File name should have {0} extension.
-SysMLDiagramEditorUtil_OpenModelResourceErrorDialogTitle=Error
-SysMLDiagramEditorUtil_OpenModelResourceErrorDialogMessage=Failed to load model file {0}
-SysMLDiagramEditorUtil_CreateDiagramProgressTask=Creating diagram and model files
-SysMLDiagramEditorUtil_CreateDiagramCommandLabel=Creating diagram and model
-SysMLDocumentProvider_isModifiable=Updating cache failed
-SysMLDocumentProvider_handleElementContentChanged=Failed to refresh hierarchy for changed resource
-SysMLDocumentProvider_IncorrectInputError={1}
-SysMLDocumentProvider_NoDiagramInResourceError=Diagram is not present in resource
-SysMLDocumentProvider_DiagramLoadingError=Error loading diagram
-SysMLDocumentProvider_UnsynchronizedFileSaveError=The file has been changed on the file system
-SysMLDocumentProvider_SaveDiagramTask=Saving diagram
-SysMLDocumentProvider_SaveNextResourceTask=Saving {0}
-SysMLDocumentProvider_SaveAsOperation=Saving {0} diagram as
-InitDiagramFile_ResourceErrorDialogTitle=Error
-InitDiagramFile_ResourceErrorDialogMessage=Model file loading failed
-InitDiagramFile_WizardTitle=Initialize new {0} diagram file
-InitDiagramFile_OpenModelFileDialogTitle=Select domain model
-SysMLNewDiagramFileWizard_CreationPageName=Initialize new diagram file
-SysMLNewDiagramFileWizard_CreationPageTitle=Diagram file
-SysMLNewDiagramFileWizard_CreationPageDescription=Create new diagram based on {0} model content
-SysMLNewDiagramFileWizard_RootSelectionPageName=Select diagram root element
-SysMLNewDiagramFileWizard_RootSelectionPageTitle=Diagram root element
-SysMLNewDiagramFileWizard_RootSelectionPageDescription=Select semantic model element to be depicted on diagram
-SysMLNewDiagramFileWizard_RootSelectionPageSelectionTitle=Select diagram root element:
-SysMLNewDiagramFileWizard_RootSelectionPageNoSelectionMessage=Diagram root element is not selected
-SysMLNewDiagramFileWizard_RootSelectionPageInvalidSelectionMessage=Invalid diagram root element is selected
-SysMLNewDiagramFileWizard_InitDiagramCommand=Initializing diagram contents
-SysMLNewDiagramFileWizard_IncorrectRootError=Incorrect model object stored as a root resource object
-SysMLDiagramEditor_SavingDeletedFile=The original file "{0}" has been deleted.
-SysMLDiagramEditor_SaveAsErrorTitle=Problem During Save As...
-SysMLDiagramEditor_SaveAsErrorMessage=Save could not be completed. Target file is already open in another editor.
-SysMLDiagramEditor_SaveErrorTitle=Save Problems
-SysMLDiagramEditor_SaveErrorMessage=Could not save file.
-SysMLElementChooserDialog_SelectModelElementTitle=Select model element
-ModelElementSelectionPageMessage=Select model element:
-ValidateActionMessage=Validate
-Sysml1Group_title=sysml
-ConstraintBlock1CreationTool_title=ConstraintBlock
-ConstraintBlock1CreationTool_desc=Create new ConstraintBlock
-ConstraintProperty2CreationTool_title=ConstraintProperty
-ConstraintProperty2CreationTool_desc=Create new ConstraintProperty
-
-CommandName_OpenDiagram=Open Diagram
-NavigatorActionProvider_OpenDiagramActionName=Open Diagram
-SysMLModelingAssistantProviderTitle=Select domain model element
-SysMLModelingAssistantProviderMessage=Available domain model elements:
-SysmlCreationWizardTitle=New Parametric Diagram
-SysmlCreationWizard_DiagramModelFilePageTitle=Create Parametric Diagram
-SysmlCreationWizard_DiagramModelFilePageDescription=Select file that will contain diagram model.
-SysmlCreationWizard_DomainModelFilePageTitle=Create Parametric Domain Model
-SysmlCreationWizard_DomainModelFilePageDescription=Select file that will contain domain model.
-SysmlCreationWizardOpenEditorError=Error opening diagram editor
-SysmlCreationWizardCreationError=Creation Problems
-SysmlCreationWizardPageExtensionError=File name should have {0} extension.
-SysmlDiagramEditorUtil_OpenModelResourceErrorDialogTitle=Error
-SysmlDiagramEditorUtil_OpenModelResourceErrorDialogMessage=Failed to load model file {0}
-SysmlDiagramEditorUtil_CreateDiagramProgressTask=Creating diagram and model files
-SysmlDiagramEditorUtil_CreateDiagramCommandLabel=Creating diagram and model
-SysmlDocumentProvider_isModifiable=Updating cache failed
-SysmlDocumentProvider_handleElementContentChanged=Failed to refresh hierarchy for changed resource
-SysmlDocumentProvider_IncorrectInputError={1}
-SysmlDocumentProvider_NoDiagramInResourceError=Diagram is not present in resource
-SysmlDocumentProvider_DiagramLoadingError=Error loading diagram
-SysmlDocumentProvider_UnsynchronizedFileSaveError=The file has been changed on the file system
-SysmlDocumentProvider_SaveDiagramTask=Saving diagram
-SysmlDocumentProvider_SaveNextResourceTask=Saving {0}
-SysmlDocumentProvider_SaveAsOperation=Saving {0} diagram as
-SysmlNewDiagramFileWizard_CreationPageName=Initialize new diagram file
-SysmlNewDiagramFileWizard_CreationPageTitle=Diagram file
-SysmlNewDiagramFileWizard_CreationPageDescription=Create new diagram based on {0} model content
-SysmlNewDiagramFileWizard_RootSelectionPageName=Select diagram root element
-SysmlNewDiagramFileWizard_RootSelectionPageTitle=Diagram root element
-SysmlNewDiagramFileWizard_RootSelectionPageDescription=Select semantic model element to be depicted on diagram
-SysmlNewDiagramFileWizard_RootSelectionPageSelectionTitle=Select diagram root element:
-SysmlNewDiagramFileWizard_RootSelectionPageNoSelectionMessage=Diagram root element is not selected
-SysmlNewDiagramFileWizard_RootSelectionPageInvalidSelectionMessage=Invalid diagram root element is selected
-SysmlNewDiagramFileWizard_InitDiagramCommand=Initializing diagram contents
-SysmlNewDiagramFileWizard_IncorrectRootError=Incorrect model object stored as a root resource object
-SysmlDiagramEditor_SavingDeletedFile=The original file "{0}" has been deleted.
-SysmlDiagramEditor_SaveAsErrorTitle=Problem During Save As...
-SysmlDiagramEditor_SaveAsErrorMessage=Save could not be completed. Target file is already open in another editor.
-SysmlDiagramEditor_SaveErrorTitle=Save Problems
-SysmlDiagramEditor_SaveErrorMessage=Could not save file.
-SysmlElementChooserDialog_SelectModelElementTitle=Select model element
-SysmlModelingAssistantProviderTitle=Select domain model element
-SysmlModelingAssistantProviderMessage=Available domain model elements:
-ConstraintProperty1CreationTool_title=ConstraintProperty
-ConstraintProperty1CreationTool_desc=Create new ConstraintProperty
-Property2CreationTool_title=Property
-Property2CreationTool_desc=Create new Property
-AbstractParser_UnexpectedValueType=Value of type {0} is expected
-AbstractParser_WrongStringConversion=String value does not convert to {0} value
-AbstractParser_UnknownLiteral=Unknown literal: {0}
-MessageFormatParser_InvalidInputError=Invalid input at {0}
-Parametric1Group_title=Parametric
-Connector3CreationTool_title=Connector
-Connector3CreationTool_desc=Create new Connector
-NavigatorGroupName_Resource_1000_links=links
-NavigatorGroupName_Property_2005_incominglinks=incoming links
-NavigatorGroupName_Property_2005_outgoinglinks=outgoing links
-NavigatorGroupName_Property_3002_incominglinks=incoming links
-NavigatorGroupName_Property_3002_outgoinglinks=outgoing links
-NavigatorGroupName_Connector_4001_target=target
-NavigatorGroupName_Connector_4001_source=source
-createParametric1Group_title=Parametric
-createConstraintProperty1CreationTool_title=ConstraintProperty
-createConstraintProperty1CreationTool_desc=Create new ConstraintProperty
-createProperty2CreationTool_title=Property
-createProperty2CreationTool_desc=Create new Property
-createConnector3CreationTool_title=Connector
-createConnector3CreationTool_desc=Create new Connector
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/model/Parametric.gmfgen b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/model/Parametric.gmfgen
deleted file mode 100644
index 274361ddef2..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/model/Parametric.gmfgen
+++ /dev/null
@@ -1,559 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xmi:XMI xmi:version="2.0"
- xmlns:xmi="http://www.omg.org/XMI"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:gmfgen="http://www.eclipse.org/gmf/2009/GenModel"
- xmlns:papyrusgmfgenextension="http://www.eclipse.org/papyrus/2009/papyrusgmfgenextension">
- <gmfgen:GenEditorGenerator
- packageNamePrefix="org.eclipse.papyrus.sysml.diagram.parametric"
- modelID="Parametric"
- dynamicTemplates="true"
- templateDirectory="/org.eclipse.papyrus.def/dynamic-templates3.5/codegen">
- <audits>
- <categories
- id="org.eclipse.uml2.uml.util.UMLValidator.validate"
- name="validateSysMLModel"
- description="Validate the SysML model"
- path="/0/@audits/@categories.0"/>
- <categories
- id="org.eclipse.uml2.uml.util.UMLValidator.validateConnectorElement"
- name="validateConnectorElement"
- description="validate a connector checking that its children are consistent"
- path="/0/@audits/@categories.0 /0/@audits/@categories.1"
- audits="/0/@audits/@rules.0 /0/@audits/@rules.1 /0/@audits/@rules.2 /0/@audits/@rules.3"/>
- <rules
- name="validateConnector"
- description="The NestedConnectorEnd stereotype of UML ConnectorEnd extends a UML ConnectorEnd so that the connected property"
- id="org.eclipse.uml2.uml.util.UMLValidator.validateConnectorElement_validateConnector"
- rule="/0/@expressionProviders/@providers.0/@expressions.0"
- message="NestedConnectorEnd is used for connected property identified by a multi-level path of accessible properties from the block that owns the connector."
- severity="WARNING"
- useInLiveMode="true"
- category="/0/@audits/@categories.1">
- <target
- xsi:type="gmfgen:GenDomainElementTarget"
- contextSelector="/0/@audits/@clientContexts.0">
- <element
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Connector"/>
- </target>
- </rules>
- <rules
- name="validateProperty"
- description="When you move a property, check that its incoming or outgoings connector get consistent connectorEnd"
- id="org.eclipse.uml2.uml.util.UMLValidator.validateConnectorElement_validateProperty"
- rule="/0/@expressionProviders/@providers.0/@expressions.1"
- message="NestedConnectorEnd is used for connected property identified by a multi-level path of accessible properties from the block that owns the connector."
- severity="WARNING"
- useInLiveMode="true"
- category="/0/@audits/@categories.1">
- <target
- xsi:type="gmfgen:GenDomainElementTarget"
- contextSelector="/0/@audits/@clientContexts.0">
- <element
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Property"/>
- </target>
- </rules>
- <rules
- name="validateConnectorEnd"
- description="The NestedConnectorEnd stereotype of UML ConnectorEnd extends a UML ConnectorEnd so that the connected property"
- id="org.eclipse.uml2.uml.util.UMLValidator.validateConnectorElement_validateConnectorEnd"
- rule="/0/@expressionProviders/@providers.0/@expressions.2"
- message="NestedConnectorEnd is used for connected property identified by a multi-level path of accessible properties from the block that owns the connector."
- severity="WARNING"
- useInLiveMode="true"
- category="/0/@audits/@categories.1">
- <target
- xsi:type="gmfgen:GenDomainElementTarget"
- contextSelector="/0/@audits/@clientContexts.0">
- <element
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/ConnectorEnd"/>
- </target>
- </rules>
- <rules
- name="validateNestedConnectorEnd"
- description="The NestedConnectorEnd stereotype of UML ConnectorEnd extends a UML ConnectorEnd so that the connected property"
- id="org.eclipse.uml2.uml.util.UMLValidator.validateConnectorElement_validateNestedConnectorEnd"
- rule="/0/@expressionProviders/@providers.0/@expressions.3"
- message="NestedConnectorEnd is used for connected property identified by a multi-level path of accessible properties from the block that owns the connector."
- severity="WARNING"
- useInLiveMode="true"
- category="/0/@audits/@categories.1">
- <target
- xsi:type="gmfgen:GenDomainElementTarget"
- contextSelector="/0/@audits/@clientContexts.0">
- <element
- href="../../org.eclipse.papyrus.sysml/model/sysml.genmodel#//sysml/blocks/NestedConnectorEnd"/>
- </target>
- </rules>
- <clientContexts
- ruleTargets="/0/@audits/@rules.0/@target /0/@audits/@rules.1/@target /0/@audits/@rules.2/@target /0/@audits/@rules.3/@target"/>
- </audits>
- <diagram
- visualID="1000"
- editPartClassName="ParametricEditPart"
- itemSemanticEditPolicyClassName="ParametricItemSemanticEditPolicy"
- canonicalEditPolicyClassName="ParametricCanonicalEditPolicy"
- iconProviderPriority="Low"
- validationProviderPriority="Low">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Diagram"/>
- <elementType
- xsi:type="gmfgen:MetamodelType"
- editHelperClassName="ResourceEditHelper"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.draw2d.FreeformLayer"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="EditPolicyRoles.DRAG_DROP_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.sysml.diagram.parametric.edit.policies.CustomDiagramDragDropEditPolicy"/>
- <domainDiagramElement
- href="../../../plugin/org.eclipse.papyrus.infra.core.resource/model/resource.genmodel#//resource/Resource"/>
- <childNodes
- xsi:type="gmfgen:GenChildSideAffixedNode"
- visualID="3002"
- editPartClassName="Property2EditPart"
- itemSemanticEditPolicyClassName="Property2ItemSemanticEditPolicy"
- notationViewFactoryClassName="PropertyViewFactory"
- canonicalEditPolicyClassName="Property2CanonicalEditPolicy"
- graphicalNodeEditPolicyClassName="Property2GraphicalNodeEditPolicy"
- createCommandClassName="Property2CreateCommand"
- containers="/0/@diagram/@topLevelNodes.0">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <elementType
- xsi:type="gmfgen:MetamodelType"
- editHelperClassName="PropertyEditHelper"/>
- <viewmap
- xsi:type="gmfgen:InnerClassViewmap"
- className="ParameterDescriptor"
- classBody="&#xA;/**&#xA; * @generated&#xA; */&#xA;public class ParameterDescriptor extends org.eclipse.draw2d.RectangleFigure {&#xA;&#xA;&#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;public ParameterDescriptor() {&#xA;&#x9;&#x9;&#x9;&#x9;this.setLineWidth(1);&#xA;this.setPreferredSize(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(16)&#xA;, getMapMode().DPtoLP(16)&#xA;));&#xA;&#x9;}&#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;private boolean myUseLocalCoordinates = false;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;protected boolean useLocalCoordinates() {&#xA;&#x9;&#x9;return myUseLocalCoordinates;&#xA;&#x9;}&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;protected void setUseLocalCoordinates(boolean useLocalCoordinates) {&#xA;&#x9;&#x9;myUseLocalCoordinates = useLocalCoordinates;&#xA;&#x9;}&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;}&#xA;&#xA;">
- <attributes
- xsi:type="gmfgen:DefaultSizeAttributes"
- width="16"
- height="16"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:OpenDiagramBehaviour"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="RequestConstants.REQ_DELETE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.sysml.diagram.parametric.edit.policies.NoDeleteFromDiagramEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="RequestConstants.REQ_SEMANTIC_WRAPPER"
- editPolicyQualifiedClassName="org.eclipse.papyrus.sysml.diagram.parametric.edit.policies.NoDeleteFromModelEditPolicy"/>
- <modelFacet>
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Property"/>
- <containmentMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/StructuredClassifier/ownedAttribute"/>
- <childMetaFeature
- href="../../org.eclipse.papyrus.sysml/model/sysml.genmodel#//sysml/constraints/ConstraintProperty/base_Property"/>
- </modelFacet>
- <labels
- xsi:type="gmfgen:GenExternalNodeLabel"
- visualID="5003"
- editPartClassName="PropertyName2EditPart"
- itemSemanticEditPolicyClassName="PropertyName2ItemSemanticEditPolicy"
- notationViewFactoryClassName="PropertyNameViewFactory">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="RequestConstants.REQ_DELETE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.sysml.diagram.parametric.edit.policies.NoDeleteFromDiagramEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="RequestConstants.REQ_SEMANTIC_WRAPPER"
- editPolicyQualifiedClassName="org.eclipse.papyrus.sysml.diagram.parametric.edit.policies.NoDeleteFromModelEditPolicy"/>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.1">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </modelFacet>
- </labels>
- </childNodes>
- <topLevelNodes
- visualID="2003"
- editPartClassName="ConstraintPropertyEditPart"
- itemSemanticEditPolicyClassName="ConstraintPropertyItemSemanticEditPolicy"
- notationViewFactoryClassName="ConstraintPropertyViewFactory"
- canonicalEditPolicyClassName="ConstraintPropertyCanonicalEditPolicy"
- childNodes="/0/@diagram/@childNodes.0"
- graphicalNodeEditPolicyClassName="ConstraintPropertyGraphicalNodeEditPolicy"
- createCommandClassName="ConstraintPropertyCreateCommand">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <elementType
- xsi:type="gmfgen:MetamodelType"
- editHelperClassName="ConstraintPropertyEditHelper"/>
- <viewmap
- xsi:type="gmfgen:InnerClassViewmap"
- className="ConstraintPropertyFigureDescriptor"
- classBody="&#xA;/**&#xA; * @generated&#xA; */&#xA;public class ConstraintPropertyFigureDescriptor extends org.eclipse.draw2d.RoundedRectangle {&#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;private org.eclipse.papyrus.sysml.diagram.parametric.figures.CenteredWrappedLabel fConstraintPropertyFigureLabel; &#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;private org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel fConstraintLabel; &#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;public ConstraintPropertyFigureDescriptor() {&#xA;&#x9;&#x9;&#xA;&#x9;org.eclipse.draw2d.GridLayout layoutThis = new org.eclipse.draw2d.GridLayout();&#xA;&#x9;layoutThis.numColumns = 1;&#xA;&#x9;layoutThis.makeColumnsEqualWidth = true;&#xA;&#x9;this.setLayoutManager(layoutThis);&#xA;&#xA;&#x9;&#x9;this.setCornerDimensions(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(25)&#xA;, getMapMode().DPtoLP(25)&#xA;));&#xA;this.setLineWidth(1);&#xA;this.setMinimumSize(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(200)&#xA;, getMapMode().DPtoLP(120)&#xA;));&#xA;&#x9;&#x9;createContents();&#xA;&#x9;}&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;private void createContents(){&#xA;&#xA;&#xA;fConstraintPropertyFigureLabel = new org.eclipse.papyrus.sysml.diagram.parametric.figures.CenteredWrappedLabel();&#xA;&#xA;&#xA;&#xA;&#xA;org.eclipse.draw2d.GridData constraintFConstraintPropertyFigureLabel = new org.eclipse.draw2d.GridData();&#xA;constraintFConstraintPropertyFigureLabel.verticalAlignment = org.eclipse.draw2d.GridData.END;&#xA;constraintFConstraintPropertyFigureLabel.horizontalAlignment = org.eclipse.draw2d.GridData.CENTER;&#xA;constraintFConstraintPropertyFigureLabel.horizontalIndent = 0;&#xA;constraintFConstraintPropertyFigureLabel.horizontalSpan = 1;&#xA;constraintFConstraintPropertyFigureLabel.verticalSpan = 1;&#xA;constraintFConstraintPropertyFigureLabel.grabExcessHorizontalSpace = true;&#xA;constraintFConstraintPropertyFigureLabel.grabExcessVerticalSpace = true;&#xA;this.add(fConstraintPropertyFigureLabel, constraintFConstraintPropertyFigureLabel);&#xA;&#xA;&#xA;&#xA;&#xA;fConstraintLabel = new org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel();&#xA;&#xA;&#xA;&#xA;&#xA;org.eclipse.draw2d.GridData constraintFConstraintLabel = new org.eclipse.draw2d.GridData();&#xA;constraintFConstraintLabel.verticalAlignment = org.eclipse.draw2d.GridData.BEGINNING;&#xA;constraintFConstraintLabel.horizontalAlignment = org.eclipse.draw2d.GridData.END;&#xA;constraintFConstraintLabel.horizontalIndent = 0;&#xA;constraintFConstraintLabel.horizontalSpan = 1;&#xA;constraintFConstraintLabel.verticalSpan = 1;&#xA;constraintFConstraintLabel.grabExcessHorizontalSpace = true;&#xA;constraintFConstraintLabel.grabExcessVerticalSpace = true;&#xA;this.add(fConstraintLabel, constraintFConstraintLabel);&#xA;&#xA;&#xA;&#xA;&#x9;}&#xA;&#xA;&#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;private boolean myUseLocalCoordinates = false;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;protected boolean useLocalCoordinates() {&#xA;&#x9;&#x9;return myUseLocalCoordinates;&#xA;&#x9;}&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;protected void setUseLocalCoordinates(boolean useLocalCoordinates) {&#xA;&#x9;&#x9;myUseLocalCoordinates = useLocalCoordinates;&#xA;&#x9;}&#xA;&#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;public org.eclipse.papyrus.sysml.diagram.parametric.figures.CenteredWrappedLabel getConstraintPropertyFigureLabel() {&#xA;&#x9;&#x9;return fConstraintPropertyFigureLabel;&#xA;&#x9;}&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;public org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel getConstraintLabel() {&#xA;&#x9;&#x9;return fConstraintLabel;&#xA;&#x9;}&#xA;&#xA;&#xA;}&#xA;&#xA;"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="RequestConstants.REQ_CREATE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.sysml.diagram.parametric.edit.policies.CreateParameterEditPolicy"/>
- <modelFacet>
- <metaClass
- href="../../org.eclipse.papyrus.sysml/model/sysml.genmodel#//sysml/constraints/ConstraintProperty"/>
- <containmentMetaFeature
- href="../../../plugin/org.eclipse.papyrus.infra.core.resource/model/resource.genmodel#//resource/Resource/eobjects"/>
- <childMetaFeature
- href="../../../plugin/org.eclipse.papyrus.infra.core.resource/model/resource.genmodel#//resource/Resource/eobjects"/>
- </modelFacet>
- <labels
- visualID="5001"
- editPartClassName="ConstraintPropertyNameEditPart"
- itemSemanticEditPolicyClassName="ConstraintPropertyNameItemSemanticEditPolicy"
- notationViewFactoryClassName="ConstraintPropertyLabelViewFactory"
- elementIcon="true">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:ParentAssignedViewmap"
- getterName="getConstraintPropertyFigureLabel"
- figureQualifiedClassName="org.eclipse.papyrus.sysml.diagram.parametric.figures.CenteredWrappedLabel"/>
- <modelFacet
- parser="/0/@labelParsers/@implementations.3"/>
- </labels>
- <labels
- visualID="5004"
- editPartClassName="ConstraintLabelEditPart"
- itemSemanticEditPolicyClassName="ConstraintLabelItemSemanticEditPolicy"
- notationViewFactoryClassName="ConstraintPropertyLabelViewFactory"
- elementIcon="true">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:ParentAssignedViewmap"
- getterName="getConstraintLabel"
- figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="RequestConstants.REQ_SEMANTIC_WRAPPER"
- editPolicyQualifiedClassName="org.eclipse.papyrus.sysml.diagram.parametric.edit.policies.NoDeleteFromModelEditPolicy"/>
- <modelFacet
- parser="/0/@labelParsers/@implementations.4"/>
- </labels>
- </topLevelNodes>
- <topLevelNodes
- visualID="2005"
- editPartClassName="PropertyEditPart"
- itemSemanticEditPolicyClassName="PropertyItemSemanticEditPolicy"
- notationViewFactoryClassName="PropertyViewFactory"
- canonicalEditPolicyClassName="PropertyCanonicalEditPolicy"
- graphicalNodeEditPolicyClassName="PropertyGraphicalNodeEditPolicy"
- createCommandClassName="PropertyCreateCommand">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <elementType
- xsi:type="gmfgen:SpecializationType"
- metamodelType="/0/@diagram/@childNodes.0/@elementType"/>
- <viewmap
- xsi:type="gmfgen:InnerClassViewmap"
- className="PropertyFigure"
- classBody="&#xA;/**&#xA; * @generated&#xA; */&#xA;public class PropertyFigure extends org.eclipse.draw2d.RectangleFigure {&#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;private org.eclipse.papyrus.sysml.diagram.parametric.figures.CenteredWrappedLabel fPropertyFigureLabel; &#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;public PropertyFigure() {&#xA;&#x9;&#x9;&#xA;&#x9;org.eclipse.papyrus.uml.diagram.common.draw2d.CenterLayout layoutThis = new org.eclipse.papyrus.uml.diagram.common.draw2d.CenterLayout();&#xA;&#xA;&#xA;&#x9;this.setLayoutManager(layoutThis);&#xA;&#xA;&#x9;&#x9;this.setLineWidth(1);&#xA;this.setMinimumSize(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(100)&#xA;, getMapMode().DPtoLP(40)&#xA;));&#xA;&#x9;&#x9;createContents();&#xA;&#x9;}&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;private void createContents(){&#xA;&#xA;&#xA;fPropertyFigureLabel = new org.eclipse.papyrus.sysml.diagram.parametric.figures.CenteredWrappedLabel();&#xA;&#xA;&#xA;&#xA;this.add(fPropertyFigureLabel);&#xA;&#xA;&#xA;&#x9;}&#xA;&#xA;&#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;private boolean myUseLocalCoordinates = false;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;protected boolean useLocalCoordinates() {&#xA;&#x9;&#x9;return myUseLocalCoordinates;&#xA;&#x9;}&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;protected void setUseLocalCoordinates(boolean useLocalCoordinates) {&#xA;&#x9;&#x9;myUseLocalCoordinates = useLocalCoordinates;&#xA;&#x9;}&#xA;&#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;public org.eclipse.papyrus.sysml.diagram.parametric.figures.CenteredWrappedLabel getPropertyFigureLabel() {&#xA;&#x9;&#x9;return fPropertyFigureLabel;&#xA;&#x9;}&#xA;&#xA;&#xA;}&#xA;&#xA;"/>
- <modelFacet>
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Property"/>
- <containmentMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/StructuredClassifier/ownedAttribute"/>
- <childMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/StructuredClassifier/ownedAttribute"/>
- </modelFacet>
- <labels
- visualID="5002"
- editPartClassName="PropertyNameEditPart"
- itemSemanticEditPolicyClassName="PropertyNameItemSemanticEditPolicy"
- notationViewFactoryClassName="PropertyNameViewFactory"
- elementIcon="true">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:ParentAssignedViewmap"
- getterName="getPropertyFigureLabel"
- figureQualifiedClassName="org.eclipse.papyrus.sysml.diagram.parametric.figures.CenteredWrappedLabel"/>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.1">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </modelFacet>
- </labels>
- </topLevelNodes>
- <links
- visualID="4001"
- editPartClassName="ConnectorEditPart"
- itemSemanticEditPolicyClassName="ConnectorItemSemanticEditPolicy"
- notationViewFactoryClassName="ConnectorViewFactory"
- createCommandClassName="ConnectorCreateCommand"
- reorientCommandClassName="ConnectorReorientCommand">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Edge"/>
- <elementType
- xsi:type="gmfgen:MetamodelType"
- editHelperClassName="ConnectorEditHelper"/>
- <viewmap
- xsi:type="gmfgen:InnerClassViewmap"
- className="ConnectorFigure"
- classBody="&#xA;/**&#xA; * @generated&#xA; */&#xA;public class ConnectorFigure extends org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx {&#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;private org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel fConnectorLabel; &#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;public ConnectorFigure() {&#xA;&#x9;&#x9;this.setLineWidth(1);&#xA;&#xA;&#x9;&#x9;createContents();&#xA;&#x9;}&#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;private void createContents(){&#xA;&#xA;&#xA;fConnectorLabel = new org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel();&#xA;fConnectorLabel.setText(&quot;&quot;);&#xA;&#xA;this.add(fConnectorLabel);&#xA;&#xA;&#xA;&#x9;}&#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;public org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel getConnectorLabel() {&#xA;&#x9;&#x9;return fConnectorLabel;&#xA;&#x9;}&#xA;&#xA;&#xA;}&#xA;&#xA;"/>
- <modelFacet
- xsi:type="gmfgen:TypeLinkModelFacet">
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Connector"/>
- <containmentMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/StructuredClassifier/ownedConnector"/>
- <childMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/StructuredClassifier/ownedConnector"/>
- <sourceMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/ConnectorEnd/role"/>
- <targetMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/ConnectorEnd/role"/>
- </modelFacet>
- <labels
- visualID="6001"
- editPartClassName="ConnectorNameEditPart"
- itemSemanticEditPolicyClassName="ConnectorNameItemSemanticEditPolicy"
- notationViewFactoryClassName="ConnectorNameViewFactory"
- elementIcon="true">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:ParentAssignedViewmap"
- getterName="getConnectorLabel"
- figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel">
- <attributes
- xsi:type="gmfgen:LabelOffsetAttributes"
- y="40"/>
- </viewmap>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.2">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </modelFacet>
- </labels>
- </links>
- <palette>
- <groups
- title="Parametric"
- largeIconPath="platform:/plugin/org.eclipse.gmf.runtime.diagram.ui/icons/group.gif"
- smallIconPath="platform:/plugin/org.eclipse.gmf.runtime.diagram.ui/icons/group.gif">
- <entries
- xsi:type="gmfgen:ToolEntry"
- title="ConstraintProperty"
- description="Create new ConstraintProperty"
- largeIconPath="platform:/plugin/org.eclipse.papyrus.sysml.edit/icons/full/obj16/ConstraintProperty.gif"
- smallIconPath="platform:/plugin/org.eclipse.papyrus.sysml.edit/icons/full/obj16/ConstraintProperty.gif"
- genNodes="/0/@diagram/@topLevelNodes.0"/>
- <entries
- xsi:type="gmfgen:ToolEntry"
- title="Property"
- description="Create new Property"
- largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Property.gif"
- smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Property.gif"
- genNodes="/0/@diagram/@childNodes.0 /0/@diagram/@topLevelNodes.1"/>
- <entries
- xsi:type="gmfgen:ToolEntry"
- title="Connector"
- description="Create new Connector"
- smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Connector.gif"
- genLinks="/0/@diagram/@links.0"/>
- </groups>
- </palette>
- <preferencePages
- xsi:type="gmfgen:GenStandardPreferencePage"
- iD="org.eclipse.papyrus.sysml.diagram.general"
- name="Sysml Diagram">
- <children
- xsi:type="gmfgen:GenStandardPreferencePage"
- iD="org.eclipse.papyrus.sysml.diagram.appearance"
- name="Appearance"
- kind="Appearance"/>
- <children
- xsi:type="gmfgen:GenStandardPreferencePage"
- iD="org.eclipse.papyrus.sysml.diagram.connections"
- name="Connections"
- kind="Connections"/>
- <children
- xsi:type="gmfgen:GenStandardPreferencePage"
- iD="org.eclipse.papyrus.sysml.diagram.printing"
- name="Printing"
- kind="Printing"/>
- <children
- xsi:type="gmfgen:GenStandardPreferencePage"
- iD="org.eclipse.papyrus.sysml.diagram.rulersAndGrid"
- name="Rulers And Grid"
- kind="RulersAndGrid"/>
- </preferencePages>
- </diagram>
- <plugin
- iD="org.eclipse.papyrus.sysml.diagram.parametric"
- name="Sysml Parametric diagram Plugin"
- provider="Eclipse.org"
- version="0.9.0.qualifier">
- <requiredPlugins>org.eclipse.draw2d</requiredPlugins>
- <requiredPlugins>org.eclipse.gmf.runtime.draw2d.ui</requiredPlugins>
- </plugin>
- <editor/>
- <navigator>
- <childReferences
- child="/0/@diagram"/>
- <childReferences
- parent="/0/@diagram/@topLevelNodes.0"
- child="/0/@diagram/@childNodes.0"/>
- <childReferences
- parent="/0/@diagram"
- child="/0/@diagram/@topLevelNodes.0"/>
- <childReferences
- parent="/0/@diagram"
- child="/0/@diagram/@topLevelNodes.1"/>
- <childReferences
- parent="/0/@diagram"
- child="/0/@diagram/@links.0"
- groupName="links"
- groupIcon="icons/linksNavigatorGroup.gif"/>
- <childReferences
- parent="/0/@diagram/@links.0"
- child="/0/@diagram/@topLevelNodes.1"
- referenceType="out_target"
- groupName="target"
- groupIcon="icons/linkTargetNavigatorGroup.gif"/>
- <childReferences
- parent="/0/@diagram/@topLevelNodes.1"
- child="/0/@diagram/@links.0"
- referenceType="in_source"
- groupName="incoming links"
- groupIcon="icons/incomingLinksNavigatorGroup.gif"/>
- <childReferences
- parent="/0/@diagram/@links.0"
- child="/0/@diagram/@childNodes.0"
- referenceType="out_target"
- groupName="target"
- groupIcon="icons/linkTargetNavigatorGroup.gif"/>
- <childReferences
- parent="/0/@diagram/@childNodes.0"
- child="/0/@diagram/@links.0"
- referenceType="in_source"
- groupName="incoming links"
- groupIcon="icons/incomingLinksNavigatorGroup.gif"/>
- <childReferences
- parent="/0/@diagram/@links.0"
- child="/0/@diagram/@topLevelNodes.1"
- referenceType="in_source"
- groupName="source"
- groupIcon="icons/linkSourceNavigatorGroup.gif"/>
- <childReferences
- parent="/0/@diagram/@topLevelNodes.1"
- child="/0/@diagram/@links.0"
- referenceType="out_target"
- groupName="outgoing links"
- groupIcon="icons/outgoingLinksNavigatorGroup.gif"/>
- <childReferences
- parent="/0/@diagram/@links.0"
- child="/0/@diagram/@childNodes.0"
- referenceType="in_source"
- groupName="source"
- groupIcon="icons/linkSourceNavigatorGroup.gif"/>
- <childReferences
- parent="/0/@diagram/@childNodes.0"
- child="/0/@diagram/@links.0"
- referenceType="out_target"
- groupName="outgoing links"
- groupIcon="icons/outgoingLinksNavigatorGroup.gif"/>
- </navigator>
- <diagramUpdater/>
- <propertySheet>
- <tabs
- xsi:type="gmfgen:GenStandardPropertyTab"
- iD="appearance"/>
- <tabs
- xsi:type="gmfgen:GenStandardPropertyTab"
- iD="diagram"/>
- <tabs
- xsi:type="gmfgen:GenCustomPropertyTab"
- iD="domain"
- label="Core">
- <filter
- xsi:type="gmfgen:TypeTabFilter">
- <types>org.eclipse.gmf.runtime.notation.View</types>
- <types>org.eclipse.gef.EditPart</types>
- <generatedTypes>abstractNavigatorItem</generatedTypes>
- </filter>
- </tabs>
- </propertySheet>
- <domainGenModel
- href="../../org.eclipse.papyrus.sysml/model/sysml.genmodel#/"/>
- <expressionProviders>
- <providers
- xsi:type="gmfgen:GenJavaExpressionProvider"
- injectExpressionBody="true">
- <expressions
- xsi:type="gmfgen:GenConstraint"
- body="return ModelValidationHelper.validateConnector(context, ctx);"/>
- <expressions
- xsi:type="gmfgen:GenConstraint"
- body="return ModelValidationHelper.validateProperty(context, ctx);"/>
- <expressions
- xsi:type="gmfgen:GenConstraint"
- body="return ModelValidationHelper.validateConnectorEnd(context, ctx);"/>
- <expressions
- xsi:type="gmfgen:GenConstraint"
- body="return ModelValidationHelper.validateNestedConnectorEnd(context, ctx);"/>
- </providers>
- </expressionProviders>
- <labelParsers
- extensibleViaService="true">
- <implementations
- xsi:type="gmfgen:PredefinedParser"/>
- <implementations
- xsi:type="gmfgen:CustomParser"
- uses="/0/@diagram/@topLevelNodes.1/@labels.0/@modelFacet /0/@diagram/@childNodes.0/@labels.0/@modelFacet"
- qualifiedName="org.eclipse.papyrus.sysml.diagram.parametric.parsers.PropertyLabelParser"/>
- <implementations
- xsi:type="gmfgen:CustomParser"
- uses="/0/@diagram/@links.0/@labels.0/@modelFacet"
- qualifiedName="org.eclipse.papyrus.sysml.diagram.parametric.parsers.ConnectorLabelParser"/>
- <implementations
- xsi:type="gmfgen:CustomParser"
- uses="/0/@diagram/@topLevelNodes.0/@labels.0/@modelFacet"
- qualifiedName="org.eclipse.papyrus.sysml.diagram.parametric.parsers.ConstraintPropertyLabelParser"/>
- <implementations
- xsi:type="gmfgen:CustomParser"
- uses="/0/@diagram/@topLevelNodes.0/@labels.1/@modelFacet"
- qualifiedName="org.eclipse.papyrus.sysml.diagram.parametric.parsers.ConstraintLabelParser"/>
- </labelParsers>
- <contextMenus
- context="/0/@diagram">
- <items
- xsi:type="gmfgen:LoadResourceAction"/>
- </contextMenus>
- </gmfgen:GenEditorGenerator>
- <papyrusgmfgenextension:PapyrusExtensionRootNode>
- <extensionNodes
- xsi:type="papyrusgmfgenextension:SpecificLocator"
- comment="Affixed Parameter locator"
- classpath="org.eclipse.papyrus.sysml.diagram.parametric.locator.ParameterPositionLocator"
- genChildSideAffixedNode="/0/@diagram/@childNodes.0"/>
- <extensionNodes
- xsi:type="papyrusgmfgenextension:LabelVisibilityPreference"
- comment="HiddenName"
- role="Name"
- iconPathRole="platform:/plugin/org.eclipse.papyrus.uml.diagram.common/icons/label_role/name.png"
- linkLabels="/0/@diagram/@links.0/@labels.0"
- visibleByDefault="false"/>
- <extensionNodes
- xsi:type="papyrusgmfgenextension:ExtendedGenView"
- comment=""
- genView="/0/@diagram/@links.0"
- name="ExtendedUMLLinks"
- superOwnedEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.UMLConnectionNodeEditPart"/>
- </papyrusgmfgenextension:PapyrusExtensionRootNode>
-</xmi:XMI>
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/model/Parametric.gmfgraph b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/model/Parametric.gmfgraph
deleted file mode 100644
index 40f04caf4eb..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/model/Parametric.gmfgraph
+++ /dev/null
@@ -1,147 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<gmfgraph:Canvas xmi:version="2.0"
- xmlns:xmi="http://www.omg.org/XMI"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:gmfgraph="http://www.eclipse.org/gmf/2006/GraphicalDefinition" name="sysml">
- <figures
- name="Default">
- <descriptors
- name="ConstraintPropertyFigureDescriptor">
- <actualFigure
- xsi:type="gmfgraph:RoundedRectangle"
- name="ConstraintPropertyFigure"
- cornerWidth="25"
- cornerHeight="25">
- <layout
- xsi:type="gmfgraph:GridLayout"/>
- <minimumSize
- dx="200"
- dy="120"/>
- <children
- xsi:type="gmfgraph:CustomFigure"
- name="ConstraintPropertyFigureLabel"
- qualifiedClassName="org.eclipse.papyrus.sysml.diagram.parametric.figures.CenteredWrappedLabel">
- <layoutData
- xsi:type="gmfgraph:GridLayoutData"
- grabExcessHorizontalSpace="true"
- grabExcessVerticalSpace="true"
- verticalAlignment="END"/>
- </children>
- <children
- xsi:type="gmfgraph:CustomFigure"
- name="ConstraintLabel"
- qualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel">
- <layoutData
- xsi:type="gmfgraph:GridLayoutData"
- grabExcessHorizontalSpace="true"
- grabExcessVerticalSpace="true"
- verticalAlignment="BEGINNING"
- horizontalAlignment="END"/>
- </children>
- </actualFigure>
- <accessors
- accessor="getConstraintPropertyFigureLabel"
- figure="//@figures.0/@descriptors.0/@actualFigure/@children.0"/>
- <accessors
- accessor="getConstraintLabel"
- figure="//@figures.0/@descriptors.0/@actualFigure/@children.1"/>
- </descriptors>
- <descriptors
- name="PropertyFigure">
- <actualFigure
- xsi:type="gmfgraph:Rectangle"
- name="PropertyFigure">
- <layout
- xsi:type="gmfgraph:CustomLayout"
- qualifiedClassName="org.eclipse.papyrus.uml.diagram.common.draw2d.CenterLayout"/>
- <minimumSize
- dx="100"
- dy="40"/>
- <children
- xsi:type="gmfgraph:CustomFigure"
- name="PropertyFigureLabel"
- qualifiedClassName="org.eclipse.papyrus.sysml.diagram.parametric.figures.CenteredWrappedLabel"/>
- </actualFigure>
- <accessors
- accessor="getPropertyFigureLabel"
- figure="//@figures.0/@descriptors.1/@actualFigure/@children.0"/>
- </descriptors>
- <descriptors
- name="ParameterDescriptor">
- <actualFigure
- xsi:type="gmfgraph:Rectangle"
- name="ParameterRectangle">
- <preferredSize
- dx="16"
- dy="16"/>
- </actualFigure>
- </descriptors>
- <descriptors
- name="ParameterLabelFigure">
- <actualFigure
- xsi:type="gmfgraph:Label"
- name="ParameterLabel"/>
- </descriptors>
- <descriptors
- name="ConnectorFigure">
- <actualFigure
- xsi:type="gmfgraph:PolylineConnection"
- name="ConnectorPolylineConnection">
- <children
- xsi:type="gmfgraph:Label"
- name="ConnectorLabel"/>
- </actualFigure>
- <accessors
- accessor="getConnectorLabel"
- figure="//@figures.0/@descriptors.4/@actualFigure/@children.0"/>
- </descriptors>
- </figures>
- <nodes
- name="NodeConstraintProperty"
- figure="ConstraintPropertyFigureDescriptor"/>
- <nodes
- name="NodeProperty"
- figure="PropertyFigure"/>
- <nodes
- name="ParameterNode"
- figure="ParameterDescriptor"
- affixedParentSide="NSEW"/>
- <connections
- name="ConnectorConnection"
- figure="ConnectorFigure"/>
- <labels
- name="Property"
- figure="PropertyFigure"
- accessor="//@figures.0/@descriptors.1/@accessors.0">
- <facets
- xsi:type="gmfgraph:AlignmentFacet"
- alignment="CENTER"/>
- </labels>
- <labels
- name="ConstraintProperty"
- figure="ConstraintPropertyFigureDescriptor"
- accessor="//@figures.0/@descriptors.0/@accessors.0">
- <facets
- xsi:type="gmfgraph:AlignmentFacet"
- alignment="CENTER"/>
- </labels>
- <labels
- name="ParameterLabel"
- figure="ParameterLabelFigure"
- elementIcon="false">
- <facets
- xsi:type="gmfgraph:AlignmentFacet"/>
- </labels>
- <labels
- name="ConnectorDiagramLabel"
- figure="ConnectorFigure"
- accessor="//@figures.0/@descriptors.4/@accessors.0"/>
- <labels
- name="ConstraintLabel"
- figure="ConstraintPropertyFigureDescriptor"
- accessor="//@figures.0/@descriptors.0/@accessors.1">
- <facets
- xsi:type="gmfgraph:AlignmentFacet"
- alignment="END"/>
- </labels>
-</gmfgraph:Canvas>
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/model/Parametric.gmfmap b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/model/Parametric.gmfmap
deleted file mode 100644
index 0e3d1611f53..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/model/Parametric.gmfmap
+++ /dev/null
@@ -1,182 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<gmfmap:Mapping xmi:version="2.0"
- xmlns:xmi="http://www.omg.org/XMI"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
- xmlns:gmfmap="http://www.eclipse.org/gmf/2008/mappings"
- xmlns:gmftool="http://www.eclipse.org/gmf/2005/ToolDefinition">
- <nodes>
- <containmentFeature
- href="../../../plugin/org.eclipse.papyrus.infra.core.resource/model/resource.ecore#//Resource/eobjects"/>
- <ownedChild>
- <domainMetaElement
- href="../../org.eclipse.papyrus.sysml.converted/model/sysml.ecore#//constraints/ConstraintProperty"/>
- <labelMappings>
- <diagramLabel
- href="Parametric.gmfgraph#ConstraintProperty"/>
- </labelMappings>
- <labelMappings>
- <diagramLabel
- href="Parametric.gmfgraph#ConstraintLabel"/>
- </labelMappings>
- <tool
- xsi:type="gmftool:CreationTool"
- href="Parametric.gmftool#//@palette/@tools.0/@tools.0"/>
- <diagramNode
- href="Parametric.gmfgraph#NodeConstraintProperty"/>
- <children
- referencedChild="//@nodes.0/@ownedChild/@children.0/@ownedChild">
- <containmentFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.ecore#//StructuredClassifier/ownedAttribute"/>
- <childrenFeature
- href="../../org.eclipse.papyrus.sysml.converted/model/sysml.ecore#//constraints/ConstraintProperty/base_Property"/>
- <ownedChild
- relatedDiagrams="//@diagram">
- <domainMetaElement
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.ecore#//Property"/>
- <labelMappings
- xsi:type="gmfmap:FeatureLabelMapping">
- <diagramLabel
- href="Parametric.gmfgraph#ParameterLabel"/>
- <features
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.ecore#//NamedElement/name"/>
- </labelMappings>
- <tool
- xsi:type="gmftool:CreationTool"
- href="Parametric.gmftool#//@palette/@tools.0/@tools.1"/>
- <diagramNode
- href="Parametric.gmfgraph#ParameterNode"/>
- </ownedChild>
- </children>
- </ownedChild>
- </nodes>
- <nodes>
- <containmentFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.ecore#//StructuredClassifier/ownedAttribute"/>
- <ownedChild>
- <domainMetaElement
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.ecore#//Property"/>
- <labelMappings
- xsi:type="gmfmap:FeatureLabelMapping">
- <diagramLabel
- href="Parametric.gmfgraph#Property"/>
- <features
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.ecore#//NamedElement/name"/>
- </labelMappings>
- <tool
- xsi:type="gmftool:CreationTool"
- href="Parametric.gmftool#//@palette/@tools.0/@tools.1"/>
- <diagramNode
- href="Parametric.gmfgraph#NodeProperty"/>
- </ownedChild>
- </nodes>
- <links
- relatedDiagrams="//@diagram">
- <domainMetaElement
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.ecore#//Connector"/>
- <labelMappings
- xsi:type="gmfmap:FeatureLabelMapping">
- <diagramLabel
- href="Parametric.gmfgraph#ConnectorDiagramLabel"/>
- <features
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.ecore#//NamedElement/name"/>
- </labelMappings>
- <containmentFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.ecore#//StructuredClassifier/ownedConnector"/>
- <tool
- xsi:type="gmftool:CreationTool"
- href="Parametric.gmftool#//@palette/@tools.0/@tools.2"/>
- <diagramLink
- href="Parametric.gmfgraph#ConnectorConnection"/>
- <sourceMetaFeature
- xsi:type="ecore:EReference"
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.ecore#//ConnectorEnd/role"/>
- <linkMetaFeature
- xsi:type="ecore:EReference"
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.ecore#//ConnectorEnd/role"/>
- </links>
- <diagram>
- <diagramCanvas
- href="Parametric.gmfgraph#sysml"/>
- <domainModel
- href="../../org.eclipse.papyrus.sysml.converted/model/sysml.ecore#//blocks"/>
- <domainMetaElement
- href="../../../plugin/org.eclipse.papyrus.infra.core.resource/model/resource.ecore#//Resource"/>
- <palette
- href="Parametric.gmftool#//@palette"/>
- </diagram>
- <audits
- id="org.eclipse.uml2.uml.util.UMLValidator.validate"
- name="validateSysMLModel"
- description="Validate the SysML model">
- <childContainers
- id="org.eclipse.uml2.uml.util.UMLValidator.validateConnectorElement"
- name="validateConnectorElement"
- description="validate a connector checking that its children are consistent">
- <audits
- name="validateConnector"
- description="The NestedConnectorEnd stereotype of UML ConnectorEnd extends a UML ConnectorEnd so that the connected property"
- id="org.eclipse.uml2.uml.util.UMLValidator.validateConnectorElement_validateConnector"
- severity="WARNING"
- useInLiveMode="true"
- message="NestedConnectorEnd is used for connected property identified by a multi-level path of accessible properties from the block that owns the connector.">
- <rule
- body="return ModelValidationHelper.validateConnector(context, ctx);"
- language="java"/>
- <target
- xsi:type="gmfmap:DomainElementTarget">
- <element
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.ecore#//Connector"/>
- </target>
- </audits>
- <audits
- name="validateProperty"
- description="When you move a property, check that its incoming or outgoings connector get consistent connectorEnd"
- id="org.eclipse.uml2.uml.util.UMLValidator.validateConnectorElement_validateProperty"
- severity="WARNING"
- useInLiveMode="true"
- message="NestedConnectorEnd is used for connected property identified by a multi-level path of accessible properties from the block that owns the connector.">
- <rule
- body="return ModelValidationHelper.validateProperty(context, ctx);"
- language="java"/>
- <target
- xsi:type="gmfmap:DomainElementTarget">
- <element
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.ecore#//Property"/>
- </target>
- </audits>
- <audits
- name="validateConnectorEnd"
- description="The NestedConnectorEnd stereotype of UML ConnectorEnd extends a UML ConnectorEnd so that the connected property"
- id="org.eclipse.uml2.uml.util.UMLValidator.validateConnectorElement_validateConnectorEnd"
- severity="WARNING"
- useInLiveMode="true"
- message="NestedConnectorEnd is used for connected property identified by a multi-level path of accessible properties from the block that owns the connector.">
- <rule
- body="return ModelValidationHelper.validateConnectorEnd(context, ctx);"
- language="java"/>
- <target
- xsi:type="gmfmap:DomainElementTarget">
- <element
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.ecore#//ConnectorEnd"/>
- </target>
- </audits>
- <audits
- name="validateNestedConnectorEnd"
- description="The NestedConnectorEnd stereotype of UML ConnectorEnd extends a UML ConnectorEnd so that the connected property"
- id="org.eclipse.uml2.uml.util.UMLValidator.validateConnectorElement_validateNestedConnectorEnd"
- severity="WARNING"
- useInLiveMode="true"
- message="NestedConnectorEnd is used for connected property identified by a multi-level path of accessible properties from the block that owns the connector.">
- <rule
- body="return ModelValidationHelper.validateNestedConnectorEnd(context, ctx);"
- language="java"/>
- <target
- xsi:type="gmfmap:DomainElementTarget">
- <element
- href="../../org.eclipse.papyrus.sysml.converted/model/sysml.ecore#//blocks/NestedConnectorEnd"/>
- </target>
- </audits>
- </childContainers>
- </audits>
-</gmfmap:Mapping>
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/model/Parametric.gmftool b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/model/Parametric.gmftool
deleted file mode 100644
index f30d8a80cb9..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/model/Parametric.gmftool
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<gmftool:ToolRegistry xmi:version="2.0"
- xmlns:xmi="http://www.omg.org/XMI"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:gmftool="http://www.eclipse.org/gmf/2005/ToolDefinition">
- <palette
- title="sysmlPalette">
- <tools
- xsi:type="gmftool:ToolGroup"
- title="Parametric">
- <smallIcon
- xsi:type="gmftool:BundleImage"
- path="/icons/group.gif"
- bundle="platform:/plugin/org.eclipse.gmf.runtime.diagram.ui"/>
- <largeIcon
- xsi:type="gmftool:BundleImage"
- path="/icons/group.gif"
- bundle="platform:/plugin/org.eclipse.gmf.runtime.diagram.ui"/>
- <tools
- xsi:type="gmftool:CreationTool"
- title="ConstraintProperty"
- description="Create new ConstraintProperty">
- <smallIcon
- xsi:type="gmftool:BundleImage"
- path="/icons/full/obj16/ConstraintProperty.gif"
- bundle="platform:/plugin/org.eclipse.papyrus.sysml.edit"/>
- <largeIcon
- xsi:type="gmftool:BundleImage"
- path="/icons/full/obj16/ConstraintProperty.gif"
- bundle="platform:/plugin/org.eclipse.papyrus.sysml.edit"/>
- </tools>
- <tools
- xsi:type="gmftool:CreationTool"
- title="Property"
- description="Create new Property">
- <smallIcon
- xsi:type="gmftool:BundleImage"
- path="/icons/full/obj16/Property.gif"
- bundle="platform:/plugin/org.eclipse.uml2.uml.edit"/>
- <largeIcon
- xsi:type="gmftool:BundleImage"
- path="/icons/full/obj16/Property.gif"
- bundle="platform:/plugin/org.eclipse.uml2.uml.edit"/>
- </tools>
- <tools
- xsi:type="gmftool:CreationTool"
- title="Connector"
- description="Create new Connector">
- <smallIcon
- xsi:type="gmftool:BundleImage"
- path="/icons/full/obj16/Connector.gif"
- bundle="platform:/plugin/org.eclipse.uml2.uml.edit"/>
- </tools>
- </tools>
- </palette>
-</gmftool:ToolRegistry>
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/model/Parametric.trace b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/model/Parametric.trace
deleted file mode 100644
index 89f49f47e77..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/model/Parametric.trace
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<trace:TraceModel xmi:version="2.0"
- xmlns:xmi="http://www.omg.org/XMI"
- xmlns:trace="http://www.eclipse.org/gmf/2006/Trace">
- <nodeTraces
- visualID="2003"
- queryText="(let _eClass_:ecore::EClass = modelFacet.metaClass.ecoreClass in _eClass_.ePackage.nsURI = 'http://www.eclipse.org/papyrus/0.7.0/SysML/Constraints' and _eClass_.name = 'ConstraintProperty') and (let _containmentMF_:ecore::EStructuralFeature = modelFacet.containmentMetaFeature.ecoreFeature in (let _eClass_:ecore::EClass = _containmentMF_.eContainingClass in _eClass_.ePackage.nsURI = 'http://www.eclipse.org/papyurs/0.7.0/Resource' and _eClass_.name = 'Resource') and _containmentMF_.name = 'eobjects')">
- <nodeLabelTraces
- visualID="5001"
- queryText="true"/>
- <nodeLabelTraces
- visualID="5004"
- queryText="true"/>
- </nodeTraces>
- <nodeTraces
- visualID="2005"
- queryText="(let _eClass_:ecore::EClass = modelFacet.metaClass.ecoreClass in _eClass_.ePackage.nsURI = 'http://www.eclipse.org/uml2/3.0.0/UML' and _eClass_.name = 'Property') and (let _containmentMF_:ecore::EStructuralFeature = modelFacet.containmentMetaFeature.ecoreFeature in (let _eClass_:ecore::EClass = _containmentMF_.eContainingClass in _eClass_.ePackage.nsURI = 'http://www.eclipse.org/uml2/3.0.0/UML' and _eClass_.name = 'StructuredClassifier') and _containmentMF_.name = 'ownedAttribute')">
- <nodeLabelTraces
- visualID="5002"
- queryText="true"/>
- </nodeTraces>
- <childNodeTraces
- visualID="3002"
- queryText="(let _eClass_:ecore::EClass = modelFacet.metaClass.ecoreClass in _eClass_.ePackage.nsURI = 'http://www.eclipse.org/uml2/3.0.0/UML' and _eClass_.name = 'Property') and (let _containmentMF_:ecore::EStructuralFeature = modelFacet.containmentMetaFeature.ecoreFeature in (let _eClass_:ecore::EClass = _containmentMF_.eContainingClass in _eClass_.ePackage.nsURI = 'http://www.eclipse.org/uml2/3.0.0/UML' and _eClass_.name = 'StructuredClassifier') and _containmentMF_.name = 'ownedAttribute') and ( let _childMF_:ecore::EStructuralFeature = modelFacet.childMetaFeature.ecoreFeature in (let _eClass_:ecore::EClass = _childMF_.eContainingClass in _eClass_.ePackage.nsURI = 'http://www.eclipse.org/papyrus/0.7.0/SysML/Constraints' and _eClass_.name = 'ConstraintProperty') and _childMF_.name = 'base_Property')">
- <nodeLabelTraces
- visualID="5003"
- queryText="true"/>
- </childNodeTraces>
- <linkTraces
- visualID="4001"
- queryText="modelFacet.oclIsKindOf(gmfgen::TypeLinkModelFacet) and (let _eClass_:ecore::EClass = modelFacet.oclAsType(gmfgen::TypeLinkModelFacet).metaClass.ecoreClass in _eClass_.ePackage.nsURI = 'http://www.eclipse.org/uml2/3.0.0/UML' and _eClass_.name = 'Connector')">
- <linkLabelTraces
- visualID="6001"
- queryText="true"/>
- </linkTraces>
-</trace:TraceModel>
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/model/SysML.Parametric.idgen b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/model/SysML.Parametric.idgen
new file mode 100644
index 00000000000..4db68156930
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/model/SysML.Parametric.idgen
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<idgen:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gmfgen="http://www.eclipse.org/gmf/2009/GenModel" xmlns:idgen="http://www.eclipse.org/papyrus/0.7.0/idgen" name="Parametric" type="Parametric" icon="icons/obj16/Diagram_Parametric.gif" label="SysML Parametric Diagram" language="sysml" javaPackagePrefix="org.eclipse.papyrus.sysml.diagram.parametric" javaClassPrefix="ParametricDiagram" createCommandLabel="Create a new Parametric Diagram">
+ <diagramEditPart name="Diagram edit part">
+ <behaviors javaClassQualifiedName="org.eclipse.papyrus.uml.diagram.common.editpolicies.DuplicatePasteEditPolicy" key="DuplicatePasteEditPolicy.PASTE_ROLE"/>
+ <behaviors javaClassQualifiedName="org.eclipse.papyrus.sysml.diagram.internalblock.edit.policy.CustomDragDropEditPolicy" key="EditPolicyRoles.DRAG_DROP_ROLE"/>
+ <behaviors javaClassQualifiedName="org.eclipse.papyrus.gmf.diagram.common.edit.policy.DefaultXYLayoutEditPolicy" key="EditPolicy.LAYOUT_ROLE"/>
+ <behaviors name="" javaClassQualifiedName="org.eclipse.papyrus.gmf.diagram.common.edit.policy.DefaultCreationEditPolicy" key="EditPolicyRoles.CREATION_ROLE"/>
+ <behaviors javaClassQualifiedName="org.eclipse.papyrus.gmf.diagram.common.edit.policy.DefaultContainerNodeEditPolicy" key="EditPolicy.GRAPHICAL_NODE_ROLE"/>
+ </diagramEditPart>
+ <inheritedDiagrams name="CompositeDiagram" viewProviderClassQualifiedName="" editPartProviderClassQualifiedName="" dndEditPolicyClassQualifiedName="org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies.CustomDiagramDragDropEditPolicy">
+ <genInheritedEditor href="../../org.eclipse.papyrus.uml.diagram.composite/model/compositediagram.gmfgen#CompositeStructure"/>
+ <genNodes>
+ <genNode xsi:type="gmfgen:GenTopLevelNode" href="../../org.eclipse.papyrus.uml.diagram.composite/model/compositediagram.gmfgen#/0/@diagram/@topLevelNodes.48"/>
+ <semanticType href="../../org.eclipse.papyrus.sysml.diagram.common/model/UML.ReusableParts.idgen#org.eclipse.papyrus.uml.Constraint"/>
+ </genNodes>
+ <genNodes generatePreferencePage="false" generateTool="false">
+ <genNode xsi:type="gmfgen:GenChildNode" href="../../org.eclipse.papyrus.uml.diagram.composite/model/compositediagram.gmfgen#/0/@diagram/@childNodes.27"/>
+ <semanticType href="../../org.eclipse.papyrus.sysml.diagram.common/model/UML.ReusableParts.idgen#org.eclipse.papyrus.uml.Comment"/>
+ </genNodes>
+ <genNodes>
+ <genNode xsi:type="gmfgen:GenTopLevelNode" href="../../org.eclipse.papyrus.uml.diagram.composite/model/compositediagram.gmfgen#/0/@diagram/@topLevelNodes.43"/>
+ <semanticType href="../../org.eclipse.papyrus.sysml.diagram.common/model/UML.ReusableParts.idgen#org.eclipse.papyrus.uml.Comment"/>
+ </genNodes>
+ <genNodes generatePreferencePage="false" generateTool="false">
+ <genNode xsi:type="gmfgen:GenChildNode" href="../../org.eclipse.papyrus.uml.diagram.composite/model/compositediagram.gmfgen#/0/@diagram/@childNodes.32"/>
+ <semanticType href="../../org.eclipse.papyrus.sysml.diagram.common/model/UML.ReusableParts.idgen#org.eclipse.papyrus.uml.Constraint"/>
+ </genNodes>
+ <genLinks>
+ <genLink href="../../org.eclipse.papyrus.uml.diagram.composite/model/compositediagram.gmfgen#/0/@diagram/@links.1"/>
+ </genLinks>
+ <genLinks>
+ <genLink href="../../org.eclipse.papyrus.uml.diagram.composite/model/compositediagram.gmfgen#/0/@diagram/@links.2"/>
+ </genLinks>
+ </inheritedDiagrams>
+ <customJavaClasses name="" customEditPolicyProvider="org.eclipse.papyrus.sysml.diagram.internalblock.CustomEditPolicyProvider" customPreferenceInitializer="org.eclipse.papyrus.sysml.diagram.parametric.preferences.CustomPreferenceInitializer"/>
+ <usedCustomNodes href="../../org.eclipse.papyrus.sysml.diagram.common/model/SysML.ReusableParts.idgen#shape_sysml_block_as_composite"/>
+ <usedCustomNodes href="../../org.eclipse.papyrus.sysml.diagram.common/model/SysML.ReusableParts.idgen#shape_sysml_blockproperty_as_composite"/>
+ <usedCustomNodes href="../../org.eclipse.papyrus.sysml.diagram.common/model/SysML.ReusableParts.idgen#shape_sysml_flowport_as_affixed"/>
+ <usedCustomNodes href="../../org.eclipse.papyrus.sysml.diagram.common/model/UML.ReusableParts.idgen#shape_uml_port_as_affixed"/>
+ <usedCustomEdges href="../../org.eclipse.papyrus.sysml.diagram.common/model/UML.ReusableParts.idgen#link_uml_connector"/>
+ <usedCustomEdges href="../../org.eclipse.papyrus.sysml.diagram.common/model/UML.ReusableParts.idgen#link_uml_dependency"/>
+ <usedCustomDecorations href="../../org.eclipse.papyrus.sysml.diagram.common/model/SysML.ReusableParts.idgen#label_sysml_block_name"/>
+ <usedCustomDecorations href="../../org.eclipse.papyrus.sysml.diagram.common/model/SysML.ReusableParts.idgen#affixedlabel_sysml_flowport_label"/>
+ <usedCustomDecorations href="../../org.eclipse.papyrus.sysml.diagram.common/model/UML.ReusableParts.idgen#affixedlabel_uml_appliedstereotype"/>
+ <usedCustomDecorations href="../../org.eclipse.papyrus.sysml.diagram.common/model/UML.ReusableParts.idgen#affixedlabel_uml_port_label"/>
+ <usedCustomDecorations href="../../org.eclipse.papyrus.sysml.diagram.common/model/SysML.ReusableParts.idgen#compartment_sysml_structure"/>
+ <usedCustomDecorations href="../../org.eclipse.papyrus.sysml.diagram.common/model/SysML.ReusableParts.idgen#compartment_sysml_blockproperty_structure"/>
+ <usedCustomDecorations href="../../org.eclipse.papyrus.sysml.diagram.common/model/UML.ReusableParts.idgen#label_uml_property_label"/>
+ <usedCustomDecorations href="../../org.eclipse.papyrus.sysml.diagram.common/model/UML.ReusableParts.idgen#linklabel_uml_appliedstereotype"/>
+ <usedCustomDecorations href="../../org.eclipse.papyrus.sysml.diagram.common/model/UML.ReusableParts.idgen#linklabel_uml_connector_label"/>
+ <usedCustomDecorations href="../../org.eclipse.papyrus.sysml.diagram.common/model/UML.ReusableParts.idgen#linklabel_uml_connector_source_multiplicity"/>
+ <usedCustomDecorations href="../../org.eclipse.papyrus.sysml.diagram.common/model/UML.ReusableParts.idgen#linklabel_uml_connector_target_multiplicity"/>
+ <usedCustomDecorations href="../../org.eclipse.papyrus.sysml.diagram.common/model/UML.ReusableParts.idgen#linklabel_uml_namedelement_name"/>
+ <diagramConfig>
+ <contains xsi:type="idgen:GraphicalTypeDiagramRef">
+ <contains>
+ <ref href="../../org.eclipse.papyrus.sysml.diagram.common/model/SysML.ReusableParts.idgen#shape_sysml_block_as_composite"/>
+ <contains>
+ <ref href="../../org.eclipse.papyrus.sysml.diagram.common/model/SysML.ReusableParts.idgen#shape_sysml_flowport_as_affixed"/>
+ </contains>
+ <contains>
+ <ref href="../../org.eclipse.papyrus.sysml.diagram.common/model/UML.ReusableParts.idgen#shape_uml_port_as_affixed"/>
+ </contains>
+ <contains>
+ <ref href="../../org.eclipse.papyrus.sysml.diagram.common/model/SysML.ReusableParts.idgen#compartment_sysml_structure"/>
+ </contains>
+ <contains>
+ <ref href="../../org.eclipse.papyrus.sysml.diagram.common/model/SysML.ReusableParts.idgen#shape_sysml_blockproperty_as_composite"/>
+ <contains>
+ <ref href="../../org.eclipse.papyrus.sysml.diagram.common/model/SysML.ReusableParts.idgen#shape_sysml_flowport_as_affixed"/>
+ </contains>
+ <contains>
+ <ref href="../../org.eclipse.papyrus.sysml.diagram.common/model/UML.ReusableParts.idgen#shape_uml_port_as_affixed"/>
+ </contains>
+ <contains>
+ <ref href="../../org.eclipse.papyrus.sysml.diagram.common/model/SysML.ReusableParts.idgen#compartment_sysml_blockproperty_structure"/>
+ <contains>
+ <ref href="../../org.eclipse.papyrus.sysml.diagram.common/model/SysML.ReusableParts.idgen#shape_sysml_blockproperty_as_composite"/>
+ </contains>
+ </contains>
+ </contains>
+ <contains>
+ <ref href="../../org.eclipse.papyrus.sysml.diagram.common/model/SysML.ReusableParts.idgen#shape_sysml_constraintblockproperty_as_composite"/>
+ <contains>
+ <ref href="../../org.eclipse.papyrus.sysml.diagram.common/model/UML.ReusableParts.idgen#shape_uml_property_as_label"/>
+ </contains>
+ <contains>
+ <ref href="../../org.eclipse.papyrus.sysml.diagram.common/model/SysML.ReusableParts.idgen#compartment_sysml_blockproperty_structure"/>
+ <contains>
+ <ref href="../../org.eclipse.papyrus.sysml.diagram.common/model/SysML.ReusableParts.idgen#shape_sysml_constraintblockproperty_as_composite"/>
+ </contains>
+ <contains>
+ <ref href="../../org.eclipse.papyrus.sysml.diagram.common/model/UML.ReusableParts.idgen#label_uml_property_label"/>
+ </contains>
+ </contains>
+ </contains>
+ </contains>
+ <contains>
+ <ref href="../../org.eclipse.papyrus.sysml.diagram.common/model/UML.ReusableParts.idgen#link_uml_dependency"/>
+ </contains>
+ <contains>
+ <ref href="../../org.eclipse.papyrus.sysml.diagram.common/model/UML.ReusableParts.idgen#link_uml_connector"/>
+ </contains>
+ </contains>
+ <contains>
+ <ref href="../../org.eclipse.papyrus.sysml.diagram.common/model/SysML.ReusableParts.idgen#compartment_sysml_structure"/>
+ <contains>
+ <ref href="../../org.eclipse.papyrus.sysml.diagram.common/model/SysML.ReusableParts.idgen#shape_sysml_blockproperty_as_composite"/>
+ </contains>
+ <contains>
+ <ref href="../../org.eclipse.papyrus.sysml.diagram.common/model/SysML.ReusableParts.idgen#shape_sysml_constraintblockproperty_as_composite"/>
+ </contains>
+ </contains>
+ <contains>
+ <ref href="../../org.eclipse.papyrus.sysml.diagram.common/model/SysML.ReusableParts.idgen#compartment_sysml_blockproperty_structure"/>
+ <contains>
+ <ref href="../../org.eclipse.papyrus.sysml.diagram.common/model/SysML.ReusableParts.idgen#shape_sysml_blockproperty_as_composite"/>
+ </contains>
+ <contains>
+ <ref href="../../org.eclipse.papyrus.sysml.diagram.common/model/SysML.ReusableParts.idgen#shape_sysml_constraintblockproperty_as_composite"/>
+ </contains>
+ </contains>
+ </diagramConfig>
+</idgen:Diagram>
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/palettes/parametric.palette.xml b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/palettes/parametric.palette.xml
new file mode 100644
index 00000000000..75247fe2000
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/palettes/parametric.palette.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<paletteDefinition>
+ <content>
+ <drawer id="parametric.drawer.nodes" name="Nodes" iconpath="platform:/plugin/org.eclipse.gmf.runtime.diagram.ui/icons/group.gif">
+ <aspectTool description="Create a new ConstraintProperty" id="parametric.tool.constraintblockpropertycomposite"
+ name="ConstraintProperty" refToolId="parametric.tool.constraintblockpropertycomposite">
+ </aspectTool>
+ <aspectTool description="Create a new ConstraintParameter" id="parametric.tool.parameter"
+ name="ConstraintParameter" refToolId="parametric.tool.parameter">
+ </aspectTool>
+ <aspectTool description="Create a new Part" id="parametric.tool.blockpropertycomposite"
+ name="Part" refToolId="parametric.tool.blockpropertycomposite">
+ </aspectTool>
+ <aspectTool description="Create a new Reference" id="parametric.tool.reference"
+ name="Reference" refToolId="parametric.tool.reference">
+ </aspectTool>
+ <aspectTool description="Create a new Value" id="parametric.tool.value"
+ name="Value" refToolId="parametric.tool.value">
+ </aspectTool>
+ </drawer>
+ <drawer id="parametric.drawer.edges" name="Edges" iconpath="platform:/plugin/org.eclipse.gmf.runtime.diagram.ui/icons/group.gif">
+ <aspectTool description="Create a new BindingConnector" id="parametric.tool.connector"
+ name="BindingConnector" refToolId="parametric.tool.connector">
+ </aspectTool>
+ </drawer>
+ <drawer id="parametric.drawer.others" name="Others" iconpath="platform:/plugin/org.eclipse.gmf.runtime.diagram.ui/icons/group.gif">
+ <aspectTool description="Create a new Dependency" id="parametric.tool.dependency"
+ name="Dependency" refToolId="parametric.tool.dependency">
+ </aspectTool>
+ <aspectTool description="Create a new Comment" id="parametric.tool.comment"
+ name="Comment" refToolId="parametric.tool.comment">
+ </aspectTool>
+ <aspectTool description="Create a new Constraint" id="parametric.tool.constraint"
+ name="Constraint" refToolId="parametric.tool.constraint">
+ </aspectTool>
+ <aspectTool description="Create a new CommentAnnotatedElement" id="parametric.tool.commentannotatedelement"
+ name="CommentAnnotatedElement" refToolId="parametric.tool.comment_constraint_link">
+ </aspectTool>
+ </drawer>
+ </content>
+</paletteDefinition>
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/plugin.properties b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/plugin.properties
index 7d806bfb50e..1095de7c781 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/plugin.properties
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/plugin.properties
@@ -1,59 +1,12 @@
-#/*****************************************************************************
-#* Copyright (c) 2009 Atos Origin.
-# *
-# *
-# * All rights reserved. This program and the accompanying materials
-# * are made available under the terms of the Eclipse Public License v1.0
-# * which accompanies this distribution, and is available at
-# * http://www.eclipse.org/legal/epl-v10.html
-# *
-# * Contributors:
-# * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
-# *
-# *****************************************************************************/
-pluginName=Papyrus Paramatric Diagram for SysML (Incubation)
+#################################################################################
+# Copyright (c) 2010 CEA LIST.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - initial API and implementation
+##################################################################################
+pluginName=SysML Parametric Diagram
providerName=Eclipse Modeling Project
-
-editorName=SysML Diagram Editing
-context.description=SysML Diagram Editing
-context.name=In SysML Diagram Editor
-newWizardName=SysML Diagram
-newWizardDesc=Creates SysML diagram.
-
-initDiagramActionLabel=Initialize sysml_diagram diagram file
-
-
-navigatorContentName=*.sysml_diagram diagram contents
-domainNavigatorContentName=*.sysml model contents
-update.diagram.name=Update SysML diagram
-update.diagram.description=Perform SysML diagram update
-
-
-# Property Sheet
-tab.appearance=Appearance
-tab.diagram=Rulers & Grid
-tab.domain=Core
-
-# Preferences
-prefpage.org.eclipse.papyrus.sysml.diagram.general=SysML Diagram
-prefpage.org.eclipse.papyrus.sysml.diagram.appearance=Appearance
-prefpage.org.eclipse.papyrus.sysml.diagram.connections=Connections
-prefpage.org.eclipse.papyrus.sysml.diagram.printing=Printing
-prefpage.org.eclipse.papyrus.sysml.diagram.rulersAndGrid=Rulers And Grid
-
-
-# Providers
-metatype.name.Resource_1000=Undefined
-metatype.name.ConstraintProperty_2001=ConstraintProperty
-metatype.name.ConstraintBlock_2002=ConstraintBlock
-
-# Commands and menu actions
-cmdcategory.name=SysML Editor Commands
-cmdcategory.desc=SysML Editor Commands
-
-metatype.name.ConstraintProperty_2003=ConstraintProperty
-metatype.name.ConstraintBlock_2004=ConstraintBlock
-metatype.name.Property_2004=Property
-metatype.name.Property_2005=Property
-metatype.name.Property_3002=Property
-metatype.name.Connector_4001=Connector
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/plugin.xml b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/plugin.xml
index 451f5e3b0e0..9b4009cdcc1 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/plugin.xml
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/plugin.xml
@@ -1,838 +1,562 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin>
- <extension point="org.eclipse.gmf.runtime.common.ui.services.action.contributionItemProviders">
- <contributionItemProvider checkPluginLoaded="false" class="org.eclipse.papyrus.sysml.diagram.parametric.providers.ParametricDiagramContributionItemProvider">
- <Priority name="Low"/>
- <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
- <popupStructuredContributionCriteria objectClass="org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart" policyClass="org.eclipse.papyrus.sysml.diagram.parametric.providers.ParametricDiagramContributionPolicyClass"/>
- <popupAction id="papyrus.restoreRelatedLinksAction" path="/navigateMenu/additions"/>
- </popupContribution>
- </contributionItemProvider>
- </extension>
-
-
-
- <extension point="org.eclipse.ui.contexts" id="ui-context">
- <?gmfgen generated="true"?>
- <context
- description="%context.description"
- id="org.eclipse.papyrus.sysml.diagram.parametric.ui.diagramContext"
- name="%context.name"
- parentId="org.eclipse.gmf.runtime.diagram.ui.diagramContext">
- </context>
- </extension>
-
-
- <extension point="org.eclipse.ui.popupMenus" id="init-diagram-action">
- <?gmfgen generated="false"?>
- <!-- FIX Bug 314257-->
- <!--objectContribution
- id="org.eclipse.papyrus.sysml.diagram.parametric.InitDiagram"
- nameFilter="*.sysml"
- objectClass="org.eclipse.core.resources.IFile">
- <action
- label="%initDiagramActionLabel"
- class="org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlInitDiagramFileAction"
- menubarPath="additions"
- enablesFor="1"
- id="org.eclipse.papyrus.sysml.diagram.parametric.InitDiagramAction">
- </action>
- </objectContribution-->
- </extension>
-
-
- <extension
- id="Sysml Plugin.palettedefinition"
- name="Sysml Plugin Predefined Entries"
- point="org.eclipse.gmf.runtime.diagram.ui.paletteProviders">
-
- <paletteProvider class="org.eclipse.gmf.runtime.diagram.ui.providers.DefaultPaletteProvider">
- <Priority name="Lowest"/>
- <contribution
- factoryClass="org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlPaletteFactory">
- <predefinedEntry id="standardGroup/noteStack/noteTool" remove="true"/>
- <predefinedEntry id="standardGroup/noteStack/textTool" remove="true"/>
- <predefinedEntry id="standardGroup/noteStack/noteattachmentTool" remove="true"/>
- <entry
- defineOnly="true"
- description="Create new Property"
- id="createProperty2CreationTool"
- kind="tool"
- label="Property"
- large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Property.gif"
- path=""
- small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Property.gif">
- </entry>
- <entry
- defineOnly="true"
- description="Create new ConstraintProperty"
- id="createConstraintProperty1CreationTool"
- kind="tool"
- label="ConstraintProperty"
- large_icon="platform:/plugin/org.eclipse.papyrus.sysml.edit/icons/full/obj16/ConstraintProperty.gif"
- path=""
- small_icon="platform:/plugin/org.eclipse.papyrus.sysml.edit/icons/full/obj16/ConstraintProperty.gif">
- </entry>
- <entry
- defineOnly="true"
- description="Create new Connector"
- id="createConnector3CreationTool"
- kind="tool"
- label="Connector"
- large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Connector.gif"
- small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Connector.gif">
- </entry>
-
- </contribution>
- </paletteProvider>
-
- </extension>
-
- <extension
- id="Sysml Plugin.standard"
- name="Sysml Plugin Standard Palette"
- point="org.eclipse.gmf.runtime.diagram.ui.paletteProviders">
-
- <paletteProvider class="org.eclipse.gmf.runtime.diagram.ui.providers.DefaultPaletteProvider">
- <Priority name="Low"/>
- <contribution
- factoryClass="org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlPaletteFactory">
- <predefinedEntry id="standardGroup/noteStack/noteTool" remove="true"/>
- <predefinedEntry id="standardGroup/noteStack/textTool" remove="true"/>
- <predefinedEntry id="standardGroup/noteStack/noteattachmentTool" remove="true"/>
- <entry
- description=""
- id="createSysml1Group"
- kind="drawer"
- label="Parametric Diagram"
- large_icon="platform:/plugin/org.eclipse.gmf.runtime.diagram.ui/icons/group.gif"
- path="/"
- small_icon="platform:/plugin/org.eclipse.gmf.runtime.diagram.ui/icons/group.gif">
- </entry>
-
- <predefinedEntry
- id="createProperty2CreationTool"
- path="/createSysml1Group">
- </predefinedEntry>
- <predefinedEntry
- id="createConstraintProperty1CreationTool"
- path="/createSysml1Group">
- </predefinedEntry>
- <predefinedEntry
- id="createConnector3CreationTool"
- path="/createSysml1Group">
- </predefinedEntry>
-
-
- </contribution>
- <editor id="org.eclipse.papyrus.sysml.diagram.parametric"/>
- </paletteProvider>
-
- </extension>
-
- <extension point="org.eclipse.ui.preferencePages" id="prefpages">
- <?gmfgen generated="true"?>
- <page
- id="org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams.Parametric"
- name="Parametric Diagram"
- category="org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams"
- class="org.eclipse.papyrus.sysml.diagram.parametric.preferences.DiagramGeneralPreferencePage">
- </page>
-
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+<!-- Diagram declaration -->
+<extension point="org.eclipse.papyrus.infra.core.papyrusDiagram">
+ <creationCommand
+ creationCommandClass="org.eclipse.papyrus.sysml.diagram.parametric.ParametricDiagramCreateCommand"
+ icon="icons/obj16/Diagram_Parametric.png"
+ id="org.eclipse.papyrus.sysml.diagram.parametric.CreateCommand"
+ language="sysml"
+ label="SysML Parametric Diagram"/>
+ <editorDiagram
+ actionBarContributorId="org.eclipse.papyrus.uml.diagram.common.part.UMLDiagramActionBarContributor"
+ factoryClass="org.eclipse.papyrus.sysml.diagram.parametric.ParametricDiagramEditorFactory"
+ icon="icons/obj16/Diagram_Parametric.png" />
+</extension>
- <page
- id="org.eclipse.papyrus.sysml.diagram.parametric.preferences.DiagramPrintingPreferencePage"
- name="%prefpage.org.eclipse.papyrus.sysml.diagram.printing"
- category="org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams.Parametric"
- class="org.eclipse.papyrus.sysml.diagram.parametric.preferences.DiagramPrintingPreferencePage">
- </page>
+<!-- Diagram creation command and handler -->
+<extension point="org.eclipse.ui.commands">
+ <command id="org.eclipse.papyrus.sysml.diagram.parametric.CreateCommand"
+ name="Create a new Parametric Diagram"
+ description="Create a new Parametric Diagram"
+ categoryId="org.eclipse.papyrus.editor.category"/>
+</extension>
- <page
- id="org.eclipse.papyrus.sysml.diagram.parametric.preferences.DiagramRulersAndGridPreferencePage"
- name="%prefpage.org.eclipse.papyrus.sysml.diagram.rulersAndGrid"
- category="org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams.Parametric"
- class="org.eclipse.papyrus.sysml.diagram.parametric.preferences.DiagramRulersAndGridPreferencePage">
- </page>
+<extension point="org.eclipse.ui.handlers">
+ <handler
+ class="org.eclipse.papyrus.sysml.diagram.parametric.CreateParametricDiagramWithNavigationHandler"
+ commandId="org.eclipse.papyrus.sysml.diagram.parametric.CreateCommand">
+ <activeWhen>
+ <with variable="activeEditorId">
+ <equals value="org.eclipse.papyrus.infra.core.papyrusEditor" />
+ </with>
+ </activeWhen>
+ </handler>
+</extension>
- </extension>
+<!-- Diagram creation command registration in menu and toolbar -->
+<extension point="org.eclipse.ui.menus">
- <extension point="org.eclipse.ui.views.properties.tabbed.propertyContributor" id="prop-contrib">
- <?gmfgen generated="true"?>
- <propertyContributor
- contributorId="org.eclipse.papyrus.sysml.diagram.parametric"
- labelProvider="org.eclipse.papyrus.sysml.diagram.parametric.sheet.SysmlSheetLabelProvider">
- <propertyCategory category="domain"/>
- <propertyCategory category="visual"/>
- <propertyCategory category="extra"/>
- </propertyContributor>
- </extension>
+ <menuContribution locationURI="menu:org.eclipse.papyrus.ui.menu">
+ <menu id="org.eclipse.papyrus.uml.diagram.ui.menu.diagrams" label="Diagrams">
+ <command commandId="org.eclipse.papyrus.sysml.diagram.parametric.CreateCommand"
+ icon="icons/obj16/Diagram_Parametric.png" label="Create a new Parametric Diagram"
+ style="push" tooltip="Create a new Parametric Diagram">
+ <visibleWhen>
+ <reference definitionId="org.eclipse.papyrus.sysml.diagram.common.IsPapyrusActiveWithSysML"/>
+ </visibleWhen>
+
+ </command>
+ </menu>
+ </menuContribution>
+
+ <menuContribution locationURI="toolbar:org.eclipse.ui.main.toolbar">
+ <toolbar id="org.eclipse.papyrus.uml.diagram.ui.toolbar">
+ <command commandId="org.eclipse.papyrus.sysml.diagram.parametric.CreateCommand"
+ icon="icons/obj16/Diagram_Parametric.png" label="Create a new Parametric Diagram"
+ style="push" tooltip="Create a new Parametric Diagram">
+ <visibleWhen>
+ <reference definitionId="org.eclipse.papyrus.sysml.diagram.common.IsPapyrusActiveWithSysML"/>
+ </visibleWhen>
+
+ </command>
+ </toolbar>
+ </menuContribution>
+
+ <menuContribution locationURI="popup:org.eclipse.papyrus.views.modelexplorer.popupmenu.creatediagram">
+ <command commandId="org.eclipse.papyrus.sysml.diagram.parametric.CreateCommand"
+ icon="icons/obj16/Diagram_Parametric.png"
+ label="Create a new Parametric Diagram"
+ style="push"
+ tooltip="Create a new Parametric Diagram">
+ <visibleWhen>
+ <reference definitionId="org.eclipse.papyrus.sysml.diagram.common.IsPapyrusActiveWithSysML"/>
+ </visibleWhen>
+
+ </command>
+ </menuContribution>
+
+</extension>
- <extension point="org.eclipse.ui.views.properties.tabbed.propertyTabs" id="proptabs">
- <?gmfgen generated="true"?>
- <propertyTabs contributorId="org.eclipse.papyrus.sysml.diagram.parametric">
- <propertyTab
- category="visual"
- id="property.tab.AppearancePropertySection"
- label="%tab.appearance"/>
- <propertyTab
- category="visual"
- id="property.tab.DiagramPropertySection"
- label="%tab.diagram"/>
- <propertyTab
- category="domain"
- id="property.tab.domain"
- label="%tab.domain"/>
- </propertyTabs>
- </extension>
+<!-- Palette tool definition (defines tools possibly used by the palette(s)) -->
+<extension point="org.eclipse.gmf.runtime.diagram.ui.paletteProviders"
+ name="SYSML_Parametric_Predefined_Entries"
+ id="org.eclipse.papyrus.sysml.diagram.blockdefinition.palettedefinition">
+
+ <paletteProvider class="org.eclipse.gmf.runtime.diagram.ui.providers.DefaultPaletteProvider">
+ <Priority name="Lowest"/> <!-- Lower priority than Palette tool declaration -->
+
+ <!-- SysML Parametric Diagram specific tool definition -->
+ <contribution
+ factoryClass="org.eclipse.papyrus.sysml.diagram.parametric.factory.DiagramPaletteFactory">
+
+ <!-- parametric.tool.constraintblockpropertycomposite -->
+ <entry
+ defineOnly="true"
+ description="Create a ConstraintBlockProperty"
+ id="parametric.tool.constraintblockpropertycomposite"
+ kind="tool"
+ label="ConstraintProperty"
+ large_icon="platform:/plugin/org.eclipse.papyrus.sysml/icons/blocks/Block.gif"
+ small_icon="platform:/plugin/org.eclipse.papyrus.sysml/icons/blocks/Block.gif">
+ </entry>
+
+ <!-- parametric.tool.parameter -->
+ <entry
+ defineOnly="true"
+ description="Create a Parameter"
+ id="parametric.tool.parameter"
+ kind="tool"
+ label="ConstraintParameter"
+ large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Port.gif"
+ small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Port.gif">
+ </entry>
+
+ <!-- parametric.tool.blockpropertycomposite -->
+ <entry
+ defineOnly="true"
+ description="Create a Part"
+ id="parametric.tool.blockpropertycomposite"
+ kind="tool"
+ label="Part"
+ large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Property.gif"
+ small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Property.gif">
+ </entry>
+
+ <!-- parametric.tool.reference -->
+ <entry
+ defineOnly="true"
+ description="Create a Reference"
+ id="parametric.tool.reference"
+ kind="tool"
+ label="Reference"
+ large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Property.gif"
+ small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Property.gif">
+ </entry>
+
+ <!-- parametric.tool.value -->
+ <entry
+ defineOnly="true"
+ description="Create a Value"
+ id="parametric.tool.value"
+ kind="tool"
+ label="Value"
+ large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Property.gif"
+ small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Property.gif">
+ </entry>
+
+ <!-- Start of user code Custom node button entry
+ -->
+
+ <!-- End of user code -->
+
+
+ <!-- parametric.tool.connector -->
+ <entry
+ defineOnly="true"
+ description="Create a Connector"
+ id="parametric.tool.connector"
+ kind="tool"
+ label="Connector"
+ large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Connector.gif"
+ small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Connector.gif">
+ </entry>
+
+ <!-- parametric.tool.dependency -->
+ <entry
+ defineOnly="true"
+ description="Create a Dependency"
+ id="parametric.tool.dependency"
+ kind="tool"
+ label="Dependency"
+ large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Dependency.gif"
+ small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Dependency.gif">
+ </entry>
+ <!-- Start of user code Custom edge button entry -->
+ <!-- parametric.tool.comment -->
+ <entry
+ defineOnly="true"
+ description="Create a Comment"
+ id="parametric.tool.comment"
+ kind="tool"
+ label="Comment"
+ large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Comment.gif"
+ small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Comment.gif">
+ </entry>
+
+ <!-- internalblock.tool.constraint -->
+ <entry defineOnly="true"
+ description="Create a Constraint"
+ id="parametric.tool.constraint"
+ kind="tool"
+ label="Constraint"
+ large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Constraint.gif"
+ small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Constraint.gif">
+ </entry>
- <extension point="org.eclipse.ui.views.properties.tabbed.propertySections" id="propsections">
- <?gmfgen generated="true"?>
- <propertySections contributorId="org.eclipse.papyrus.sysml.diagram.parametric">
- <propertySection id="property.section.ConnectorAppearancePropertySection"
- filter="org.eclipse.gmf.runtime.diagram.ui.properties.filters.ConnectionEditPartPropertySectionFilter"
- class="org.eclipse.gmf.runtime.diagram.ui.properties.sections.appearance.ConnectionAppearancePropertySection"
- tab="property.tab.AppearancePropertySection">
- </propertySection>
- <propertySection id="property.section.ShapeColorAndFontPropertySection"
- filter="org.eclipse.gmf.runtime.diagram.ui.properties.filters.ShapeEditPartPropertySectionFilter"
- class="org.eclipse.gmf.runtime.diagram.ui.properties.sections.appearance.ShapeColorsAndFontsPropertySection"
- tab="property.tab.AppearancePropertySection">
- </propertySection>
- <propertySection id="property.section.DiagramColorsAndFontsPropertySection"
- filter="org.eclipse.gmf.runtime.diagram.ui.properties.filters.DiagramEditPartPropertySectionFilter"
- class="org.eclipse.gmf.runtime.diagram.ui.properties.sections.appearance.DiagramColorsAndFontsPropertySection"
- tab="property.tab.AppearancePropertySection">
- </propertySection>
- <propertySection id="property.section.RulerGridPropertySection"
- filter="org.eclipse.gmf.runtime.diagram.ui.properties.filters.DiagramEditPartPropertySectionFilter"
- class="org.eclipse.gmf.runtime.diagram.ui.properties.sections.grid.RulerGridPropertySection"
- tab="property.tab.DiagramPropertySection">
- </propertySection>
- <propertySection
- id="property.section.domain"
- tab="property.tab.domain"
- class="org.eclipse.papyrus.sysml.diagram.parametric.sheet.SysmlPropertySection">
- <input type="org.eclipse.gmf.runtime.notation.View"/>
- <input type="org.eclipse.gef.EditPart"/>
- <input type="org.eclipse.papyrus.sysml.diagram.parametric.navigator.SysmlAbstractNavigatorItem"/>
- </propertySection>
- </propertySections>
- </extension>
+ <entry
+ defineOnly="true"
+ description="Create a Comment / Constraint link"
+ id="parametric.tool.comment_constraint_link"
+ kind="tool"
+ label="Comment / Constraint link"
+ large_icon="icons/obj16/Link.gif"
+ small_icon="icons/obj16/Link.gif">
+ </entry>
+
+ <!-- End of user code -->
+
+ </contribution>
+
+ <!-- Specify diagram this palette tools relate to -->
+ <editor id="org.eclipse.papyrus.sysml.diagram.parametric"/>
+
+ </paletteProvider>
+</extension>
-
-<?gmfgen generated="true"?>
-
- <extension point="org.eclipse.core.runtime.preferences">
- <?gmfgen generated="true"?>
- <initializer class="org.eclipse.papyrus.sysml.diagram.parametric.preferences.DiagramPreferenceInitializer"/>
- </extension>
+<!-- Palette tool declaration (declares the real palette containment) -->
+<extension point="org.eclipse.papyrus.uml.diagram.common.paletteDefinition"
+ name="SYSML_Parametric">
+
+ <paletteDefinition ID="SYSML_Parametric"
+ class="org.eclipse.papyrus.uml.diagram.common.service.PluginPaletteProvider"
+ name="SYSML_Parametric" icon="platform:/plugin/org.eclipse.gmf.runtime.diagram.ui/icons/group.gif"
+ path="palettes/parametric.palette.xml"
+ provider="CEA LIST">
+ <Priority name="Low"/>
+
+ <!-- Specify diagram this palette tools relate to -->
+ <editor id="org.eclipse.papyrus.sysml.diagram.parametric"/>
+ </paletteDefinition>
+</extension>
- <extension point="org.eclipse.gmf.runtime.diagram.core.viewProviders" id="view-provider">
- <?gmfgen generated="true"?>
- <viewProvider class="org.eclipse.papyrus.sysml.diagram.parametric.providers.SysmlViewProvider">
- <Priority name="Lowest"/>
- <context viewClass="org.eclipse.gmf.runtime.notation.Diagram" semanticHints="Parametric"/>
- <context viewClass="org.eclipse.gmf.runtime.notation.Node" semanticHints="2003,2005,3002"/>
- <context viewClass="org.eclipse.gmf.runtime.notation.Edge" semanticHints="4001"/>
- </viewProvider>
- </extension>
- <extension point="org.eclipse.gmf.runtime.diagram.ui.editpartProviders" id="ep-provider">
- <?gmfgen generated="true"?>
- <editpartProvider class="org.eclipse.papyrus.sysml.diagram.parametric.providers.SysmlEditPartProvider">
- <Priority name="Lowest"/>
- <object class="org.eclipse.gmf.runtime.notation.Diagram" id="generated-diagram">
- <method name="getType()" value="Parametric"/>
- </object>
- <object class="org.eclipse.gmf.runtime.notation.Node" id="generated-nodes">
- <method name="getType()" value="2003,2005,3002"/>
- </object>
- <object class="org.eclipse.gmf.runtime.notation.Edge" id="generated-links">
- <method name="getType()" value="4001"/>
- </object>
- <object class="org.eclipse.gmf.runtime.notation.Node" id="generated-labels">
- <method name="getType()" value="5001,5004,5002,5003"/>
- </object>
- <object class="org.eclipse.gmf.runtime.notation.Node" id="generated-compartments">
- <method name="getType()" value=""/>
- </object>
- <context views="generated-diagram,generated-nodes,generated-links,generated-labels,generated-compartments"/>
- </editpartProvider>
- </extension>
+<!-- Diagram view providers declaration -->
+<extension point="org.eclipse.gmf.runtime.diagram.core.viewProviders">
+ <!-- Diagram view provider -->
+ <viewProvider class="org.eclipse.papyrus.sysml.diagram.parametric.provider.ParametricDiagramViewProvider">
+ <Priority name="Low"/>
+ <context viewClass="org.eclipse.gmf.runtime.notation.Diagram" semanticHints="Parametric"/>
+ </viewProvider>
+
+ <!-- Custom graphical types view provider -->
+ <viewProvider class="org.eclipse.papyrus.sysml.diagram.parametric.provider.CustomViewProvider">
+ <Priority name="Medium"/>
+ <context viewClass="org.eclipse.gmf.runtime.notation.Node" semanticHints="UML::Property, UML::Port, SysML::ReferenceProperty, SysML::FlowPort, SysML::FlowPort_Out, SysML::Block, SysML::FlowPort_In, SysML::FlowPort_InOut, SysML::PartProperty, SysML::ConstraintProperty"/>
+ <context viewClass="org.eclipse.gmf.runtime.notation.Node" semanticHints="shape_sysml_flowport_as_affixed, shape_uml_port_as_affixed, shape_sysml_block_as_composite, shape_sysml_blockproperty_as_composite, shape_sysml_constraintblockproperty_as_composite"/>
+ <context viewClass="org.eclipse.gmf.runtime.notation.Edge" semanticHints="UML::Connector, UML::Dependency"/>
+ <context viewClass="org.eclipse.gmf.runtime.notation.Edge" semanticHints="link_uml_dependency, link_uml_connector"/>
+
+ <!-- Additional descriptors provided in case the semantic hint is is not provided -->
+
+ <!-- "uml.Class" -->
+ <object id="uml.Class" class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)">
+ <method name="getProxyClassID()" value="uml.Class"/>
+ </object>
+ <context viewClass="org.eclipse.gmf.runtime.notation.Node" semanticHints="uml.Class"/>
+
+ <!-- "uml.Port" -->
+ <object id="uml.Port" class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)">
+ <method name="getProxyClassID()" value="uml.Port"/>
+ </object>
+ <context viewClass="org.eclipse.gmf.runtime.notation.Node" semanticHints="uml.Port"/>
+
+ <!-- "uml.Property" -->
+ <object id="uml.Property" class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)">
+ <method name="getProxyClassID()" value="uml.Property"/>
+ </object>
+ <context viewClass="org.eclipse.gmf.runtime.notation.Node" semanticHints="uml.Property"/>
+
+ <!-- "uml.Connector" -->
+ <object id="uml.Connector" class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)">
+ <method name="getProxyClassID()" value="uml.Connector"/>
+ </object>
+ <context viewClass="org.eclipse.gmf.runtime.notation.Edge" semanticHints="uml.Connector"/>
+
+ <!-- "uml.Dependency" -->
+ <object id="uml.Dependency" class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)">
+ <method name="getProxyClassID()" value="uml.Dependency"/>
+ </object>
+ <context viewClass="org.eclipse.gmf.runtime.notation.Edge" semanticHints="uml.Dependency"/>
+ <object id="elementtype.node"
+ class="org.eclipse.papyrus.gmf.diagram.common.commands.ISemanticHintAdapter(org.eclipse.papyrus.sysml.diagram.common)">
+
+ <method
+ name="getSemanticHint()"
+ value="UML::Property, SysML::ActorPartProperty, SysML::ValueProperty, SysML::ReferenceProperty, SysML::FlowPort_In, UML::Port, SysML::FlowPort_Out, SysML::PartProperty, SysML::FlowPort_InOut, SysML::FlowPort, SysML::Block, SysML::FlowPort_NA">
+ </method>
+ </object>
+ <context
+ elements="elementtype.node"
+ viewClass="org.eclipse.gmf.runtime.notation.Node">
+ </context>
+ <object id="elementtype.edge"
+ class="org.eclipse.papyrus.gmf.diagram.common.commands.ISemanticHintAdapter(org.eclipse.papyrus.sysml.diagram.common)">
+ <method
+ name="getSemanticHint()"
+ value="UML::Dependency, UML::Connector">
+ </method>
+ </object>
+ <context
+ elements="elementtype.edge"
+ viewClass="org.eclipse.gmf.runtime.notation.Edge">
+ </context>
+
+ </viewProvider>
- <extension point="org.eclipse.gmf.runtime.emf.ui.modelingAssistantProviders" id="modelassist-provider">
- <?gmfgen generated="true"?>
- <modelingAssistantProvider class="org.eclipse.papyrus.sysml.diagram.parametric.providers.SysmlModelingAssistantProvider">
- <Priority name="Lowest"/>
- <object class="org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ParametricEditPart" id="Resource_1000"/>
- <object class="org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ConstraintPropertyEditPart" id="ConstraintProperty_2003"/>
- <object class="org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.PropertyEditPart" id="Property_2005"/>
- <context elements="Resource_1000,ConstraintProperty_2003,Property_2005"/>
- </modelingAssistantProvider>
- </extension>
+ <!-- ViewProvider for inherited elements (from CompositeDiagram ViewProvider) -->
+ <viewProvider class="org.eclipse.papyrus.sysml.diagram.parametric.provider.InheritedCompositeDiagramViewProvider">
+ <Priority name="Low"></Priority>
+
+ <!-- Load the ViewProvider on following SemanticHint related to IElementType(s) used in the palette (also used for legacy elements) -->
+ <context viewClass="org.eclipse.gmf.runtime.notation.Node" semanticHints="UML::Comment, UML::Constraint"></context>
+
+ <!--
+ "2109" = COMMENT
+ "3097" = COMMENT_CN
+ "2114" = CONSTRAINT
+ "3120" = CONSTRAINT_CN
+ -->
+ <context viewClass="org.eclipse.gmf.runtime.notation.Node" semanticHints="2109, 3097, 2114, 3120"></context>
+
+ <!--
+ "4002" = COMMENT_ANNOTATED_ELEMENT
+ "4003" = CONSTRAINT_CONSTRAINED_ELEMENT
+ -->
+ <context viewClass="org.eclipse.gmf.runtime.notation.Edge" semanticHints="4002, 4003"></context>
+
+ <!-- Additional descriptors provided in case the semantic hint is is not provided -->
+
+ <!-- "uml.Comment" -->
+ <object id="uml.Comment" class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)">
+ <method name="getProxyClassID()" value="uml.Comment"></method>
+ </object>
- <extension point="org.eclipse.gmf.runtime.common.ui.services.iconProviders" id="icon-provider">
- <?gmfgen generated="true"?>
- <IconProvider class="org.eclipse.papyrus.sysml.diagram.parametric.providers.SysmlIconProvider">
- <Priority name="Low"/>
- </IconProvider>
- </extension>
+ <!-- "uml.Constraint" -->
+ <object id="uml.Constraint" class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)">
+ <method name="getProxyClassID()" value="uml.Constraint"></method>
+ </object>
- <extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypes" id="element-types">
- <?gmfgen generated="true"?>
- <metamodel nsURI="http://www.eclipse.org/papyurs/0.7.0/Resource">
- <metamodelType
- id="org.eclipse.papyrus.sysml.diagram.parametric.Resource_1000"
- name="%metatype.name.Resource_1000"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
- eclass="Resource"
- edithelper="org.eclipse.papyrus.sysml.diagram.parametric.edit.helpers.ResourceEditHelper">
- <param name="semanticHint" value="1000"/>
- </metamodelType>
- </metamodel>
- <metamodel nsURI="http://www.eclipse.org/papyrus/0.7.0/SysML/Constraints">
- <metamodelType
- id="org.eclipse.papyrus.sysml.diagram.parametric.ConstraintProperty_2003"
- name="%metatype.name.ConstraintProperty_2003"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
- eclass="ConstraintProperty"
- edithelper="org.eclipse.papyrus.sysml.diagram.parametric.edit.helpers.ConstraintPropertyEditHelper">
- <param name="semanticHint" value="2003"/>
- </metamodelType>
- </metamodel>
- <metamodel nsURI="http://www.eclipse.org/uml2/3.0.0/UML">
- <specializationType
- id="org.eclipse.papyrus.sysml.diagram.parametric.Property_2005"
- name="%metatype.name.Property_2005"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType">
- <specializes id="org.eclipse.papyrus.sysml.diagram.parametric.Property_3002"/>
- <param name="semanticHint" value="2005"/>
- </specializationType>
- </metamodel>
- <metamodel nsURI="http://www.eclipse.org/uml2/3.0.0/UML">
- <metamodelType
- id="org.eclipse.papyrus.sysml.diagram.parametric.Property_3002"
- name="%metatype.name.Property_3002"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
- eclass="Property"
- edithelper="org.eclipse.papyrus.sysml.diagram.parametric.edit.helpers.PropertyEditHelper">
- <param name="semanticHint" value="3002"/>
- </metamodelType>
- </metamodel>
- <metamodel nsURI="http://www.eclipse.org/uml2/3.0.0/UML">
- <metamodelType
- id="org.eclipse.papyrus.sysml.diagram.parametric.Connector_4001"
- name="%metatype.name.Connector_4001"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
- eclass="Connector"
- edithelper="org.eclipse.papyrus.sysml.diagram.parametric.edit.helpers.ConnectorEditHelper">
- <param name="semanticHint" value="4001"/>
- </metamodelType>
- </metamodel>
- </extension>
+ <!-- Additional activation contexts for nodes semantic objects -->
+ <context viewClass="org.eclipse.gmf.runtime.notation.Node" elements="uml.Comment, uml.Constraint"></context>
+
+ </viewProvider>
+</extension>
- <extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypeBindings" id="element-types-bindings">
- <?gmfgen generated="true"?>
- <clientContext id="org.eclipse.papyrus.sysml.diagram.parametric.TypeContext">
- <enablement>
- <test
- property="org.eclipse.gmf.runtime.emf.core.editingDomain"
- value="org.eclipse.papyrus.sysml.diagram.parametric.EditingDomain"/>
- </enablement>
- </clientContext>
- <binding context="org.eclipse.papyrus.sysml.diagram.parametric.TypeContext">
- <elementType ref="org.eclipse.papyrus.sysml.diagram.parametric.Resource_1000"/>
- <elementType ref="org.eclipse.papyrus.sysml.diagram.parametric.ConstraintProperty_2003"/>
- <elementType ref="org.eclipse.papyrus.sysml.diagram.parametric.Property_2005"/>
- <elementType ref="org.eclipse.papyrus.sysml.diagram.parametric.Property_3002"/>
- <elementType ref="org.eclipse.papyrus.sysml.diagram.parametric.Connector_4001"/>
- <advice ref="org.eclipse.gmf.runtime.diagram.core.advice.notationDepdendents"/>
- </binding>
- </extension>
- <extension point="org.eclipse.core.expressions.propertyTesters" id="navigator-proptest.isURIEditorInput">
- <?gmfgen generated="true"?>
- <propertyTester
- id="org.eclipse.papyrus.sysml.diagram.parametric.URIEditorInputPropertyTester"
- type="org.eclipse.emf.common.ui.URIEditorInput"
- namespace="org.eclipse.papyrus.sysml.diagram.parametric"
- properties="isURIEditorInput"
- class="org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlUriEditorInputTester">
- </propertyTester>
- </extension>
+<!-- Diagram edit part providers declaration -->
+<extension point="org.eclipse.gmf.runtime.diagram.ui.editpartProviders">
+ <!-- Diagram edit part provider -->
+ <editpartProvider class="org.eclipse.papyrus.sysml.diagram.parametric.provider.ParametricDiagramEditPartProvider">
+ <Priority name="Low"/>
+ <object
+ id="org.eclipse.papyrus.sysml.diagram.parametric.Diagram"
+ class="org.eclipse.gmf.runtime.notation.Diagram">
+ <method name="getType()" value="Parametric"/>
+ </object>
+ <context views="org.eclipse.papyrus.sysml.diagram.parametric.Diagram"/>
+ </editpartProvider>
+
+ <!-- Custom graphical types edit part provider -->
+ <editpartProvider class="org.eclipse.papyrus.sysml.diagram.parametric.provider.CustomEditPartProvider">
+ <Priority name="Medium"/>
+
+ <object
+ class="org.eclipse.gmf.runtime.notation.Node(org.eclipse.gmf.runtime.notation)"
+ id="org.eclipse.papyrus.sysml.diagram.parametric.CustomNodeGraphicalTypes">
+ <method name="getType()" value="shape_sysml_flowport_as_affixed, shape_uml_port_as_affixed, shape_sysml_block_as_composite, shape_sysml_blockproperty_as_composite, shape_sysml_constraintblockproperty_as_composite"/>
+ </object>
+
+ <object
+ class="org.eclipse.gmf.runtime.notation.Node(org.eclipse.gmf.runtime.notation)"
+ id="org.eclipse.papyrus.sysml.diagram.parametric.CustomGraphicalTypes_Decorations">
+ <method name="getType()" value="linklabel_uml_connector_source_multiplicity, compartment_sysml_blockproperty_structure, linklabel_uml_connector_target_multiplicity, affixedlabel_sysml_flowport_label, compartment_sysml_structure, affixedlabel_uml_port_label, label_sysml_block_name, linklabel_uml_appliedstereotype, linklabel_uml_namedelement_name, linklabel_uml_connector_label, label_uml_property_label, shape_uml_constraint_as_label, affixedlabel_uml_appliedstereotype"/>
+ </object>
+
+ <context views="org.eclipse.papyrus.sysml.diagram.parametric.CustomNodeGraphicalTypes"/>
+ <context views="org.eclipse.papyrus.sysml.diagram.parametric.CustomGraphicalTypes_Decorations"/>
+
+ <object
+ class="org.eclipse.gmf.runtime.notation.Edge(org.eclipse.gmf.runtime.notation)"
+ id="org.eclipse.papyrus.sysml.diagram.parametric.CustomEdgeGraphicalTypes">
+ <method name="getType()" value="link_uml_dependency, link_uml_connector"/>
+ </object>
+
+ <context views="org.eclipse.papyrus.sysml.diagram.parametric.CustomEdgeGraphicalTypes"/>
+
+ </editpartProvider>
+
+ <!-- EditPartProvider for inherited elements (from CompositeDiagram) -->
+ <editpartProvider class="org.eclipse.papyrus.sysml.diagram.parametric.provider.InheritedCompositeDiagramEditPartProvider">
+ <Priority name="Low"></Priority>
+
+ <!--
+ The semantic hints given here are used in case the provider is not already loaded.
+ As soon as the provider is loaded its provides method is used.
+ "2109" = COMMENT
+ "5192" = COMMENT_LABEL_BODY_HINT
+ "3097" = COMMENT_CN
+ "5150" = COMMENT_CN_LABEL_BODY_HINT
+ "2114" = CONSTRAINT
+ "5197" = CONSTRAINT_LABEL_NAME_HINT
+ "6039" = CONSTRAINT_LABEL_SPECIFICATION_HINT
+ "3120" = CONSTRAINT_CN
+ "6048" = CONSTRAINT_CN_LABEL_NAME_HINT
+ "6049" = CONSTRAINT_CN_LABEL_SPECIFICATION_HINT
+ -->
+ <object id="COMMENT" class="org.eclipse.gmf.runtime.notation.Node">
+ <method name="getType()" value="2109, 5192"></method>
+ </object>
+ <object id="COMMENT_CN" class="org.eclipse.gmf.runtime.notation.Node">
+ <method name="getType()" value="3097, 5150"></method>
+ </object>
+ <object id="CONSTRAINT" class="org.eclipse.gmf.runtime.notation.Node">
+ <method name="getType()" value="2114, 5197, 6039"></method>
+ </object>
+ <object id="CONSTRAINT_CN" class="org.eclipse.gmf.runtime.notation.Node">
+ <method name="getType()" value="3120, 6048, 6049"></method>
+ </object>
- <extension point="org.eclipse.ui.navigator.viewer" id="navigator-viewbinding">
- <?gmfgen generated="true"?>
- <viewerContentBinding viewerId="org.eclipse.ui.navigator.ProjectExplorer">
- <includes>
- <contentExtension pattern="org.eclipse.papyrus.sysml.diagram.parametric.resourceContent"/>
- <contentExtension pattern="org.eclipse.papyrus.sysml.diagram.parametric.domainResourceContent"/>
- <contentExtension pattern="org.eclipse.papyrus.sysml.diagram.parametric.navigatorLinkHelper"/>
- </includes>
- </viewerContentBinding>
- <viewerActionBinding viewerId="org.eclipse.ui.navigator.ProjectExplorer">
- <includes>
- <actionExtension pattern="org.eclipse.papyrus.sysml.diagram.parametric.navigatorActionProvider"/>
- </includes>
- </viewerActionBinding>
- </extension>
+ <!--
+ "4002" = COMMENT_ANNOTATED_ELEMENT
+ "4003" = CONSTRAINT_CONSTRAINED_ELEMENT
+ -->
+ <object id="COMMENT_ANNOTATED_ELEMENT" class="org.eclipse.gmf.runtime.notation.Edge">
+ <method name="getType()" value="4002"></method>
+ </object>
+ <object id="CONSTRAINT_CONSTRAINED_ELEMENT" class="org.eclipse.gmf.runtime.notation.Edge">
+ <method name="getType()" value="4003"></method>
+ </object>
- <extension point="org.eclipse.ui.navigator.navigatorContent" id="navigator-content">
- <?gmfgen generated="true"?>
- <navigatorContent
- id="org.eclipse.papyrus.sysml.diagram.parametric.resourceContent"
- name="%navigatorContentName"
- priority="normal"
- contentProvider="org.eclipse.papyrus.sysml.diagram.parametric.navigator.SysmlNavigatorContentProvider"
- labelProvider="org.eclipse.papyrus.sysml.diagram.parametric.navigator.SysmlNavigatorLabelProvider"
- icon="icons/obj16/ResourceDiagramFile.gif"
- activeByDefault="true">
- <triggerPoints>
- <or>
- <and>
- <instanceof value="org.eclipse.core.resources.IFile"/>
- <test property="org.eclipse.core.resources.extension" value="sysml_diagram"/>
- </and>
- <instanceof value="org.eclipse.papyrus.sysml.diagram.parametric.navigator.SysmlAbstractNavigatorItem"/>
- </or>
- </triggerPoints>
- <possibleChildren>
- <or>
- <instanceof value="org.eclipse.papyrus.sysml.diagram.parametric.navigator.SysmlAbstractNavigatorItem"/>
- </or>
- </possibleChildren>
- <commonSorter
- id="org.eclipse.papyrus.sysml.diagram.parametric.navigatorSorter"
- class="org.eclipse.papyrus.sysml.diagram.parametric.navigator.SysmlNavigatorSorter">
- <parentExpression>
- <or>
- <and>
- <instanceof value="org.eclipse.core.resources.IFile"/>
- <test property="org.eclipse.core.resources.extension" value="sysml_diagram"/>
- </and>
- <instanceof value="org.eclipse.papyrus.sysml.diagram.parametric.navigator.SysmlAbstractNavigatorItem"/>
- </or>
- </parentExpression>
- </commonSorter>
- </navigatorContent>
- <navigatorContent
- id="org.eclipse.papyrus.sysml.diagram.parametric.domainResourceContent"
- name="%domainNavigatorContentName"
- priority="normal"
- contentProvider="org.eclipse.papyrus.sysml.diagram.parametric.navigator.SysmlDomainNavigatorContentProvider"
- labelProvider="org.eclipse.papyrus.sysml.diagram.parametric.navigator.SysmlDomainNavigatorLabelProvider"
- icon="icons/obj16/ResourceDiagramFile.gif"
- activeByDefault="true">
- <triggerPoints>
- <or>
- <and>
- <instanceof value="org.eclipse.core.resources.IFile"/>
- <test property="org.eclipse.core.resources.extension" value="sysml"/>
- </and>
- <instanceof value="org.eclipse.papyrus.sysml.diagram.parametric.navigator.SysmlDomainNavigatorItem"/>
- </or>
- </triggerPoints>
- <possibleChildren>
- <instanceof value="org.eclipse.papyrus.sysml.diagram.parametric.navigator.SysmlDomainNavigatorItem"/>
- </possibleChildren>
- </navigatorContent>
- <actionProvider
- id="org.eclipse.papyrus.sysml.diagram.parametric.navigatorActionProvider"
- class="org.eclipse.papyrus.sysml.diagram.parametric.navigator.SysmlNavigatorActionProvider">
- <enablement>
- <or>
- <instanceof value="org.eclipse.papyrus.sysml.diagram.parametric.navigator.SysmlAbstractNavigatorItem"/>
- </or>
- </enablement>
- </actionProvider>
- </extension>
-
- <extension point="org.eclipse.ui.navigator.linkHelper" id="navigator-linkhelper">
- <?gmfgen generated="true"?>
- <linkHelper
- id="org.eclipse.papyrus.sysml.diagram.parametric.navigatorLinkHelper"
- class="org.eclipse.papyrus.sysml.diagram.parametric.navigator.SysmlNavigatorLinkHelper">
- <editorInputEnablement>
- <and>
- <instanceof value="org.eclipse.emf.common.ui.URIEditorInput"/>
- <test property="org.eclipse.papyrus.sysml.diagram.parametric.isURIEditorInput"/>
- </and>
- </editorInputEnablement>
- <selectionEnablement>
- <instanceof value="org.eclipse.papyrus.sysml.diagram.parametric.navigator.SysmlAbstractNavigatorItem"/>
- </selectionEnablement>
- </linkHelper>
- </extension>
- <extension point="org.eclipse.ui.commands" id="update-cmd">
- <?gmfgen generated="true"?>
- <command
- categoryId="org.eclipse.ui.category.edit"
- defaultHandler="org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlDiagramUpdateCommand"
- description="%update.diagram.description"
- id="org.eclipse.papyrus.sysml.diagram.parametric.updateDiagram"
- name="%update.diagram.name"/>
- </extension>
-
- <extension point="org.eclipse.ui.bindings" id="update-cmd-binding">
- <?gmfgen generated="true"?>
- <key
- commandId="org.eclipse.papyrus.sysml.diagram.parametric.updateDiagram"
- contextId="org.eclipse.papyrus.sysml.diagram.parametric.ui.diagramContext"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
- sequence="F5"/>
- </extension>
+ <context views="COMMENT, COMMENT_CN, CONSTRAINT, CONSTRAINT_CN"></context>
+ <context views="COMMENT_ANNOTATED_ELEMENT, CONSTRAINT_CONSTRAINED_ELEMENT"></context>
+
+ </editpartProvider>
+
+</extension>
- <extension point="org.eclipse.ui.menus" id="context-menus">
- <?gmfgen generated="true"?>
- <!-- menuContribution locationURI="menu:org.eclipse.ui.main.menu?after=">
- </menuContribution>
- <menuContribution locationURI="toolbar:org.eclipse.ui.main.toolbar?after=">
- </menuContribution -->
- <menuContribution locationURI="popup:org.eclipse.gmf.runtime.diagram.ui.DiagramEditorContextMenu">
- <command commandId="org.eclipse.papyrus.sysml.diagram.parametric.LoadResourceAction">
- <visibleWhen>
- <and>
- <with variable="activePartId"><equals value="org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlDiagramEditorID"/></with>
- <with variable="selection"><iterate ifEmpty="false">
- <instanceof value="org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ParametricEditPart"/>
- </iterate></with>
- </and>
- </visibleWhen>
- </command>
- </menuContribution>
-
-
- <menuContribution locationURI="menu:org.eclipse.papyrus.ui.menu">
- <menu id="org.eclipse.papyrus.uml.diagram.ui.menu.diagrams"
- label="Diagrams">
- <command commandId="org.eclipse.papyrus.sysml.diagram.parametric.CreateParametricDiagramCommand"
- icon="icons/obj16/Diagram_Parametric.gif"
- label="Create a new Parametric Diagram"
- style="push"
- tooltip="Create a new Parametric Diagram">
- <visibleWhen>
- <reference definitionId="org.eclipse.papyrus.sysml.diagram.common.IsPapyrusActiveWithSysML"/>
- </visibleWhen>
- </command>
- </menu>
- </menuContribution>
-
- <menuContribution locationURI="toolbar:org.eclipse.ui.main.toolbar">
- <toolbar id="org.eclipse.papyrus.uml.diagram.ui.toolbar">
- <command commandId="org.eclipse.papyrus.sysml.diagram.parametric.CreateParametricDiagramCommand"
- icon="icons/obj16/Diagram_Parametric.gif"
- label="Create a new Parametric Diagram"
- style="push"
- tooltip="Create a new Parametric Diagram">
- <visibleWhen>
- <reference definitionId="org.eclipse.papyrus.sysml.diagram.common.IsPapyrusActiveWithSysML"/>
- </visibleWhen>
- </command>
- </toolbar>
- </menuContribution>
-
- <menuContribution
- locationURI="popup:org.eclipse.papyrus.views.modelexplorer.popupmenu.creatediagram">
- <command commandId="org.eclipse.papyrus.sysml.diagram.parametric.CreateParametricDiagramCommand"
- icon="icons/obj16/Diagram_Parametric.gif"
- label="Create a new Parametric Diagram"
- style="push"
- tooltip="Create a new Parametric Diagram">
- <visibleWhen>
- <reference definitionId="org.eclipse.papyrus.sysml.diagram.common.IsPapyrusActiveWithSysML"/>
- </visibleWhen>
- </command>
- </menuContribution>
-
+<!-- Diagram edit policy provider -->
+<extension
+ point="org.eclipse.gmf.runtime.diagram.ui.editpolicyProviders">
+ <editpolicyProvider
+ class="org.eclipse.papyrus.sysml.diagram.parametric.provider.CustomEditPolicyProvider">
+ <Priority name="Low"/>
+ </editpolicyProvider>
</extension>
- <extension point="org.eclipse.ui.commands" id="menu-commands">
- <?gmfgen generated="true"?>
- <category id="org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlDiagramEditorID" name="%cmdcategory.name" description="%cmdcategory.desc"/>
- <command id="org.eclipse.papyrus.sysml.diagram.parametric.LoadResourceAction"
- name="Load Resource"
- categoryId="org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlDiagramEditorID"
- defaultHandler="org.eclipse.papyrus.sysml.diagram.parametric.part.LoadResourceAction"/>
- </extension>
-
- <extension point="org.eclipse.ui.commands">
- <command description="Create a new Parametric Diagram"
- categoryId="org.eclipse.papyrus.editor.category"
- id="org.eclipse.papyrus.sysml.diagram.parametric.CreateParametricDiagramCommand"
- name="Create Parametric Diagram">
- </command>
- </extension>
-
- <extension point="org.eclipse.ui.handlers">
- <handler class="org.eclipse.papyrus.sysml.diagram.parametric.CreateParametricDiagramWithNavigationHandler"
- commandId="org.eclipse.papyrus.sysml.diagram.parametric.CreateParametricDiagramCommand">
- <activeWhen>
- <with variable="activeEditorId">
- <equals value="org.eclipse.papyrus.infra.core.papyrusEditor"></equals>
- </with>
- </activeWhen>
- </handler>
- </extension>
-
-
- <extension
- point="org.eclipse.papyrus.infra.core.papyrusDiagram">
- <editorDiagram
- factoryClass="org.eclipse.papyrus.sysml.diagram.parametric.ParametricDiagramEditorFactory"
- icon="icons/obj16/Diagram_Parametric.gif">
- </editorDiagram>
- <creationCommand
- creationCommandClass="org.eclipse.papyrus.sysml.diagram.parametric.CreateParametricDiagramCommand"
- creationCondition="org.eclipse.papyrus.sysml.diagram.parametric.ParametricDiagramCondition"
- icon="icons/obj16/Diagram_Parametric.gif"
- id="org.eclipse.papyrus.sysml.diagram.parametric.CreateParametricDiagramCommand"
- language="sysml"
- label="SysML Parametric Diagram">
- </creationCommand>
- </extension>
-<extension point="org.eclipse.gmf.runtime.common.ui.services.parserProviders" id="parser-provider">
- <?gmfgen generated="true"?>
- <ParserProvider class="org.eclipse.papyrus.sysml.diagram.parametric.providers.SysmlParserProvider">
- <Priority name="Lowest"/>
- </ParserProvider>
- </extension>
+<!-- Preference pages declaration -->
+<extension point="org.eclipse.ui.preferencePages" id="prefpages">
+
+ <!-- Diagram Preference pages declaration -->
+ <page
+ id="org.eclipse.papyrus.sysml.diagram.parametric.preferences"
+ name="Parametric Diagram"
+ category="org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams"
+ class="org.eclipse.papyrus.sysml.diagram.parametric.preferences.ParametricDiagramGeneralPreferencePage">
+ </page>
-<extension point="org.eclipse.ui.preferencePages">
-
-
-
- <?gmfgen generated="true"?>
- <page category="org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams.Parametric"
- class="org.eclipse.papyrus.sysml.diagram.parametric.preferences.ConstraintPropertyPreferencePage"
- id="org.eclipse.papyrus.sysml.diagram.parametric.preferences.ConstraintPropertyPreferencePage"
- name="ConstraintProperty Node" />
+ <!-- Element Preference pages declaration -->
+ <page category="org.eclipse.papyrus.sysml.diagram.parametric.preferences"
+ class="org.eclipse.papyrus.sysml.diagram.parametric.preferences.ConstraintPreferencePage"
+ id="org.eclipse.papyrus.sysml.diagram.parametric.preferences.ConstraintPreferencePage"
+ name="Constraint">
+ </page>
+
+
+
+
+ <page category="org.eclipse.papyrus.sysml.diagram.parametric.preferences"
+ class="org.eclipse.papyrus.sysml.diagram.parametric.preferences.CommentPreferencePage"
+ id="org.eclipse.papyrus.sysml.diagram.parametric.preferences.CommentPreferencePage"
+ name="Comment">
+ </page>
+
+ <page category="org.eclipse.papyrus.sysml.diagram.parametric.preferences"
+ class="org.eclipse.papyrus.sysml.diagram.parametric.preferences.CommentAnnotatedElementPreferencePage"
+ id="org.eclipse.papyrus.sysml.diagram.parametric.preferences.CommentAnnotatedElementPreferencePage"
+ name="CommentAnnotatedElement">
+ </page>
-
- <?gmfgen generated="true"?>
- <page category="org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams.Parametric"
- class="org.eclipse.papyrus.sysml.diagram.parametric.preferences.PropertyPreferencePage"
- id="org.eclipse.papyrus.sysml.diagram.parametric.preferences.PropertyPreferencePage"
- name="Property Node" />
-
-
-
-
- <?gmfgen generated="true"?>
- <page category="org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams.Parametric"
- class="org.eclipse.papyrus.sysml.diagram.parametric.preferences.ConnectorPreferencePage"
- id="org.eclipse.papyrus.sysml.diagram.parametric.preferences.ConnectorPreferencePage"
- name="Connector Link" />
-
-
-</extension>
-<extension
- point="org.eclipse.papyrus.extensionpoints.editors.DirectEditor">
- <DirectEditor
- contributor="Eclipse.org"
- editorConfiguration="org.eclipse.papyrus.sysml.diagram.parametric.texteditor.ConstraintPropertyConfiguration"
- icon="platform:/plugin/org.eclipse.papyrus.sysml/icons/constraints/ConstraintProperty.gif"
- language="Papyrus SysML"
- objectToEdit="org.eclipse.papyrus.sysml.constraints.ConstraintProperty">
- <simpleeditor
- editorConfiguration="org.eclipse.papyrus.sysml.diagram.parametric.texteditor.ConstraintPropertyConfiguration">
- </simpleeditor>
- </DirectEditor>
-</extension>
-
-<extension point="org.eclipse.emf.validation.constraintProviders">
- <?gmfgen generated="true"?>
- <category id="org.eclipse.uml2.uml.util.UMLValidator.validate" mandatory="false" name="validateSysMLModel">
- <![CDATA[Validate the SysML model]]>
- </category>
- <category id="org.eclipse.uml2.uml.util.UMLValidator.validate/org.eclipse.uml2.uml.util.UMLValidator.validateConnectorElement" mandatory="false" name="validateConnectorElement">
- <![CDATA[validate a connector checking that its children are consistent]]>
- </category>
- <constraintProvider cache="true">
- <package namespaceUri="http://www.eclipse.org/uml2/3.0.0/UML"/>
- <package namespaceUri="http://www.eclipse.org/papyrus/0.7.0/SysML/Blocks"/>
- <constraints categories="org.eclipse.uml2.uml.util.UMLValidator.validate">
- </constraints>
- <constraints categories="org.eclipse.uml2.uml.util.UMLValidator.validate/org.eclipse.uml2.uml.util.UMLValidator.validateConnectorElement">
- <constraint id="org.eclipse.uml2.uml.util.UMLValidator.validateConnectorElement_validateConnector"
- lang="Java" class="org.eclipse.papyrus.sysml.diagram.parametric.providers.SysmlValidationProvider$Adapter1"
- name="validateConnector"
- mode="Live"
- severity="WARNING" statusCode="200">
-
- <description><![CDATA[The NestedConnectorEnd stereotype of UML ConnectorEnd extends a UML ConnectorEnd so that the connected property]]></description>
- <message><![CDATA[NestedConnectorEnd is used for connected property identified by a multi-level path of accessible properties from the block that owns the connector.]]></message>
- <target class="uml.Connector"/>
- </constraint>
- <constraint id="org.eclipse.uml2.uml.util.UMLValidator.validateConnectorElement_validateProperty"
- lang="Java" class="org.eclipse.papyrus.sysml.diagram.parametric.providers.SysmlValidationProvider$Adapter2"
- name="validateProperty"
- mode="Live"
- severity="WARNING" statusCode="200">
-
- <description><![CDATA[When you move a property, check that its incoming or outgoings connector get consistent connectorEnd]]></description>
- <message><![CDATA[NestedConnectorEnd is used for connected property identified by a multi-level path of accessible properties from the block that owns the connector.]]></message>
- <target class="uml.Property"/>
- </constraint>
- <constraint id="org.eclipse.uml2.uml.util.UMLValidator.validateConnectorElement_validateConnectorEnd"
- lang="Java" class="org.eclipse.papyrus.sysml.diagram.parametric.providers.SysmlValidationProvider$Adapter3"
- name="validateConnectorEnd"
- mode="Live"
- severity="WARNING" statusCode="200">
-
- <description><![CDATA[The NestedConnectorEnd stereotype of UML ConnectorEnd extends a UML ConnectorEnd so that the connected property]]></description>
- <message><![CDATA[NestedConnectorEnd is used for connected property identified by a multi-level path of accessible properties from the block that owns the connector.]]></message>
- <target class="uml.ConnectorEnd"/>
- </constraint>
- <constraint id="org.eclipse.uml2.uml.util.UMLValidator.validateConnectorElement_validateNestedConnectorEnd"
- lang="Java" class="org.eclipse.papyrus.sysml.diagram.parametric.providers.SysmlValidationProvider$Adapter4"
- name="validateNestedConnectorEnd"
- mode="Live"
- severity="WARNING" statusCode="200">
-
- <description><![CDATA[The NestedConnectorEnd stereotype of UML ConnectorEnd extends a UML ConnectorEnd so that the connected property]]></description>
- <message><![CDATA[NestedConnectorEnd is used for connected property identified by a multi-level path of accessible properties from the block that owns the connector.]]></message>
- <target class="sysml.blocks.NestedConnectorEnd"/>
- </constraint>
- </constraints>
- </constraintProvider>
- </extension>
-<extension point="org.eclipse.emf.validation.constraintBindings">
- <?gmfgen generated="true"?>
- <clientContext default="false" id="org.eclipse.papyrus.sysml.diagram.parametricDefaultCtx">
- <selector class="org.eclipse.papyrus.sysml.diagram.parametric.providers.SysmlValidationProvider$DefaultCtx"/>
- </clientContext>
- <binding context="org.eclipse.papyrus.sysml.diagram.parametricDefaultCtx">
- <constraint ref="org.eclipse.papyrus.sysml.diagram.parametric.org.eclipse.uml2.uml.util.UMLValidator.validateConnectorElement_validateConnector"/>
- <constraint ref="org.eclipse.papyrus.sysml.diagram.parametric.org.eclipse.uml2.uml.util.UMLValidator.validateConnectorElement_validateProperty"/>
- <constraint ref="org.eclipse.papyrus.sysml.diagram.parametric.org.eclipse.uml2.uml.util.UMLValidator.validateConnectorElement_validateConnectorEnd"/>
- <constraint ref="org.eclipse.papyrus.sysml.diagram.parametric.org.eclipse.uml2.uml.util.UMLValidator.validateConnectorElement_validateNestedConnectorEnd"/>
- </binding>
-
- </extension>
-<extension
- point="org.eclipse.gmf.runtime.diagram.ui.editpolicyProviders">
- <editpolicyProvider
- class="org.eclipse.papyrus.sysml.diagram.parametric.providers.CustomEditPolicyProvider">
- <Priority
- name="Lowest">
- </Priority>
- </editpolicyProvider>
-</extension>
-<extension point="org.eclipse.gmf.runtime.common.ui.services.markerNavigationProviders" id="markers-navigation">
- <?gmfgen generated="true"?>
- <MarkerNavigationProvider class="org.eclipse.papyrus.sysml.diagram.parametric.providers.SysmlMarkerNavigationProvider">
- <MarkerType name="org.eclipse.papyrus.sysml.diagram.parametric.diagnostic"/>
- <Priority name="Lowest"/>
- </MarkerNavigationProvider>
- </extension>
-
-<extension id="diagnostic" name="Sysml Parametric diagram Plugin problems" point="org.eclipse.core.resources.markers">
- <?gmfgen generated="true"?>
- <super type="org.eclipse.core.resources.problemmarker"/>
- <super type="org.eclipse.gmf.runtime.common.ui.services.marker"/>
- <persistent value="true"/>
- </extension><extension
- id="Sysml Parametric diagram Plugin.palettedefinition"
- name="Sysml Parametric diagram Plugin Predefined Entries"
- point="org.eclipse.gmf.runtime.diagram.ui.paletteProviders">
-
- <?gmfgen generated="true"?>
- <paletteProvider class="org.eclipse.gmf.runtime.diagram.ui.providers.DefaultPaletteProvider">
- <Priority name="Lowest"/>
- <contribution
- factoryClass="org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlPaletteFactory">
- <predefinedEntry id="standardGroup/noteStack/noteTool" remove="true"/>
- <predefinedEntry id="standardGroup/noteStack/textTool" remove="true"/>
- <predefinedEntry id="standardGroup/noteStack/noteattachmentTool" remove="true"/>
- <entry
- defineOnly="true"
- description="Create new ConstraintProperty"
- id="createConstraintProperty1CreationTool"
- kind="tool"
- label="ConstraintProperty"
- large_icon="platform:/plugin/org.eclipse.papyrus.sysml.edit/icons/full/obj16/ConstraintProperty.gif"
- path=""
- small_icon="platform:/plugin/org.eclipse.papyrus.sysml.edit/icons/full/obj16/ConstraintProperty.gif">
- </entry>
- <entry
- defineOnly="true"
- description="Create new Property"
- id="createProperty2CreationTool"
- kind="tool"
- label="Property"
- large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Property.gif"
- path=""
- small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Property.gif">
- </entry>
- <entry
- defineOnly="true"
- description="Create new Connector"
- id="createConnector3CreationTool"
- kind="tool"
- label="Connector"
- large_icon=""
- path=""
- small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Connector.gif">
- </entry>
-
- </contribution>
- </paletteProvider>
-
- </extension>
-
-<extension
- id="Sysml Parametric diagram Plugin.standard"
- name="Sysml Parametric diagram Plugin Standard Palette"
- point="org.eclipse.gmf.runtime.diagram.ui.paletteProviders">
-
- <?gmfgen generated="true"?>
- <paletteProvider class="org.eclipse.gmf.runtime.diagram.ui.providers.DefaultPaletteProvider">
- <Priority name="Low"/>
- <contribution
- factoryClass="org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlPaletteFactory">
- <predefinedEntry id="standardGroup/noteStack/noteTool" remove="true"/>
- <predefinedEntry id="standardGroup/noteStack/textTool" remove="true"/>
- <predefinedEntry id="standardGroup/noteStack/noteattachmentTool" remove="true"/>
- <entry
- description=""
- id="createParametric1Group"
- kind="drawer"
- label="Parametric"
- large_icon="platform:/plugin/org.eclipse.gmf.runtime.diagram.ui/icons/group.gif"
- path="/"
- small_icon="platform:/plugin/org.eclipse.gmf.runtime.diagram.ui/icons/group.gif">
- <expand
- force="true">
- </expand>
- </entry>
-
- <predefinedEntry
- id="createConstraintProperty1CreationTool"
- path="/createParametric1Group">
- </predefinedEntry>
- <predefinedEntry
- id="createProperty2CreationTool"
- path="/createParametric1Group">
- </predefinedEntry>
- <predefinedEntry
- id="createConnector3CreationTool"
- path="/createParametric1Group">
- </predefinedEntry>
-
-
- </contribution>
- <editor id="org.eclipse.papyrus.sysml.diagram.parametric"/>
- </paletteProvider>
-
- </extension>
-
-<extension point="org.eclipse.ui.handlers" id="menu-handlers">
- <?gmfgen generated="true"?>
- </extension>
-
- <!-- optionally, specify keybindings -->
-</plugin>
+ <page category="org.eclipse.papyrus.sysml.diagram.parametric.preferences"
+ class="org.eclipse.papyrus.sysml.diagram.parametric.preferences.BlockCompositePreferencePage"
+ id="org.eclipse.papyrus.sysml.diagram.parametric.preferences.BlockCompositePreferencePage"
+ name="BlockComposite">
+ </page>
+
+ <page category="org.eclipse.papyrus.sysml.diagram.parametric.preferences"
+ class="org.eclipse.papyrus.sysml.diagram.parametric.preferences.CustomBlockPropertyCompositePreferencePage"
+ id="org.eclipse.papyrus.sysml.diagram.parametric.preferences.CustomBlockPropertyCompositePreferencePage"
+ name="BlockPropertyComposite">
+ </page>
+
+ <page category="org.eclipse.papyrus.sysml.diagram.parametric.preferences"
+ class="org.eclipse.papyrus.sysml.diagram.parametric.preferences.CustomConstraintPropertyCompositePreferencePage"
+ id="org.eclipse.papyrus.sysml.diagram.parametric.preferences.CustomConstraintPropertyCompositePreferencePage"
+ name="ConstraintPropertyComposite">
+ </page>
+
+ <page category="org.eclipse.papyrus.sysml.diagram.parametric.preferences"
+ class="org.eclipse.papyrus.sysml.diagram.parametric.preferences.FlowPortPreferencePage"
+ id="org.eclipse.papyrus.sysml.diagram.parametric.preferences.FlowPortPreferencePage"
+ name="FlowPort">
+ </page>
+
+ <page category="org.eclipse.papyrus.sysml.diagram.parametric.preferences"
+ class="org.eclipse.papyrus.sysml.diagram.parametric.preferences.PortPreferencePage"
+ id="org.eclipse.papyrus.sysml.diagram.parametric.preferences.PortPreferencePage"
+ name="Port">
+ </page>
+
+ <page category="org.eclipse.papyrus.sysml.diagram.parametric.preferences"
+ class="org.eclipse.papyrus.sysml.diagram.parametric.preferences.ConnectorPreferencePage"
+ id="org.eclipse.papyrus.sysml.diagram.parametric.preferences.ConnectorPreferencePage"
+ name="Connector">
+ </page>
+
+ <page category="org.eclipse.papyrus.sysml.diagram.parametric.preferences"
+ class="org.eclipse.papyrus.sysml.diagram.parametric.preferences.DependencyPreferencePage"
+ id="org.eclipse.papyrus.sysml.diagram.parametric.preferences.DependencyPreferencePage"
+ name="Dependency">
+ </page>
+
+
+</extension>
+
+<!-- // Start of user code custom extensions
+ -->
+<!-- Parser provider declaration -->
+<extension point="org.eclipse.gmf.runtime.common.ui.services.parserProviders">
+ <ParserProvider class="org.eclipse.papyrus.sysml.diagram.parametric.provider.ParserProvider">
+ <Priority name="Low"></Priority>
+ </ParserProvider>
+</extension>
+
+ <!-- Diagram specific advices -->
+<extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypes">
+ <metamodel nsURI="http://www.eclipse.org/uml2/4.0.0/UML">
+ <!-- specific advices (pop up on creation) -->
+ <adviceBinding id="org.eclipse.papyrus.sysml.service.types.helper.ConstraintParameterEditHelperAdvice"
+ class="org.eclipse.papyrus.sysml.service.types.helper.ConstraintParameterEditHelperAdvice"
+ inheritance="none"
+ typeId="org.eclipse.papyrus.uml.Property"/>
+ </metamodel>
+</extension>
+
+<!-- UML ElementType bindings to Papyrus shared IClientContext -->
+<extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypeBindings">
+
+ <!-- Bindings declaration to shared IClientContext -->
+ <binding context="org.eclipse.papyrus.infra.services.edit.TypeContext">
+ <elementType ref="org.eclipse.papyrus.sysml.service.types.helper.ConstraintParameterEditHelperAdvice"/>
+ </binding>
+
+</extension>
+
+<!-- // End of user code
+ -->
+
+</plugin> \ No newline at end of file
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/ParametricDiagramCreateCommand.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/ParametricDiagramCreateCommand.java
new file mode 100644
index 00000000000..7966aa486a3
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/ParametricDiagramCreateCommand.java
@@ -0,0 +1,168 @@
+package org.eclipse.papyrus.sysml.diagram.parametric;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.core.services.ViewService;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
+import org.eclipse.gmf.runtime.notation.Bounds;
+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.infra.gmfdiag.common.AbstractPapyrusGmfCreateDiagramCommandHandler;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.infra.services.edit.utils.GMFCommandUtils;
+import org.eclipse.papyrus.sysml.blocks.Block;
+import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes;
+import org.eclipse.papyrus.sysml.diagram.parametric.provider.ElementTypes;
+import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.common.commands.SemanticAdapter;
+import org.eclipse.papyrus.uml.diagram.composite.part.UMLDiagramEditorPlugin;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.util.UMLUtil;
+
+// Start of user code custom imports
+// End of user code
+
+public class ParametricDiagramCreateCommand extends AbstractPapyrusGmfCreateDiagramCommandHandler {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getDefaultDiagramName() {
+ return "NewParametricDiagram"; //$NON-NLS-1$
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getDiagramNotationID() {
+ return ElementTypes.DIAGRAM_ID;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected PreferencesHint getPreferenceHint() {
+ return Activator.DIAGRAM_PREFERENCES_HINT;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Diagram createDiagram(Resource diagramResource, EObject owner, String name) {
+ // Start of user code Custom diagram creation
+ Diagram diagram = null;
+
+ if(owner instanceof org.eclipse.uml2.uml.Class) {
+ org.eclipse.uml2.uml.Class cOwner = (org.eclipse.uml2.uml.Class)owner;
+ Block block = UMLUtil.getStereotypeApplication(cOwner, Block.class);
+
+ if(block != null) {
+ canvasDomainElement = (EObject)owner;
+ Package owningPackage = ((Element)owner).getNearestPackage();
+ diagram = super.createDiagram(diagramResource, owningPackage, name);
+ }
+
+ } else if(owner instanceof Package) {
+
+ try {
+ canvasDomainElement = null;
+
+ IEditCommandRequest request = new CreateElementRequest((Package)owner, SysMLElementTypes.BLOCK);
+ IElementEditService commandService = ElementEditServiceUtils.getCommandProvider(owner);
+ if(commandService == null) {
+ return null;
+ }
+
+ ICommand createElementCommand = commandService.getEditCommand(request);
+ if((createElementCommand != null) && (createElementCommand.canExecute())) {
+ createElementCommand.execute(new NullProgressMonitor(), null);
+ EObject block = GMFCommandUtils.getCommandEObjectResult(createElementCommand);
+ canvasDomainElement = block;
+ diagram = super.createDiagram(diagramResource, (Package)owner, name);
+ }
+
+ } catch (ExecutionException e) {
+ e.printStackTrace();
+ }
+
+ }
+
+ return diagram;
+ // End of user code
+ }
+
+ // Start of user code Custom creation command
+ /** Domain Element referenced by canvas if it differs from {@link Package} */
+ protected EObject canvasDomainElement = null;
+
+ /** Default margin for the display of Domain Element referenced by canvas */
+ protected static int DEFAULT_MARGIN = 20;
+
+ /** Default height for the display of Domain Element referenced by canvas */
+ protected static int DEFAULT_HEIGHT = 600;
+
+ /** Default width for the display of Domain Element referenced by canvas */
+ protected static int DEFAULT_WIDTH = 1000;
+
+ /**
+ * Initialize the diagram. The diagram is attached to the element selected on creation.
+ * Possible element types are: Block.
+ */
+ @Override
+ protected void initializeDiagram(EObject diagram) {
+ if(diagram instanceof Diagram) {
+ Diagram currentDiagram = (Diagram)diagram;
+ if(canvasDomainElement != null) {
+ currentDiagram.setElement(canvasDomainElement);
+ initializeDiagramContent(currentDiagram);
+ }
+ }
+ }
+
+ /**
+ * Initialize the diagram with the canvas domain element shown.
+ *
+ * @param diagram
+ * the diagram to initialize
+ */
+ protected void initializeDiagramContent(Diagram diagram) {
+
+ // Create a view for the canvasDomainElement in the new diagram
+ View view =
+ ViewService.getInstance().createNode(new SemanticAdapter(canvasDomainElement, null), diagram, SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID, ViewUtil.APPEND, true, UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
+ view.setElement(diagram.getElement());
+
+ // Update the view position and size (should adapt to canvas current size)
+ Bounds viewBounds = (Bounds)((Node)view).getLayoutConstraint();
+ viewBounds.setX(DEFAULT_MARGIN);
+ viewBounds.setY(DEFAULT_MARGIN);
+ viewBounds.setHeight(DEFAULT_HEIGHT);
+ viewBounds.setWidth(DEFAULT_WIDTH);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @generated NOT
+ */
+ @Override
+ public boolean isParentReassignable() {
+ // Bug 374626: [Model Explorer] Moving an IBD from a block to another block shall be forbidden
+ return false;
+ }
+
+ // End of user code
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/ParametricDiagramEditorFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/ParametricDiagramEditorFactory.java
new file mode 100644
index 00000000000..2bb7a36cd11
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/ParametricDiagramEditorFactory.java
@@ -0,0 +1,12 @@
+package org.eclipse.papyrus.sysml.diagram.parametric;
+
+import org.eclipse.papyrus.infra.gmfdiag.common.GmfEditorFactory;
+import org.eclipse.papyrus.sysml.diagram.parametric.provider.ElementTypes;
+
+public class ParametricDiagramEditorFactory extends GmfEditorFactory {
+
+ public ParametricDiagramEditorFactory() {
+ super(ParametricDiagramForMultiEditor.class, ElementTypes.DIAGRAM_ID);
+ }
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/ParametricDiagramForMultiEditor.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/ParametricDiagramForMultiEditor.java
index 7477764384f..b622f68c7da 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/ParametricDiagramForMultiEditor.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/ParametricDiagramForMultiEditor.java
@@ -1,114 +1,103 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.emf.common.ui.URIEditorInput;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.papyrus.infra.core.editor.BackboneException;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlDiagramEditor;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlDiagramEditorPlugin;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.PartInitException;
-
-public class ParametricDiagramForMultiEditor extends SysmlDiagramEditor {
-
- /**
- * The location of diagram icon in the plug-in
- */
- private static final String DIAG_IMG_PATH = "icons/obj16/Diagram_Parametric.gif";
-
- /**
- * The image descriptor of the diagram icon
- */
- private static final ImageDescriptor DIAG_IMG_DESC = SysmlDiagramEditorPlugin.getBundledImageDescriptor(ParametricDiagramForMultiEditor.DIAG_IMG_PATH);
-
- /** The editor splitter. */
- private Composite splitter;
-
- /**
- * Constructor for SashSystem v2. Context and required objects are retrieved
- * from the ServiceRegistry.
- *
- * @throws BackboneException
- * @throws ServiceException
- *
- */
- public ParametricDiagramForMultiEditor(ServicesRegistry servicesRegistry, Diagram diagram) throws ServiceException {
- super(servicesRegistry, diagram);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void init(IEditorSite site, IEditorInput input) throws PartInitException {
- super.init(site, input);
- setPartName(getDiagram().getName());
- setTitleImage(DIAG_IMG_DESC.createImage());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setInput(IEditorInput input) {
- try {
- // Provide an URI with fragment in order to reuse the same Resource
- // and set the diagram to the fragment.
- URIEditorInput uriInput = new URIEditorInput(EcoreUtil.getURI(getDiagram()));
- doSetInput(uriInput, true);
- } catch (CoreException x) {
- String title = "Problem opening";
- String msg = "Cannot open input element:";
- Shell shell = getSite().getShell();
- ErrorDialog.openError(shell, title, msg, x.getStatus());
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void createGraphicalViewer(Composite parent) {
- splitter = parent;
- super.createGraphicalViewer(parent);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setFocus() {
- splitter.setFocus();
- super.setFocus();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getEditingDomainID() {
- return "org.eclipse.papyrus.sysml.diagram.parametric.EditingDomain";
- }
-
-}
+package org.eclipse.papyrus.sysml.diagram.parametric;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.emf.common.ui.URIEditorInput;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.papyrus.infra.core.editor.BackboneException;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.sysml.diagram.parametric.part.ParametricDiagramEditor;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.PartInitException;
+
+/**
+ * An editor to be used in multitabs editor. This editor extends the original UML Diagram.
+ *
+ */
+public class ParametricDiagramForMultiEditor extends ParametricDiagramEditor {
+
+ /**
+ * The location of diagram icon in the plug-in
+ */
+ private static final String DIAG_IMG_PATH = "icons/obj16/Diagram_Parametric.png";
+
+ /**
+ * The image descriptor of the diagram icon
+ */
+ private static final ImageDescriptor DIAG_IMG_DESC = Activator.getBundledImageDescriptor(ParametricDiagramForMultiEditor.DIAG_IMG_PATH);
+
+ /** The editor splitter. */
+ private Composite splitter;
+
+ /**
+ * Constructor for SashSystem v2. Context and required objects are retrieved from the
+ * ServiceRegistry.
+ *
+ * @throws BackboneException
+ * @throws ServiceException
+ *
+ */
+ public ParametricDiagramForMultiEditor(ServicesRegistry servicesRegistry, Diagram diagram) throws BackboneException, ServiceException {
+ super(servicesRegistry, diagram);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void init(IEditorSite site, IEditorInput input) throws PartInitException {
+ super.init(site, input);
+ setPartName(getDiagram().getName());
+ setTitleImage(DIAG_IMG_DESC.createImage());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setInput(IEditorInput input) {
+ try {
+ // Provide an URI with fragment in order to reuse the same Resource
+ // and set the diagram to the fragment.
+ URIEditorInput uriInput = new URIEditorInput(EcoreUtil.getURI(getDiagram()));
+ doSetInput(uriInput, true);
+ } catch (CoreException x) {
+ String title = "Problem opening";
+ String msg = "Cannot open input element:";
+ Shell shell = getSite().getShell();
+ ErrorDialog.openError(shell, title, msg, x.getStatus());
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void createGraphicalViewer(Composite parent) {
+ splitter = parent;
+ super.createGraphicalViewer(parent);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setFocus() {
+ splitter.setFocus();
+ super.setFocus();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getEditingDomainID() {
+ return "org.eclipse.papyrus.sysml.diagram.parametric.EditingDomain";
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/ParametricDiagramEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/ParametricDiagramEditPart.java
new file mode 100644
index 00000000000..8f4125a80ce
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/ParametricDiagramEditPart.java
@@ -0,0 +1,31 @@
+package org.eclipse.papyrus.sysml.diagram.parametric.edit.part;
+
+import org.eclipse.gef.EditPolicy;
+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.gmf.diagram.common.edit.policy.DefaultContainerNodeEditPolicy;
+import org.eclipse.papyrus.gmf.diagram.common.edit.policy.DefaultCreationEditPolicy;
+import org.eclipse.papyrus.gmf.diagram.common.edit.policy.DefaultXYLayoutEditPolicy;
+import org.eclipse.papyrus.sysml.diagram.internalblock.edit.policy.CustomDragDropEditPolicy;
+import org.eclipse.papyrus.sysml.diagram.parametric.edit.policy.DiagramSemanticEditPolicy;
+import org.eclipse.papyrus.sysml.diagram.parametric.policies.CustomParametricSemanticPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.DuplicatePasteEditPolicy;
+
+public class ParametricDiagramEditPart extends DiagramEditPart {
+
+ public ParametricDiagramEditPart(View view) {
+ super(view);
+ }
+
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DiagramSemanticEditPolicy());
+ installEditPolicy(DuplicatePasteEditPolicy.PASTE_ROLE, new DuplicatePasteEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDragDropEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, new DefaultXYLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy());
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultContainerNodeEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomParametricSemanticPolicy());
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/edit/policy/DiagramSemanticEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/edit/policy/DiagramSemanticEditPolicy.java
new file mode 100644
index 00000000000..f4d1149e7be
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/edit/policy/DiagramSemanticEditPolicy.java
@@ -0,0 +1,43 @@
+package org.eclipse.papyrus.sysml.diagram.parametric.edit.policy;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gef.requests.ReconnectRequest;
+// Start of user code custom imports
+// End of user code
+import org.eclipse.papyrus.sysml.diagram.parametric.policies.CustomDefaultSemanticEditPolicy;
+
+public class DiagramSemanticEditPolicy extends CustomDefaultSemanticEditPolicy {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Command getReorientRelationshipSourceCommand(ReconnectRequest request) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Command getReorientRelationshipTargetCommand(ReconnectRequest request) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Command getReorientRefRelationshipSourceCommand(ReconnectRequest request) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Command getReorientRefRelationshipTargetCommand(ReconnectRequest request) {
+ return UnexecutableCommand.INSTANCE;
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/edit/policy/ParametricDiagramDragDropEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/edit/policy/ParametricDiagramDragDropEditPolicy.java
new file mode 100644
index 00000000000..5aefccbb024
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/edit/policy/ParametricDiagramDragDropEditPolicy.java
@@ -0,0 +1,38 @@
+package org.eclipse.papyrus.sysml.diagram.parametric.edit.policy;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.gmf.diagram.common.provider.IGraphicalTypeRegistry;
+import org.eclipse.papyrus.sysml.diagram.parametric.provider.GraphicalTypeRegistry;
+import org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies.CustomDiagramDragDropEditPolicy;
+
+/** Customization of the DND edit policy for the Parametric Diagram */
+public class ParametricDiagramDragDropEditPolicy extends CustomDiagramDragDropEditPolicy {
+
+ /** Local graphical type registry */
+ protected IGraphicalTypeRegistry registry = new GraphicalTypeRegistry();
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int getNodeVisualID(View containerView, EObject domainElement) {
+ String domainType = registry.getNodeGraphicalType(domainElement, containerView.getType());
+ if (IGraphicalTypeRegistry.UNDEFINED_TYPE.equals(domainType)) {
+ return -1; // undefined
+ }
+ return new Integer(domainType);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int getLinkWithClassVisualID(EObject domainElement) {
+ String domainType = registry.getEdgeGraphicalType(domainElement);
+ if (IGraphicalTypeRegistry.UNDEFINED_TYPE.equals(domainType)) {
+ return -1; // undefined
+ }
+ return new Integer(domainType);
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/factory/DiagramPaletteFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/factory/DiagramPaletteFactory.java
new file mode 100644
index 00000000000..2a7b5905238
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/factory/DiagramPaletteFactory.java
@@ -0,0 +1,62 @@
+package org.eclipse.papyrus.sysml.diagram.parametric.factory;
+
+import java.util.Arrays;
+import java.util.HashMap;
+
+import org.eclipse.gef.Tool;
+import org.eclipse.gmf.runtime.diagram.ui.services.palette.PaletteFactory;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.papyrus.sysml.diagram.internalblock.provider.ElementTypes;
+import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.common.service.AspectUnspecifiedTypeConnectionTool;
+import org.eclipse.papyrus.uml.diagram.common.service.AspectUnspecifiedTypeCreationTool;
+import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes;
+
+@SuppressWarnings("serial")
+public class DiagramPaletteFactory extends PaletteFactory.Adapter {
+
+ private static HashMap<String, IElementType[]> nodesToolIdTypesMap = new HashMap<String, IElementType[]>() {
+
+ {
+ put("parametric.tool.blockcomposite", new IElementType[]{ SysMLElementTypes.BLOCK });
+ put("parametric.tool.blockpropertycomposite", new IElementType[]{ SysMLElementTypes.PART_PROPERTY });
+ put("parametric.tool.reference", new IElementType[]{ SysMLElementTypes.REFERENCE_PROPERTY });
+ put("parametric.tool.value", new IElementType[]{ SysMLElementTypes.VALUE_PROPERTY });
+ put("parametric.tool.constraintblockpropertycomposite", new IElementType[]{ SysMLElementTypes.CONSTRAINT_PROPERTY });
+ put("parametric.tool.flowport", new IElementType[]{ SysMLElementTypes.FLOW_PORT });
+ put("parametric.tool.port", new IElementType[]{ UMLElementTypes.PORT });
+ put("parametric.tool.parameter", new IElementType[]{ UMLElementTypes.PROPERTY });
+ //Start of user code Custom nodes
+ put("parametric.tool.constraint", new IElementType[]{ UMLElementTypes.CONSTRAINT });
+ put("parametric.tool.comment", new IElementType[]{ UMLElementTypes.COMMENT });
+ //End of user code
+ }
+ };
+
+ private static HashMap<String, IElementType[]> edgesToolIdTypesMap = new HashMap<String, IElementType[]>() {
+
+ {
+ put("parametric.tool.connector", new IElementType[]{ UMLElementTypes.CONNECTOR });
+ put("parametric.tool.dependency", new IElementType[]{ UMLElementTypes.DEPENDENCY });
+ //Start of user code Custom edges
+ put("parametric.tool.comment_constraint_link", new IElementType[]{ ElementTypes.COMMENT_ANNOTATED_ELEMENT, ElementTypes.CONSTRAINT_CONSTRAINED_ELEMENT });
+ //End of user code
+ }
+ };
+
+ public Tool createTool(String toolId) {
+
+ IElementType[] types;
+
+ types = nodesToolIdTypesMap.get(toolId);
+ if(types != null) {
+ return new AspectUnspecifiedTypeCreationTool(Arrays.asList(types));
+ }
+
+ types = edgesToolIdTypesMap.get(toolId);
+ if(types != null) {
+ return new AspectUnspecifiedTypeConnectionTool(Arrays.asList(types));
+ }
+ return null;
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/factory/DiagramPaletteFactory.java.lost b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/factory/DiagramPaletteFactory.java.lost
new file mode 100644
index 00000000000..28a8ccfd100
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/factory/DiagramPaletteFactory.java.lost
@@ -0,0 +1,18 @@
+
+Tue Jun 25 16:58:16 CEST 2013
+================================================================================
+Start of user code Custom nodes
+
+ //End of user code
+Start of user code Custom edges
+
+ //End of user code
+
+Tue Jun 25 17:00:48 CEST 2013
+================================================================================
+Start of user code Custom nodes
+
+ //End of user code
+Start of user code Custom edges
+
+ //End of user code
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/factory/ParametricDiagramViewFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/factory/ParametricDiagramViewFactory.java
new file mode 100644
index 00000000000..95bc3423246
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/factory/ParametricDiagramViewFactory.java
@@ -0,0 +1,18 @@
+package org.eclipse.papyrus.sysml.diagram.parametric.factory;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.DiagramViewFactory;
+import org.eclipse.gmf.runtime.notation.MeasurementUnit;
+
+public class ParametricDiagramViewFactory extends DiagramViewFactory {
+
+ // Start of user code Custom view Factory field
+ // End of user code
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected MeasurementUnit getMeasurementUnit() {
+ return MeasurementUnit.PIXEL_LITERAL;
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/part/ParametricDiagramEditor.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/part/ParametricDiagramEditor.java
new file mode 100644
index 00000000000..75d1e14f700
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/part/ParametricDiagramEditor.java
@@ -0,0 +1,51 @@
+package org.eclipse.papyrus.sysml.diagram.parametric.part;
+
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.sysml.diagram.parametric.Activator;
+
+/**
+ * @generated
+ */
+public class ParametricDiagramEditor extends org.eclipse.papyrus.uml.diagram.composite.part.UMLDiagramEditor {
+
+ /** context used when trying to find services */
+ public static final String ID = "org.eclipse.papyrus.sysml.diagram.parametric.part.ParametricDiagramEditorID"; //$NON-NLS-1$
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getContextID() {
+ return CONTEXT_ID;
+ }
+
+ /**
+ * @throws org.eclipse.papyrus.infra.core.services.ServiceException
+ * @generated
+ */
+ public ParametricDiagramEditor(ServicesRegistry servicesRegistry, Diagram diagram) throws ServiceException, org.eclipse.papyrus.infra.core.services.ServiceException {
+ super(servicesRegistry, diagram);
+ }
+
+ // Start of user code Custom Editor Methods
+ // End of user code
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getContributorId() {
+ return Activator.PLUGIN_ID;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected PreferencesHint getPreferencesHint() {
+ return Activator.DIAGRAM_PREFERENCES_HINT;
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/BlockCompositePreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/BlockCompositePreferencePage.java
new file mode 100644
index 00000000000..204f72703c8
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/BlockCompositePreferencePage.java
@@ -0,0 +1,83 @@
+package org.eclipse.papyrus.sysml.diagram.parametric.preferences;
+
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes;
+import org.eclipse.papyrus.sysml.diagram.parametric.provider.ElementTypes;
+
+public class BlockCompositePreferencePage extends ParametricDiagramNodePreferencePage {
+
+ /** Constant key to access preferences */
+ public static String prefKey = ElementTypes.DIAGRAM_ID + "_" + SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID; //$NON-NLS-1$
+
+ /** The compartments default visibility for preferences */
+ public static final Map<String, Boolean> compartmentDefaultVisibilityMap;
+
+ /** The compartment titles default visibility for preferences */
+ public static final Map<String, Boolean> compartmentTitleDefaultVisibilityMap;
+
+ /** Static attribute initialization */
+ static {
+ compartmentDefaultVisibilityMap = new LinkedHashMap<String, Boolean>();
+ compartmentDefaultVisibilityMap.put("structure", Boolean.TRUE); //$NON-NLS-1$
+
+ compartmentTitleDefaultVisibilityMap = new LinkedHashMap<String, Boolean>();
+ compartmentTitleDefaultVisibilityMap.put("structure", Boolean.TRUE); //$NON-NLS-1$
+
+
+ // Start of user code custom static initializations
+ // End of user code
+
+ Collections.unmodifiableMap(compartmentDefaultVisibilityMap);
+ Collections.unmodifiableMap(compartmentTitleDefaultVisibilityMap);
+ }
+
+ /** Constructor */
+ public BlockCompositePreferencePage() {
+ super();
+ setPreferenceKey(ElementTypes.DIAGRAM_ID + "_" + SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID); //$NON-NLS-1$
+ }
+
+ /** Default preferences initializer */
+ public static void initDefaults(IPreferenceStore store) {
+ // Start of user code custom default initializations
+ // End of user code
+
+ // Initialize default visibility for compartments in preference page.
+ for(String compartmentName : compartmentDefaultVisibilityMap.keySet()) {
+ String showCompartmentKey = PreferenceConstantHelper.getCompartmentElementConstant(prefKey, compartmentName, PreferenceConstantHelper.COMPARTMENT_VISIBILITY);
+ store.setDefault(showCompartmentKey, compartmentDefaultVisibilityMap.get(compartmentName));
+ }
+
+ // Initialize default title visibility for compartments in preference page.
+ for(String compartmentName : compartmentTitleDefaultVisibilityMap.keySet()) {
+ String showCompartmentTitleKey = PreferenceConstantHelper.getCompartmentElementConstant(prefKey, compartmentName, PreferenceConstantHelper.COMPARTMENT_NAME_VISIBILITY);
+ store.setDefault(showCompartmentTitleKey, compartmentTitleDefaultVisibilityMap.get(compartmentName));
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void initializeCompartmentNamesList() {
+ for(String name : compartmentDefaultVisibilityMap.keySet()) {
+ this.compartmentNamesList.add(name);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void initializeCompartmentTitlesList() {
+ for(String name : compartmentTitleDefaultVisibilityMap.keySet()) {
+ this.compartmentTitlesList.add(name);
+ }
+ }
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CommentAnnotatedElementPreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CommentAnnotatedElementPreferencePage.java
new file mode 100644
index 00000000000..56fb3a64404
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CommentAnnotatedElementPreferencePage.java
@@ -0,0 +1,30 @@
+package org.eclipse.papyrus.sysml.diagram.parametric.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.sysml.diagram.parametric.provider.ElementTypes;
+
+public class CommentAnnotatedElementPreferencePage extends ParametricDiagramLinkPreferencePage {
+
+ /** Constant key to access preferences */
+ protected static String prefKey = ElementTypes.DIAGRAM_ID + "_CommentAnnotatedElement"; //$NON-NLS-1$
+
+
+ /** Default constructor */
+ public CommentAnnotatedElementPreferencePage() {
+ super();
+ setPreferenceKey(ElementTypes.DIAGRAM_ID + "_CommentAnnotatedElement"); //$NON-NLS-1$
+ }
+
+ /**
+ * Initialize defaults using a specified {@link IPreferenceStore}
+ *
+ * @param store
+ * the preference store.
+ */
+ public static void initDefaults(IPreferenceStore store) {
+ // Start of user code custom default initializations
+ // End of user code
+
+ }
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CommentPreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CommentPreferencePage.java
new file mode 100644
index 00000000000..d81c51d3791
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CommentPreferencePage.java
@@ -0,0 +1,31 @@
+package org.eclipse.papyrus.sysml.diagram.parametric.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.sysml.diagram.parametric.provider.ElementTypes;
+
+public class CommentPreferencePage extends ParametricDiagramNodePreferencePage {
+
+ /** Constant key to access preferences */
+ protected static String prefKey = ElementTypes.DIAGRAM_ID + "_Comment"; //$NON-NLS-1$
+
+
+ /** Default constructor */
+ public CommentPreferencePage() {
+ super();
+ setPreferenceKey(ElementTypes.DIAGRAM_ID + "_Comment"); //$NON-NLS-1$
+ }
+
+ /**
+ * Initialize defaults using a specified {@link IPreferenceStore}
+ *
+ * @param store
+ * the preference store.
+ */
+ public static void initDefaults(IPreferenceStore store) {
+ // Start of user code custom default initializations
+ // End of user code
+
+ }
+
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ConnectorPreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ConnectorPreferencePage.java
new file mode 100644
index 00000000000..21808a0f5b2
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ConnectorPreferencePage.java
@@ -0,0 +1,61 @@
+package org.eclipse.papyrus.sysml.diagram.parametric.preferences;
+
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.sysml.diagram.parametric.provider.ElementTypes;
+import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes;
+
+public class ConnectorPreferencePage extends ParametricDiagramLinkPreferencePage {
+
+ /** Constant key to access preferences */
+ public static String prefKey = ElementTypes.DIAGRAM_ID + "_" + UMLGraphicalTypes.LINK_UML_CONNECTOR_ID; //$NON-NLS-1$
+
+ /** The labels default visibility for preferences */
+ public static final Map<String, Boolean> labelDefaultVisibilityMap;
+
+ /** Static attribute initialization */
+ static {
+ labelDefaultVisibilityMap = new LinkedHashMap<String, Boolean>();
+ labelDefaultVisibilityMap.put("Stereotype", Boolean.TRUE); //$NON-NLS-1$
+ labelDefaultVisibilityMap.put("Name", Boolean.TRUE); //$NON-NLS-1$
+ labelDefaultVisibilityMap.put("SourceMultiplicity", Boolean.TRUE); //$NON-NLS-1$
+ labelDefaultVisibilityMap.put("TargetMultiplicity", Boolean.TRUE); //$NON-NLS-1$
+
+ // Start of user code custom static initializations
+ // End of user code
+
+ Collections.unmodifiableMap(labelDefaultVisibilityMap);
+ }
+
+ /** Constructor */
+ public ConnectorPreferencePage() {
+ super();
+ setPreferenceKey(ElementTypes.DIAGRAM_ID + "_" + UMLGraphicalTypes.LINK_UML_CONNECTOR_ID); //$NON-NLS-1$
+ }
+
+ /** Default preferences initializer */
+ public static void initDefaults(IPreferenceStore store) {
+ // Start of user code custom default initializations
+ // End of user code
+
+ // Initialize default visibility for labels in preference page.
+ for(String labelName : labelDefaultVisibilityMap.keySet()) {
+ String showLabelKey = PreferenceConstantHelper.getCompartmentElementConstant(prefKey, labelName, PreferenceConstantHelper.LABEL_VISIBILITY);
+ store.setDefault(showLabelKey, labelDefaultVisibilityMap.get(labelName));
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void initializeLabelsList() {
+ for(String name : labelDefaultVisibilityMap.keySet()) {
+ this.labelsList.add(name);
+ }
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ConstraintConstrainedElementPreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ConstraintConstrainedElementPreferencePage.java
new file mode 100644
index 00000000000..42d66df2afe
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ConstraintConstrainedElementPreferencePage.java
@@ -0,0 +1,30 @@
+package org.eclipse.papyrus.sysml.diagram.parametric.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.sysml.diagram.parametric.provider.ElementTypes;
+
+public class ConstraintConstrainedElementPreferencePage extends ParametricDiagramLinkPreferencePage {
+
+ /** Constant key to access preferences */
+ protected static String prefKey = ElementTypes.DIAGRAM_ID + "_ConstraintConstrainedElement"; //$NON-NLS-1$
+
+
+ /** Default constructor */
+ public ConstraintConstrainedElementPreferencePage() {
+ super();
+ setPreferenceKey(ElementTypes.DIAGRAM_ID + "_ConstraintConstrainedElement"); //$NON-NLS-1$
+ }
+
+ /**
+ * Initialize defaults using a specified {@link IPreferenceStore}
+ *
+ * @param store
+ * the preference store.
+ */
+ public static void initDefaults(IPreferenceStore store) {
+ // Start of user code custom default initializations
+ // End of user code
+
+ }
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ConstraintPreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ConstraintPreferencePage.java
new file mode 100644
index 00000000000..6a31b455ae9
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ConstraintPreferencePage.java
@@ -0,0 +1,31 @@
+package org.eclipse.papyrus.sysml.diagram.parametric.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.sysml.diagram.parametric.provider.ElementTypes;
+
+public class ConstraintPreferencePage extends ParametricDiagramNodePreferencePage {
+
+ /** Constant key to access preferences */
+ protected static String prefKey = ElementTypes.DIAGRAM_ID + "_Constraint"; //$NON-NLS-1$
+
+
+ /** Default constructor */
+ public ConstraintPreferencePage() {
+ super();
+ setPreferenceKey(ElementTypes.DIAGRAM_ID + "_Constraint"); //$NON-NLS-1$
+ }
+
+ /**
+ * Initialize defaults using a specified {@link IPreferenceStore}
+ *
+ * @param store
+ * the preference store.
+ */
+ public static void initDefaults(IPreferenceStore store) {
+ // Start of user code custom default initializations
+ // End of user code
+
+ }
+
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/DependencyPreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/DependencyPreferencePage.java
new file mode 100644
index 00000000000..c321e7e2939
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/DependencyPreferencePage.java
@@ -0,0 +1,59 @@
+package org.eclipse.papyrus.sysml.diagram.parametric.preferences;
+
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.sysml.diagram.parametric.provider.ElementTypes;
+import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes;
+
+public class DependencyPreferencePage extends ParametricDiagramLinkPreferencePage {
+
+ /** Constant key to access preferences */
+ public static String prefKey = ElementTypes.DIAGRAM_ID + "_" + UMLGraphicalTypes.LINK_UML_DEPENDENCY_ID; //$NON-NLS-1$
+
+ /** The labels default visibility for preferences */
+ public static final Map<String, Boolean> labelDefaultVisibilityMap;
+
+ /** Static attribute initialization */
+ static {
+ labelDefaultVisibilityMap = new LinkedHashMap<String, Boolean>();
+ labelDefaultVisibilityMap.put("Stereotype", Boolean.TRUE); //$NON-NLS-1$
+ labelDefaultVisibilityMap.put("Name", Boolean.TRUE); //$NON-NLS-1$
+
+ // Start of user code custom static initializations
+ // End of user code
+
+ Collections.unmodifiableMap(labelDefaultVisibilityMap);
+ }
+
+ /** Constructor */
+ public DependencyPreferencePage() {
+ super();
+ setPreferenceKey(ElementTypes.DIAGRAM_ID + "_" + UMLGraphicalTypes.LINK_UML_DEPENDENCY_ID); //$NON-NLS-1$
+ }
+
+ /** Default preferences initializer */
+ public static void initDefaults(IPreferenceStore store) {
+ // Start of user code custom default initializations
+ // End of user code
+
+ // Initialize default visibility for labels in preference page.
+ for(String labelName : labelDefaultVisibilityMap.keySet()) {
+ String showLabelKey = PreferenceConstantHelper.getCompartmentElementConstant(prefKey, labelName, PreferenceConstantHelper.LABEL_VISIBILITY);
+ store.setDefault(showLabelKey, labelDefaultVisibilityMap.get(labelName));
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void initializeLabelsList() {
+ for(String name : labelDefaultVisibilityMap.keySet()) {
+ this.labelsList.add(name);
+ }
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/FlowPortPreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/FlowPortPreferencePage.java
new file mode 100644
index 00000000000..c5119a7db01
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/FlowPortPreferencePage.java
@@ -0,0 +1,60 @@
+package org.eclipse.papyrus.sysml.diagram.parametric.preferences;
+
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.sysml.diagram.parametric.provider.ElementTypes;
+
+public class FlowPortPreferencePage extends ParametricDiagramNodePreferencePage {
+
+ /** Constant key to access preferences */
+ public static String prefKey = ElementTypes.DIAGRAM_ID + "_shape_sysml_flowport_as_affixed"; //$NON-NLS-1$
+
+ /** The labels default visibility for preferences */
+ public static final Map<String, Boolean> labelDefaultVisibilityMap;
+
+ /** Static attribute initialization */
+ static {
+ labelDefaultVisibilityMap = new LinkedHashMap<String, Boolean>();
+ labelDefaultVisibilityMap.put("FlowPortAffixedLabel", Boolean.TRUE); //$NON-NLS-1$
+ labelDefaultVisibilityMap.put("AppliedStereotypeAffixedLabel", Boolean.TRUE); //$NON-NLS-1$
+
+ // Start of user code custom static initializations
+ // End of user code
+
+ Collections.unmodifiableMap(labelDefaultVisibilityMap);
+ }
+
+ /** Constructor */
+ public FlowPortPreferencePage() {
+ super();
+ setPreferenceKey(ElementTypes.DIAGRAM_ID + "_shape_sysml_flowport_as_affixed"); //$NON-NLS-1$
+ }
+
+ /** Default preferences initializer */
+ public static void initDefaults(IPreferenceStore store) {
+ // Start of user code custom default initializations
+ store.setDefault(PreferenceConstantHelper.getElementConstant(prefKey, PreferenceConstantHelper.WIDTH), 20);
+ store.setDefault(PreferenceConstantHelper.getElementConstant(prefKey, PreferenceConstantHelper.HEIGHT), 20);
+ // End of user code
+
+ // Initialize default visibility for labels in preference page.
+ for(String labelName : labelDefaultVisibilityMap.keySet()) {
+ String showLabelKey = PreferenceConstantHelper.getCompartmentElementConstant(prefKey, labelName, PreferenceConstantHelper.LABEL_VISIBILITY);
+ store.setDefault(showLabelKey, labelDefaultVisibilityMap.get(labelName));
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void initializeLabelsList() {
+ for(String name : labelDefaultVisibilityMap.keySet()) {
+ this.labelsList.add(name);
+ }
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ParametricDiagramGeneralPreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ParametricDiagramGeneralPreferencePage.java
new file mode 100644
index 00000000000..9f0750bfb35
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ParametricDiagramGeneralPreferencePage.java
@@ -0,0 +1,11 @@
+package org.eclipse.papyrus.sysml.diagram.parametric.preferences;
+
+import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.DiagramPreferencePage;
+import org.eclipse.papyrus.sysml.diagram.parametric.Activator;
+
+public class ParametricDiagramGeneralPreferencePage extends DiagramPreferencePage {
+
+ public ParametricDiagramGeneralPreferencePage() {
+ setPreferenceStore(Activator.getInstance().getPreferenceStore());
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ParametricDiagramLinkPreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ParametricDiagramLinkPreferencePage.java
new file mode 100644
index 00000000000..8f688d25a1e
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ParametricDiagramLinkPreferencePage.java
@@ -0,0 +1,60 @@
+package org.eclipse.papyrus.sysml.diagram.parametric.preferences;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.TreeMap;
+
+import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.AbstractPapyrusLinkPreferencePage;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.OrderedLabelGroup;
+import org.eclipse.papyrus.sysml.diagram.parametric.Activator;
+import org.eclipse.swt.widgets.Composite;
+
+public class ParametricDiagramLinkPreferencePage extends AbstractPapyrusLinkPreferencePage {
+
+ /** The list of label names for this link */
+ protected List<String> labelsList;
+
+ /** Constructor */
+ public ParametricDiagramLinkPreferencePage() {
+ labelsList = new ArrayList<String>();
+ initializeLabelsList();
+ Collections.unmodifiableList(labelsList);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void createPageContents(Composite parent) {
+ super.createPageContents(parent);
+
+ // Add label visibility group
+ if(!labelsList.isEmpty()) {
+ OrderedLabelGroup compartmentGroup = new OrderedLabelGroup(parent, getPreferenceKey(), this, labelsList);
+ addAbstractGroup(compartmentGroup);
+ }
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getBundleId() {
+ return Activator.PLUGIN_ID;
+ }
+
+ /** Initialize the list containing names of labels. */
+ protected void initializeLabelsList() {
+ // Implemented by subclasses.
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected final TreeMap<String, String> getLabelRole() {
+ return new TreeMap<String, String>();
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ParametricDiagramNodePreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ParametricDiagramNodePreferencePage.java
new file mode 100644
index 00000000000..4d9e33bb8e6
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ParametricDiagramNodePreferencePage.java
@@ -0,0 +1,106 @@
+package org.eclipse.papyrus.sysml.diagram.parametric.preferences;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.TreeMap;
+
+import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.AbstractPapyrusNodePreferencePage;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.OrderedCompartmentGroup;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.OrderedLabelGroup;
+import org.eclipse.papyrus.sysml.diagram.parametric.Activator;
+import org.eclipse.swt.widgets.Composite;
+
+public class ParametricDiagramNodePreferencePage extends AbstractPapyrusNodePreferencePage {
+
+ /** The list owning the names of compartments */
+ protected List<String> compartmentNamesList;
+
+ /** The list owning the names of compartment that have a title */
+ protected List<String> compartmentTitlesList;
+
+ /** The list of label names for this node */
+ protected List<String> labelsList;
+
+ /** Constructor */
+ public ParametricDiagramNodePreferencePage() {
+ this.labelsList = new ArrayList<String>();
+ this.compartmentNamesList = new ArrayList<String>();
+ this.compartmentTitlesList = new ArrayList<String>();
+
+ initializeLabelsList();
+ initializeCompartmentNamesList();
+ initializeCompartmentTitlesList();
+
+ Collections.unmodifiableList(labelsList);
+ Collections.unmodifiableList(compartmentNamesList);
+ Collections.unmodifiableList(compartmentTitlesList);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void createPageContents(Composite parent) {
+ super.createPageContents(parent);
+
+ // Add compartments visibility group
+ if(!compartmentNamesList.isEmpty()) {
+ OrderedCompartmentGroup compartmentGroup = new OrderedCompartmentGroup(parent, getPreferenceKey(), this, compartmentNamesList, compartmentTitlesList, getPreferenceStore());
+ addAbstractGroup(compartmentGroup);
+ }
+
+ // Add label visibility group
+ if(!labelsList.isEmpty()) {
+ OrderedLabelGroup compartmentGroup = new OrderedLabelGroup(parent, getPreferenceKey(), this, labelsList);
+ addAbstractGroup(compartmentGroup);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getBundleId() {
+ return Activator.PLUGIN_ID;
+ }
+
+ /** Initialize the list containing names of labels. */
+ protected void initializeLabelsList() {
+ // Implemented by subclasses.
+ }
+
+ /** Initialize the list containing the names of compartments. */
+ protected void initializeCompartmentNamesList() {
+ // Implemented by subclasses.
+ }
+
+ /** Initialize the list containing the names of compartment that have titles. */
+ protected void initializeCompartmentTitlesList() {
+ // Implemented by subclasses.
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected final TreeMap<String, String> getLabelRole() {
+ return new TreeMap<String, String>();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected final TreeMap<String, Boolean> getCompartmentTitleVisibilityPreferences() {
+ return new TreeMap<String, Boolean>();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected final void initializeCompartmentsList() {
+ compartmentsList = Collections.emptyList();
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ParametricDiagramPreferenceInitializer.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ParametricDiagramPreferenceInitializer.java
new file mode 100644
index 00000000000..ae5bebb52d8
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ParametricDiagramPreferenceInitializer.java
@@ -0,0 +1,28 @@
+package org.eclipse.papyrus.sysml.diagram.parametric.preferences;
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.sysml.diagram.parametric.Activator;
+
+public class ParametricDiagramPreferenceInitializer extends AbstractPreferenceInitializer {
+
+ protected IPreferenceStore getPreferenceStore() {
+ return Activator.getInstance().getPreferenceStore();
+ }
+
+ @Override
+ public void initializeDefaultPreferences() {
+ IPreferenceStore store = getPreferenceStore();
+
+ org.eclipse.papyrus.sysml.diagram.parametric.preferences.ConstraintPreferencePage.initDefaults(store);
+ org.eclipse.papyrus.sysml.diagram.parametric.preferences.CommentPreferencePage.initDefaults(store);
+ org.eclipse.papyrus.sysml.diagram.parametric.preferences.CommentAnnotatedElementPreferencePage.initDefaults(store);
+ BlockCompositePreferencePage.initDefaults(store);
+ BlockPropertyCompositePreferencePage.initDefaults(store);
+ FlowPortPreferencePage.initDefaults(store);
+ PortPreferencePage.initDefaults(store);
+ ConnectorPreferencePage.initDefaults(store);
+ DependencyPreferencePage.initDefaults(store);
+
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/PortPreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/PortPreferencePage.java
new file mode 100644
index 00000000000..7c3c7303ff0
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/preferences/PortPreferencePage.java
@@ -0,0 +1,60 @@
+package org.eclipse.papyrus.sysml.diagram.parametric.preferences;
+
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.sysml.diagram.parametric.provider.ElementTypes;
+
+public class PortPreferencePage extends ParametricDiagramNodePreferencePage {
+
+ /** Constant key to access preferences */
+ public static String prefKey = ElementTypes.DIAGRAM_ID + "_shape_uml_port_as_affixed"; //$NON-NLS-1$
+
+ /** The labels default visibility for preferences */
+ public static final Map<String, Boolean> labelDefaultVisibilityMap;
+
+ /** Static attribute initialization */
+ static {
+ labelDefaultVisibilityMap = new LinkedHashMap<String, Boolean>();
+ labelDefaultVisibilityMap.put("PortAffixedLabel", Boolean.TRUE); //$NON-NLS-1$
+ labelDefaultVisibilityMap.put("AppliedStereotypeAffixedLabel", Boolean.TRUE); //$NON-NLS-1$
+
+ // Start of user code custom static initializations
+ // End of user code
+
+ Collections.unmodifiableMap(labelDefaultVisibilityMap);
+ }
+
+ /** Constructor */
+ public PortPreferencePage() {
+ super();
+ setPreferenceKey(ElementTypes.DIAGRAM_ID + "_shape_uml_port_as_affixed"); //$NON-NLS-1$
+ }
+
+ /** Default preferences initializer */
+ public static void initDefaults(IPreferenceStore store) {
+ // Start of user code custom default initializations
+ store.setDefault(PreferenceConstantHelper.getElementConstant(prefKey, PreferenceConstantHelper.WIDTH), 20);
+ store.setDefault(PreferenceConstantHelper.getElementConstant(prefKey, PreferenceConstantHelper.HEIGHT), 20);
+ // End of user code
+
+ // Initialize default visibility for labels in preference page.
+ for(String labelName : labelDefaultVisibilityMap.keySet()) {
+ String showLabelKey = PreferenceConstantHelper.getCompartmentElementConstant(prefKey, labelName, PreferenceConstantHelper.LABEL_VISIBILITY);
+ store.setDefault(showLabelKey, labelDefaultVisibilityMap.get(labelName));
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void initializeLabelsList() {
+ for(String name : labelDefaultVisibilityMap.keySet()) {
+ this.labelsList.add(name);
+ }
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/CustomEditPartProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/CustomEditPartProvider.java
new file mode 100644
index 00000000000..9efdac2be81
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/CustomEditPartProvider.java
@@ -0,0 +1,120 @@
+package org.eclipse.papyrus.sysml.diagram.parametric.provider;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.gmf.runtime.common.core.service.IOperation;
+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.Edge;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.gmf.diagram.common.provider.CustomAbstractEditPartProvider;
+import org.eclipse.papyrus.sysml.diagram.common.edit.part.BlockPropertyStructureCompartmentEditPart;
+import org.eclipse.papyrus.sysml.diagram.common.edit.part.FlowPortAffixedLabelNameEditPart;
+import org.eclipse.papyrus.sysml.diagram.common.edit.part.FlowPortAffixedNodeEditPart;
+import org.eclipse.papyrus.sysml.diagram.common.edit.part.StructureCompartmentEditPart;
+import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes;
+import org.eclipse.papyrus.sysml.diagram.parametric.edit.part.CustomBlockCompositeEditPartTN;
+import org.eclipse.papyrus.sysml.diagram.parametric.edit.part.CustomBlockLabelNameEditPart;
+import org.eclipse.papyrus.sysml.diagram.parametric.edit.part.CustomBlockPropertyCompositeEditPart;
+import org.eclipse.papyrus.sysml.diagram.parametric.edit.part.CustomConstraintBlockPropertyCompositeEditPart;
+import org.eclipse.papyrus.sysml.diagram.parametric.edit.part.CustomConstraintParameterAffixedNodeEditPart;
+import org.eclipse.papyrus.uml.diagram.common.edit.part.AppliedStereotypeAffixedLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.common.edit.part.AppliedStereotypeLinkLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.common.edit.part.ConnectorEditPart;
+import org.eclipse.papyrus.uml.diagram.common.edit.part.ConnectorLinkLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.common.edit.part.ConnectorLinkLabelSourceMultiplicityEditPart;
+import org.eclipse.papyrus.uml.diagram.common.edit.part.ConnectorLinkLabelTargetMultiplicityEditPart;
+import org.eclipse.papyrus.uml.diagram.common.edit.part.ConstraintNodeLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.common.edit.part.DependencyEditPart;
+import org.eclipse.papyrus.uml.diagram.common.edit.part.NamedElementLinkLabelNameEditPart;
+import org.eclipse.papyrus.uml.diagram.common.edit.part.PortAffixedLabelNameEditPart;
+import org.eclipse.papyrus.uml.diagram.common.edit.part.PortAffixedNodeEditPart;
+import org.eclipse.papyrus.uml.diagram.common.edit.part.PropertyNodeLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes;
+
+public class CustomEditPartProvider extends CustomAbstractEditPartProvider {
+
+ /** Map containing node view types supported by this provider */
+ protected Map<String, Class<?>> nodeMap = new HashMap<String, Class<?>>();
+
+ /** Map containing edge view types supported by this provider */
+ protected Map<String, Class<?>> edgeMap = new HashMap<String, Class<?>>();
+
+ /** Default constructor */
+ public CustomEditPartProvider() {
+ super();
+
+ diagramType = ElementTypes.DIAGRAM_ID;
+
+ // Nodes
+ nodeMap.put(SysMLGraphicalTypes.SHAPE_SYSML_CONSTRAINTBLOCKPROPERTY_AS_COMPOSITE_ID, CustomConstraintBlockPropertyCompositeEditPart.class);
+ nodeMap.put(SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, CustomBlockPropertyCompositeEditPart.class);
+ nodeMap.put(SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID, CustomBlockCompositeEditPartTN.class);
+ nodeMap.put(SysMLGraphicalTypes.SHAPE_SYSML_FLOWPORT_AS_AFFIXED_ID, FlowPortAffixedNodeEditPart.class);
+ nodeMap.put(UMLGraphicalTypes.SHAPE_UML_PORT_AS_AFFIXED_ID, PortAffixedNodeEditPart.class);
+ nodeMap.put(UMLGraphicalTypes.SHAPE_UML_PROPERTY_AS_AFFIXED_ID, CustomConstraintParameterAffixedNodeEditPart.class);
+
+ // Decorations
+ nodeMap.put(SysMLGraphicalTypes.AFFIXEDLABEL_SYSML_FLOWPORT_LABEL_ID, FlowPortAffixedLabelNameEditPart.class);
+ nodeMap.put(SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID, BlockPropertyStructureCompartmentEditPart.class);
+ nodeMap.put(SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID, StructureCompartmentEditPart.class);
+ nodeMap.put(SysMLGraphicalTypes.LABEL_SYSML_BLOCK_NAME_ID, CustomBlockLabelNameEditPart.class); // TODO : change for multi FlowText
+ nodeMap.put(UMLGraphicalTypes.AFFIXEDLABEL_UML_APPLIEDSTEREOTYPE_ID, AppliedStereotypeAffixedLabelEditPart.class);
+ nodeMap.put(UMLGraphicalTypes.AFFIXEDLABEL_UML_PORT_LABEL_ID, PortAffixedLabelNameEditPart.class);
+ nodeMap.put(UMLGraphicalTypes.LABEL_UML_PROPERTY_LABEL_ID, PropertyNodeLabelEditPart.class);
+ nodeMap.put(UMLGraphicalTypes.SHAPE_UML_CONSTRAINT_AS_LABEL_ID, ConstraintNodeLabelEditPart.class);
+ nodeMap.put(UMLGraphicalTypes.LINKLABEL_UML_APPLIEDSTEREOTYPE_ID, AppliedStereotypeLinkLabelEditPart.class);
+ nodeMap.put(UMLGraphicalTypes.LINKLABEL_UML_CONNECTOR_LABEL_ID, ConnectorLinkLabelEditPart.class);
+ nodeMap.put(UMLGraphicalTypes.LINKLABEL_UML_CONNECTOR_SOURCE_MULTIPLICITY_ID, ConnectorLinkLabelSourceMultiplicityEditPart.class);
+ nodeMap.put(UMLGraphicalTypes.LINKLABEL_UML_CONNECTOR_TARGET_MULTIPLICITY_ID, ConnectorLinkLabelTargetMultiplicityEditPart.class);
+ nodeMap.put(UMLGraphicalTypes.LINKLABEL_UML_NAMEDELEMENT_NAME_ID, NamedElementLinkLabelNameEditPart.class);
+
+
+ // Edges
+ edgeMap.put(UMLGraphicalTypes.LINK_UML_CONNECTOR_ID, ConnectorEditPart.class);
+ edgeMap.put(UMLGraphicalTypes.LINK_UML_DEPENDENCY_ID, DependencyEditPart.class);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean provides(IOperation operation) {
+ if(operation instanceof CreateGraphicEditPartOperation) {
+ View newView = ((IEditPartOperation)operation).getView();
+ if (newView == null) {
+ return false;
+ }
+
+ String graphicalType = newView.getType();
+
+ if((newView instanceof Node) && (!nodeMap.containsKey(graphicalType))) {
+ return false;
+ }
+
+ if((newView instanceof Edge) && (!edgeMap.containsKey(graphicalType))) {
+ return false;
+ }
+ }
+
+ return super.provides(operation);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Class<?> getNodeEditPartClass(View view) {
+ return nodeMap.get(view.getType());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Class<?> getEdgeEditPartClass(View view) {
+ return edgeMap.get(view.getType());
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/CustomGraphicalTypeRegistry.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/CustomGraphicalTypeRegistry.java
new file mode 100644
index 00000000000..5b838c32c5f
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/CustomGraphicalTypeRegistry.java
@@ -0,0 +1,224 @@
+package org.eclipse.papyrus.sysml.diagram.parametric.provider;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.ISpecializationType;
+import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes;
+import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes;
+import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes;
+
+public class CustomGraphicalTypeRegistry extends GraphicalTypeRegistry {
+
+ /** Default constructor */
+ public CustomGraphicalTypeRegistry() {
+
+ super();
+
+ // Nodes
+ knownNodes.add(SysMLGraphicalTypes.SHAPE_SYSML_CONSTRAINTBLOCKPROPERTY_AS_COMPOSITE_ID);
+ knownNodes.add(SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID);
+ knownNodes.add(SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID);
+ knownNodes.add(SysMLGraphicalTypes.SHAPE_SYSML_FLOWPORT_AS_AFFIXED_ID);
+ knownNodes.add(UMLGraphicalTypes.SHAPE_UML_PORT_AS_AFFIXED_ID);
+ knownNodes.add(UMLGraphicalTypes.SHAPE_UML_PROPERTY_AS_AFFIXED_ID);
+ // Decorations
+ knownNodes.add(SysMLGraphicalTypes.AFFIXEDLABEL_SYSML_FLOWPORT_LABEL_ID);
+ knownNodes.add(SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID);
+ knownNodes.add(SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID);
+ knownNodes.add(SysMLGraphicalTypes.LABEL_SYSML_BLOCK_NAME_ID);
+ knownNodes.add(UMLGraphicalTypes.AFFIXEDLABEL_UML_APPLIEDSTEREOTYPE_ID);
+ knownNodes.add(UMLGraphicalTypes.AFFIXEDLABEL_UML_PORT_LABEL_ID);
+ knownNodes.add(UMLGraphicalTypes.LABEL_UML_PROPERTY_LABEL_ID);
+ knownNodes.add(UMLGraphicalTypes.SHAPE_UML_CONSTRAINT_AS_LABEL_ID);
+ knownNodes.add(UMLGraphicalTypes.LINKLABEL_UML_APPLIEDSTEREOTYPE_ID);
+ knownNodes.add(UMLGraphicalTypes.LINKLABEL_UML_CONNECTOR_LABEL_ID);
+ knownNodes.add(UMLGraphicalTypes.LINKLABEL_UML_CONNECTOR_SOURCE_MULTIPLICITY_ID);
+ knownNodes.add(UMLGraphicalTypes.LINKLABEL_UML_CONNECTOR_TARGET_MULTIPLICITY_ID);
+ knownNodes.add(UMLGraphicalTypes.LINKLABEL_UML_NAMEDELEMENT_NAME_ID);
+
+ // Edges
+ knownEdges.add(UMLGraphicalTypes.LINK_UML_CONNECTOR_ID);
+ knownEdges.add(UMLGraphicalTypes.LINK_UML_DEPENDENCY_ID);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getNodeGraphicalType(EObject domainElement, String containerType) {
+ // Start of user code getNodeGraphicalType(EObject domainElement, String containerType)
+ // End of user code
+
+ if(((ISpecializationType)SysMLElementTypes.BLOCK).getMatcher().matches(domainElement)) {
+ if (ElementTypes.DIAGRAM_ID.equals(containerType)) {
+ return SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID;
+ }
+ return UNDEFINED_TYPE;
+ }
+ if(((ISpecializationType)SysMLElementTypes.CONSTRAINT_PROPERTY).getMatcher().matches(domainElement)) {
+ if (SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID.equals(domainElement)) {
+ return SysMLGraphicalTypes.SHAPE_SYSML_CONSTRAINTBLOCKPROPERTY_AS_COMPOSITE_ID;
+ }
+ if (SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID.equals(containerType)) {
+ return SysMLGraphicalTypes.SHAPE_SYSML_CONSTRAINTBLOCKPROPERTY_AS_COMPOSITE_ID;
+ }
+ if (SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID.equals(containerType)) {
+ return SysMLGraphicalTypes.SHAPE_SYSML_CONSTRAINTBLOCKPROPERTY_AS_COMPOSITE_ID;
+ }
+ return UNDEFINED_TYPE;
+ }
+
+ if(((ISpecializationType)SysMLElementTypes.PART_PROPERTY).getMatcher().matches(domainElement)) {
+ if (SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID.equals(containerType)) {
+ return SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID;
+ }
+ if (SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID.equals(containerType)) {
+ return SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID;
+ }
+ if (SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID.equals(containerType)) {
+ return SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID;
+ }
+ return UNDEFINED_TYPE;
+ }
+ if(((ISpecializationType)SysMLElementTypes.REFERENCE_PROPERTY).getMatcher().matches(domainElement)) {
+ if (SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID.equals(containerType)) {
+ return SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID;
+ }
+ if (SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID.equals(containerType)) {
+ return SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID;
+ }
+ if (SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID.equals(containerType)) {
+ return SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID;
+ }
+ return UNDEFINED_TYPE;
+ }
+ if(((ISpecializationType)SysMLElementTypes.VALUE_PROPERTY).getMatcher().matches(domainElement)) {
+ if (SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID.equals(containerType)) {
+ return SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID;
+ }
+ if (SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID.equals(containerType)) {
+ return SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID;
+ }
+ if (SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID.equals(containerType)) {
+ return SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID;
+ }
+ return UNDEFINED_TYPE;
+ }
+ // Order is important for Part/Reference/ConstraintProperty which are also Property
+ if(UMLElementTypes.PROPERTY.getEClass().isInstance(domainElement)) {
+ if (SysMLGraphicalTypes.SHAPE_SYSML_CONSTRAINTBLOCKPROPERTY_AS_COMPOSITE_ID.equals(containerType)) {
+ return UMLGraphicalTypes.SHAPE_UML_PROPERTY_AS_AFFIXED_ID;
+ }
+ return UNDEFINED_TYPE;
+
+ }
+
+ return super.getNodeGraphicalType(domainElement, containerType);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getNodeGraphicalType(String proposedType, String containerType) {
+ // Start of user code getNodeGraphicalType(String proposedType, String containerType)
+ // End of user code
+
+ if(SysMLElementTypes.BLOCK.getSemanticHint().equals(proposedType)) {
+ if (ElementTypes.DIAGRAM_ID.equals(containerType)) {
+ return SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID;
+ }
+ return UNDEFINED_TYPE;
+ }
+
+ if(UMLElementTypes.PROPERTY.getSemanticHint().equals(proposedType)) {
+ if (SysMLGraphicalTypes.SHAPE_SYSML_CONSTRAINTBLOCKPROPERTY_AS_COMPOSITE_ID.equals(containerType)) {
+ return UMLGraphicalTypes.SHAPE_UML_PROPERTY_AS_AFFIXED_ID;
+ }
+ return UNDEFINED_TYPE;
+ }
+
+ if(SysMLElementTypes.CONSTRAINT_PROPERTY.getSemanticHint().equals(proposedType)) {
+ if (SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID.equals(containerType)) {
+ return SysMLGraphicalTypes.SHAPE_SYSML_CONSTRAINTBLOCKPROPERTY_AS_COMPOSITE_ID;
+ }
+ if (SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID.equals(containerType)) {
+ return SysMLGraphicalTypes.SHAPE_SYSML_CONSTRAINTBLOCKPROPERTY_AS_COMPOSITE_ID;
+ }
+ if (SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID.equals(containerType)) {
+ return SysMLGraphicalTypes.SHAPE_SYSML_CONSTRAINTBLOCKPROPERTY_AS_COMPOSITE_ID;
+ }
+ return UNDEFINED_TYPE;
+ }
+
+ if(SysMLElementTypes.PART_PROPERTY.getSemanticHint().equals(proposedType)) {
+ if (SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID.equals(containerType)) {
+ return SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID;
+ }
+ if (SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID.equals(containerType)) {
+ return SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID;
+ }
+ if (SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID.equals(containerType)) {
+ return SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID;
+ }
+ return UNDEFINED_TYPE;
+ }
+ if(SysMLElementTypes.REFERENCE_PROPERTY.getSemanticHint().equals(proposedType)) {
+ if (SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID.equals(containerType)) {
+ return SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID;
+ }
+ if (SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID.equals(containerType)) {
+ return SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID;
+ }
+ if (SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID.equals(containerType)) {
+ return SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID;
+ }
+ return UNDEFINED_TYPE;
+ }
+ if(SysMLElementTypes.VALUE_PROPERTY.getSemanticHint().equals(proposedType)) {
+ if (SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID.equals(containerType)) {
+ return SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID;
+ }
+ if (SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID.equals(containerType)) {
+ return SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID;
+ }
+ if (SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID.equals(containerType)) {
+ return SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID;
+ }
+ return UNDEFINED_TYPE;
+ }
+ return super.getNodeGraphicalType(proposedType, containerType);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getEdgeGraphicalType(EObject domainElement) {
+ // Start of user code getEdgeGraphicalType(EObject domainElement)
+ // End of user code
+
+ if(UMLElementTypes.CONNECTOR.getEClass().isInstance(domainElement)) {
+ return UMLGraphicalTypes.LINK_UML_CONNECTOR_ID;
+ }
+ if(UMLElementTypes.DEPENDENCY.getEClass().isInstance(domainElement)) {
+ return UMLGraphicalTypes.LINK_UML_DEPENDENCY_ID;
+ }
+ return super.getEdgeGraphicalType(domainElement);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getEdgeGraphicalType(String proposedType) {
+ // Start of user code getEdgeGraphicalType(String proposedType)
+ // End of user code
+
+ if(UMLElementTypes.CONNECTOR.getSemanticHint().equals(proposedType)) {
+ return UMLGraphicalTypes.LINK_UML_CONNECTOR_ID;
+ }
+ if(UMLElementTypes.DEPENDENCY.getSemanticHint().equals(proposedType)) {
+ return UMLGraphicalTypes.LINK_UML_DEPENDENCY_ID;
+ }
+ return super.getEdgeGraphicalType(proposedType);
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/CustomGraphicalTypes.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/CustomGraphicalTypes.java
new file mode 100644
index 00000000000..31f18f64c05
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/CustomGraphicalTypes.java
@@ -0,0 +1,13 @@
+package org.eclipse.papyrus.sysml.diagram.parametric.provider;
+
+public class CustomGraphicalTypes {
+
+ /** ********************************************************* */
+ /** Diagram custom graphical types id *********************** */
+ /** ********************************************************* */
+
+
+
+
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/CustomViewProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/CustomViewProvider.java
new file mode 100644
index 00000000000..20bfe02018c
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/CustomViewProvider.java
@@ -0,0 +1,87 @@
+package org.eclipse.papyrus.sysml.diagram.parametric.provider;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.gmf.diagram.common.factory.AffixedLabelViewFactory;
+import org.eclipse.papyrus.gmf.diagram.common.factory.CompartmentShapeViewFactory;
+import org.eclipse.papyrus.gmf.diagram.common.factory.ConnectorLabelViewFactory;
+import org.eclipse.papyrus.gmf.diagram.common.factory.InnerLabelViewFactory;
+import org.eclipse.papyrus.gmf.diagram.common.provider.CustomAbstractViewProvider;
+import org.eclipse.papyrus.sysml.diagram.common.factory.BlockCompositeClassifierViewFactory;
+import org.eclipse.papyrus.sysml.diagram.common.factory.BlockPropertyCompositeClassifierViewFactory;
+import org.eclipse.papyrus.sysml.diagram.common.factory.ConstraintBlockPropertyCompositeClassifierViewFactory;
+import org.eclipse.papyrus.sysml.diagram.common.factory.FlowPortAffixedNodeViewFactory;
+import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes;
+import org.eclipse.papyrus.uml.diagram.common.factory.ConnectorLinkViewFactory;
+import org.eclipse.papyrus.uml.diagram.common.factory.ConstraintPropertyAffixedNodeViewFactory;
+import org.eclipse.papyrus.uml.diagram.common.factory.DependencyLinkViewFactory;
+import org.eclipse.papyrus.uml.diagram.common.factory.PortAffixedNodeViewFactory;
+import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes;
+
+public class CustomViewProvider extends CustomAbstractViewProvider {
+
+ /** Map containing node view types supported by this provider */
+ protected Map<String, Class<?>> nodeMap = new HashMap<String, Class<?>>();
+
+ /** Map containing edge view types supported by this provider */
+ protected Map<String, Class<?>> edgeMap = new HashMap<String, Class<?>>();
+
+ /** Default constructor */
+ public CustomViewProvider() {
+ super();
+ this.registry = new CustomGraphicalTypeRegistry();
+
+ diagramType = ElementTypes.DIAGRAM_ID;
+
+ // Custom classifier nodes
+ nodeMap.put(SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID, BlockCompositeClassifierViewFactory.class);
+ nodeMap.put(SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, BlockPropertyCompositeClassifierViewFactory.class);
+ nodeMap.put(SysMLGraphicalTypes.SHAPE_SYSML_CONSTRAINTBLOCKPROPERTY_AS_COMPOSITE_ID, ConstraintBlockPropertyCompositeClassifierViewFactory.class);
+ nodeMap.put(UMLGraphicalTypes.SHAPE_UML_PROPERTY_AS_AFFIXED_ID, ConstraintPropertyAffixedNodeViewFactory.class);
+ // Custom affixed nodes
+ nodeMap.put(SysMLGraphicalTypes.SHAPE_SYSML_FLOWPORT_AS_AFFIXED_ID, FlowPortAffixedNodeViewFactory.class);
+ nodeMap.put(UMLGraphicalTypes.SHAPE_UML_PORT_AS_AFFIXED_ID, PortAffixedNodeViewFactory.class);
+ // Custom child node labels
+ // Custom inner labels
+ nodeMap.put(SysMLGraphicalTypes.LABEL_SYSML_BLOCK_NAME_ID, InnerLabelViewFactory.class);
+ nodeMap.put(UMLGraphicalTypes.LABEL_UML_PROPERTY_LABEL_ID, InnerLabelViewFactory.class);
+ nodeMap.put(UMLGraphicalTypes.SHAPE_UML_CONSTRAINT_AS_LABEL_ID, InnerLabelViewFactory.class);
+ // Custom compartments
+ nodeMap.put(SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID, CompartmentShapeViewFactory.class);
+ nodeMap.put(SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID, CompartmentShapeViewFactory.class);
+ // Custom affixed labels
+ nodeMap.put(SysMLGraphicalTypes.AFFIXEDLABEL_SYSML_FLOWPORT_LABEL_ID, AffixedLabelViewFactory.class);
+ nodeMap.put(UMLGraphicalTypes.AFFIXEDLABEL_UML_APPLIEDSTEREOTYPE_ID, AffixedLabelViewFactory.class);
+ nodeMap.put(UMLGraphicalTypes.AFFIXEDLABEL_UML_PORT_LABEL_ID, AffixedLabelViewFactory.class);
+
+ // Custom edges
+ edgeMap.put(UMLGraphicalTypes.LINK_UML_CONNECTOR_ID, ConnectorLinkViewFactory.class);
+ edgeMap.put(UMLGraphicalTypes.LINK_UML_DEPENDENCY_ID, DependencyLinkViewFactory.class);
+
+ // Custom edge labels
+ nodeMap.put(UMLGraphicalTypes.LINKLABEL_UML_APPLIEDSTEREOTYPE_ID, ConnectorLabelViewFactory.class);
+ nodeMap.put(UMLGraphicalTypes.LINKLABEL_UML_CONNECTOR_LABEL_ID, ConnectorLabelViewFactory.class);
+ nodeMap.put(UMLGraphicalTypes.LINKLABEL_UML_CONNECTOR_SOURCE_MULTIPLICITY_ID, ConnectorLabelViewFactory.class);
+ nodeMap.put(UMLGraphicalTypes.LINKLABEL_UML_CONNECTOR_TARGET_MULTIPLICITY_ID, ConnectorLabelViewFactory.class);
+ nodeMap.put(UMLGraphicalTypes.LINKLABEL_UML_NAMEDELEMENT_NAME_ID, ConnectorLabelViewFactory.class);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Class<?> getNodeViewClass(IAdaptable semanticAdapter, View containerView, String graphicalType) {
+ return nodeMap.get(graphicalType);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Class<?> getEdgeViewClass(IAdaptable semanticAdapter, View containerView, String graphicalType) {
+ return edgeMap.get(graphicalType);
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/ElementTypes.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/ElementTypes.java
new file mode 100644
index 00000000000..21830b124f4
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/ElementTypes.java
@@ -0,0 +1,52 @@
+package org.eclipse.papyrus.sysml.diagram.parametric.provider;
+
+import org.eclipse.gmf.runtime.emf.type.core.AbstractElementTypeEnumerator;
+import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
+
+public class ElementTypes extends AbstractElementTypeEnumerator {
+
+ /** ********************************************************* */
+ /** SysML Parametric Diagram specific elements **************** */
+ /** ********************************************************* */
+
+ /** SysML Parametric Diagram :: Diagram */
+ public static final String DIAGRAM_ID = "Parametric"; //$NON-NLS-1$
+
+
+
+
+ /** ********************************************************* */
+ /** SysML Parametric Diagram - CompositeDiagram related elements */
+ /** ********************************************************* */
+
+ /** CompositeDiagram :: CONSTRAINT */
+ public static final IHintedType CONSTRAINT = (IHintedType)getElementType("org.eclipse.papyrus.uml.diagram.composite.Constraint_2114"); //$NON-NLS-1$
+
+ public static final String CONSTRAINT_LABEL_NAME_HINT = "5197"; //$NON-NLS-1$
+
+ public static final String CONSTRAINT_LABEL_SPECIFICATION_HINT = "6039"; //$NON-NLS-1$
+
+ /** CompositeDiagram :: COMMENT_CN */
+ public static final IHintedType COMMENT_CN = (IHintedType)getElementType("org.eclipse.papyrus.uml.diagram.composite.Comment_3097"); //$NON-NLS-1$
+
+ public static final String COMMENT_CN_LABEL_BODY_HINT = "5150"; //$NON-NLS-1$
+
+ /** CompositeDiagram :: COMMENT */
+ public static final IHintedType COMMENT = (IHintedType)getElementType("org.eclipse.papyrus.uml.diagram.composite.Comment_2109"); //$NON-NLS-1$
+
+ public static final String COMMENT_LABEL_BODY_HINT = "5192"; //$NON-NLS-1$
+
+ /** CompositeDiagram :: CONSTRAINT_CN */
+ public static final IHintedType CONSTRAINT_CN = (IHintedType)getElementType("org.eclipse.papyrus.uml.diagram.composite.Constraint_3120"); //$NON-NLS-1$
+
+ public static final String CONSTRAINT_CN_LABEL_NAME_HINT = "6048"; //$NON-NLS-1$
+
+ public static final String CONSTRAINT_CN_LABEL_SPECIFICATION_HINT = "6049"; //$NON-NLS-1$
+
+ /** CompositeDiagram :: COMMENT_ANNOTATED_ELEMENT */
+ public static final IHintedType COMMENT_ANNOTATED_ELEMENT = (IHintedType)getElementType("org.eclipse.papyrus.uml.diagram.composite.CommentAnnotatedElement_4002"); //$NON-NLS-1$
+
+ /** CompositeDiagram :: CONSTRAINT_CONSTRAINED_ELEMENT */
+ public static final IHintedType CONSTRAINT_CONSTRAINED_ELEMENT = (IHintedType)getElementType("org.eclipse.papyrus.uml.diagram.composite.ConstraintConstrainedElement_4003"); //$NON-NLS-1$
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/GraphicalTypeRegistry.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/GraphicalTypeRegistry.java
new file mode 100644
index 00000000000..95e3081cd89
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/GraphicalTypeRegistry.java
@@ -0,0 +1,195 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.parametric.provider;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
+import org.eclipse.papyrus.gmf.diagram.common.provider.IGraphicalTypeRegistry;
+import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes;
+import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes;
+
+/**
+ * <pre>
+ * This class provides graphical type id (used as View type) for
+ * domain element according to their actual or expected graphical
+ * container type.
+ * </pre>
+ */
+public class GraphicalTypeRegistry implements IGraphicalTypeRegistry {
+
+ /** A Set containing all known node graphical types */
+ protected Set<String> knownNodes = new HashSet<String>();
+
+ /** A Set containing all known edge graphical types */
+ protected Set<String> knownEdges = new HashSet<String>();
+
+ /** Default constructor */
+ public GraphicalTypeRegistry() {
+
+ // Fill known edges set
+ knownEdges.add(ElementTypes.COMMENT_ANNOTATED_ELEMENT.getSemanticHint());
+ knownEdges.add(ElementTypes.CONSTRAINT_CONSTRAINED_ELEMENT.getSemanticHint());
+
+ // Fill known nodes set (primary nodes)
+ knownNodes.add(UMLElementTypes.CONSTRAINT.getSemanticHint());
+ knownNodes.add(UMLElementTypes.COMMENT.getSemanticHint());
+
+ knownNodes.add(ElementTypes.CONSTRAINT.getSemanticHint());
+ knownNodes.add(ElementTypes.COMMENT_CN.getSemanticHint());
+ knownNodes.add(ElementTypes.COMMENT.getSemanticHint());
+ knownNodes.add(ElementTypes.CONSTRAINT_CN.getSemanticHint());
+
+ // Fill known nodes set (child label nodes)
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getEdgeGraphicalType(EObject domainElement) {
+
+ String graphicalType = UNDEFINED_TYPE;
+ if(domainElement == null) {
+ return UNDEFINED_TYPE;
+ }
+ return graphicalType;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getEdgeGraphicalType(IElementType elementType) {
+ if(elementType instanceof IHintedType) {
+ String semanticHint = ((IHintedType)elementType).getSemanticHint();
+ return getEdgeGraphicalType(semanticHint);
+ }
+
+ return UNDEFINED_TYPE;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getEdgeGraphicalType(String proposedType) {
+ if(isKnownEdgeType(proposedType)) {
+ return proposedType;
+ }
+
+ return UNDEFINED_TYPE;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getNodeGraphicalType(EObject domainElement, String containerType) {
+
+ String graphicalType = UNDEFINED_TYPE;
+ if((containerType == null) || (domainElement == null)) {
+ return UNDEFINED_TYPE;
+ }
+
+ if(domainElement instanceof org.eclipse.uml2.uml.Constraint) {
+ if(ElementTypes.DIAGRAM_ID.equals(containerType)) { // Constraint TopNode
+ graphicalType = ElementTypes.CONSTRAINT.getSemanticHint();
+ }
+ if(SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID.equals(containerType)) {
+ graphicalType = ElementTypes.CONSTRAINT_CN.getSemanticHint();
+ }
+
+ }
+
+ if(domainElement instanceof org.eclipse.uml2.uml.Comment) {
+ if(ElementTypes.DIAGRAM_ID.equals(containerType)) { // Comment TopNode
+ graphicalType = ElementTypes.COMMENT.getSemanticHint();
+ }
+ if(SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID.equals(containerType)) {
+ graphicalType = ElementTypes.COMMENT_CN.getSemanticHint();
+ }
+ if(SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID.equals(containerType)) {
+ graphicalType = ElementTypes.COMMENT_CN.getSemanticHint();
+ }
+
+ }
+
+ return graphicalType;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getNodeGraphicalType(IElementType elementType, String containerType) {
+ if(elementType instanceof IHintedType) {
+ String semanticHint = ((IHintedType)elementType).getSemanticHint();
+ return getNodeGraphicalType(semanticHint, containerType);
+ }
+
+ return UNDEFINED_TYPE;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getNodeGraphicalType(String proposedType, String containerType) {
+ if((UMLElementTypes.COMMENT.getSemanticHint().equals(proposedType))) {
+
+ if(ElementTypes.DIAGRAM_ID.equals(containerType)) { // Constraint TopNode
+ return ElementTypes.COMMENT.getSemanticHint();
+ }
+
+ if(SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID.equals(containerType)) {
+ return ElementTypes.COMMENT_CN.getSemanticHint();
+ }
+
+ if(SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID.equals(containerType)) {
+ return ElementTypes.COMMENT_CN.getSemanticHint();
+ }
+
+ return UNDEFINED_TYPE;
+ }
+
+ if(UMLElementTypes.CONSTRAINT.getSemanticHint().equals(proposedType)) {
+
+ if(ElementTypes.DIAGRAM_ID.equals(containerType)) { // Constraint TopNode
+ return ElementTypes.CONSTRAINT.getSemanticHint();
+ }
+ if(SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID.equals(containerType)) {
+ return ElementTypes.CONSTRAINT_CN.getSemanticHint();
+ }
+
+ return UNDEFINED_TYPE;
+ }
+ if(isKnownNodeType(proposedType)) {
+ return proposedType;
+ }
+
+ return UNDEFINED_TYPE;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isKnownEdgeType(String type) {
+ return knownEdges.contains(type);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isKnownNodeType(String type) {
+ return knownNodes.contains(type);
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/IGraphicalTypeRegistry.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/IGraphicalTypeRegistry.java
new file mode 100644
index 00000000000..fff577cb88d
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/IGraphicalTypeRegistry.java
@@ -0,0 +1,97 @@
+package org.eclipse.papyrus.sysml.diagram.parametric.provider;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+
+/**
+ * This interface provides an API for accessing the local graphical type registry.
+ * This registry provides a graphical type for existing model elements.
+ */
+public interface IGraphicalTypeRegistry {
+
+ /** Constant for undefined graphical type */
+ public static final String UNDEFINED_TYPE = "undefined_type";
+
+ /**
+ * Get a valid edge graphical type for the domain element.
+ *
+ * @param domainElement
+ * the domain element.
+ * @return the domain element graphical type.
+ */
+ public String getEdgeGraphicalType(EObject domainElement);
+
+ /**
+ * Get a valid edge graphical type for the element type.
+ *
+ * @param elementType
+ * the element type.
+ * @param containerType
+ * the type of the graphical owner of the domain element.
+ * @return the domain element graphical type.
+ */
+ public String getEdgeGraphicalType(IElementType elementType);
+
+ /**
+ * Get a valid edge graphical type for the proposed type.
+ *
+ * @param proposedType
+ * the proposed type.
+ * @param containerType
+ * the type of the graphical owner of the domain element.
+ * @return the domain element graphical type.
+ */
+ public String getEdgeGraphicalType(String proposedType);
+
+ /**
+ * Get a valid node graphical type for the domain element.
+ *
+ * @param domainElement
+ * the domain element.
+ * @param containerType
+ * the type of the graphical owner of the domain element.
+ * @return the domain element graphical type.
+ */
+ public String getNodeGraphicalType(EObject domainElement, String containerType);
+
+ /**
+ * Get a valid node graphical type for the element type.
+ *
+ * @param elementType
+ * the element type.
+ * @param containerType
+ * the type of the graphical owner of the domain element.
+ * @return the domain element graphical type.
+ */
+ public String getNodeGraphicalType(IElementType elementType, String containerType);
+
+ /**
+ * Get a valid node graphical type for the proposed type.
+ *
+ * @param proposedType
+ * the proposed type.
+ * @param containerType
+ * the type of the graphical owner of the domain element.
+ * @return the domain element graphical type.
+ */
+ public String getNodeGraphicalType(String proposedType, String containerType);
+
+ /**
+ * Test if the type is a known edge graphical type in this diagram
+ *
+ * @param type
+ * the type to test
+ * @return true if the type is known
+ */
+ public boolean isKnownEdgeType(String type);
+
+ /**
+ * Test if the type is a known node graphical type in this diagram
+ *
+ * @param type
+ * the type to test
+ * @return true if the type is known
+ */
+ public boolean isKnownNodeType(String type);
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/InheritedCompositeDiagramEditPartProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/InheritedCompositeDiagramEditPartProvider.java
new file mode 100644
index 00000000000..6ec36d6fd70
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/InheritedCompositeDiagramEditPartProvider.java
@@ -0,0 +1,54 @@
+package org.eclipse.papyrus.sysml.diagram.parametric.provider;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.service.IOperation;
+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.sysml.diagram.parametric.provider.ElementTypes;
+import org.eclipse.papyrus.uml.diagram.composite.providers.UMLEditPartProvider;
+
+public class InheritedCompositeDiagramEditPartProvider extends UMLEditPartProvider {
+
+
+ @Override
+ public synchronized boolean provides(IOperation operation) {
+ if(operation instanceof CreateGraphicEditPartOperation) {
+ View view = ((IEditPartOperation)operation).getView();
+
+ // Ensure current diagram is a Parametric Diagram
+ if(!ElementTypes.DIAGRAM_ID.equals(view.getDiagram().getType())) {
+ return false;
+ }
+
+ // Test supported inherited types
+ EObject eobject = view.getElement();
+
+ /** Nodes (and ChildLabelNodes) *********** */
+ if(eobject instanceof org.eclipse.uml2.uml.Constraint) {
+ return true;
+ }
+ if(eobject instanceof org.eclipse.uml2.uml.Comment) {
+ return true;
+ }
+
+ // Additional test needed here to decide whether to support Feature type links.
+ // As feature type link are not related to a MetaClass from the domain model
+ // they are not already handled by previous tests.
+ // Also concerns NotationType.
+ String hint = view.getType();
+
+ /** Edges (Feature) : COMMENT_ANNOTATED_ELEMENT *********** */
+ if(ElementTypes.COMMENT_ANNOTATED_ELEMENT.getSemanticHint().equals(hint)) {
+ return true;
+ }
+ /** Edges (Feature) : CONSTRAINT_CONSTRAINED_ELEMENT *********** */
+ if(ElementTypes.CONSTRAINT_CONSTRAINED_ELEMENT.getSemanticHint().equals(hint)) {
+ return true;
+ }
+
+ }
+ return false;
+ }
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/InheritedCompositeDiagramViewProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/InheritedCompositeDiagramViewProvider.java
new file mode 100644
index 00000000000..37ef4b7f617
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/InheritedCompositeDiagramViewProvider.java
@@ -0,0 +1,218 @@
+package org.eclipse.papyrus.sysml.diagram.parametric.provider;
+
+
+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.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.core.services.view.CreateEdgeViewOperation;
+import org.eclipse.gmf.runtime.diagram.core.services.view.CreateNodeViewOperation;
+import org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewForKindOperation;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.gmf.diagram.common.provider.IGraphicalTypeRegistry;
+import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes;
+import org.eclipse.papyrus.sysml.diagram.parametric.provider.ElementTypes;
+import org.eclipse.papyrus.sysml.diagram.parametric.provider.GraphicalTypeRegistry;
+import org.eclipse.papyrus.sysml.diagram.parametric.Activator;
+import org.eclipse.papyrus.uml.diagram.common.commands.SemanticAdapter;
+import org.eclipse.papyrus.uml.diagram.composite.providers.UMLViewProvider;
+import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes;
+
+public class InheritedCompositeDiagramViewProvider extends UMLViewProvider {
+
+ /** Local graphical type registry */
+ protected IGraphicalTypeRegistry registry = new GraphicalTypeRegistry();
+
+ @Override
+ public Edge createEdge(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Edge createdEdge = null;
+
+ IElementType elementType = (IElementType)semanticAdapter.getAdapter(IElementType.class);
+ if(elementType != null) {
+ createdEdge = super.createEdge(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
+ } else {
+
+ EObject domainElement = (EObject)semanticAdapter.getAdapter(EObject.class);
+
+ String domainElementGraphicalType = semanticHint;
+ if(domainElementGraphicalType == null) {
+ domainElementGraphicalType = registry.getEdgeGraphicalType(domainElement);
+ }
+
+ if((!IGraphicalTypeRegistry.UNDEFINED_TYPE.equals(domainElementGraphicalType)) && (registry.isKnownEdgeType(domainElementGraphicalType))) {
+ // Cannot use createEdge from super class as it never take the graphical type (semanticHint) into account.
+ // createdEdge = super.createEdge(semanticAdapter, containerView, domainElementGraphicalType, index, persisted, preferencesHint);
+
+ if(ElementTypes.COMMENT_ANNOTATED_ELEMENT.getSemanticHint().equals(domainElementGraphicalType)) {
+ createdEdge = createCommentAnnotatedElement_4002(containerView, index, persisted, preferencesHint);
+ }
+ if(ElementTypes.CONSTRAINT_CONSTRAINED_ELEMENT.getSemanticHint().equals(domainElementGraphicalType)) {
+ createdEdge = createConstraintConstrainedElement_4003(containerView, index, persisted, preferencesHint);
+ }
+ }
+ }
+
+ if(createdEdge == null) {
+ Activator.log.error(new Exception("Could not create Edge."));
+ }
+
+ return createdEdge;
+ }
+
+ @Override
+ protected boolean provides(CreateViewForKindOperation op) {
+ // Never use this method (often incorrectly implemented due to GMF Tooling choices).
+ String diagramType = op.getContainerView().getDiagram().getType();
+ if(!ElementTypes.DIAGRAM_ID.equals(diagramType)) {
+ return false;
+ }
+
+ throw new UnsupportedOperationException("Should never be called by the " + diagramType + " diagram.");
+ }
+
+ @Override
+ protected boolean provides(CreateEdgeViewOperation op) {
+
+ // Must have a container
+ if(op.getContainerView() == null) {
+ return false;
+ }
+
+ // This provider is registered for InternalBlock Diagram only
+ String diagramType = op.getContainerView().getDiagram().getType();
+ if(!ElementTypes.DIAGRAM_ID.equals(diagramType)) {
+ return false;
+ }
+
+ IElementType elementType = getSemanticElementType(op.getSemanticAdapter());
+ if(elementType == ElementTypes.COMMENT_ANNOTATED_ELEMENT) {
+ return true;
+ }
+ if(elementType == ElementTypes.CONSTRAINT_CONSTRAINED_ELEMENT) {
+ return true;
+ }
+
+ // /////////////////////////////////////////////////////////////////////
+ // Test possibility to provide a view based on the semantic nature and its expected container.
+ // /////////////////////////////////////////////////////////////////////
+
+ // IElementType may be null (especially when drop from ModelExplorer).
+ // In such a case, test the semantic EObject instead.
+ if(elementType == null) {
+ EObject domainElement = (EObject)op.getSemanticAdapter().getAdapter(EObject.class);
+ String domainElementGraphicalType = op.getSemanticHint();
+ if(domainElementGraphicalType == null) {
+ domainElementGraphicalType = registry.getEdgeGraphicalType(domainElement);
+ }
+
+ if((!IGraphicalTypeRegistry.UNDEFINED_TYPE.equals(domainElementGraphicalType)) && (registry.isKnownEdgeType(domainElementGraphicalType))) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ protected boolean provides(CreateNodeViewOperation op) {
+ // Must have a container
+ if(op.getContainerView() == null) {
+ return false;
+ }
+ // Get the type of the container
+ String containerGraphicalType = op.getContainerView().getType();
+
+ // This provider is registered for InternalBlock Diagram only
+ String diagramType = op.getContainerView().getDiagram().getType();
+ if(!ElementTypes.DIAGRAM_ID.equals(diagramType)) {
+ return false;
+ }
+
+ // /////////////////////////////////////////////////////////////////////
+ // Test possibility to provide a view based on the ElementType and its expected container.
+ // /////////////////////////////////////////////////////////////////////
+
+ IElementType elementType = (IElementType)op.getSemanticAdapter().getAdapter(IElementType.class);
+ if(elementType == UMLElementTypes.CONSTRAINT) {
+ if(ElementTypes.DIAGRAM_ID.equals(containerGraphicalType)) {
+ return true;
+ }
+ if(SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID.equals(containerGraphicalType)) {
+ return true;
+ }
+ }
+ if(elementType == UMLElementTypes.COMMENT) {
+ if(ElementTypes.DIAGRAM_ID.equals(containerGraphicalType)) {
+ return true;
+ }
+ if(SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID.equals(containerGraphicalType)) {
+ return true;
+ }
+ if(SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID.equals(containerGraphicalType)) {
+ return true;
+ }
+ }
+
+ // /////////////////////////////////////////////////////////////////////
+ // Test possibility to provide a view based on the semantic nature and its expected container.
+ // /////////////////////////////////////////////////////////////////////
+
+ // IElementType may be null (especially when drop from ModelExplorer).
+ // In such a case, test the semantic EObject instead.
+ if(elementType == null) {
+ EObject domainElement = (EObject)op.getSemanticAdapter().getAdapter(EObject.class);
+ String domainElementGraphicalType = op.getSemanticHint();
+ if(domainElementGraphicalType == null) {
+ domainElementGraphicalType = registry.getNodeGraphicalType(domainElement, containerGraphicalType);
+ } else {
+ domainElementGraphicalType = registry.getNodeGraphicalType(domainElementGraphicalType, containerGraphicalType);
+ }
+
+ if((!IGraphicalTypeRegistry.UNDEFINED_TYPE.equals(domainElementGraphicalType)) && (registry.isKnownNodeType(domainElementGraphicalType))) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public Node createNode(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
+
+ // Use the GraphicalTypeRegistry to find the expected type for a domain element
+ // Get the type of the container
+ String containerGraphicalType = containerView.getType();
+
+ // Get the type of the domain element
+ EObject domainElement = (EObject)semanticAdapter.getAdapter(EObject.class);
+
+ if(semanticHint != null) {
+ // Look for a possible graphicalType replacement
+ String graphicalType = registry.getNodeGraphicalType(semanticHint, containerGraphicalType);
+ return super.createNode(new SemanticAdapter(domainElement, null), containerView, graphicalType, index, persisted, preferencesHint);
+ }
+
+ String domainElementGraphicalType = registry.getNodeGraphicalType(domainElement, containerGraphicalType);
+
+ // Create the expected node
+ if(!IGraphicalTypeRegistry.UNDEFINED_TYPE.equals(domainElementGraphicalType)) {
+ return super.createNode(semanticAdapter, containerView, domainElementGraphicalType, index, persisted, preferencesHint);
+ }
+
+ Activator.log.error(new Exception("Could not create Node."));
+ return null;
+ }
+
+ @Override
+ protected void stampShortcut(View containerView, Node target) {
+ if(!ElementTypes.DIAGRAM_ID.equals(containerView.getDiagram().getType())) {
+ EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
+ shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
+ shortcutAnnotation.getDetails().put("modelID", ElementTypes.DIAGRAM_ID); //$NON-NLS-1$
+ target.getEAnnotations().add(shortcutAnnotation);
+ }
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/ParametricDiagramEditPartProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/ParametricDiagramEditPartProvider.java
new file mode 100644
index 00000000000..4e53242ab38
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/ParametricDiagramEditPartProvider.java
@@ -0,0 +1,37 @@
+package org.eclipse.papyrus.sysml.diagram.parametric.provider;
+
+import org.eclipse.gmf.runtime.common.core.service.IOperation;
+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.sysml.diagram.parametric.Activator;
+import org.eclipse.papyrus.sysml.diagram.parametric.edit.part.ParametricDiagramEditPart;
+
+public class ParametricDiagramEditPartProvider extends AbstractEditPartProvider {
+
+ @Override
+ public boolean provides(IOperation operation) {
+ if(operation instanceof CreateGraphicEditPartOperation) {
+ View view = ((IEditPartOperation)operation).getView();
+
+ // Ensure current diagram is Parametric Diagram
+ if(ElementTypes.DIAGRAM_ID.equals(view.getType())) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ protected Class<?> getDiagramEditPartClass(View view) {
+ if(ElementTypes.DIAGRAM_ID.equals(view.getType())) {
+ return ParametricDiagramEditPart.class;
+ }
+
+ Activator.log.error(new Exception("Could not create EditPart."));
+ return null;
+ }
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/ParametricDiagramEditPolicyProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/ParametricDiagramEditPolicyProvider.java
new file mode 100644
index 00000000000..de9fd4010b9
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/ParametricDiagramEditPolicyProvider.java
@@ -0,0 +1,50 @@
+package org.eclipse.papyrus.sysml.diagram.parametric.provider;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.common.core.service.AbstractProvider;
+import org.eclipse.gmf.runtime.common.core.service.IOperation;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.CreateEditPoliciesOperation;
+import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.IEditPolicyProvider;
+import org.eclipse.papyrus.sysml.diagram.internalblock.edit.policy.CustomDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.edit.part.PortAffixedNodeEditPart;
+
+public class ParametricDiagramEditPolicyProvider extends AbstractProvider implements IEditPolicyProvider {
+
+ public boolean provides(IOperation operation) {
+
+ CreateEditPoliciesOperation epOperation = (CreateEditPoliciesOperation)operation;
+ if(!(epOperation.getEditPart() instanceof GraphicalEditPart)) {
+ return false;
+ }
+ GraphicalEditPart gep = (GraphicalEditPart)epOperation.getEditPart();
+ String diagramType = gep.getNotationView().getDiagram().getType();
+ if(!ElementTypes.DIAGRAM_ID.equals(diagramType)) {
+ return false;
+ }
+
+ if(gep instanceof org.eclipse.papyrus.uml.diagram.composite.edit.parts.ConstraintEditPart) {
+ return true;
+ }
+ if(gep instanceof PortAffixedNodeEditPart) {
+ return true;
+ }
+ if(gep instanceof org.eclipse.papyrus.uml.diagram.composite.edit.parts.UseCaseEditPartCN) {
+ return true;
+ }
+ if(gep instanceof org.eclipse.papyrus.uml.diagram.composite.edit.parts.CommentEditPart) {
+ return true;
+ }
+ if(gep instanceof org.eclipse.papyrus.uml.diagram.composite.edit.parts.InteractionConstraintEditPartCN) {
+ return true;
+ }
+
+ return false;
+ }
+
+ public void createEditPolicies(EditPart editPart) {
+ editPart.installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDragDropEditPolicy());
+ }
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/ParametricDiagramViewProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/ParametricDiagramViewProvider.java
new file mode 100644
index 00000000000..44dc9c87ee9
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/provider/ParametricDiagramViewProvider.java
@@ -0,0 +1,31 @@
+package org.eclipse.papyrus.sysml.diagram.parametric.provider;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.core.providers.AbstractViewProvider;
+import org.eclipse.gmf.runtime.diagram.core.services.view.CreateDiagramViewOperation;
+import org.eclipse.papyrus.sysml.diagram.parametric.Activator;
+import org.eclipse.papyrus.sysml.diagram.parametric.factory.ParametricDiagramViewFactory;
+
+public class ParametricDiagramViewProvider extends AbstractViewProvider {
+
+ @Override
+ protected boolean provides(CreateDiagramViewOperation operation) {
+
+ if(ElementTypes.DIAGRAM_ID.equals(operation.getSemanticHint())) {
+ return true;
+ }
+
+ return false;
+ }
+
+ @Override
+ protected Class<?> getDiagramViewClass(IAdaptable semanticAdapter, String diagramKind) {
+ if(ElementTypes.DIAGRAM_ID.equals(diagramKind)) {
+ return ParametricDiagramViewFactory.class;
+ }
+
+ Activator.log.error(new Exception("Could not create View."));
+ return null;
+ }
+}
+
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/utils/ParametricDiagramGraphicalTypes.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/utils/ParametricDiagramGraphicalTypes.java
new file mode 100644
index 00000000000..05a8de05c4e
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src-gen/org/eclipse/papyrus/sysml/diagram/parametric/utils/ParametricDiagramGraphicalTypes.java
@@ -0,0 +1,15 @@
+package org.eclipse.papyrus.sysml.diagram.parametric.utils;
+
+public class ParametricDiagramGraphicalTypes {
+
+ /** ********************************************************* */
+ /** Diagram custom graphical types id *********************** */
+ /** ********************************************************* */
+
+
+
+
+
+
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/Activator.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/Activator.java
new file mode 100644
index 00000000000..df6e7ce7ccb
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/Activator.java
@@ -0,0 +1,105 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.parametric;
+
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.papyrus.infra.core.log.LogHelper;
+import org.eclipse.papyrus.sysml.diagram.parametric.preferences.CustomPreferenceInitializer;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/** The activator class controls the plug-in life cycle */
+public class Activator extends AbstractUIPlugin {
+
+ /** The plug-in ID */
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.sysml.diagram.parametric";
+
+ /** The plug-in shared instance */
+ private static Activator plugin;
+
+ /** The logging helper */
+ public static LogHelper log;
+
+ /** The plug-in Preference store */
+ public static final PreferencesHint DIAGRAM_PREFERENCES_HINT = new PreferencesHint(PLUGIN_ID);
+
+ /** Default constructor */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+
+ // register the login helper
+ log = new LogHelper(plugin);
+
+ // register the preference store
+ PreferencesHint.registerPreferenceStore(DIAGRAM_PREFERENCES_HINT, getPreferenceStore());
+
+ // Preferences initialization
+ CustomPreferenceInitializer diagramPreferenceInitializer = new CustomPreferenceInitializer();
+ diagramPreferenceInitializer.initializeDefaultPreferences();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getInstance() {
+ return plugin;
+ }
+
+ /**
+ * 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(PLUGIN_ID, path);
+ }
+
+ /**
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#getPreferenceStore()
+ *
+ * @return Shared Preference Store.
+ */
+ @Override
+ public IPreferenceStore getPreferenceStore() {
+ IPreferenceStore store = org.eclipse.papyrus.infra.gmfdiag.preferences.Activator.getDefault().getPreferenceStore();
+ return store;
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/CreateParametricDiagramWithNavigationHandler.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/CreateParametricDiagramWithNavigationHandler.java
index d316e42d529..23be1b6512c 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/CreateParametricDiagramWithNavigationHandler.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/CreateParametricDiagramWithNavigationHandler.java
@@ -1,25 +1,25 @@
-/*****************************************************************************
- * Copyright (c) 2011 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric;
-
-import org.eclipse.papyrus.infra.gmfdiag.navigation.CreateDiagramWithNavigationHandler;
-
-
-public class CreateParametricDiagramWithNavigationHandler extends CreateDiagramWithNavigationHandler {
-
- public CreateParametricDiagramWithNavigationHandler() {
- super(new CreateParametricDiagramCommand(), new ParametricDiagramCondition());
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.parametric;
+
+import org.eclipse.papyrus.infra.gmfdiag.navigation.CreateDiagramWithNavigationHandler;
+
+
+public class CreateParametricDiagramWithNavigationHandler extends CreateDiagramWithNavigationHandler {
+
+ public CreateParametricDiagramWithNavigationHandler() {
+ super(new ParametricDiagramCreateCommand(), new ParametricDiagramCondition());
+ }
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/ParametricDiagramCondition.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/ParametricDiagramCondition.java
index 355e25ef85f..edf0b0a3123 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/custom-src/org/eclipse/papyrus/sysml/diagram/parametric/ParametricDiagramCondition.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/ParametricDiagramCondition.java
@@ -1,40 +1,44 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.papyrus.infra.core.extension.commands.PerspectiveContextDependence;
-import org.eclipse.papyrus.sysml.util.SysmlResource;
-import org.eclipse.uml2.uml.Class;
-
-/**
- * ParametricDiagramCondition to set conditions for the diagram creation
- */
-public class ParametricDiagramCondition extends PerspectiveContextDependence {
-
- /**
- * {@inheritDoc}
- */
- public boolean create(EObject selectedElement) {
- if(super.create(selectedElement)) {
- if(selectedElement instanceof org.eclipse.uml2.uml.Class) {
- Class clazz = (org.eclipse.uml2.uml.Class)selectedElement;
- if(clazz.getAppliedStereotype(SysmlResource.BLOCK_ID) != null || clazz.getAppliedStereotype(SysmlResource.CONSTRAINT_BLOCK_ID) != null) {
- return true;
- }
- }
- }
- return false;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.parametric;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.infra.core.extension.commands.PerspectiveContextDependence;
+import org.eclipse.papyrus.sysml.blocks.Block;
+import org.eclipse.uml2.uml.util.UMLUtil;
+
+/**
+ * ParametricDiagramCondition to set conditions for the diagram creation
+ */
+public class ParametricDiagramCondition extends PerspectiveContextDependence {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean create(EObject selectedElement) {
+ if(super.create(selectedElement)) {
+ if(selectedElement instanceof org.eclipse.uml2.uml.Class) {
+ org.eclipse.uml2.uml.Class clazz = (org.eclipse.uml2.uml.Class)selectedElement;
+ if(UMLUtil.getStereotypeApplication(clazz, Block.class) != null) {
+ return true;
+ }
+ }
+ else if(selectedElement instanceof org.eclipse.uml2.uml.Package) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/CustomBindingConnectorCreateCommand.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/CustomBindingConnectorCreateCommand.java
new file mode 100644
index 00000000000..e2656ec954c
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/CustomBindingConnectorCreateCommand.java
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.parametric.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.sysml.blocks.BlocksPackage;
+import org.eclipse.papyrus.sysml.constraints.ConstraintBlock;
+import org.eclipse.papyrus.sysml.constraints.ConstraintProperty;
+import org.eclipse.papyrus.uml.service.types.utils.ConnectorUtils;
+import org.eclipse.papyrus.uml.service.types.utils.RequestParameterUtils;
+import org.eclipse.uml2.uml.Connector;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.StructuredClassifier;
+import org.eclipse.uml2.uml.util.UMLUtil;
+import org.eclipse.uml2.uml.util.UMLUtil.StereotypeApplicationHelper;
+
+/**
+ * Creates a Message between MessageOccurrenceSpecifications. Converts OccurrenceSpecifications to
+ * MessageOccurrenceSpecifications if needed
+ */
+public class CustomBindingConnectorCreateCommand extends EditElementCommand {
+
+ private final EObject source;
+ private final EObject target;
+
+ public CustomBindingConnectorCreateCommand(final CreateRelationshipRequest request) {
+ super(request.getLabel(), null, request);
+ this.source = request.getSource();
+ this.target = request.getTarget();
+
+ }
+
+ @Override
+ public boolean canExecute() {
+ if(this.source == null) {
+ return false;
+ }
+ if(this.target == null) {
+ return true;
+ }
+ if(this.source == this.target) {
+ return false;
+ }
+ if (this.source != null && this.target != null) {
+ return isConstraintParameter((Element)source, RequestParameterUtils.getSourceView(getRequest()))
+ || isConstraintParameter((Element)target, RequestParameterUtils.getTargetView(getRequest()));
+ }
+ return false;
+ }
+
+ private boolean isConstraintParameter(Element element, View view) {
+ if (element instanceof Property) {
+ Property property = (Property) element;
+ Element ownerConstraintBlock = property.getOwner();
+ if (ownerConstraintBlock instanceof org.eclipse.uml2.uml.Class && UMLUtil.getStereotypeApplication(ownerConstraintBlock, ConstraintBlock.class) != null) {
+ // check for graphics : owned by a constraintProperty
+ View containerView = ViewUtil.getContainerView(view);
+ Element containerElement = (Element)containerView.getElement();
+ return containerElement instanceof Property
+ && UMLUtil.getStereotypeApplication(containerElement, ConstraintProperty.class) != null
+ && ((Property)containerElement).getType() == ownerConstraintBlock;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+
+ if(!canExecute()) {
+ throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
+ }
+
+ // Create the Connector and its ConnectorEnd. Correct container are set and paths are set in case of <<NestedConnectorEnd>>.
+ StructuredClassifier deducedContainer = new ConnectorUtils().deduceContainer(RequestParameterUtils.getSourceView(getRequest()), RequestParameterUtils.getTargetView(getRequest()));
+ ((CreateRelationshipRequest)getRequest()).setContainer(deducedContainer);
+ IElementEditService commandProvider = ElementEditServiceUtils.getCommandProvider(deducedContainer);
+ ICommand editCommand = commandProvider.getEditCommand(getRequest());
+
+ if (editCommand.canExecute()) {
+ editCommand.execute(monitor, info);
+ Object newObject = editCommand.getCommandResult().getReturnValue();
+
+ if (newObject instanceof Connector) {
+ Connector connector = (Connector)newObject;
+ // Apply the <<BindingConnector>> stereotype
+ StereotypeApplicationHelper.INSTANCE.applyStereotype(connector, BlocksPackage.eINSTANCE.getBindingConnector());
+ }
+
+ return CommandResult.newOKCommandResult(newObject);
+ }
+ return CommandResult.newErrorCommandResult("Invalid arguments in create link command");
+ }
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/commands/ConnectorCreateCommand.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/commands/ConnectorCreateCommand.java
deleted file mode 100644
index 9bbf7728d96..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/commands/ConnectorCreateCommand.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.edit.commands;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.policies.SysmlBaseItemSemanticEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil;
-import org.eclipse.uml2.uml.ConnectableElement;
-import org.eclipse.uml2.uml.Connector;
-import org.eclipse.uml2.uml.ConnectorEnd;
-import org.eclipse.uml2.uml.StructuredClassifier;
-import org.eclipse.uml2.uml.UMLFactory;
-
-/**
- * @generated
- */
-public class ConnectorCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- protected final EObject source;
-
- /**
- * @generated
- */
- protected final EObject target;
-
- /**
- * @generated
- */
- protected StructuredClassifier container;
-
- /**
- * @generated
- */
- public ConnectorCreateCommand(CreateRelationshipRequest request, EObject source, EObject target) {
- super(request.getLabel(), null, request);
- this.source = source;
- this.target = target;
- container = deduceContainer(source, target);
- }
-
- /**
- * @generated
- */
- public boolean canExecute() {
- if(source == null && target == null) {
- return false;
- }
- if(source != null && false == source instanceof ConnectableElement) {
- return false;
- }
- if(target != null && false == target instanceof ConnectableElement) {
- 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 SysmlBaseItemSemanticEditPolicy.getLinkConstraints().canCreateConnector_4001(getContainer(), getSource(), getTarget());
- }
-
- /**
- * @generated NOT
- */
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- if(!canExecute()) {
- throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
- }
- Connector newElement = UMLFactory.eINSTANCE.createConnector();
- if(getContainer() != null) {
- getContainer().getOwnedConnectors().add(newElement);
- }
- // create the connector ends
- ConnectorEnd source = newElement.createEnd();
- ConnectorEnd target = newElement.createEnd();
- source.setRole(getSource());
- target.setRole(getTarget());
-
- doConfigure(newElement, monitor, info);
- ((CreateElementRequest)getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Connector newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- configureRequest.setParameter(CreateRelationshipRequest.SOURCE, getSource());
- configureRequest.setParameter(CreateRelationshipRequest.TARGET, getTarget());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if(configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-
- /**
- * @generated
- */
- protected void setElementToEdit(EObject element) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * @generated
- */
- protected ConnectableElement getSource() {
- return (ConnectableElement)source;
- }
-
- /**
- * @generated
- */
- protected ConnectableElement getTarget() {
- return (ConnectableElement)target;
- }
-
- /**
- * @generated
- */
- public StructuredClassifier getContainer() {
- return container;
- }
-
- /**
- * Default approach is to traverse ancestors of the source to find instance of container. Modify
- * with appropriate logic.
- *
- * @generated NOT
- */
- private static StructuredClassifier deduceContainer(EObject source, EObject target) {
- // get the structured classifier, graphical container of the
- for(Object obj : DiagramEditPartsUtil.getEObjectViews(source)) {
- if(obj instanceof Node && ((Node)obj).getDiagram() != null) {
- EObject element = ((Node)obj).getDiagram().getElement();
- if(element instanceof StructuredClassifier) {
- return (StructuredClassifier)element;
- }
- }
- }
- return null;
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/commands/ConnectorReorientCommand.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/commands/ConnectorReorientCommand.java
deleted file mode 100644
index 022b8786103..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/commands/ConnectorReorientCommand.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.edit.commands;
-
-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.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.sysml.diagram.parametric.edit.policies.SysmlBaseItemSemanticEditPolicy;
-import org.eclipse.uml2.uml.ConnectableElement;
-import org.eclipse.uml2.uml.Connector;
-import org.eclipse.uml2.uml.ConnectorEnd;
-import org.eclipse.uml2.uml.StructuredClassifier;
-
-/**
- * @generated
- */
-public class ConnectorReorientCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private final int reorientDirection;
-
- /**
- * @generated
- */
- private final EObject oldEnd;
-
- /**
- * @generated
- */
- private final EObject newEnd;
-
- /**
- * @generated
- */
- public ConnectorReorientCommand(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 Connector) {
- return false;
- }
- if(reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
- return canReorientSource();
- }
- if(reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
- return canReorientTarget();
- }
- return false;
- }
-
- /**
- * @generated NOT
- */
- protected boolean canReorientSource() {
- if(!(oldEnd instanceof ConnectableElement && newEnd instanceof ConnectableElement)) {
- return false;
- }
- ConnectableElement target = null;
- EList<ConnectorEnd> ends = getLink().getEnds();
- if(ends != null && !ends.isEmpty()) {
- target = ends.get(1).getRole();
- }
- if(!(getLink().eContainer() instanceof StructuredClassifier)) {
- return false;
- }
- StructuredClassifier container = (StructuredClassifier)getLink().eContainer();
- return SysmlBaseItemSemanticEditPolicy.LinkConstraints.canExistConnector_4001(container, getNewSource(), target);
- }
-
- /**
- * @generated NOT
- */
- protected boolean canReorientTarget() {
- if(!(oldEnd instanceof ConnectableElement && newEnd instanceof ConnectableElement)) {
- return false;
- }
- ConnectableElement source = null;
- EList<ConnectorEnd> ends = getLink().getEnds();
- if(ends != null && !ends.isEmpty()) {
- source = ends.get(0).getRole();
- }
- if(!(getLink().eContainer() instanceof StructuredClassifier)) {
- return false;
- }
- StructuredClassifier container = (StructuredClassifier)getLink().eContainer();
- return SysmlBaseItemSemanticEditPolicy.LinkConstraints.canExistConnector_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 NOT
- */
- protected CommandResult reorientSource() throws ExecutionException {
- EList<ConnectorEnd> ends = getLink().getEnds();
- if(ends != null && !ends.isEmpty()) {
- ends.get(0).setRole(getNewSource());
- return CommandResult.newOKCommandResult(getLink());
- } else {
- return CommandResult.newCancelledCommandResult();
- }
- }
-
- /**
- * @generated NOT
- */
- protected CommandResult reorientTarget() throws ExecutionException {
- EList<ConnectorEnd> ends = getLink().getEnds();
- if(ends != null && !ends.isEmpty()) {
- ends.get(1).setRole(getNewTarget());
- return CommandResult.newOKCommandResult(getLink());
- } else {
- return CommandResult.newCancelledCommandResult();
- }
- }
-
- /**
- * @generated
- */
- protected Connector getLink() {
- return (Connector)getElementToEdit();
- }
-
- /**
- * @generated
- */
- protected ConnectableElement getOldSource() {
- return (ConnectableElement)oldEnd;
- }
-
- /**
- * @generated
- */
- protected ConnectableElement getNewSource() {
- return (ConnectableElement)newEnd;
- }
-
- /**
- * @generated
- */
- protected ConnectableElement getOldTarget() {
- return (ConnectableElement)oldEnd;
- }
-
- /**
- * @generated
- */
- protected ConnectableElement getNewTarget() {
- return (ConnectableElement)newEnd;
- }
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/commands/ConstraintPropertyCreateCommand.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/commands/ConstraintPropertyCreateCommand.java
deleted file mode 100644
index 46dfcfd145f..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/commands/ConstraintPropertyCreateCommand.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.edit.commands;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.resource.Resource;
-import org.eclipse.papyrus.resource.util.ResourceUtil;
-import org.eclipse.papyrus.sysml.constraints.ConstraintProperty;
-import org.eclipse.papyrus.sysml.constraints.ConstraintsFactory;
-import org.eclipse.uml2.uml.Class;
-import org.eclipse.uml2.uml.Property;
-import org.eclipse.uml2.uml.UMLFactory;
-
-/**
- * @generated
- */
-public class ConstraintPropertyCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private EClass eClass = null;
-
- /**
- * @generated
- */
- private EObject eObject = null;
-
- /**
- * @generated
- */
- public ConstraintPropertyCreateCommand(CreateElementRequest req, EObject eObject) {
- super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
- }
-
- /**
- * @generated
- */
- public static ConstraintPropertyCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ConstraintPropertyCreateCommand(req, eObject);
- }
-
- /**
- * @generated
- */
- public ConstraintPropertyCreateCommand(CreateElementRequest req) {
- super(req.getLabel(), null, req);
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- protected EObject getElementToEdit() {
-
- EObject container = ((CreateElementRequest)getRequest()).getContainer();
- if(container instanceof View) {
- container = ((View)container).getElement();
- }
- if(container != null) {
- return container;
- }
- return eObject;
- }
-
- /**
- * @generated
- */
- public boolean canExecute() {
-
- return true;
-
- }
-
- /**
- * @generated NOT
- */
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- ConstraintProperty newElement = ConstraintsFactory.eINSTANCE.createConstraintProperty();
-
- EObject elementToEdit = getElementToEdit();
-
- if(elementToEdit instanceof Class) {
- Class aClass = (Class)elementToEdit;
- Property property = UMLFactory.eINSTANCE.createProperty();
- aClass.getOwnedAttributes().add(property);
- newElement.setBase_Property(property);
- }
-
- Resource owner = ResourceUtil.getResource(elementToEdit);
- owner.getEobjects().add(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest)getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(ConstraintProperty newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if(configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/commands/Property2CreateCommand.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/commands/Property2CreateCommand.java
deleted file mode 100644
index 1bf23c7f9e6..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/commands/Property2CreateCommand.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.edit.commands;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.sysml.constraints.ConstraintProperty;
-import org.eclipse.uml2.uml.Property;
-import org.eclipse.uml2.uml.StructuredClassifier;
-import org.eclipse.uml2.uml.Type;
-import org.eclipse.uml2.uml.UMLFactory;
-
-/**
- * @generated
- */
-public class Property2CreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private EClass eClass = null;
-
- /**
- * @generated
- */
- private EObject eObject = null;
-
- /**
- * @generated
- */
- public Property2CreateCommand(CreateElementRequest req, EObject eObject) {
- super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
- }
-
- /**
- * @generated
- */
- public static Property2CreateCommand create(CreateElementRequest req, EObject eObject) {
- return new Property2CreateCommand(req, eObject);
- }
-
- /**
- * @generated
- */
- public Property2CreateCommand(CreateElementRequest req) {
- super(req.getLabel(), null, req);
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- protected EObject getElementToEdit() {
-
- EObject container = ((CreateElementRequest)getRequest()).getContainer();
- if(container instanceof View) {
- container = ((View)container).getElement();
- }
- if(container != null) {
- return container;
- }
- return eObject;
- }
-
- /**
- * @generated NOT
- */
- public boolean canExecute() {
- ConstraintProperty container = (ConstraintProperty)getElementToEdit();
- Property baseProperty = container.getBase_Property();
- if(baseProperty != null && baseProperty.getType() != null) {
- // TODO constraint is too restrictive
- // && StereotypeUtils.isStereotypeApplied("SysML::Constraints::ConstraintBlock",
- // baseProperty.getType())) {
- return true;
- }
- return false;
-
- }
-
- /**
- * @generated NOT
- */
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Property newElement = UMLFactory.eINSTANCE.createProperty();
- ConstraintProperty owner = (ConstraintProperty)getElementToEdit();
- Type type = owner.getBase_Property().getType();
-
- if(type != null && type instanceof StructuredClassifier) {
- StructuredClassifier classifier = (StructuredClassifier)type;
- classifier.getOwnedAttributes().add(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest)getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- } else {
- return CommandResult.newCancelledCommandResult();
- }
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Property newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if(configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/commands/PropertyCreateCommand.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/commands/PropertyCreateCommand.java
deleted file mode 100644
index f3ab3a73680..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/commands/PropertyCreateCommand.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.edit.commands;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.uml2.uml.Property;
-import org.eclipse.uml2.uml.StructuredClassifier;
-import org.eclipse.uml2.uml.UMLFactory;
-
-/**
- * @generated
- */
-public class PropertyCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private EClass eClass = null;
-
- /**
- * @generated
- */
- private EObject eObject = null;
-
- /**
- * @generated
- */
- public PropertyCreateCommand(CreateElementRequest req, EObject eObject) {
- super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
- }
-
- /**
- * @generated
- */
- public static PropertyCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new PropertyCreateCommand(req, eObject);
- }
-
- /**
- * @generated
- */
- public PropertyCreateCommand(CreateElementRequest req) {
- super(req.getLabel(), null, req);
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- protected EObject getElementToEdit() {
-
- EObject container = ((CreateElementRequest)getRequest()).getContainer();
- if(container instanceof View) {
- container = ((View)container).getElement();
- }
- if(container != null) {
- return container;
- }
- return eObject;
- }
-
- /**
- * @generated
- */
- public boolean canExecute() {
-
- return true;
-
- }
-
- /**
- * @generated
- */
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Property newElement = UMLFactory.eINSTANCE.createProperty();
-
- StructuredClassifier owner = (StructuredClassifier)getElementToEdit();
- owner.getOwnedAttributes().add(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest)getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Property newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if(configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/commands/SysmlReorientConnectionViewCommand.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/commands/SysmlReorientConnectionViewCommand.java
deleted file mode 100644
index d6e9b75d520..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/commands/SysmlReorientConnectionViewCommand.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.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 SysmlReorientConnectionViewCommand extends AbstractTransactionalCommand {
-
- /**
- * @generated
- */
- private IAdaptable edgeAdaptor;
-
- /**
- * @generated
- */
- public SysmlReorientConnectionViewCommand(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 SysmlReorientConnectionViewCommand"; //$NON-NLS-1$
- Edge edge = (Edge)getEdgeAdaptor().getAdapter(Edge.class);
- assert null != edge : "Null edge in SysmlReorientConnectionViewCommand"; //$NON-NLS-1$
- View tempView = edge.getSource();
- edge.setSource(edge.getTarget());
- edge.setTarget(tempView);
- return CommandResult.newOKCommandResult();
- }
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/helpers/ConnectorEditHelper.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/helpers/ConnectorEditHelper.java
deleted file mode 100644
index e55d99d4b4a..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/helpers/ConnectorEditHelper.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.edit.helpers;
-
-/**
- * @generated
- */
-public class ConnectorEditHelper extends SysmlBaseEditHelper {
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/helpers/ConstraintPropertyEditHelper.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/helpers/ConstraintPropertyEditHelper.java
deleted file mode 100644
index cb092f6ea84..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/helpers/ConstraintPropertyEditHelper.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.edit.helpers;
-
-/**
- * @generated
- */
-public class ConstraintPropertyEditHelper extends SysmlBaseEditHelper {
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/helpers/ResourceEditHelper.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/helpers/ResourceEditHelper.java
deleted file mode 100644
index b2491486a80..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/helpers/ResourceEditHelper.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.edit.helpers;
-
-/**
- * @generated
- */
-public class ResourceEditHelper extends SysmlBaseEditHelper {
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/helpers/SysmlBaseEditHelper.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/helpers/SysmlBaseEditHelper.java
deleted file mode 100644
index 5f679efcf9f..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/helpers/SysmlBaseEditHelper.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.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.ElementTypeRegistry;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelper;
-import org.eclipse.gmf.runtime.emf.type.core.edithelper.IEditHelperAdvice;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
-
-/**
- * @generated
- */
-public class SysmlBaseEditHelper extends AbstractEditHelper {
-
- /**
- * @generated
- */
- public static final String EDIT_POLICY_COMMAND = "edit policy command"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final String CONTEXT_ELEMENT_TYPE = "context element type"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- protected IEditHelperAdvice[] getEditHelperAdvice(IEditCommandRequest req) {
- if(req.getParameter(CONTEXT_ELEMENT_TYPE) instanceof IElementType) {
- return ElementTypeRegistry.getInstance().getEditHelperAdvice((IElementType)req.getParameter(CONTEXT_ELEMENT_TYPE));
- }
- return super.getEditHelperAdvice(req);
- }
-
- /**
- * @generated
- */
- protected ICommand getInsteadCommand(IEditCommandRequest req) {
- ICommand epCommand = (ICommand)req.getParameter(EDIT_POLICY_COMMAND);
- req.setParameter(EDIT_POLICY_COMMAND, null);
- ICommand ehCommand = super.getInsteadCommand(req);
- if(epCommand == null) {
- return ehCommand;
- }
- if(ehCommand == null) {
- return epCommand;
- }
- CompositeCommand command = new CompositeCommand(null);
- command.add(epCommand);
- command.add(ehCommand);
- return command;
- }
-
- /**
- * @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/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomBlockCompositeEditPartTN.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomBlockCompositeEditPartTN.java
new file mode 100644
index 00000000000..45d0799010d
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomBlockCompositeEditPartTN.java
@@ -0,0 +1,69 @@
+package org.eclipse.papyrus.sysml.diagram.parametric.edit.part;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.sysml.diagram.common.edit.part.BlockLabelNameEditPart;
+import org.eclipse.papyrus.sysml.diagram.common.edit.part.StructureCompartmentEditPart;
+import org.eclipse.papyrus.sysml.diagram.common.figure.SysMLDiagramFrameFigure;
+import org.eclipse.papyrus.sysml.diagram.parametric.figures.ParametricDiagramFrameFigure;
+import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementEditPart;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.NodeNamedElementFigure;
+
+
+public class CustomBlockCompositeEditPartTN extends AbstractElementEditPart {
+
+ public CustomBlockCompositeEditPartTN(View view) {
+ super(view);
+ }
+
+ @Override
+ protected IFigure createNodeShape() {
+ return this.primaryShape = new ParametricDiagramFrameFigure();
+ }
+
+ @Override
+ public NodeNamedElementFigure getPrimaryShape() {
+ return (NodeNamedElementFigure)primaryShape;
+ }
+
+ @Override
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if(childEditPart instanceof BlockLabelNameEditPart) {
+ ((BlockLabelNameEditPart)childEditPart).setLabel(getPrimaryShape().getNameLabel());
+ return true;
+ }
+ if(childEditPart instanceof StructureCompartmentEditPart) {
+ IFigure pane = ((SysMLDiagramFrameFigure)getPrimaryShape()).getStructureCompartmentFigure();
+ setupContentPane(pane);
+ pane.add(((StructureCompartmentEditPart)childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ protected boolean removeFixedChild(EditPart childEditPart) {
+ return false;
+ }
+
+ @Override
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+ if(editPart instanceof StructureCompartmentEditPart) {
+ return ((SysMLDiagramFrameFigure)getPrimaryShape()).getStructureCompartmentFigure();
+ }
+ return getContentPane();
+ }
+
+ @Override
+ public EditPart getPrimaryChildEditPart() {
+ return null;
+ }
+
+ @Override
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+ return null;
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomBlockLabelNameEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomBlockLabelNameEditPart.java
new file mode 100644
index 00000000000..fa63868d0ff
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomBlockLabelNameEditPart.java
@@ -0,0 +1,17 @@
+package org.eclipse.papyrus.sysml.diagram.parametric.edit.part;
+
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.sysml.diagram.common.edit.part.BlockLabelNameEditPart;
+
+public class CustomBlockLabelNameEditPart extends BlockLabelNameEditPart {
+
+ public CustomBlockLabelNameEditPart(View view) {
+ super(view);
+ }
+
+ @Override
+ protected String getLabelText() {
+ String diagramName = getDiagramView().getName();
+ return super.getLabelText() + " [" + diagramName + "]";
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomBlockPropertyCompositeEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomBlockPropertyCompositeEditPart.java
new file mode 100644
index 00000000000..10f16e46603
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomBlockPropertyCompositeEditPart.java
@@ -0,0 +1,20 @@
+package org.eclipse.papyrus.sysml.diagram.parametric.edit.part;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.sysml.diagram.common.edit.part.BlockPropertyCompositeEditPart;
+import org.eclipse.papyrus.sysml.diagram.parametric.policies.CustomParametricSemanticPolicy;
+
+public class CustomBlockPropertyCompositeEditPart extends
+ BlockPropertyCompositeEditPart {
+
+ public CustomBlockPropertyCompositeEditPart(View view) {
+ super(view);
+ }
+
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomParametricSemanticPolicy());
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomConstraintBlockPropertyCompositeEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomConstraintBlockPropertyCompositeEditPart.java
new file mode 100644
index 00000000000..b488262393d
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomConstraintBlockPropertyCompositeEditPart.java
@@ -0,0 +1,21 @@
+package org.eclipse.papyrus.sysml.diagram.parametric.edit.part;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.sysml.diagram.common.edit.part.ConstraintBlockPropertyCompositeEditPart;
+import org.eclipse.papyrus.sysml.diagram.parametric.policies.CustomParametricSemanticPolicy;
+
+public class CustomConstraintBlockPropertyCompositeEditPart extends
+ ConstraintBlockPropertyCompositeEditPart {
+
+ public CustomConstraintBlockPropertyCompositeEditPart(View view) {
+ super(view);
+ }
+
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomParametricSemanticPolicy());
+ }
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomConstraintParameterAffixedNodeEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomConstraintParameterAffixedNodeEditPart.java
new file mode 100644
index 00000000000..41cc9983fb7
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomConstraintParameterAffixedNodeEditPart.java
@@ -0,0 +1,19 @@
+package org.eclipse.papyrus.sysml.diagram.parametric.edit.part;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.sysml.diagram.parametric.policies.CustomParametricSemanticPolicy;
+import org.eclipse.papyrus.uml.diagram.common.edit.part.ConstraintParameterAffixedNodeEditPart;
+
+public class CustomConstraintParameterAffixedNodeEditPart extends ConstraintParameterAffixedNodeEditPart {
+
+ public CustomConstraintParameterAffixedNodeEditPart(View view) {
+ super(view);
+ }
+
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomParametricSemanticPolicy());
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomPortAffixedNodeEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomPortAffixedNodeEditPart.java
new file mode 100644
index 00000000000..c89c9070057
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomPortAffixedNodeEditPart.java
@@ -0,0 +1,20 @@
+package org.eclipse.papyrus.sysml.diagram.parametric.edit.part;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.sysml.diagram.parametric.policies.CustomParametricSemanticPolicy;
+import org.eclipse.papyrus.uml.diagram.common.edit.part.PortAffixedNodeEditPart;
+
+public class CustomPortAffixedNodeEditPart extends PortAffixedNodeEditPart {
+
+ public CustomPortAffixedNodeEditPart(View view) {
+ super(view);
+ }
+
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomParametricSemanticPolicy());
+ }
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/parts/ConnectorEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/parts/ConnectorEditPart.java
deleted file mode 100644
index 58ecd9c5f64..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/parts/ConnectorEditPart.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.edit.parts;
-
-import org.eclipse.draw2d.Connection;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.policies.ConnectorItemSemanticEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editparts.UMLConnectionNodeEditPart;
-import org.eclipse.papyrus.uml.diagram.common.figure.edge.UMLEdgeFigure;
-
-/**
- * @generated
- */
-public class ConnectorEditPart extends UMLConnectionNodeEditPart
-
-implements ITreeBranchEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 4001;
-
- /**
- * @generated
- */
- public ConnectorEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ConnectorItemSemanticEditPolicy());
- }
-
- /**
- * @generated
- */
- protected boolean addFixedChild(EditPart childEditPart) {
- if(childEditPart instanceof ConnectorNameEditPart) {
- ((ConnectorNameEditPart)childEditPart).setLabel(getPrimaryShape().getConnectorLabel());
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
- protected void addChildVisual(EditPart childEditPart, int index) {
- if(addFixedChild(childEditPart)) {
- return;
- }
- super.addChildVisual(childEditPart, -1);
- }
-
- /**
- * @generated
- */
- protected boolean removeFixedChild(EditPart childEditPart) {
- if(childEditPart instanceof ConnectorNameEditPart) {
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
- protected void removeChildVisual(EditPart childEditPart) {
- if(removeFixedChild(childEditPart)) {
- return;
- }
- super.removeChildVisual(childEditPart);
- }
-
- /**
- * Creates figure for this edit part.
- *
- * Body of this method does not depend on settings in generation model so you may safely remove
- * <i>generated</i> tag and modify it.
- *
- * @generated
- */
-
- protected Connection createConnectionFigure() {
- return new ConnectorFigure();
- }
-
- /**
- * @generated
- */
- public ConnectorFigure getPrimaryShape() {
- return (ConnectorFigure)getFigure();
- }
-
- /**
- * @generated NOT extends UMLEdgeFigure
- */
- public class ConnectorFigure extends UMLEdgeFigure {
-
- /**
- * @generated
- */
- private WrappingLabel fConnectorLabel;
-
- /**
- * @generated
- */
- public ConnectorFigure() {
- this.setLineWidth(1);
-
- createContents();
- }
-
- /**
- * @generated NOT protected
- */
- protected void createContents() {
-
- fConnectorLabel = new WrappingLabel();
- fConnectorLabel.setText("");
-
- this.add(fConnectorLabel);
-
- }
-
- /**
- * @generated
- */
- public WrappingLabel getConnectorLabel() {
- return fConnectorLabel;
- }
-
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/parts/ConnectorNameEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/parts/ConnectorNameEditPart.java
deleted file mode 100644
index 105a4f92926..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/parts/ConnectorNameEditPart.java
+++ /dev/null
@@ -1,756 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.edit.parts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.ConnectionLocator;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.policies.SysmlTextSelectionEditPolicy;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlVisualIDRegistry;
-import org.eclipse.papyrus.sysml.diagram.parametric.providers.SysmlElementTypes;
-import org.eclipse.papyrus.sysml.diagram.parametric.providers.SysmlParserProvider;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editparts.ILabelRoleProvider;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil;
-import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants;
-import org.eclipse.papyrus.infra.emf.appearance.helper.NameLabelIconHelper;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @generated
- */
-public class ConnectorNameEditPart extends LabelEditPart implements ITextAwareEditPart, ILabelRoleProvider {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 6001;
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /** direct edition mode (default, undefined, registered editor, etc.) */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /** configuration from a registered edit dialog */
- protected IDirectEditorConfiguration configuration;
-
- /**
- * @generated
- */
- static {
- registerSnapBackPosition(SysmlVisualIDRegistry.getType(org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ConnectorNameEditPart.VISUAL_ID), new Point(0, 40));
- }
-
- /**
- * @generated
- */
- public ConnectorNameEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new SysmlTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ParametricEditPart.LinkLabelDragPolicy());
- }
-
- /**
- * @generated
- */
- public int getKeyPoint() {
- return ConnectionLocator.MIDDLE;
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getText();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getText();
- } else {
- return ((Label)figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if(figure instanceof WrappingLabel) {
- ((WrappingLabel)figure).setText(text);
- } else if(figure instanceof ILabelFigure) {
- ((ILabelFigure)figure).setText(text);
- } else {
- ((Label)figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getIcon();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getIcon();
- } else {
- return ((Label)figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if(figure instanceof WrappingLabel) {
- ((WrappingLabel)figure).setIcon(icon);
- } else if(figure instanceof ILabelFigure) {
- ((ILabelFigure)figure).setIcon(icon);
- } else {
- ((Label)figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(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 NOT
- */
- protected Image getLabelIcon() {
- EObject parserElement = getParserElement();
- if(parserElement == null) {
- return null;
- }
-
- List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer());
- for(View view : views) {
- if(NameLabelIconHelper.showLabelIcon(view)) {
- return SysmlElementTypes.getImage(parserElement.eClass());
- }
- }
- return null;
-
- }
-
- /**
- * @generated
- */
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
- }
- if(text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof SysmlTextSelectionEditPolicy) {
- ((SysmlTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof SysmlTextSelectionEditPolicy) {
- ((SysmlTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- public String isValid(final Object value) {
- if(value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- 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) {
- parser = SysmlParserProvider.getParser(SysmlElementTypes.Connector_4001, getParserElement(), SysmlVisualIDRegistry.getType(org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ConnectorNameEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), SysmlEditPartFactory.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() instanceof TextDirectEditManager) {
- ((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;
-
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch(directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if(configuration == null || configuration.getLanguage() == null) {
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
- helper.showEditor();
- return;
- } else if(configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if(configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), ((IDirectEditorConfiguration)configuration).getTextToEdit(resolveSemanticElement()), (IDirectEditorConfiguration)configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if(Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
-
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- public void run() {
- if(isActive() && isEditable()) {
- if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof SysmlTextSelectionEditPolicy) {
- ((SysmlTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof SysmlTextSelectionEditPolicy) {
- ((SysmlTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline());
- }
- }
-
- /**
- * @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();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see
- * org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if(checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if(checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if(resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
- }
- }
- }
-
- /**
- * Updates the preference configuration
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- public void run() {
- if(isActive() && isEditable()) {
- if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- protected void 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();
- }
- }
- }
-
- if(event.getNewValue() instanceof EAnnotation && VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON.equals(((EAnnotation)event.getNewValue()).getSource())) {
- refreshLabel();
- }
-
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-
- /**
- * @generated
- */
- public String getLabelRole() {
- return "Name";//$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- public String getIconPathRole() {
- return "platform:/plugin/org.eclipse.papyrus.uml.diagram.common/icons/label_role/name.png";//$NON-NLS-1$
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/parts/ConstraintLabelEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/parts/ConstraintLabelEditPart.java
deleted file mode 100644
index 14409979b2f..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/parts/ConstraintLabelEditPart.java
+++ /dev/null
@@ -1,767 +0,0 @@
-package org.eclipse.papyrus.sysml.diagram.parametric.edit.parts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.policies.NoDeleteFromModelEditPolicy;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.policies.SysmlTextSelectionEditPolicy;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlVisualIDRegistry;
-import org.eclipse.papyrus.sysml.diagram.parametric.providers.SysmlElementTypes;
-import org.eclipse.papyrus.sysml.diagram.parametric.providers.SysmlParserProvider;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil;
-import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants;
-import org.eclipse.papyrus.infra.emf.appearance.helper.NameLabelIconHelper;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @generated
- */
-public class ConstraintLabelEditPart 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;
-
- /** direct edition mode (default, undefined, registered editor, etc.) */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /** configuration from a registered edit dialog */
- protected IDirectEditorConfiguration configuration;
-
- /**
- * @generated
- */
- public ConstraintLabelEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new SysmlTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ParametricEditPart.NodeLabelDragPolicy());
- installEditPolicy(RequestConstants.REQ_SEMANTIC_WRAPPER, new NoDeleteFromModelEditPolicy());
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getText();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getText();
- } else {
- return ((Label)figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if(figure instanceof WrappingLabel) {
- ((WrappingLabel)figure).setText(text);
- } else if(figure instanceof ILabelFigure) {
- ((ILabelFigure)figure).setText(text);
- } else {
- ((Label)figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getIcon();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getIcon();
- } else {
- return ((Label)figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if(figure instanceof WrappingLabel) {
- ((WrappingLabel)figure).setIcon(icon);
- } else if(figure instanceof ILabelFigure) {
- ((ILabelFigure)figure).setIcon(icon);
- } else {
- ((Label)figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(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 NOT
- */
- protected Image getLabelIcon() {
- EObject parserElement = getParserElement();
- if(parserElement == null) {
- return null;
- }
-
- List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer());
- for(View view : views) {
- if(NameLabelIconHelper.showLabelIcon(view)) {
- return SysmlElementTypes.getImage(parserElement.eClass());
- }
- }
- return null;
-
- }
-
- /**
- * @generated
- */
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
- }
- if(text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof SysmlTextSelectionEditPolicy) {
- ((SysmlTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof SysmlTextSelectionEditPolicy) {
- ((SysmlTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- public String isValid(final Object value) {
- if(value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- 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) {
- parser = SysmlParserProvider.getParser(SysmlElementTypes.ConstraintProperty_2003, getParserElement(), SysmlVisualIDRegistry.getType(org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ConstraintLabelEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), SysmlEditPartFactory.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() instanceof TextDirectEditManager) {
- ((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;
-
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch(directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if(configuration == null || configuration.getLanguage() == null) {
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
- helper.showEditor();
- return;
- } else if(configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if(configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), ((IDirectEditorConfiguration)configuration).getTextToEdit(resolveSemanticElement()), (IDirectEditorConfiguration)configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if(Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
-
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- public void run() {
- if(isActive() && isEditable()) {
- if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof SysmlTextSelectionEditPolicy) {
- ((SysmlTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof SysmlTextSelectionEditPolicy) {
- ((SysmlTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline());
- }
- }
-
- /**
- * @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();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see
- * org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if(checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if(checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if(resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
- }
- }
- }
-
- /**
- * Updates the preference configuration
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- public void run() {
- if(isActive() && isEditable()) {
- if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- protected void 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) {
- refreshLabel();
- Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer)event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if(getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if(resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
-
- if(event.getNewValue() instanceof EAnnotation && VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON.equals(((EAnnotation)event.getNewValue()).getSource())) {
- refreshLabel();
- }
-
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-
- private static final String ADD_PARENT_MODEL = "AddParentModel";
-
- /**
- * @generated
- */
- public void activate() {
- super.activate();
- addOwnerElementListeners();
- }
-
- /**
- * @generated
- */
- protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View)getParent().getModel())); //$NON-NLS-1$
-
- }
-
- /**
- * @generated
- */
- public void deactivate() {
- removeOwnerElementListeners();
- super.deactivate();
-
- }
-
- /**
- * @generated
- */
- protected void removeOwnerElementListeners() {
- removeListenerFilter(ADD_PARENT_MODEL);
-
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/parts/ConstraintPropertyEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/parts/ConstraintPropertyEditPart.java
deleted file mode 100644
index 44b7e14bc92..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/parts/ConstraintPropertyEditPart.java
+++ /dev/null
@@ -1,496 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.edit.parts;
-
-import org.eclipse.draw2d.GridData;
-import org.eclipse.draw2d.GridLayout;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.draw2d.RoundedRectangle;
-import org.eclipse.draw2d.Shape;
-import org.eclipse.draw2d.StackLayout;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.RequestConstants;
-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.IBorderItemLocator;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
-import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
-import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceConverter;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
-import org.eclipse.papyrus.sysml.constraints.ConstraintProperty;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.policies.ConstraintPropertyItemSemanticEditPolicy;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.policies.CreateParameterEditPolicy;
-import org.eclipse.papyrus.sysml.diagram.parametric.figures.CenteredWrappedLabel;
-import org.eclipse.papyrus.sysml.diagram.parametric.helper.SelfCompartmentNotificationHelper;
-import org.eclipse.papyrus.sysml.diagram.parametric.locator.ParameterPositionLocator;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlDiagramEditorPlugin;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlVisualIDRegistry;
-import org.eclipse.papyrus.sysml.diagram.parametric.providers.SysmlElementTypes;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.BorderItemResizableEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.uml2.uml.Property;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class ConstraintPropertyEditPart extends
-
-AbstractBorderedShapeEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 2003;
-
- /**
- * @generated
- */
- protected IFigure contentPane;
-
- /**
- * @generated
- */
- protected IFigure primaryShape;
-
- /**
- * Notifier for listening and stop listening model element.
- */
- private SelfCompartmentNotificationHelper notifier = new SelfCompartmentNotificationHelper(this, UMLPackage.eINSTANCE.getStructuredClassifier_OwnedAttribute(), (IHintedType)SysmlElementTypes.Property_3002);
-
- /**
- * @generated
- */
- public ConstraintPropertyEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ConstraintPropertyItemSemanticEditPolicy());
- installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
-
- //in Papyrus diagrams are not strongly synchronised
- //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.sysml.diagram.parametric.edit.policies.ConstraintPropertyCanonicalEditPolicy());
-
- installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- installEditPolicy(RequestConstants.REQ_CREATE, new CreateParameterEditPolicy());
- // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
- // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
- }
-
- /**
- * @generated
- */
- protected LayoutEditPolicy createLayoutEditPolicy() {
- org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() {
-
- protected EditPolicy createChildEditPolicy(EditPart child) {
- View childView = (View)child.getModel();
- switch(SysmlVisualIDRegistry.getVisualID(childView)) {
- case Property2EditPart.VISUAL_ID:
-
- return new BorderItemResizableEditPolicy();
-
- }
- EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(result == null) {
- result = new NonResizableEditPolicy();
- }
- return result;
- }
-
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-
- /**
- * @generated
- */
- protected IFigure createNodeShape() {
- return primaryShape = new ConstraintPropertyFigureDescriptor();
- }
-
- /**
- * @generated
- */
- public ConstraintPropertyFigureDescriptor getPrimaryShape() {
- return (ConstraintPropertyFigureDescriptor)primaryShape;
- }
-
- /**
- * @generated
- */
- protected boolean addFixedChild(EditPart childEditPart) {
- if(childEditPart instanceof ConstraintPropertyNameEditPart) {
- ((ConstraintPropertyNameEditPart)childEditPart).setLabel(getPrimaryShape().getConstraintPropertyFigureLabel());
- return true;
- }
- if(childEditPart instanceof ConstraintLabelEditPart) {
- ((ConstraintLabelEditPart)childEditPart).setLabel(getPrimaryShape().getConstraintLabel());
- return true;
- }
-
- //Papyrus Gencode :Affixed Parameter locator
- if(childEditPart instanceof Property2EditPart) {
- IBorderItemLocator locator = new ParameterPositionLocator(getMainFigure(), PositionConstants.NONE);
- getBorderedFigure().getBorderItemContainer().add(((Property2EditPart)childEditPart).getFigure(), locator);
- return true;
- }
-
- return false;
- }
-
- /**
- * @generated
- */
- protected boolean removeFixedChild(EditPart childEditPart) {
- if(childEditPart instanceof ConstraintPropertyNameEditPart) {
- return true;
- }
- if(childEditPart instanceof ConstraintLabelEditPart) {
- return true;
- }
- if(childEditPart instanceof Property2EditPart) {
- getBorderedFigure().getBorderItemContainer().remove(((Property2EditPart)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 IBorderItemEditPart) {
- return getBorderedFigure().getBorderItemContainer();
- }
- return getContentPane();
- }
-
- /**
- * @generated
- */
- protected NodeFigure createNodePlate() {
- String prefElementId = "ConstraintProperty";
- IPreferenceStore store = SysmlDiagramEditorPlugin.getInstance().getPreferenceStore();
- String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.WIDTH);
- String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.HEIGHT);
- DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
-
- return result;
- }
-
- /**
- * 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;
- }
-
- /**
- * Default implementation treats passed figure as content pane. Respects layout one may have set
- * for generated figure.
- *
- * @param nodeShape
- * instance of generated figure class
- * @generated
- */
- protected IFigure setupContentPane(IFigure nodeShape) {
- if(nodeShape.getLayoutManager() == null) {
- ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
- layout.setSpacing(5);
- nodeShape.setLayoutManager(layout);
- }
- return nodeShape; // use nodeShape itself as contentPane
- }
-
- /**
- * @generated
- */
- public IFigure getContentPane() {
- if(contentPane != null) {
- return contentPane;
- }
- return super.getContentPane();
- }
-
- /**
- * @generated
- */
- protected void setForegroundColor(Color color) {
- if(primaryShape != null) {
- primaryShape.setForegroundColor(color);
- }
- }
-
- /**
- * @generated
- */
- protected void setLineWidth(int width) {
- if(primaryShape instanceof Shape) {
- ((Shape)primaryShape).setLineWidth(width);
- }
- }
-
- /**
- * @generated
- */
- protected void setLineType(int style) {
- if(primaryShape instanceof Shape) {
- ((Shape)primaryShape).setLineStyle(style);
- }
- }
-
- /**
- * @generated
- */
- public EditPart getPrimaryChildEditPart() {
- return getChildBySemanticHint(SysmlVisualIDRegistry.getType(ConstraintPropertyNameEditPart.VISUAL_ID));
- }
-
- /**
- * @generated
- */
- public class ConstraintPropertyFigureDescriptor extends RoundedRectangle {
-
- /**
- * @generated
- */
- private CenteredWrappedLabel fConstraintPropertyFigureLabel;
-
- /**
- * @generated
- */
- private WrappingLabel fConstraintLabel;
-
- /**
- * @generated
- */
- public ConstraintPropertyFigureDescriptor() {
-
- GridLayout layoutThis = new GridLayout();
- layoutThis.numColumns = 1;
- layoutThis.makeColumnsEqualWidth = true;
- this.setLayoutManager(layoutThis);
-
- this.setCornerDimensions(new Dimension(getMapMode().DPtoLP(25), getMapMode().DPtoLP(25)));
- this.setLineWidth(1);
- this.setMinimumSize(new Dimension(getMapMode().DPtoLP(200), getMapMode().DPtoLP(120)));
- createContents();
- }
-
- /**
- * @generated
- */
- private void createContents() {
-
- fConstraintPropertyFigureLabel = new CenteredWrappedLabel();
-
- GridData constraintFConstraintPropertyFigureLabel = new GridData();
- constraintFConstraintPropertyFigureLabel.verticalAlignment = GridData.END;
- constraintFConstraintPropertyFigureLabel.horizontalAlignment = GridData.CENTER;
- constraintFConstraintPropertyFigureLabel.horizontalIndent = 0;
- constraintFConstraintPropertyFigureLabel.horizontalSpan = 1;
- constraintFConstraintPropertyFigureLabel.verticalSpan = 1;
- constraintFConstraintPropertyFigureLabel.grabExcessHorizontalSpace = true;
- constraintFConstraintPropertyFigureLabel.grabExcessVerticalSpace = true;
- this.add(fConstraintPropertyFigureLabel, constraintFConstraintPropertyFigureLabel);
-
- fConstraintLabel = new WrappingLabel();
-
- GridData constraintFConstraintLabel = new GridData();
- constraintFConstraintLabel.verticalAlignment = GridData.BEGINNING;
- constraintFConstraintLabel.horizontalAlignment = GridData.END;
- constraintFConstraintLabel.horizontalIndent = 0;
- constraintFConstraintLabel.horizontalSpan = 1;
- constraintFConstraintLabel.verticalSpan = 1;
- constraintFConstraintLabel.grabExcessHorizontalSpace = true;
- constraintFConstraintLabel.grabExcessVerticalSpace = true;
- this.add(fConstraintLabel, constraintFConstraintLabel);
-
- }
-
- /**
- * @generated
- */
- private boolean myUseLocalCoordinates = false;
-
- /**
- * @generated
- */
- protected boolean useLocalCoordinates() {
- return myUseLocalCoordinates;
- }
-
- /**
- * @generated
- */
- protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
- myUseLocalCoordinates = useLocalCoordinates;
- }
-
- /**
- * @generated
- */
- public CenteredWrappedLabel getConstraintPropertyFigureLabel() {
- return fConstraintPropertyFigureLabel;
- }
-
- /**
- * @generated
- */
- public WrappingLabel getConstraintLabel() {
- return fConstraintLabel;
- }
-
- }
-
- /**
- * @generated
- */
- @Override
- public Object getPreferredValue(EStructuralFeature feature) {
- IPreferenceStore preferenceStore = (IPreferenceStore)getDiagramPreferencesHint().getPreferenceStore();
- Object result = null;
-
- if(feature == NotationPackage.eINSTANCE.getLineStyle_LineColor() || feature == NotationPackage.eINSTANCE.getFontStyle_FontColor() || feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
- String prefColor = null;
- if(feature == NotationPackage.eINSTANCE.getLineStyle_LineColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant("ConstraintProperty", PreferenceConstantHelper.COLOR_LINE);
- } else if(feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant("ConstraintProperty", PreferenceConstantHelper.COLOR_FONT);
- } else if(feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant("ConstraintProperty", PreferenceConstantHelper.COLOR_FILL);
- }
- result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor((IPreferenceStore)preferenceStore, prefColor));
- } else if(feature == NotationPackage.eINSTANCE.getFillStyle_Transparency() || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
- String prefGradient = PreferenceConstantHelper.getElementConstant("ConstraintProperty", PreferenceConstantHelper.COLOR_GRADIENT);
- GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(preferenceStore.getString(prefGradient));
- if(feature == NotationPackage.eINSTANCE.getFillStyle_Transparency()) {
- result = new Integer(gradientPreferenceConverter.getTransparency());
- } else if(feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
- result = gradientPreferenceConverter.getGradientData();
- }
- }
-
- if(result == null) {
- result = getStructuralFeatureValue(feature);
- }
- return result;
- }
-
- /**
- * Activate a listener for to Handle notification for new owned property
- */
- @Override
- public void activate() {
- super.activate();
- EObject parent = resolveSemanticElement();
- // listen constraint property and self base property
- notifier.listenObject(parent);
- if(parent instanceof ConstraintProperty) {
- Property property = ((ConstraintProperty)parent).getBase_Property();
- notifier.listenObject(property);
- if(property.getType() != null) {
- notifier.listenObject(property.getType());
- }
- }
- // ensure children parts are correctly initialized.
- SelfCompartmentNotificationHelper.updatePropertiesParts(this, UMLPackage.eINSTANCE.getStructuredClassifier_OwnedAttribute(), (IHintedType)SysmlElementTypes.Property_3002);
- }
-
- /**
- * Deactivate listeners to handle notification in the message occurence specification
- */
- @Override
- public void deactivate() {
- notifier.unlistenAll();
- super.deactivate();
- }
-
- /**
- * Remove listeners to handle notification in the message occurence specification
- */
- @Override
- public void removeNotify() {
- notifier.unlistenAll();
- super.removeNotify();
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/parts/ConstraintPropertyNameEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/parts/ConstraintPropertyNameEditPart.java
deleted file mode 100644
index 7b44fc3d663..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/parts/ConstraintPropertyNameEditPart.java
+++ /dev/null
@@ -1,792 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.edit.parts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.sysml.constraints.ConstraintProperty;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.policies.SysmlTextSelectionEditPolicy;
-import org.eclipse.papyrus.sysml.diagram.parametric.figures.CenteredWrappedLabel;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlVisualIDRegistry;
-import org.eclipse.papyrus.sysml.diagram.parametric.providers.SysmlElementTypes;
-import org.eclipse.papyrus.sysml.diagram.parametric.providers.SysmlParserProvider;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil;
-import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants;
-import org.eclipse.papyrus.infra.emf.appearance.helper.NameLabelIconHelper;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @generated
- */
-public class ConstraintPropertyNameEditPart 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;
-
- /** direct edition mode (default, undefined, registered editor, etc.) */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /** configuration from a registered edit dialog */
- protected IDirectEditorConfiguration configuration;
-
- /**
- * @generated
- */
- public ConstraintPropertyNameEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new SysmlTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ParametricEditPart.NodeLabelDragPolicy());
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getText();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getText();
- } else {
- return ((Label)figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if(figure instanceof WrappingLabel) {
- ((WrappingLabel)figure).setText(text);
- } else if(figure instanceof ILabelFigure) {
- ((ILabelFigure)figure).setText(text);
- } else {
- ((Label)figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getIcon();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getIcon();
- } else {
- return ((Label)figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if(figure instanceof WrappingLabel) {
- ((WrappingLabel)figure).setIcon(icon);
- } else if(figure instanceof ILabelFigure) {
- ((ILabelFigure)figure).setIcon(icon);
- } else {
- ((Label)figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(CenteredWrappedLabel 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 NOT
- */
- protected Image getLabelIcon() {
- EObject parserElement = getParserElement();
- if(parserElement == null) {
- return null;
- }
-
- List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer());
- for(View view : views) {
- if(NameLabelIconHelper.showLabelIcon(view)) {
- return SysmlElementTypes.getImage(parserElement.eClass());
- }
- }
- return null;
-
- }
-
- /**
- * @generated
- */
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
- }
- if(text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof SysmlTextSelectionEditPolicy) {
- ((SysmlTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof SysmlTextSelectionEditPolicy) {
- ((SysmlTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- public String isValid(final Object value) {
- if(value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- 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) {
- parser = SysmlParserProvider.getParser(SysmlElementTypes.ConstraintProperty_2003, getParserElement(), SysmlVisualIDRegistry.getType(org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ConstraintPropertyNameEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), SysmlEditPartFactory.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() instanceof TextDirectEditManager) {
- ((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;
-
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch(directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if(configuration == null || configuration.getLanguage() == null) {
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
- helper.showEditor();
- return;
- } else if(configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if(configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), ((IDirectEditorConfiguration)configuration).getTextToEdit(resolveSemanticElement()), (IDirectEditorConfiguration)configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if(Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
-
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- public void run() {
- if(isActive() && isEditable()) {
- if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof SysmlTextSelectionEditPolicy) {
- ((SysmlTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof SysmlTextSelectionEditPolicy) {
- ((SysmlTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline());
- }
- }
-
- /**
- * @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();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see
- * org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if(checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if(checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated NOT
- */
- protected boolean checkExtendedEditor() {
- EObject semanticElement = resolveSemanticElement();
- if(semanticElement != null && semanticElement instanceof ConstraintProperty) {
- boolean hasSpecificEditorConfiguration = DirectEditorsUtil.hasSpecificEditorConfiguration(((ConstraintProperty)semanticElement).getBase_Property().eClass().getInstanceClassName());
-
- return hasSpecificEditorConfiguration;
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated NOT
- */
- protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.SYSML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
- }
- }
- }
-
- /**
- * Updates the preference configuration
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- public void run() {
- if(isActive() && isEditable()) {
- if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- protected void 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) {
- refreshLabel();
- Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer)event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if(getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if(resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
-
- if(event.getNewValue() instanceof EAnnotation && VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON.equals(((EAnnotation)event.getNewValue()).getSource())) {
- refreshLabel();
- }
-
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-
- private static final String ADD_PARENT_MODEL = "AddParentModel";
-
- /**
- * @generated
- */
- public void activate() {
- super.activate();
- addOwnerElementListeners();
- }
-
- /**
- * @generated
- */
- protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View)getParent().getModel())); //$NON-NLS-1$
-
- }
-
- /**
- * @generated
- */
- public void deactivate() {
- removeOwnerElementListeners();
- super.deactivate();
-
- }
-
- /**
- * @generated
- */
- protected void removeOwnerElementListeners() {
- removeListenerFilter(ADD_PARENT_MODEL);
-
- }
-
- // @Override
- // public EObject resolveSemanticElement() {
- // EObject semanticElement = super.resolveSemanticElement();
- // if (semanticElement instanceof ConstraintProperty) {
- // semanticElement = ((ConstraintProperty) semanticElement).getBase_Property();
- // }
- // return semanticElement;
- // }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/parts/ParametricEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/parts/ParametricEditPart.java
deleted file mode 100644
index cceaf0dda80..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/parts/ParametricEditPart.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.edit.parts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
-import org.eclipse.gef.handles.MoveHandle;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.NonResizableLabelEditPolicy;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.policies.CustomDiagramDragDropEditPolicy;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.policies.ParametricItemSemanticEditPolicy;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.DuplicatePasteEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.providers.ViewInfo;
-import org.eclipse.papyrus.uml.diagram.common.util.MDTUtil;
-
-/**
- * @generated
- */
-public class ParametricEditPart extends DiagramEditPart {
-
- /**
- * @generated
- */
- public final static String MODEL_ID = "Parametric"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 1000;
-
- /**
- * @generated
- */
- public ParametricEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(DuplicatePasteEditPolicy.PASTE_ROLE, new DuplicatePasteEditPolicy());
-
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ParametricItemSemanticEditPolicy());
-
- //in Papyrus diagrams are not strongly synchronised
- //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.sysml.diagram.parametric.edit.policies.ParametricCanonicalEditPolicy());
-
- installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
- // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.POPUPBAR_ROLE);
- }
-
- /**
- * @generated
- */
- /* package-local */static class NodeLabelDragPolicy extends NonResizableEditPolicy {
-
- /**
- * @generated
- */
- @SuppressWarnings("rawtypes")
- protected List createSelectionHandles() {
- MoveHandle h = new MoveHandle((GraphicalEditPart)getHost());
- h.setBorder(null);
- return Collections.singletonList(h);
- }
-
- /**
- * @generated
- */
- public Command getCommand(Request request) {
- return null;
- }
-
- /**
- * @generated
- */
- public boolean understandsRequest(Request request) {
- return false;
- }
- }
-
- /**
- * @generated
- */
- /* package-local */static class LinkLabelDragPolicy extends NonResizableLabelEditPolicy {
-
- /**
- * @generated
- */
- @SuppressWarnings("rawtypes")
- protected List createSelectionHandles() {
- MoveHandle mh = new MoveHandle((GraphicalEditPart)getHost());
- mh.setBorder(null);
- return Collections.singletonList(mh);
- }
- }
-
- /**
- * @generated
- */
- protected void handleNotificationEvent(Notification event) {
-
- super.handleNotificationEvent(event);
- if(event.getNotifier() instanceof EAnnotation) {
- EAnnotation eAnnotation = (EAnnotation)event.getNotifier();
- if(eAnnotation.getSource() != null && eAnnotation.getSource().equals(MDTUtil.FilterViewAndLabelsSource)) {
- //modification form MOSKitt approach, canonical policies are not called
- MDTUtil.filterDiagramViews(this.getDiagramView());
- }
- }
- }
-
- /**
- * @generated
- */
- public Object getAdapter(Class adapter) {
-
- if(adapter != null && adapter.equals(ViewInfo.class)) {
- return SysmlVisualIDRegistry.getDiagramViewInfo();
- }
- return super.getAdapter(adapter);
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/parts/Property2EditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/parts/Property2EditPart.java
deleted file mode 100644
index cdd49de3c3b..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/parts/Property2EditPart.java
+++ /dev/null
@@ -1,383 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.edit.parts;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.Shape;
-import org.eclipse.draw2d.StackLayout;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.editpolicies.LayoutEditPolicy;
-import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
-import org.eclipse.gef.handles.MoveHandle;
-import org.eclipse.gef.requests.CreateRequest;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.BorderedBorderItemEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
-import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
-import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceConverter;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.policies.NoDeleteFromDiagramEditPolicy;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.policies.NoDeleteFromModelEditPolicy;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.policies.OpenDiagramEditPolicy;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.policies.Property2ItemSemanticEditPolicy;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlDiagramEditorPlugin;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlVisualIDRegistry;
-import org.eclipse.papyrus.sysml.diagram.parametric.providers.SysmlElementTypes;
-import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @generated
- */
-public class Property2EditPart extends
-
-BorderedBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 3002;
-
- /**
- * @generated
- */
- protected IFigure contentPane;
-
- /**
- * @generated
- */
- protected IFigure primaryShape;
-
- /**
- * @generated
- */
- public Property2EditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, getPrimaryDragEditPolicy());
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new Property2ItemSemanticEditPolicy());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy());
- installEditPolicy(RequestConstants.REQ_DELETE, new NoDeleteFromDiagramEditPolicy());
- installEditPolicy(RequestConstants.REQ_SEMANTIC_WRAPPER, new NoDeleteFromModelEditPolicy());
- // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
- // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
- }
-
- /**
- * @generated
- */
- protected LayoutEditPolicy createLayoutEditPolicy() {
- org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() {
-
- protected EditPolicy createChildEditPolicy(EditPart child) {
- View childView = (View)child.getModel();
- switch(SysmlVisualIDRegistry.getVisualID(childView)) {
- case PropertyName2EditPart.VISUAL_ID:
- return new BorderItemSelectionEditPolicy() {
-
- protected List createSelectionHandles() {
- MoveHandle mh = new MoveHandle((GraphicalEditPart)getHost());
- mh.setBorder(null);
- return Collections.singletonList(mh);
- }
- };
- }
- EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(result == null) {
- result = new NonResizableEditPolicy();
- }
- return result;
- }
-
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-
- /**
- * @generated
- */
- protected IFigure createNodeShape() {
- return primaryShape = new ParameterDescriptor();
- }
-
- /**
- * @generated
- */
- public ParameterDescriptor getPrimaryShape() {
- return (ParameterDescriptor)primaryShape;
- }
-
- /**
- * @generated
- */
- protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) {
- if(borderItemEditPart instanceof PropertyName2EditPart) {
- BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.SOUTH);
- locator.setBorderItemOffset(new Dimension(-20, -20));
- borderItemContainer.add(borderItemEditPart.getFigure(), locator);
- } else {
- super.addBorderItem(borderItemContainer, borderItemEditPart);
- }
- }
-
- /**
- * @generated
- */
- protected NodeFigure createNodePlate() {
- String prefElementId = "Property";
- IPreferenceStore store = SysmlDiagramEditorPlugin.getInstance().getPreferenceStore();
- String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.WIDTH);
- String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.HEIGHT);
- DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
-
- //FIXME: workaround for #154536
- result.getBounds().setSize(result.getPreferredSize());
- return result;
- }
-
- /**
- * 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;
- }
-
- /**
- * 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
- */
- protected void setForegroundColor(Color color) {
- if(primaryShape != null) {
- primaryShape.setForegroundColor(color);
- }
- }
-
- /**
- * @generated
- */
- protected void setLineWidth(int width) {
- if(primaryShape instanceof Shape) {
- ((Shape)primaryShape).setLineWidth(width);
- }
- }
-
- /**
- * @generated
- */
- protected void setLineType(int style) {
- if(primaryShape instanceof Shape) {
- ((Shape)primaryShape).setLineStyle(style);
- }
- }
-
- /**
- * @generated
- */
- public EditPart getPrimaryChildEditPart() {
- return getChildBySemanticHint(SysmlVisualIDRegistry.getType(PropertyName2EditPart.VISUAL_ID));
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnSource() {
- ArrayList<IElementType> types = new ArrayList<IElementType>(1);
- types.add(SysmlElementTypes.Connector_4001);
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnSourceAndTarget(IGraphicalEditPart targetEditPart) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(targetEditPart instanceof PropertyEditPart) {
- types.add(SysmlElementTypes.Connector_4001);
- }
- if(targetEditPart instanceof org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.Property2EditPart) {
- types.add(SysmlElementTypes.Connector_4001);
- }
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMATypesForTarget(IElementType relationshipType) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(relationshipType == SysmlElementTypes.Connector_4001) {
- types.add(SysmlElementTypes.Property_2005);
- types.add(SysmlElementTypes.Property_3002);
- }
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnTarget() {
- ArrayList<IElementType> types = new ArrayList<IElementType>(1);
- types.add(SysmlElementTypes.Connector_4001);
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMATypesForSource(IElementType relationshipType) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(relationshipType == SysmlElementTypes.Connector_4001) {
- types.add(SysmlElementTypes.Property_2005);
- types.add(SysmlElementTypes.Property_3002);
- }
- return types;
- }
-
- /**
- * @generated
- */
- public class ParameterDescriptor extends RectangleFigure {
-
- /**
- * @generated
- */
- public ParameterDescriptor() {
- this.setLineWidth(1);
- this.setPreferredSize(new Dimension(getMapMode().DPtoLP(16), getMapMode().DPtoLP(16)));
- }
-
- /**
- * @generated
- */
- private boolean myUseLocalCoordinates = false;
-
- /**
- * @generated
- */
- protected boolean useLocalCoordinates() {
- return myUseLocalCoordinates;
- }
-
- /**
- * @generated
- */
- protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
- myUseLocalCoordinates = useLocalCoordinates;
- }
-
- }
-
- /**
- * @generated
- */
- @Override
- public Object getPreferredValue(EStructuralFeature feature) {
- IPreferenceStore preferenceStore = (IPreferenceStore)getDiagramPreferencesHint().getPreferenceStore();
- Object result = null;
-
- if(feature == NotationPackage.eINSTANCE.getLineStyle_LineColor() || feature == NotationPackage.eINSTANCE.getFontStyle_FontColor() || feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
- String prefColor = null;
- if(feature == NotationPackage.eINSTANCE.getLineStyle_LineColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant("Property", PreferenceConstantHelper.COLOR_LINE);
- } else if(feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant("Property", PreferenceConstantHelper.COLOR_FONT);
- } else if(feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant("Property", PreferenceConstantHelper.COLOR_FILL);
- }
- result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor((IPreferenceStore)preferenceStore, prefColor));
- } else if(feature == NotationPackage.eINSTANCE.getFillStyle_Transparency() || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
- String prefGradient = PreferenceConstantHelper.getElementConstant("Property", PreferenceConstantHelper.COLOR_GRADIENT);
- GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(preferenceStore.getString(prefGradient));
- if(feature == NotationPackage.eINSTANCE.getFillStyle_Transparency()) {
- result = new Integer(gradientPreferenceConverter.getTransparency());
- } else if(feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
- result = gradientPreferenceConverter.getGradientData();
- }
- }
-
- if(result == null) {
- result = getStructuralFeatureValue(feature);
- }
- return result;
- }
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/parts/PropertyEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/parts/PropertyEditPart.java
deleted file mode 100644
index 4d954ccc14c..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/parts/PropertyEditPart.java
+++ /dev/null
@@ -1,427 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.edit.parts;
-
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.Shape;
-import org.eclipse.draw2d.StackLayout;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.editpolicies.LayoutEditPolicy;
-import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
-import org.eclipse.gef.requests.CreateRequest;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
-import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceConverter;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.policies.PropertyItemSemanticEditPolicy;
-import org.eclipse.papyrus.sysml.diagram.parametric.figures.CenteredWrappedLabel;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlDiagramEditorPlugin;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlVisualIDRegistry;
-import org.eclipse.papyrus.sysml.diagram.parametric.providers.SysmlElementTypes;
-import org.eclipse.papyrus.uml.diagram.common.draw2d.CenterLayout;
-import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @generated
- */
-public class PropertyEditPart extends
-
-ShapeNodeEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 2005;
-
- /**
- * @generated
- */
- protected IFigure contentPane;
-
- /**
- * @generated
- */
- protected IFigure primaryShape;
-
- /**
- * @generated
- */
- public PropertyEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new PropertyItemSemanticEditPolicy());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
- // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
- }
-
- /**
- * @generated
- */
- protected LayoutEditPolicy createLayoutEditPolicy() {
- org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() {
-
- protected EditPolicy createChildEditPolicy(EditPart child) {
- EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(result == null) {
- result = new NonResizableEditPolicy();
- }
- return result;
- }
-
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-
- /**
- * @generated
- */
- protected IFigure createNodeShape() {
- return primaryShape = new PropertyFigure();
- }
-
- /**
- * @generated
- */
- public PropertyFigure getPrimaryShape() {
- return (PropertyFigure)primaryShape;
- }
-
- /**
- * @generated
- */
- protected boolean addFixedChild(EditPart childEditPart) {
- if(childEditPart instanceof PropertyNameEditPart) {
- ((PropertyNameEditPart)childEditPart).setLabel(getPrimaryShape().getPropertyFigureLabel());
- return true;
- }
-
- return false;
- }
-
- /**
- * @generated
- */
- protected boolean removeFixedChild(EditPart childEditPart) {
- if(childEditPart instanceof PropertyNameEditPart) {
- 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) {
- return getContentPane();
- }
-
- /**
- * @generated
- */
- protected NodeFigure createNodePlate() {
- String prefElementId = "Property";
- IPreferenceStore store = SysmlDiagramEditorPlugin.getInstance().getPreferenceStore();
- String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.WIDTH);
- String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.HEIGHT);
- DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
-
- return result;
- }
-
- /**
- * 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(5);
- nodeShape.setLayoutManager(layout);
- }
- return nodeShape; // use nodeShape itself as contentPane
- }
-
- /**
- * @generated
- */
- public IFigure getContentPane() {
- if(contentPane != null) {
- return contentPane;
- }
- return super.getContentPane();
- }
-
- /**
- * @generated
- */
- protected void setForegroundColor(Color color) {
- if(primaryShape != null) {
- primaryShape.setForegroundColor(color);
- }
- }
-
- /**
- * @generated
- */
- protected void setLineWidth(int width) {
- if(primaryShape instanceof Shape) {
- ((Shape)primaryShape).setLineWidth(width);
- }
- }
-
- /**
- * @generated
- */
- protected void setLineType(int style) {
- if(primaryShape instanceof Shape) {
- ((Shape)primaryShape).setLineStyle(style);
- }
- }
-
- /**
- * @generated
- */
- public EditPart getPrimaryChildEditPart() {
- return getChildBySemanticHint(SysmlVisualIDRegistry.getType(PropertyNameEditPart.VISUAL_ID));
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnSource() {
- ArrayList<IElementType> types = new ArrayList<IElementType>(1);
- types.add(SysmlElementTypes.Connector_4001);
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnSourceAndTarget(IGraphicalEditPart targetEditPart) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(targetEditPart instanceof org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.PropertyEditPart) {
- types.add(SysmlElementTypes.Connector_4001);
- }
- if(targetEditPart instanceof Property2EditPart) {
- types.add(SysmlElementTypes.Connector_4001);
- }
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMATypesForTarget(IElementType relationshipType) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(relationshipType == SysmlElementTypes.Connector_4001) {
- types.add(SysmlElementTypes.Property_2005);
- types.add(SysmlElementTypes.Property_3002);
- }
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnTarget() {
- ArrayList<IElementType> types = new ArrayList<IElementType>(1);
- types.add(SysmlElementTypes.Connector_4001);
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMATypesForSource(IElementType relationshipType) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(relationshipType == SysmlElementTypes.Connector_4001) {
- types.add(SysmlElementTypes.Property_2005);
- types.add(SysmlElementTypes.Property_3002);
- }
- return types;
- }
-
- /**
- * @generated
- */
- public class PropertyFigure extends RectangleFigure {
-
- /**
- * @generated
- */
- private CenteredWrappedLabel fPropertyFigureLabel;
-
- /**
- * @generated
- */
- public PropertyFigure() {
-
- CenterLayout layoutThis = new CenterLayout();
-
- this.setLayoutManager(layoutThis);
-
- this.setLineWidth(1);
- this.setMinimumSize(new Dimension(getMapMode().DPtoLP(100), getMapMode().DPtoLP(40)));
- createContents();
- }
-
- /**
- * @generated
- */
- private void createContents() {
-
- fPropertyFigureLabel = new CenteredWrappedLabel();
-
- this.add(fPropertyFigureLabel);
-
- }
-
- /**
- * @generated
- */
- private boolean myUseLocalCoordinates = false;
-
- /**
- * @generated
- */
- protected boolean useLocalCoordinates() {
- return myUseLocalCoordinates;
- }
-
- /**
- * @generated
- */
- protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
- myUseLocalCoordinates = useLocalCoordinates;
- }
-
- /**
- * @generated
- */
- public CenteredWrappedLabel getPropertyFigureLabel() {
- return fPropertyFigureLabel;
- }
-
- }
-
- /**
- * @generated
- */
- @Override
- public Object getPreferredValue(EStructuralFeature feature) {
- IPreferenceStore preferenceStore = (IPreferenceStore)getDiagramPreferencesHint().getPreferenceStore();
- Object result = null;
-
- if(feature == NotationPackage.eINSTANCE.getLineStyle_LineColor() || feature == NotationPackage.eINSTANCE.getFontStyle_FontColor() || feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
- String prefColor = null;
- if(feature == NotationPackage.eINSTANCE.getLineStyle_LineColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant("Property", PreferenceConstantHelper.COLOR_LINE);
- } else if(feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant("Property", PreferenceConstantHelper.COLOR_FONT);
- } else if(feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant("Property", PreferenceConstantHelper.COLOR_FILL);
- }
- result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor((IPreferenceStore)preferenceStore, prefColor));
- } else if(feature == NotationPackage.eINSTANCE.getFillStyle_Transparency() || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
- String prefGradient = PreferenceConstantHelper.getElementConstant("Property", PreferenceConstantHelper.COLOR_GRADIENT);
- GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(preferenceStore.getString(prefGradient));
- if(feature == NotationPackage.eINSTANCE.getFillStyle_Transparency()) {
- result = new Integer(gradientPreferenceConverter.getTransparency());
- } else if(feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
- result = gradientPreferenceConverter.getGradientData();
- }
- }
-
- if(result == null) {
- result = getStructuralFeatureValue(feature);
- }
- return result;
- }
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/parts/PropertyName2EditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/parts/PropertyName2EditPart.java
deleted file mode 100644
index 6e7f3e2d703..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/parts/PropertyName2EditPart.java
+++ /dev/null
@@ -1,754 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.edit.parts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.policies.NoDeleteFromDiagramEditPolicy;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.policies.NoDeleteFromModelEditPolicy;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.policies.SysmlTextSelectionEditPolicy;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlVisualIDRegistry;
-import org.eclipse.papyrus.sysml.diagram.parametric.providers.SysmlElementTypes;
-import org.eclipse.papyrus.sysml.diagram.parametric.providers.SysmlParserProvider;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @generated
- */
-public class PropertyName2EditPart
-
-extends LabelEditPart
-
-implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 5003;
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /** direct edition mode (default, undefined, registered editor, etc.) */
- // disable direct edition for property of a constraint property
- protected int directEditionMode = IDirectEdition.NO_DIRECT_EDITION;
-
- /** configuration from a registered edit dialog */
- protected IDirectEditorConfiguration configuration;
-
- /**
- * @generated
- */
- static {
- registerSnapBackPosition(SysmlVisualIDRegistry.getType(org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.PropertyName2EditPart.VISUAL_ID), new Point(0, 0));
- }
-
- /**
- * @generated
- */
- public PropertyName2EditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new SysmlTextSelectionEditPolicy());
- installEditPolicy(RequestConstants.REQ_DELETE, new NoDeleteFromDiagramEditPolicy());
- installEditPolicy(RequestConstants.REQ_SEMANTIC_WRAPPER, new NoDeleteFromModelEditPolicy());
- }
-
- /**
- * @generated
- */
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if(parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator)constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- public void refreshBounds() {
- int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getText();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getText();
- } else {
- return ((Label)figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if(figure instanceof WrappingLabel) {
- ((WrappingLabel)figure).setText(text);
- } else if(figure instanceof ILabelFigure) {
- ((ILabelFigure)figure).setText(text);
- } else {
- ((Label)figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getIcon();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getIcon();
- } else {
- return ((Label)figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if(figure instanceof WrappingLabel) {
- ((WrappingLabel)figure).setIcon(icon);
- } else if(figure instanceof ILabelFigure) {
- ((ILabelFigure)figure).setIcon(icon);
- } else {
- ((Label)figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- 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 SysmlTextSelectionEditPolicy) {
- ((SysmlTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof SysmlTextSelectionEditPolicy) {
- ((SysmlTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- public String isValid(final Object value) {
- if(value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- 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) {
- parser = SysmlParserProvider.getParser(SysmlElementTypes.Property_3002, getParserElement(), SysmlVisualIDRegistry.getType(org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.PropertyName2EditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), SysmlEditPartFactory.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() instanceof TextDirectEditManager) {
- ((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;
-
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch(directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if(configuration == null || configuration.getLanguage() == null) {
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
- helper.showEditor();
- return;
- } else if(configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if(configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), ((IDirectEditorConfiguration)configuration).getTextToEdit(resolveSemanticElement()), (IDirectEditorConfiguration)configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if(Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
-
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- public void run() {
- if(isActive() && isEditable()) {
- if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof SysmlTextSelectionEditPolicy) {
- ((SysmlTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof SysmlTextSelectionEditPolicy) {
- ((SysmlTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline());
- }
- }
-
- /**
- * @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();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see
- * org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if(checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if(checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if(resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
- }
- }
- }
-
- /**
- * Updates the preference configuration
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- public void run() {
- if(isActive() && isEditable()) {
- if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- protected void 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/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/parts/PropertyNameEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/parts/PropertyNameEditPart.java
deleted file mode 100644
index f8ed7985a92..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/parts/PropertyNameEditPart.java
+++ /dev/null
@@ -1,800 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.edit.parts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.policies.SysmlTextSelectionEditPolicy;
-import org.eclipse.papyrus.sysml.diagram.parametric.figures.CenteredWrappedLabel;
-import org.eclipse.papyrus.sysml.diagram.parametric.parsers.PropertyLabelParser;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlVisualIDRegistry;
-import org.eclipse.papyrus.sysml.diagram.parametric.providers.SysmlElementTypes;
-import org.eclipse.papyrus.sysml.diagram.parametric.providers.SysmlParserProvider;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil;
-import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants;
-import org.eclipse.papyrus.infra.emf.appearance.helper.NameLabelIconHelper;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @generated
- */
-public class PropertyNameEditPart 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;
-
- /** direct edition mode (default, undefined, registered editor, etc.) */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /** configuration from a registered edit dialog */
- protected IDirectEditorConfiguration configuration;
-
- /**
- * @generated
- */
- public PropertyNameEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new SysmlTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ParametricEditPart.NodeLabelDragPolicy());
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getText();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getText();
- } else {
- return ((Label)figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if(figure instanceof WrappingLabel) {
- ((WrappingLabel)figure).setText(text);
- } else if(figure instanceof ILabelFigure) {
- ((ILabelFigure)figure).setText(text);
- } else {
- ((Label)figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getIcon();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getIcon();
- } else {
- return ((Label)figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if(figure instanceof WrappingLabel) {
- ((WrappingLabel)figure).setIcon(icon);
- } else if(figure instanceof ILabelFigure) {
- ((ILabelFigure)figure).setIcon(icon);
- } else {
- ((Label)figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(CenteredWrappedLabel 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 NOT
- */
- protected Image getLabelIcon() {
- EObject parserElement = getParserElement();
- if(parserElement == null) {
- return null;
- }
-
- List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer());
- for(View view : views) {
- if(NameLabelIconHelper.showLabelIcon(view)) {
- return SysmlElementTypes.getImage(parserElement.eClass());
- }
- }
- return null;
-
- }
-
- // /**
- // * @generated
- // */
- // protected String getLabelText() {
- // String text = null;
- // EObject parserElement = getParserElement();
- // if (parserElement != null && getParser() != null) {
- // text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
- // }
- // if (text == null || text.length() == 0) {
- // text = defaultText;
- // }
- // return text;
- // }
-
- /**
- * @generated NOT
- */
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null && getDiagramView() != null) {
- EObject element = getDiagramView().getElement();
- if(getParser() instanceof PropertyLabelParser) {
- // set the container to compute the property name depth
- ((PropertyLabelParser)getParser()).setBlock(element);
- }
- 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 SysmlTextSelectionEditPolicy) {
- ((SysmlTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof SysmlTextSelectionEditPolicy) {
- ((SysmlTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- public String isValid(final Object value) {
- if(value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- 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) {
- parser = SysmlParserProvider.getParser(SysmlElementTypes.Property_2005, getParserElement(), SysmlVisualIDRegistry.getType(org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.PropertyNameEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), SysmlEditPartFactory.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() instanceof TextDirectEditManager) {
- ((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;
-
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch(directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if(configuration == null || configuration.getLanguage() == null) {
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
- helper.showEditor();
- return;
- } else if(configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if(configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), ((IDirectEditorConfiguration)configuration).getTextToEdit(resolveSemanticElement()), (IDirectEditorConfiguration)configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if(Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
-
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- public void run() {
- if(isActive() && isEditable()) {
- if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof SysmlTextSelectionEditPolicy) {
- ((SysmlTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof SysmlTextSelectionEditPolicy) {
- ((SysmlTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline());
- }
- }
-
- /**
- * @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();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see
- * org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if(checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if(checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if(resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
- }
- }
- }
-
- /**
- * Updates the preference configuration
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- public void run() {
- if(isActive() && isEditable()) {
- if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- protected void 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) {
- refreshLabel();
- Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer)event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if(getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if(resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
-
- if(event.getNewValue() instanceof EAnnotation && VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON.equals(((EAnnotation)event.getNewValue()).getSource())) {
- refreshLabel();
- }
-
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-
- private static final String ADD_PARENT_MODEL = "AddParentModel";
-
- /**
- * @generated
- */
- public void activate() {
- super.activate();
- addOwnerElementListeners();
- }
-
- /**
- * @generated
- */
- protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View)getParent().getModel())); //$NON-NLS-1$
-
- }
-
- /**
- * @generated
- */
- public void deactivate() {
- removeOwnerElementListeners();
- super.deactivate();
-
- }
-
- /**
- * @generated
- */
- protected void removeOwnerElementListeners() {
- removeListenerFilter(ADD_PARENT_MODEL);
-
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/parts/SysmlEditPartFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/parts/SysmlEditPartFactory.java
deleted file mode 100644
index 8159736287f..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/parts/SysmlEditPartFactory.java
+++ /dev/null
@@ -1,228 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.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.sysml.diagram.parametric.part.SysmlVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.IMultilineEditableFigure;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * @generated
- */
-public class SysmlEditPartFactory implements EditPartFactory {
-
- /**
- * @generated
- */
- public EditPart createEditPart(EditPart context, Object model) {
- if(model instanceof View) {
- View view = (View)model;
- switch(SysmlVisualIDRegistry.getVisualID(view)) {
-
- case ParametricEditPart.VISUAL_ID:
- return new ParametricEditPart(view);
-
- case ConstraintPropertyEditPart.VISUAL_ID:
- return new ConstraintPropertyEditPart(view);
-
- case ConstraintPropertyNameEditPart.VISUAL_ID:
- return new ConstraintPropertyNameEditPart(view);
-
- case ConstraintLabelEditPart.VISUAL_ID:
- return new ConstraintLabelEditPart(view);
-
- case PropertyEditPart.VISUAL_ID:
- return new PropertyEditPart(view);
-
- case PropertyNameEditPart.VISUAL_ID:
- return new PropertyNameEditPart(view);
-
- case Property2EditPart.VISUAL_ID:
- return new Property2EditPart(view);
-
- case PropertyName2EditPart.VISUAL_ID:
- return new PropertyName2EditPart(view);
-
- case ConnectorEditPart.VISUAL_ID:
- return new ConnectorEditPart(view);
-
- case ConnectorNameEditPart.VISUAL_ID:
- return new ConnectorNameEditPart(view);
-
- }
- }
- return createUnrecognizedEditPart(context, model);
- }
-
- /**
- * @generated
- */
- private EditPart createUnrecognizedEditPart(EditPart context, Object model) {
- // Handle creation of unrecognized child node EditParts here
- return null;
- }
-
- /**
- * @generated
- */
- public static CellEditorLocator getTextCellEditorLocator(ITextAwareEditPart source) {
- if(source.getFigure() instanceof IMultilineEditableFigure)
- return new MultilineCellEditorLocator((IMultilineEditableFigure)source.getFigure());
- else if(source.getFigure() instanceof WrappingLabel)
- return new TextCellEditorLocator((WrappingLabel)source.getFigure());
- else {
- return new LabelCellEditorLocator((Label)source.getFigure());
- }
- }
-
- /**
- * @generated
- */
- static private class MultilineCellEditorLocator implements CellEditorLocator {
-
- /**
- * @generated
- */
- private IMultilineEditableFigure multilineEditableFigure;
-
- /**
- * @generated
- */
- public MultilineCellEditorLocator(IMultilineEditableFigure figure) {
- this.multilineEditableFigure = figure;
- }
-
- /**
- * @generated
- */
- public IMultilineEditableFigure getMultilineEditableFigure() {
- return multilineEditableFigure;
- }
-
- /**
- * @generated
- */
- public void relocate(CellEditor celleditor) {
- Text text = (Text)celleditor.getControl();
- Rectangle rect = getMultilineEditableFigure().getBounds().getCopy();
- rect.x = getMultilineEditableFigure().getEditionLocation().x;
- rect.y = getMultilineEditableFigure().getEditionLocation().y;
- getMultilineEditableFigure().translateToAbsolute(rect);
- if(getMultilineEditableFigure().getText().length() > 0) {
- rect.setSize(new Dimension(text.computeSize(rect.width, SWT.DEFAULT)));
- }
- if(!rect.equals(new Rectangle(text.getBounds()))) {
- text.setBounds(rect.x, rect.y, rect.width, rect.height);
- }
- }
- }
-
- /**
- * @generated
- */
- static private class TextCellEditorLocator implements CellEditorLocator {
-
- /**
- * @generated
- */
- private WrappingLabel wrapLabel;
-
- /**
- * @generated
- */
- public TextCellEditorLocator(WrappingLabel wrapLabel) {
- this.wrapLabel = wrapLabel;
- }
-
- /**
- * @generated
- */
- public WrappingLabel getWrapLabel() {
- return wrapLabel;
- }
-
- /**
- * @generated
- */
- public void relocate(CellEditor celleditor) {
- Text text = (Text)celleditor.getControl();
- Rectangle rect = getWrapLabel().getTextBounds().getCopy();
- getWrapLabel().translateToAbsolute(rect);
- if(!text.getFont().isDisposed()) {
- if(getWrapLabel().isTextWrapOn() && getWrapLabel().getText().length() > 0) {
- rect.setSize(new Dimension(text.computeSize(rect.width, SWT.DEFAULT)));
- } else {
- int avr = FigureUtilities.getFontMetrics(text.getFont()).getAverageCharWidth();
- rect.setSize(new Dimension(text.computeSize(SWT.DEFAULT, SWT.DEFAULT)).expand(avr * 2, 0));
- }
- }
- if(!rect.equals(new Rectangle(text.getBounds()))) {
- text.setBounds(rect.x, rect.y, rect.width, rect.height);
- }
- }
- }
-
- /**
- * @generated
- */
- private static class LabelCellEditorLocator implements CellEditorLocator {
-
- /**
- * @generated
- */
- private Label label;
-
- /**
- * @generated
- */
- public LabelCellEditorLocator(Label label) {
- this.label = label;
- }
-
- /**
- * @generated
- */
- public Label getLabel() {
- return label;
- }
-
- /**
- * @generated
- */
- public void relocate(CellEditor celleditor) {
- Text text = (Text)celleditor.getControl();
- Rectangle rect = getLabel().getTextBounds().getCopy();
- getLabel().translateToAbsolute(rect);
- if(!text.getFont().isDisposed()) {
- int avr = FigureUtilities.getFontMetrics(text.getFont()).getAverageCharWidth();
- rect.setSize(new Dimension(text.computeSize(SWT.DEFAULT, SWT.DEFAULT)).expand(avr * 2, 0));
- }
- if(!rect.equals(new Rectangle(text.getBounds()))) {
- text.setBounds(rect.x, rect.y, rect.width, rect.height);
- }
- }
- }
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/ConnectorItemSemanticEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/ConnectorItemSemanticEditPolicy.java
deleted file mode 100644
index cc64477098b..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/ConnectorItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.edit.policies;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.edit.command.DeleteCommand;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.papyrus.commands.wrappers.EMFtoGMFCommandWrapper;
-import org.eclipse.papyrus.sysml.diagram.parametric.providers.SysmlElementTypes;
-
-/**
- * @generated
- */
-public class ConnectorItemSemanticEditPolicy extends SysmlBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public ConnectorItemSemanticEditPolicy() {
- super(SysmlElementTypes.Connector_4001);
- }
-
- /**
- * @generated
- */
- protected Command getDestroyElementCommand(DestroyElementRequest req) {
- CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
- cmd.setTransactionNestingEnabled(true);
- List<EObject> todestroy = new ArrayList<EObject>();
- todestroy.add(req.getElementToDestroy());
- //cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req));
- cmd.add(new EMFtoGMFCommandWrapper(new DeleteCommand(getEditingDomain(), todestroy)));
- return getGEFWrapper(cmd.reduce());
- //return getGEFWrapper(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req));
- }
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/ConstraintPropertyCanonicalEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/ConstraintPropertyCanonicalEditPolicy.java
deleted file mode 100644
index 99700601603..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/ConstraintPropertyCanonicalEditPolicy.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.edit.policies;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
-import org.eclipse.gmf.runtime.diagram.ui.commands.DeferredLayoutCommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.commands.SetViewMutabilityCommand;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.Property2EditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlDiagramUpdater;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlNodeDescriptor;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlVisualIDRegistry;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class ConstraintPropertyCanonicalEditPolicy extends CanonicalEditPolicy {
-
- /**
- * @generated
- */
- protected void refreshOnActivate() {
- // Need to activate editpart children before invoking the canonical refresh for EditParts to add event listeners
- List<?> c = getHost().getChildren();
- for(int i = 0; i < c.size(); i++) {
- ((EditPart)c.get(i)).activate();
- }
- super.refreshOnActivate();
- }
-
- /**
- * @generated
- */
- protected EStructuralFeature getFeatureToSynchronize() {
- return UMLPackage.eINSTANCE.getStructuredClassifier_OwnedAttribute();
- }
-
- /**
- * @generated
- */
- @SuppressWarnings("rawtypes")
- protected List getSemanticChildrenList() {
- View viewObject = (View)getHost().getModel();
- LinkedList<EObject> result = new LinkedList<EObject>();
- List<SysmlNodeDescriptor> childDescriptors = SysmlDiagramUpdater.getConstraintProperty_2003SemanticChildren(viewObject);
- for(SysmlNodeDescriptor d : childDescriptors) {
- result.add(d.getModelElement());
- }
- return result;
- }
-
- /**
- * @generated
- */
- protected boolean isOrphaned(Collection<EObject> semanticChildren, final View view) {
- return isMyDiagramElement(view) && !semanticChildren.contains(view.getElement());
- }
-
- /**
- * @generated
- */
- private boolean isMyDiagramElement(View view) {
- return Property2EditPart.VISUAL_ID == SysmlVisualIDRegistry.getVisualID(view);
- }
-
- /**
- * @generated
- */
- protected void refreshSemantic() {
- if(resolveSemanticElement() == null) {
- return;
- }
- LinkedList<IAdaptable> createdViews = new LinkedList<IAdaptable>();
- List<SysmlNodeDescriptor> childDescriptors = SysmlDiagramUpdater.getConstraintProperty_2003SemanticChildren((View)getHost().getModel());
- LinkedList<View> orphaned = new LinkedList<View>();
- // we care to check only views we recognize as ours
- LinkedList<View> knownViewChildren = new LinkedList<View>();
- for(View v : getViewChildren()) {
- if(isMyDiagramElement(v)) {
- knownViewChildren.add(v);
- }
- }
- // alternative to #cleanCanonicalSemanticChildren(getViewChildren(), semanticChildren)
- //
- // iteration happens over list of desired semantic elements, trying to find best matching View, while original CEP
- // iterates views, potentially losing view (size/bounds) information - i.e. if there are few views to reference same EObject, only last one
- // to answer isOrphaned == true will be used for the domain element representation, see #cleanCanonicalSemanticChildren()
- for(Iterator<SysmlNodeDescriptor> descriptorsIterator = childDescriptors.iterator(); descriptorsIterator.hasNext();) {
- SysmlNodeDescriptor next = descriptorsIterator.next();
- String hint = SysmlVisualIDRegistry.getType(next.getVisualID());
- LinkedList<View> perfectMatch = new LinkedList<View>(); // both semanticElement and hint match that of NodeDescriptor
- for(View childView : getViewChildren()) {
- EObject semanticElement = childView.getElement();
- if(next.getModelElement().equals(semanticElement)) {
- if(hint.equals(childView.getType())) {
- perfectMatch.add(childView);
- // actually, can stop iteration over view children here, but
- // may want to use not the first view but last one as a 'real' match (the way original CEP does
- // with its trick with viewToSemanticMap inside #cleanCanonicalSemanticChildren
- }
- }
- }
- if(perfectMatch.size() > 0) {
- descriptorsIterator.remove(); // precise match found no need to create anything for the NodeDescriptor
- // use only one view (first or last?), keep rest as orphaned for further consideration
- knownViewChildren.remove(perfectMatch.getFirst());
- }
- }
- // those left in knownViewChildren are subject to removal - they are our diagram elements we didn't find match to,
- // or those we have potential matches to, and thus need to be recreated, preserving size/location information.
- orphaned.addAll(knownViewChildren);
- //
- ArrayList<CreateViewRequest.ViewDescriptor> viewDescriptors = new ArrayList<CreateViewRequest.ViewDescriptor>(childDescriptors.size());
- for(SysmlNodeDescriptor next : childDescriptors) {
- String hint = SysmlVisualIDRegistry.getType(next.getVisualID());
- IAdaptable elementAdapter = new CanonicalElementAdapter(next.getModelElement(), hint);
- CreateViewRequest.ViewDescriptor descriptor = new CreateViewRequest.ViewDescriptor(elementAdapter, Node.class, hint, ViewUtil.APPEND, false, host().getDiagramPreferencesHint());
- viewDescriptors.add(descriptor);
- }
-
- boolean changed = deleteViews(orphaned.iterator());
- //
- CreateViewRequest request = getCreateViewRequest(viewDescriptors);
- Command cmd = getCreateViewCommand(request);
- if(cmd != null && cmd.canExecute()) {
- SetViewMutabilityCommand.makeMutable(new EObjectAdapter(host().getNotationView())).execute();
- executeCommand(cmd);
- @SuppressWarnings("unchecked")
- List<IAdaptable> nl = (List<IAdaptable>)request.getNewObject();
- createdViews.addAll(nl);
- }
- if(changed || createdViews.size() > 0) {
- postProcessRefreshSemantic(createdViews);
- }
- if(createdViews.size() > 1) {
- // perform a layout of the container
- DeferredLayoutCommand layoutCmd = new DeferredLayoutCommand(host().getEditingDomain(), createdViews, host());
- executeCommand(new ICommandProxy(layoutCmd));
- }
-
- makeViewsImmutable(createdViews);
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/ConstraintPropertyItemSemanticEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/ConstraintPropertyItemSemanticEditPolicy.java
deleted file mode 100644
index f78e4a0e01d..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/ConstraintPropertyItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.edit.policies;
-
-import java.util.Iterator;
-
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.common.core.command.ICompositeCommand;
-import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.sysml.constraints.ConstraintProperty;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.commands.Property2CreateCommand;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.Property2EditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlVisualIDRegistry;
-import org.eclipse.papyrus.sysml.diagram.parametric.providers.SysmlElementTypes;
-import org.eclipse.uml2.uml.Property;
-
-/**
- * @generated
- */
-public class ConstraintPropertyItemSemanticEditPolicy extends SysmlBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public ConstraintPropertyItemSemanticEditPolicy() {
- super(SysmlElementTypes.ConstraintProperty_2003);
- }
-
- /**
- * @generated
- */
- protected Command getCreateCommand(CreateElementRequest req) {
- if(SysmlElementTypes.Property_3002 == req.getElementType()) {
- return getGEFWrapper(new Property2CreateCommand(req));
- }
- return super.getCreateCommand(req);
- }
-
- /**
- * @generated NOT delete property views if any
- */
- protected Command getDestroyElementCommand(DestroyElementRequest req) {
- View view = (View)getHost().getModel();
- CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
- cmd.setTransactionNestingEnabled(false);
- EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
- if(annotation == null) {
- // there are indirectly referenced children, need extra commands: true
- addDestroyChildNodesCommand(cmd);
- addDestroyShortcutsCommand(cmd, view);
- // delete host element
- cmd.add(new DestroyElementCommand(req));
- // destroy base property
- addDestroyBasePropertyCommand(cmd);
- } else {
- cmd.add(new DeleteCommand(getEditingDomain(), view));
- }
- return getGEFWrapper(cmd.reduce());
- }
-
- /**
- * Delete property views of the constraint property
- *
- * @generated NOT
- */
- private void addDestroyChildNodesCommand(ICompositeCommand cmd) {
- View view = (View)getHost().getModel();
- for(Iterator<?> nit = view.getChildren().iterator(); nit.hasNext();) {
- Node node = (Node)nit.next();
- switch(SysmlVisualIDRegistry.getVisualID(node)) {
- case Property2EditPart.VISUAL_ID:
- // only delete from diagram
- cmd.add(new DeleteCommand(getEditingDomain(), node));
- break;
- }
- }
- }
-
- /**
- * Delete the base property from the constraint property
- *
- * @generated NOT
- */
- private void addDestroyBasePropertyCommand(ICompositeCommand cmd) {
- View view = (View)getHost().getModel();
- EObject element = view.getElement();
- if(element instanceof ConstraintProperty) {
- Property property = ((ConstraintProperty)element).getBase_Property();
- if(property != null) {
- DestroyElementRequest request = new DestroyElementRequest(property, false);
- cmd.add(new DestroyElementCommand(request));
- }
- }
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/OpenDiagramEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/OpenDiagramEditPolicy.java
deleted file mode 100644
index 4547027e26f..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/OpenDiagramEditPolicy.java
+++ /dev/null
@@ -1,183 +0,0 @@
-package org.eclipse.papyrus.sysml.diagram.parametric.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.sysml.diagram.parametric.edit.parts.ParametricEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.Messages;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlDiagramEditor;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlDiagramEditorPlugin;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlDiagramEditorUtil;
-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);
- 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(SysmlDiagramEditorUtil.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 SysmlDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT;
- }
-
- /**
- * @generated
- */
- protected String getDiagramKind() {
- return ParametricEditPart.MODEL_ID;
- }
-
- /**
- * @generated
- */
- protected String getEditorID() {
- return SysmlDiagramEditor.ID;
- }
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/ParametricCanonicalEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/ParametricCanonicalEditPolicy.java
deleted file mode 100644
index 2bd26ca228a..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/ParametricCanonicalEditPolicy.java
+++ /dev/null
@@ -1,352 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.edit.policies;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
-import org.eclipse.gmf.runtime.diagram.ui.commands.DeferredLayoutCommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.commands.SetViewMutabilityCommand;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.Edge;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.resource.ResourcePackage;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ConnectorEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ConstraintPropertyEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ParametricEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.Property2EditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.PropertyEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlDiagramUpdater;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlLinkDescriptor;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlNodeDescriptor;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlVisualIDRegistry;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class ParametricCanonicalEditPolicy extends CanonicalEditPolicy {
-
- /**
- * @generated
- */
- private Set<EStructuralFeature> myFeaturesToSynchronize;
-
- /**
- * @generated
- */
- protected void refreshOnActivate() {
- // Need to activate editpart children before invoking the canonical refresh for EditParts to add event listeners
- List<?> c = getHost().getChildren();
- for(int i = 0; i < c.size(); i++) {
- ((EditPart)c.get(i)).activate();
- }
- super.refreshOnActivate();
- }
-
- /**
- * @generated
- */
- @SuppressWarnings("rawtypes")
- protected List getSemanticChildrenList() {
- View viewObject = (View)getHost().getModel();
- LinkedList<EObject> result = new LinkedList<EObject>();
- List<SysmlNodeDescriptor> childDescriptors = SysmlDiagramUpdater.getResource_1000SemanticChildren(viewObject);
- for(SysmlNodeDescriptor d : childDescriptors) {
- result.add(d.getModelElement());
- }
- return result;
- }
-
- /**
- * @generated
- */
- protected boolean isOrphaned(Collection<EObject> semanticChildren, final View view) {
- return isMyDiagramElement(view) && !semanticChildren.contains(view.getElement());
- }
-
- /**
- * @generated
- */
- private boolean isMyDiagramElement(View view) {
- int visualID = SysmlVisualIDRegistry.getVisualID(view);
- return visualID == ConstraintPropertyEditPart.VISUAL_ID || visualID == PropertyEditPart.VISUAL_ID;
- }
-
- /**
- * @generated
- */
- protected Set getFeaturesToSynchronize() {
- if(myFeaturesToSynchronize == null) {
- myFeaturesToSynchronize = new HashSet<EStructuralFeature>();
- myFeaturesToSynchronize.add(ResourcePackage.eINSTANCE.getResource_Eobjects());
- myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getStructuredClassifier_OwnedAttribute());
- }
- return myFeaturesToSynchronize;
- }
-
- /**
- * @generated
- */
- protected void refreshSemantic() {
- if(resolveSemanticElement() == null) {
- return;
- }
- LinkedList<IAdaptable> createdViews = new LinkedList<IAdaptable>();
- List<SysmlNodeDescriptor> childDescriptors = SysmlDiagramUpdater.getResource_1000SemanticChildren((View)getHost().getModel());
- LinkedList<View> orphaned = new LinkedList<View>();
- // we care to check only views we recognize as ours
- LinkedList<View> knownViewChildren = new LinkedList<View>();
- for(View v : getViewChildren()) {
- if(isMyDiagramElement(v)) {
- knownViewChildren.add(v);
- }
- }
- // alternative to #cleanCanonicalSemanticChildren(getViewChildren(), semanticChildren)
- //
- // iteration happens over list of desired semantic elements, trying to find best matching View, while original CEP
- // iterates views, potentially losing view (size/bounds) information - i.e. if there are few views to reference same EObject, only last one
- // to answer isOrphaned == true will be used for the domain element representation, see #cleanCanonicalSemanticChildren()
- for(Iterator<SysmlNodeDescriptor> descriptorsIterator = childDescriptors.iterator(); descriptorsIterator.hasNext();) {
- SysmlNodeDescriptor next = descriptorsIterator.next();
- String hint = SysmlVisualIDRegistry.getType(next.getVisualID());
- LinkedList<View> perfectMatch = new LinkedList<View>(); // both semanticElement and hint match that of NodeDescriptor
- for(View childView : getViewChildren()) {
- EObject semanticElement = childView.getElement();
- if(next.getModelElement().equals(semanticElement)) {
- if(hint.equals(childView.getType())) {
- perfectMatch.add(childView);
- // actually, can stop iteration over view children here, but
- // may want to use not the first view but last one as a 'real' match (the way original CEP does
- // with its trick with viewToSemanticMap inside #cleanCanonicalSemanticChildren
- }
- }
- }
- if(perfectMatch.size() > 0) {
- descriptorsIterator.remove(); // precise match found no need to create anything for the NodeDescriptor
- // use only one view (first or last?), keep rest as orphaned for further consideration
- knownViewChildren.remove(perfectMatch.getFirst());
- }
- }
- // those left in knownViewChildren are subject to removal - they are our diagram elements we didn't find match to,
- // or those we have potential matches to, and thus need to be recreated, preserving size/location information.
- orphaned.addAll(knownViewChildren);
- //
- ArrayList<CreateViewRequest.ViewDescriptor> viewDescriptors = new ArrayList<CreateViewRequest.ViewDescriptor>(childDescriptors.size());
- for(SysmlNodeDescriptor next : childDescriptors) {
- String hint = SysmlVisualIDRegistry.getType(next.getVisualID());
- IAdaptable elementAdapter = new CanonicalElementAdapter(next.getModelElement(), hint);
- CreateViewRequest.ViewDescriptor descriptor = new CreateViewRequest.ViewDescriptor(elementAdapter, Node.class, hint, ViewUtil.APPEND, false, host().getDiagramPreferencesHint());
- viewDescriptors.add(descriptor);
- }
-
- boolean changed = deleteViews(orphaned.iterator());
- //
- CreateViewRequest request = getCreateViewRequest(viewDescriptors);
- Command cmd = getCreateViewCommand(request);
- if(cmd != null && cmd.canExecute()) {
- SetViewMutabilityCommand.makeMutable(new EObjectAdapter(host().getNotationView())).execute();
- executeCommand(cmd);
- @SuppressWarnings("unchecked")
- List<IAdaptable> nl = (List<IAdaptable>)request.getNewObject();
- createdViews.addAll(nl);
- }
- if(changed || createdViews.size() > 0) {
- postProcessRefreshSemantic(createdViews);
- }
-
- Collection<IAdaptable> createdConnectionViews = refreshConnections();
-
- if(createdViews.size() > 1) {
- // perform a layout of the container
- DeferredLayoutCommand layoutCmd = new DeferredLayoutCommand(host().getEditingDomain(), createdViews, host());
- executeCommand(new ICommandProxy(layoutCmd));
- }
-
- createdViews.addAll(createdConnectionViews);
-
- makeViewsImmutable(createdViews);
- }
-
- /**
- * @generated
- */
- private Diagram getDiagram() {
- return ((View)getHost().getModel()).getDiagram();
- }
-
- /**
- * @generated
- */
- private Collection<IAdaptable> refreshConnections() {
- Map<EObject, View> domain2NotationMap = new HashMap<EObject, View>();
- Collection<SysmlLinkDescriptor> linkDescriptors = collectAllLinks(getDiagram(), domain2NotationMap);
- Collection existingLinks = new LinkedList(getDiagram().getEdges());
- for(Iterator linksIterator = existingLinks.iterator(); linksIterator.hasNext();) {
- Edge nextDiagramLink = (Edge)linksIterator.next();
- int diagramLinkVisualID = SysmlVisualIDRegistry.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<SysmlLinkDescriptor> linkDescriptorsIterator = linkDescriptors.iterator(); linkDescriptorsIterator.hasNext();) {
- SysmlLinkDescriptor nextLinkDescriptor = linkDescriptorsIterator.next();
- if(diagramLinkObject == nextLinkDescriptor.getModelElement() && diagramLinkSrc == nextLinkDescriptor.getSource() && diagramLinkDst == nextLinkDescriptor.getDestination() && diagramLinkVisualID == nextLinkDescriptor.getVisualID()) {
- linksIterator.remove();
- linkDescriptorsIterator.remove();
- break;
- }
- }
- }
- deleteViews(existingLinks.iterator());
- return createConnections(linkDescriptors, domain2NotationMap);
- }
-
- /**
- * @generated
- */
- private Collection<SysmlLinkDescriptor> collectAllLinks(View view, Map<EObject, View> domain2NotationMap) {
- if(!ParametricEditPart.MODEL_ID.equals(SysmlVisualIDRegistry.getModelID(view))) {
- return Collections.emptyList();
- }
- LinkedList<SysmlLinkDescriptor> result = new LinkedList<SysmlLinkDescriptor>();
- switch(SysmlVisualIDRegistry.getVisualID(view)) {
- case ParametricEditPart.VISUAL_ID:
- {
- if(!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(SysmlDiagramUpdater.getResource_1000ContainedLinks(view));
- }
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
- break;
- }
- case ConstraintPropertyEditPart.VISUAL_ID:
- {
- if(!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(SysmlDiagramUpdater.getConstraintProperty_2003ContainedLinks(view));
- }
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
- break;
- }
- case PropertyEditPart.VISUAL_ID:
- {
- if(!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(SysmlDiagramUpdater.getProperty_2005ContainedLinks(view));
- }
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
- break;
- }
- case Property2EditPart.VISUAL_ID:
- {
- if(!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(SysmlDiagramUpdater.getProperty_3002ContainedLinks(view));
- }
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
- break;
- }
- case ConnectorEditPart.VISUAL_ID:
- {
- if(!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(SysmlDiagramUpdater.getConnector_4001ContainedLinks(view));
- }
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
- break;
- }
- }
- for(Iterator children = view.getChildren().iterator(); children.hasNext();) {
- result.addAll(collectAllLinks((View)children.next(), domain2NotationMap));
- }
- for(Iterator edges = view.getSourceEdges().iterator(); edges.hasNext();) {
- result.addAll(collectAllLinks((View)edges.next(), domain2NotationMap));
- }
- return result;
- }
-
- /**
- * @generated
- */
- private Collection<IAdaptable> createConnections(Collection<SysmlLinkDescriptor> linkDescriptors, Map<EObject, View> domain2NotationMap) {
- LinkedList<IAdaptable> adapters = new LinkedList<IAdaptable>();
- for(SysmlLinkDescriptor nextLinkDescriptor : linkDescriptors) {
- EditPart sourceEditPart = getEditPart(nextLinkDescriptor.getSource(), domain2NotationMap);
- EditPart targetEditPart = getEditPart(nextLinkDescriptor.getDestination(), domain2NotationMap);
- if(sourceEditPart == null || targetEditPart == null) {
- continue;
- }
- CreateConnectionViewRequest.ConnectionViewDescriptor descriptor = new CreateConnectionViewRequest.ConnectionViewDescriptor(nextLinkDescriptor.getSemanticAdapter(), SysmlVisualIDRegistry.getType(nextLinkDescriptor.getVisualID()), ViewUtil.APPEND, false, ((IGraphicalEditPart)getHost()).getDiagramPreferencesHint());
- CreateConnectionViewRequest ccr = new CreateConnectionViewRequest(descriptor);
- ccr.setType(RequestConstants.REQ_CONNECTION_START);
- ccr.setSourceEditPart(sourceEditPart);
- sourceEditPart.getCommand(ccr);
- ccr.setTargetEditPart(targetEditPart);
- ccr.setType(RequestConstants.REQ_CONNECTION_END);
- Command cmd = targetEditPart.getCommand(ccr);
- if(cmd != null && cmd.canExecute()) {
- executeCommand(cmd);
- IAdaptable viewAdapter = (IAdaptable)ccr.getNewObject();
- if(viewAdapter != null) {
- adapters.add(viewAdapter);
- }
- }
- }
- return adapters;
- }
-
- /**
- * @generated
- */
- private EditPart getEditPart(EObject domainModelElement, Map<EObject, View> domain2NotationMap) {
- View view = (View)domain2NotationMap.get(domainModelElement);
- if(view != null) {
- return (EditPart)getHost().getViewer().getEditPartRegistry().get(view);
- }
- return null;
- }
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/ParametricItemSemanticEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/ParametricItemSemanticEditPolicy.java
deleted file mode 100644
index 6527fe2543f..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/ParametricItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.edit.policies;
-
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.commands.ConstraintPropertyCreateCommand;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.commands.PropertyCreateCommand;
-import org.eclipse.papyrus.sysml.diagram.parametric.providers.SysmlElementTypes;
-import org.eclipse.papyrus.uml.diagram.common.commands.DuplicateNamedElementCommand;
-
-/**
- * @generated
- */
-public class ParametricItemSemanticEditPolicy extends SysmlBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public ParametricItemSemanticEditPolicy() {
- super(SysmlElementTypes.Resource_1000);
- }
-
- /**
- * @generated
- */
- protected Command getCreateCommand(CreateElementRequest req) {
- if(SysmlElementTypes.ConstraintProperty_2003 == req.getElementType()) {
- return getGEFWrapper(new ConstraintPropertyCreateCommand(req));
- }
- if(SysmlElementTypes.Property_2005 == req.getElementType()) {
- return getGEFWrapper(new PropertyCreateCommand(req));
- }
- return super.getCreateCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getDuplicateCommand(DuplicateElementsRequest req) {
- TransactionalEditingDomain editingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
- Diagram currentDiagram = null;
- if(getHost() instanceof IGraphicalEditPart) {
- currentDiagram = ((IGraphicalEditPart)getHost()).getNotationView().getDiagram();
- }
- return getGEFWrapper(new DuplicateAnythingCommand(editingDomain, req, currentDiagram));
- }
-
- /**
- * @generated
- */
- private static class DuplicateAnythingCommand extends DuplicateNamedElementCommand {
-
- private Diagram diagram;
-
- /**
- * @generated
- */
- public DuplicateAnythingCommand(TransactionalEditingDomain editingDomain, DuplicateElementsRequest req, Diagram currentDiagram) {
- super(editingDomain, req.getLabel(), req.getElementsToBeDuplicated(), req.getAllDuplicatedElementsMap(), currentDiagram);
- this.diagram = currentDiagram;
- }
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/Property2ItemSemanticEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/Property2ItemSemanticEditPolicy.java
deleted file mode 100644
index d20e4f32699..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/Property2ItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.edit.policies;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.commands.wrappers.EMFtoGMFCommandWrapper;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.commands.ConnectorCreateCommand;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.commands.ConnectorReorientCommand;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ConnectorEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.providers.SysmlElementTypes;
-
-/**
- * @generated
- */
-public class Property2ItemSemanticEditPolicy extends SysmlBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public Property2ItemSemanticEditPolicy() {
- super(SysmlElementTypes.Property_3002);
- }
-
- /**
- * @generated
- */
- protected Command getDestroyElementCommand(DestroyElementRequest req) {
- View view = (View)getHost().getModel();
- CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
- cmd.setTransactionNestingEnabled(true);
-
- EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
- if(annotation == null) {
- // there are indirectly referenced children, need extra commands: false
- addDestroyShortcutsCommand(cmd, view);
- // delete host element
- List<EObject> todestroy = new ArrayList<EObject>();
- todestroy.add(req.getElementToDestroy());
- //cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req));
- cmd.add(new EMFtoGMFCommandWrapper(new org.eclipse.emf.edit.command.DeleteCommand(getEditingDomain(), todestroy)));
- } else {
- cmd.add(new DeleteCommand(getEditingDomain(), view));
- }
- return getGEFWrapper(cmd.reduce());
- }
-
- /**
- * @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(SysmlElementTypes.Connector_4001 == req.getElementType()) {
- return getGEFWrapper(new ConnectorCreateCommand(req, req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
- if(SysmlElementTypes.Connector_4001 == req.getElementType()) {
- return getGEFWrapper(new ConnectorCreateCommand(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 ConnectorEditPart.VISUAL_ID:
- return getGEFWrapper(new ConnectorReorientCommand(req));
- }
- return super.getReorientRelationshipCommand(req);
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/PropertyItemSemanticEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/PropertyItemSemanticEditPolicy.java
deleted file mode 100644
index 454d4191050..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/PropertyItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.edit.policies;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.commands.wrappers.EMFtoGMFCommandWrapper;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.commands.ConnectorCreateCommand;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.commands.ConnectorReorientCommand;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ConnectorEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.providers.SysmlElementTypes;
-
-/**
- * @generated
- */
-public class PropertyItemSemanticEditPolicy extends SysmlBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public PropertyItemSemanticEditPolicy() {
- super(SysmlElementTypes.Property_2005);
- }
-
- /**
- * @generated
- */
- protected Command getDestroyElementCommand(DestroyElementRequest req) {
- View view = (View)getHost().getModel();
- CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
- cmd.setTransactionNestingEnabled(true);
-
- EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
- if(annotation == null) {
- // there are indirectly referenced children, need extra commands: false
- addDestroyShortcutsCommand(cmd, view);
- // delete host element
- List<EObject> todestroy = new ArrayList<EObject>();
- todestroy.add(req.getElementToDestroy());
- //cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req));
- cmd.add(new EMFtoGMFCommandWrapper(new org.eclipse.emf.edit.command.DeleteCommand(getEditingDomain(), todestroy)));
- } else {
- cmd.add(new DeleteCommand(getEditingDomain(), view));
- }
- return getGEFWrapper(cmd.reduce());
- }
-
- /**
- * @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(SysmlElementTypes.Connector_4001 == req.getElementType()) {
- return getGEFWrapper(new ConnectorCreateCommand(req, req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
- if(SysmlElementTypes.Connector_4001 == req.getElementType()) {
- return getGEFWrapper(new ConnectorCreateCommand(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 ConnectorEditPart.VISUAL_ID:
- return getGEFWrapper(new ConnectorReorientCommand(req));
- }
- return super.getReorientRelationshipCommand(req);
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/SysmlBaseItemSemanticEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/SysmlBaseItemSemanticEditPolicy.java
deleted file mode 100644
index 0aa86973d06..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/SysmlBaseItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,379 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.edit.policies;
-
-import java.util.Iterator;
-
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gef.requests.ReconnectRequest;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.common.core.command.ICompositeCommand;
-import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.SemanticEditPolicy;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.commands.MoveElementsCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.GetEditContextRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.helpers.SysmlBaseEditHelper;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlDiagramEditorPlugin;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlVisualIDRegistry;
-import org.eclipse.papyrus.sysml.diagram.parametric.providers.SysmlElementTypes;
-import org.eclipse.uml2.uml.ConnectableElement;
-import org.eclipse.uml2.uml.Connector;
-import org.eclipse.uml2.uml.StructuredClassifier;
-import org.eclipse.uml2.uml.Type;
-
-/**
- * @generated
- */
-public class SysmlBaseItemSemanticEditPolicy extends SemanticEditPolicy {
-
- /**
- * Extended request data key to hold editpart visual id.
- *
- * @generated
- */
- public static final String VISUAL_ID_KEY = "visual_id"; //$NON-NLS-1$
-
- /**
- * Extended request data key to hold the edge view during a reconnect request.
- *
- * @generated
- */
- public static final String GRAPHICAL_RECONNECTED_EDGE = "graphical_edge"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- private final IElementType myElementType;
-
- /**
- * @generated
- */
- protected SysmlBaseItemSemanticEditPolicy(IElementType elementType) {
- myElementType = elementType;
- }
-
- /**
- * Extended request data key to hold editpart visual id. Add visual id of edited editpart to
- * extended data of the request so command switch can decide what kind of diagram element is
- * being edited. It is done in those cases when it's not possible to deduce diagram element kind
- * from domain element.
- *
- * @generated
- */
- @SuppressWarnings("unchecked")
- public Command getCommand(Request request) {
- if(request instanceof ReconnectRequest) {
- Object view = ((ReconnectRequest)request).getConnectionEditPart().getModel();
- if(view instanceof View) {
- Integer id = new Integer(SysmlVisualIDRegistry.getVisualID((View)view));
- request.getExtendedData().put(VISUAL_ID_KEY, id);
- request.getExtendedData().put(GRAPHICAL_RECONNECTED_EDGE, (View)view);
- }
- }
- return super.getCommand(request);
- }
-
- /**
- * Returns visual id from request parameters.
- *
- * @generated
- */
- protected int getVisualID(IEditCommandRequest request) {
- Object id = request.getParameter(VISUAL_ID_KEY);
- return id instanceof Integer ? ((Integer)id).intValue() : -1;
- }
-
- /**
- * @generated
- */
- protected Command getSemanticCommand(IEditCommandRequest request) {
- IEditCommandRequest completedRequest = completeRequest(request);
- Command semanticCommand = getSemanticCommandSwitch(completedRequest);
- semanticCommand = getEditHelperCommand(completedRequest, semanticCommand);
- if(completedRequest instanceof DestroyRequest) {
- DestroyRequest destroyRequest = (DestroyRequest)completedRequest;
- return shouldProceed(destroyRequest) ? addDeleteViewCommand(semanticCommand, destroyRequest) : null;
- }
- return semanticCommand;
- }
-
- /**
- * @generated
- */
- protected Command addDeleteViewCommand(Command mainCommand, DestroyRequest completedRequest) {
- Command deleteViewCommand = getGEFWrapper(new DeleteCommand(getEditingDomain(), (View)getHost().getModel()));
- return mainCommand == null ? deleteViewCommand : mainCommand.chain(deleteViewCommand);
- }
-
- /**
- * @generated
- */
- private Command getEditHelperCommand(IEditCommandRequest request, Command editPolicyCommand) {
- if(editPolicyCommand != null) {
- ICommand command = editPolicyCommand instanceof ICommandProxy ? ((ICommandProxy)editPolicyCommand).getICommand() : new CommandProxy(editPolicyCommand);
- request.setParameter(SysmlBaseEditHelper.EDIT_POLICY_COMMAND, command);
- }
- IElementType requestContextElementType = getContextElementType(request);
- request.setParameter(SysmlBaseEditHelper.CONTEXT_ELEMENT_TYPE, requestContextElementType);
- ICommand command = requestContextElementType.getEditCommand(request);
- request.setParameter(SysmlBaseEditHelper.EDIT_POLICY_COMMAND, null);
- request.setParameter(SysmlBaseEditHelper.CONTEXT_ELEMENT_TYPE, null);
- if(command != null) {
- if(!(command instanceof CompositeTransactionalCommand)) {
- command = new CompositeTransactionalCommand(getEditingDomain(), command.getLabel()).compose(command);
- }
- return new ICommandProxy(command);
- }
- return editPolicyCommand;
- }
-
- /**
- * @generated
- */
- protected IElementType getContextElementType(IEditCommandRequest request) {
- IElementType requestContextElementType = SysmlElementTypes.getElementType(getVisualID(request));
- return requestContextElementType != null ? requestContextElementType : myElementType;
- }
-
- /**
- * @generated
- */
- protected Command getSemanticCommandSwitch(IEditCommandRequest req) {
- if(req instanceof CreateRelationshipRequest) {
- return getCreateRelationshipCommand((CreateRelationshipRequest)req);
- } else if(req instanceof CreateElementRequest) {
- return getCreateCommand((CreateElementRequest)req);
- } else if(req instanceof ConfigureRequest) {
- return getConfigureCommand((ConfigureRequest)req);
- } else if(req instanceof DestroyElementRequest) {
- return getDestroyElementCommand((DestroyElementRequest)req);
- } else if(req instanceof DestroyReferenceRequest) {
- return getDestroyReferenceCommand((DestroyReferenceRequest)req);
- } else if(req instanceof DuplicateElementsRequest) {
- return getDuplicateCommand((DuplicateElementsRequest)req);
- } else if(req instanceof GetEditContextRequest) {
- return getEditContextCommand((GetEditContextRequest)req);
- } else if(req instanceof MoveRequest) {
- return getMoveCommand((MoveRequest)req);
- } else if(req instanceof ReorientReferenceRelationshipRequest) {
- return getReorientReferenceRelationshipCommand((ReorientReferenceRelationshipRequest)req);
- } else if(req instanceof ReorientRelationshipRequest) {
- return getReorientRelationshipCommand((ReorientRelationshipRequest)req);
- } else if(req instanceof SetRequest) {
- return getSetCommand((SetRequest)req);
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getConfigureCommand(ConfigureRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCreateCommand(CreateElementRequest req) {
- // check if the type is an extended type, and then create directly the element...
- IElementType type = req.getElementType();
- if(type instanceof IExtendedHintedElementType) {
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(req.getContainer());
- if(provider == null) {
- return UnexecutableCommand.INSTANCE;
- }
-
- // Retrieve create command from the Element Edit service
- ICommand createGMFCommand = provider.getEditCommand(req);
-
- return getGEFWrapper(createGMFCommand);
- }
-
- 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 getGEFWrapper(new MoveElementsCommand(req));
-
- }
-
- /**
- * @generated
- */
- protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- * @generated
- */
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- * @generated
- */
- protected final Command getGEFWrapper(ICommand cmd) {
- return new ICommandProxy(cmd);
- }
-
- /**
- * Returns editing domain from the host edit part.
- *
- * @generated
- */
- protected TransactionalEditingDomain getEditingDomain() {
- return ((IGraphicalEditPart)getHost()).getEditingDomain();
- }
-
- /**
- * Clean all shortcuts to the host element from the same diagram
- *
- * @generated
- */
- protected void addDestroyShortcutsCommand(ICompositeCommand cmd, View view) {
- assert view.getEAnnotation("Shortcut") == null; //$NON-NLS-1$
- for(Iterator it = view.getDiagram().getChildren().iterator(); it.hasNext();) {
- View nextView = (View)it.next();
- if(nextView.getEAnnotation("Shortcut") == null || !nextView.isSetElement() || nextView.getElement() != view.getElement()) { //$NON-NLS-1$
- continue;
- }
- cmd.add(new DeleteCommand(getEditingDomain(), nextView));
- }
- }
-
- /**
- * @generated
- */
- public static LinkConstraints getLinkConstraints() {
- LinkConstraints cached = SysmlDiagramEditorPlugin.getInstance().getLinkConstraints();
- if(cached == null) {
- SysmlDiagramEditorPlugin.getInstance().setLinkConstraints(cached = new LinkConstraints());
- }
- return cached;
- }
-
- /**
- * @generated
- */
- public static class LinkConstraints {
-
- /**
- * @generated
- */
- public LinkConstraints() {
- // use static method #getLinkConstraints() to access instance
- }
-
- /**
- * @generated
- */
- public boolean canCreateConnector_4001(StructuredClassifier container, ConnectableElement source, ConnectableElement target) {
- return canExistConnector_4001(container, null, source, target);
- }
-
- /**
- * @generated
- */
- public boolean canExistConnector_4001(StructuredClassifier container, Connector linkInstance, ConnectableElement source, ConnectableElement target) {
- return true;
- }
-
- /**
- * Connector source and target must have the salme type
- *
- * @generated NOT
- */
- public static boolean canExistConnector_4001(StructuredClassifier container, ConnectableElement source, ConnectableElement target) {
- Type sourceType = (source == null) ? null : source.getType();
- Type targetType = (target == null) ? null : target.getType();
- if(sourceType != null && target == null) {
- return true;
- }
- return (sourceType != null && targetType != null && sourceType.equals(targetType));
- }
- }
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/SysmlTextNonResizableEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/SysmlTextNonResizableEditPolicy.java
deleted file mode 100644
index 8265437bfd2..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/SysmlTextNonResizableEditPolicy.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.edit.policies;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.FigureListener;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.handles.MoveHandle;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.NonResizableEditPolicyEx;
-import org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-
-/**
- * @generated
- */
-public class SysmlTextNonResizableEditPolicy extends NonResizableEditPolicyEx {
-
- /**
- * @generated
- */
- private IFigure selectionFeedbackFigure;
-
- /**
- * @generated
- */
- private IFigure focusFeedbackFigure;
-
- /**
- * @generated
- */
- private FigureListener hostPositionListener;
-
- /**
- * @generated
- */
- protected void showPrimarySelection() {
- if(getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getHostFigure()).setSelected(true);
- ((WrappingLabel)getHostFigure()).setFocus(true);
- } else {
- showSelection();
- showFocus();
- }
- }
-
- /**
- * @generated
- */
- protected void showSelection() {
- if(getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getHostFigure()).setSelected(true);
- ((WrappingLabel)getHostFigure()).setFocus(false);
- } else {
- hideSelection();
- addFeedback(selectionFeedbackFigure = createSelectionFeedbackFigure());
- getHostFigure().addFigureListener(getHostPositionListener());
- refreshSelectionFeedback();
- hideFocus();
- }
- }
-
- /**
- * @generated
- */
- protected void hideSelection() {
- if(getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getHostFigure()).setSelected(false);
- ((WrappingLabel)getHostFigure()).setFocus(false);
- } else {
- if(selectionFeedbackFigure != null) {
- removeFeedback(selectionFeedbackFigure);
- getHostFigure().removeFigureListener(getHostPositionListener());
- selectionFeedbackFigure = null;
- }
- hideFocus();
- }
- }
-
- /**
- * @generated
- */
- 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
- */
- private FigureListener getHostPositionListener() {
- if(hostPositionListener == null) {
- hostPositionListener = new FigureListener() {
-
- public void figureMoved(IFigure source) {
- refreshFeedback();
- }
- };
- }
- return hostPositionListener;
- }
-
- /**
- * @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/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/SysmlTextSelectionEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/SysmlTextSelectionEditPolicy.java
deleted file mode 100644
index 3e5d81b4e4c..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/policies/SysmlTextSelectionEditPolicy.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.edit.policies;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.FigureListener;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.editpolicies.SelectionEditPolicy;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-
-/**
- * @generated
- */
-public class SysmlTextSelectionEditPolicy extends SelectionEditPolicy {
-
- /**
- * @generated
- */
- private IFigure selectionFeedbackFigure;
-
- /**
- * @generated
- */
- private IFigure focusFeedbackFigure;
-
- /**
- * @generated
- */
- private FigureListener hostPositionListener;
-
- /**
- * @generated
- */
- protected void showPrimarySelection() {
- if(getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getHostFigure()).setSelected(true);
- ((WrappingLabel)getHostFigure()).setFocus(true);
- } else {
- showSelection();
- showFocus();
- }
- }
-
- /**
- * @generated
- */
- protected void showSelection() {
- if(getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getHostFigure()).setSelected(true);
- ((WrappingLabel)getHostFigure()).setFocus(false);
- } else {
- hideSelection();
- addFeedback(selectionFeedbackFigure = createSelectionFeedbackFigure());
- getHostFigure().addFigureListener(getHostPositionListener());
- refreshSelectionFeedback();
- hideFocus();
- }
- }
-
- /**
- * @generated
- */
- protected void hideSelection() {
- if(getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getHostFigure()).setSelected(false);
- ((WrappingLabel)getHostFigure()).setFocus(false);
- } else {
- if(selectionFeedbackFigure != null) {
- removeFeedback(selectionFeedbackFigure);
- getHostFigure().removeFigureListener(getHostPositionListener());
- selectionFeedbackFigure = null;
- }
- hideFocus();
- }
- }
-
- /**
- * @generated
- */
- 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
- */
- private FigureListener getHostPositionListener() {
- if(hostPositionListener == null) {
- hostPositionListener = new FigureListener() {
-
- public void figureMoved(IFigure source) {
- refreshFeedback();
- }
- };
- }
- return hostPositionListener;
- }
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/figures/CustomBlockPropertyCompositeFigure.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/figures/CustomBlockPropertyCompositeFigure.java
new file mode 100644
index 00000000000..29fd7629c05
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/figures/CustomBlockPropertyCompositeFigure.java
@@ -0,0 +1,24 @@
+package org.eclipse.papyrus.sysml.diagram.parametric.figures;
+
+import org.eclipse.draw2d.Label;
+import org.eclipse.papyrus.sysml.diagram.common.figure.BlockPropertyCompositeFigure;
+
+public class CustomBlockPropertyCompositeFigure extends
+ BlockPropertyCompositeFigure {
+
+ @Override
+ protected void initTagLabel(String value) {
+ // do nothing: we don't want a two lines element (tag + name)
+ }
+
+ @Override
+ public Label getTaggedLabel() {
+ // return a mock Label
+ return new Label();
+ }
+
+ @Override
+ public void setNameLabelIcon(boolean displayNameLabelIcon) {
+ getNameLabel().setIcon(null);
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/helpers/PropertyEditHelper.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/figures/ParametricDiagramFrameFigure.java
index 1cbb9085b15..098c23ec740 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/helpers/PropertyEditHelper.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/figures/ParametricDiagramFrameFigure.java
@@ -1,20 +1,17 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.edit.helpers;
-
-/**
- * @generated
- */
-public class PropertyEditHelper extends SysmlBaseEditHelper {
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.parametric.figures;
+
+import org.eclipse.papyrus.sysml.diagram.common.figure.SysMLDiagramFrameFigure;
+
+public class ParametricDiagramFrameFigure extends SysMLDiagramFrameFigure {
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/navigator/SysmlAbstractNavigatorItem.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/navigator/SysmlAbstractNavigatorItem.java
deleted file mode 100644
index c8dacc0ac93..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/navigator/SysmlAbstractNavigatorItem.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.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 SysmlAbstractNavigatorItem extends PlatformObject {
-
- /**
- * @generated
- */
- static {
- final Class[] supportedTypes = new Class[]{ ITabbedPropertySheetPageContributor.class };
- final ITabbedPropertySheetPageContributor propertySheetPageContributor = new ITabbedPropertySheetPageContributor() {
-
- public String getContributorId() {
- return "org.eclipse.papyrus.sysml.diagram.parametric"; //$NON-NLS-1$
- }
- };
- Platform.getAdapterManager().registerAdapters(new IAdapterFactory() {
-
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if(adaptableObject instanceof org.eclipse.papyrus.sysml.diagram.parametric.navigator.SysmlAbstractNavigatorItem && adapterType == ITabbedPropertySheetPageContributor.class) {
- return propertySheetPageContributor;
- }
- return null;
- }
-
- public Class[] getAdapterList() {
- return supportedTypes;
- }
- }, org.eclipse.papyrus.sysml.diagram.parametric.navigator.SysmlAbstractNavigatorItem.class);
- }
-
- /**
- * @generated
- */
- private Object myParent;
-
- /**
- * @generated
- */
- protected SysmlAbstractNavigatorItem(Object parent) {
- myParent = parent;
- }
-
- /**
- * @generated
- */
- public Object getParent() {
- return myParent;
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/navigator/SysmlDomainNavigatorContentProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/navigator/SysmlDomainNavigatorContentProvider.java
deleted file mode 100644
index 2125893f31e..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/navigator/SysmlDomainNavigatorContentProvider.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.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.sysml.diagram.parametric.part.SysmlDiagramEditorPlugin;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.navigator.ICommonContentExtensionSite;
-import org.eclipse.ui.navigator.ICommonContentProvider;
-
-/**
- * @generated
- */
-public class SysmlDomainNavigatorContentProvider 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 SysmlDomainNavigatorContentProvider() {
- myAdapterFctoryContentProvier = new AdapterFactoryContentProvider(SysmlDiagramEditorPlugin.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 SysmlDomainNavigatorItem) {
- return wrapEObjects(myAdapterFctoryContentProvier.getChildren(((SysmlDomainNavigatorItem)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 SysmlDomainNavigatorItem((EObject)objects[i], parentElement, myAdapterFctoryContentProvier));
- }
- }
- return result.toArray();
- }
-
- /**
- * @generated
- */
- public Object getParent(Object element) {
- if(element instanceof SysmlAbstractNavigatorItem) {
- SysmlAbstractNavigatorItem abstractNavigatorItem = (SysmlAbstractNavigatorItem)element;
- return abstractNavigatorItem.getParent();
- }
- return null;
- }
-
- /**
- * @generated
- */
- public boolean hasChildren(Object element) {
- return element instanceof IFile || getChildren(element).length > 0;
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/navigator/SysmlDomainNavigatorItem.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/navigator/SysmlDomainNavigatorItem.java
deleted file mode 100644
index 446065f92c8..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/navigator/SysmlDomainNavigatorItem.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.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 SysmlDomainNavigatorItem 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.sysml.diagram.parametric.navigator.SysmlDomainNavigatorItem) {
- org.eclipse.papyrus.sysml.diagram.parametric.navigator.SysmlDomainNavigatorItem domainNavigatorItem = (org.eclipse.papyrus.sysml.diagram.parametric.navigator.SysmlDomainNavigatorItem)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.sysml.diagram.parametric.navigator.SysmlDomainNavigatorItem.class);
- }
-
- /**
- * @generated
- */
- private Object myParent;
-
- /**
- * @generated
- */
- private EObject myEObject;
-
- /**
- * @generated
- */
- private IPropertySourceProvider myPropertySourceProvider;
-
- /**
- * @generated
- */
- public SysmlDomainNavigatorItem(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.sysml.diagram.parametric.navigator.SysmlDomainNavigatorItem) {
- return EcoreUtil.getURI(getEObject()).equals(EcoreUtil.getURI(((org.eclipse.papyrus.sysml.diagram.parametric.navigator.SysmlDomainNavigatorItem)obj).getEObject()));
- }
- return super.equals(obj);
- }
-
- /**
- * @generated
- */
- public int hashCode() {
- return EcoreUtil.getURI(getEObject()).hashCode();
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/navigator/SysmlDomainNavigatorLabelProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/navigator/SysmlDomainNavigatorLabelProvider.java
deleted file mode 100644
index 935c470715a..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/navigator/SysmlDomainNavigatorLabelProvider.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.navigator;
-
-import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlDiagramEditorPlugin;
-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 SysmlDomainNavigatorLabelProvider implements ICommonLabelProvider {
-
- /**
- * @generated
- */
- private AdapterFactoryLabelProvider myAdapterFactoryLabelProvider = new AdapterFactoryLabelProvider(SysmlDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory());
-
- /**
- * @generated
- */
- public void init(ICommonContentExtensionSite aConfig) {
- }
-
- /**
- * @generated
- */
- public Image getImage(Object element) {
- if(element instanceof SysmlDomainNavigatorItem) {
- return myAdapterFactoryLabelProvider.getImage(((SysmlDomainNavigatorItem)element).getEObject());
- }
- return null;
- }
-
- /**
- * @generated
- */
- public String getText(Object element) {
- if(element instanceof SysmlDomainNavigatorItem) {
- return myAdapterFactoryLabelProvider.getText(((SysmlDomainNavigatorItem)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/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/navigator/SysmlNavigatorActionProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/navigator/SysmlNavigatorActionProvider.java
deleted file mode 100644
index 5f39e88f3e8..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/navigator/SysmlNavigatorActionProvider.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.navigator;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.ui.URIEditorInput;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ParametricEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.Messages;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlDiagramEditor;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlDiagramEditorPlugin;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlVisualIDRegistry;
-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 SysmlNavigatorActionProvider 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 static 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 SysmlNavigatorItem) {
- selectedElement = ((SysmlNavigatorItem)selectedElement).getView();
- } else if(selectedElement instanceof IAdaptable) {
- selectedElement = ((IAdaptable)selectedElement).getAdapter(View.class);
- }
- if(selectedElement instanceof Diagram) {
- Diagram diagram = (Diagram)selectedElement;
- if(ParametricEditPart.MODEL_ID.equals(SysmlVisualIDRegistry.getModelID(diagram))) {
- myDiagram = diagram;
- }
- }
- }
- setEnabled(myDiagram != null);
- }
-
- /**
- * @generated
- */
- public void run() {
- if(myDiagram == null || myDiagram.eResource() == null) {
- return;
- }
-
- IEditorInput editorInput = getEditorInput(myDiagram);
- IWorkbenchPage page = myViewerSite.getPage();
- try {
- page.openEditor(editorInput, SysmlDiagramEditor.ID);
- } catch (PartInitException e) {
- SysmlDiagramEditorPlugin.getInstance().logError("Exception while openning diagram", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- private static IEditorInput getEditorInput(Diagram diagram) {
- Resource diagramResource = diagram.eResource();
- for(EObject nextEObject : diagramResource.getContents()) {
- if(nextEObject == diagram) {
- return new FileEditorInput(WorkspaceSynchronizer.getFile(diagramResource));
- }
- if(nextEObject instanceof Diagram) {
- break;
- }
- }
- URI uri = EcoreUtil.getURI(diagram);
- String editorName = uri.lastSegment() + '#' + diagram.eResource().getContents().indexOf(diagram);
- IEditorInput editorInput = new URIEditorInput(uri, editorName);
- return editorInput;
- }
-
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/navigator/SysmlNavigatorContentProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/navigator/SysmlNavigatorContentProvider.java
deleted file mode 100644
index aca9e5814e2..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/navigator/SysmlNavigatorContentProvider.java
+++ /dev/null
@@ -1,503 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.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.sysml.diagram.parametric.edit.parts.ConnectorEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ConstraintPropertyEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ParametricEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.Property2EditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.PropertyEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.Messages;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlVisualIDRegistry;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.navigator.ICommonContentExtensionSite;
-import org.eclipse.ui.navigator.ICommonContentProvider;
-
-/**
- * @generated
- */
-public class SysmlNavigatorContentProvider implements ICommonContentProvider {
-
- /**
- * @generated
- */
- private static final Object[] EMPTY_ARRAY = new Object[0];
-
- /**
- * @generated
- */
- private Viewer myViewer;
-
- /**
- * @generated
- */
- private AdapterFactoryEditingDomain myEditingDomain;
-
- /**
- * @generated
- */
- private WorkspaceSynchronizer myWorkspaceSynchronizer;
-
- /**
- * @generated
- */
- private Runnable myViewerRefreshRunnable;
-
- /**
- * @generated
- */
- @SuppressWarnings({ "unchecked", "serial", "rawtypes" })
- public SysmlNavigatorContentProvider() {
- 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;
- }
- });
- }
-
- /**
- *
- * Papyrus Template this method is a modification of gmf code in order to avoid
- * getViewChidreen() method becoming greater than 64kb.
- *
- * @generated
- **/
- private Object[] getViewChildrenForParametricEditPart(View view, Object parentElement) {
- Collection result = new ArrayList();
- SysmlNavigatorGroup links = new SysmlNavigatorGroup(Messages.NavigatorGroupName_Resource_1000_links, "icons/linksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
- Collection connectedViews = getChildrenByType(Collections.singleton(view), SysmlVisualIDRegistry.getType(ConstraintPropertyEditPart.VISUAL_ID));
- result.addAll(createNavigatorItems(connectedViews, parentElement, false));
- connectedViews = getChildrenByType(Collections.singleton(view), SysmlVisualIDRegistry.getType(PropertyEditPart.VISUAL_ID));
- result.addAll(createNavigatorItems(connectedViews, parentElement, false));
- connectedViews = getDiagramLinksByType(Collections.singleton(view), SysmlVisualIDRegistry.getType(ConnectorEditPart.VISUAL_ID));
- links.addChildren(createNavigatorItems(connectedViews, links, false));
- if(!links.isEmpty()) {
- result.add(links);
- }
- return result.toArray();
- }
-
- /**
- *
- * Papyrus Template this method is a modification of gmf code in order to avoid
- * getViewChidreen() method becoming greater than 64kb.
- *
- * @generated
- **/
- private Object[] getViewChildrenForConstraintPropertyEditPart(View view, Object parentElement) {
- Collection result = new ArrayList();
- Collection connectedViews = getChildrenByType(Collections.singleton(view), SysmlVisualIDRegistry.getType(Property2EditPart.VISUAL_ID));
- result.addAll(createNavigatorItems(connectedViews, parentElement, false));
- return result.toArray();
- }
-
- /**
- *
- * Papyrus Template this method is a modification of gmf code in order to avoid
- * getViewChidreen() method becoming greater than 64kb.
- *
- * @generated
- **/
- private Object[] getViewChildrenForPropertyEditPart(View view, Object parentElement) {
- Collection result = new ArrayList();
- SysmlNavigatorGroup incominglinks = new SysmlNavigatorGroup(Messages.NavigatorGroupName_Property_2005_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
- SysmlNavigatorGroup outgoinglinks = new SysmlNavigatorGroup(Messages.NavigatorGroupName_Property_2005_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
- Collection connectedViews = getIncomingLinksByType(Collections.singleton(view), SysmlVisualIDRegistry.getType(ConnectorEditPart.VISUAL_ID));
- incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
- connectedViews = getOutgoingLinksByType(Collections.singleton(view), SysmlVisualIDRegistry.getType(ConnectorEditPart.VISUAL_ID));
- outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
- if(!incominglinks.isEmpty()) {
- result.add(incominglinks);
- }
- if(!outgoinglinks.isEmpty()) {
- result.add(outgoinglinks);
- }
- return result.toArray();
- }
-
- /**
- *
- * Papyrus Template this method is a modification of gmf code in order to avoid
- * getViewChidreen() method becoming greater than 64kb.
- *
- * @generated
- **/
- private Object[] getViewChildrenForProperty2EditPart(View view, Object parentElement) {
- Collection result = new ArrayList();
- SysmlNavigatorGroup incominglinks = new SysmlNavigatorGroup(Messages.NavigatorGroupName_Property_3002_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
- SysmlNavigatorGroup outgoinglinks = new SysmlNavigatorGroup(Messages.NavigatorGroupName_Property_3002_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
- Collection connectedViews = getIncomingLinksByType(Collections.singleton(view), SysmlVisualIDRegistry.getType(ConnectorEditPart.VISUAL_ID));
- incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
- connectedViews = getOutgoingLinksByType(Collections.singleton(view), SysmlVisualIDRegistry.getType(ConnectorEditPart.VISUAL_ID));
- outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
- if(!incominglinks.isEmpty()) {
- result.add(incominglinks);
- }
- if(!outgoinglinks.isEmpty()) {
- result.add(outgoinglinks);
- }
- return result.toArray();
- }
-
- /**
- *
- * Papyrus Template this method is a modification of gmf code in order to avoid
- * getViewChidreen() method becoming greater than 64kb.
- *
- * @generated
- **/
- private Object[] getViewChildrenForConnectorEditPart(View view, Object parentElement) {
- Collection result = new ArrayList();
- SysmlNavigatorGroup target = new SysmlNavigatorGroup(Messages.NavigatorGroupName_Connector_4001_target, "icons/linkTargetNavigatorGroup.gif", parentElement); //$NON-NLS-1$
- SysmlNavigatorGroup source = new SysmlNavigatorGroup(Messages.NavigatorGroupName_Connector_4001_source, "icons/linkSourceNavigatorGroup.gif", parentElement); //$NON-NLS-1$
- Collection connectedViews = getLinksTargetByType(Collections.singleton(view), SysmlVisualIDRegistry.getType(PropertyEditPart.VISUAL_ID));
- target.addChildren(createNavigatorItems(connectedViews, target, true));
- connectedViews = getLinksTargetByType(Collections.singleton(view), SysmlVisualIDRegistry.getType(Property2EditPart.VISUAL_ID));
- target.addChildren(createNavigatorItems(connectedViews, target, true));
- connectedViews = getLinksSourceByType(Collections.singleton(view), SysmlVisualIDRegistry.getType(PropertyEditPart.VISUAL_ID));
- source.addChildren(createNavigatorItems(connectedViews, source, true));
- connectedViews = getLinksSourceByType(Collections.singleton(view), SysmlVisualIDRegistry.getType(Property2EditPart.VISUAL_ID));
- source.addChildren(createNavigatorItems(connectedViews, source, true));
- if(!target.isEmpty()) {
- result.add(target);
- }
- if(!source.isEmpty()) {
- result.add(source);
- }
- return result.toArray();
- }
-
- /**
- * @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);
- Collection result = new ArrayList();
- return result.toArray();
- }
-
- if(parentElement instanceof SysmlNavigatorGroup) {
- SysmlNavigatorGroup group = (SysmlNavigatorGroup)parentElement;
- return group.getChildren();
- }
-
- if(parentElement instanceof SysmlNavigatorItem) {
- SysmlNavigatorItem navigatorItem = (SysmlNavigatorItem)parentElement;
- if(navigatorItem.isLeaf() || !isOwnView(navigatorItem.getView())) {
- return EMPTY_ARRAY;
- }
- return getViewChildren(navigatorItem.getView(), parentElement);
- }
-
- return EMPTY_ARRAY;
- }
-
- /**
- * @generated
- */
- private Object[] getViewChildren(View view, Object parentElement) {
- switch(SysmlVisualIDRegistry.getVisualID(view)) {
-
- case ParametricEditPart.VISUAL_ID:
- {
-
- //modification of the template to avoid mistake of 65kb.
- return getViewChildrenForParametricEditPart(view, parentElement);
-
- }
-
- case Property2EditPart.VISUAL_ID:
- {
-
- //modification of the template to avoid mistake of 65kb.
- return getViewChildrenForProperty2EditPart(view, parentElement);
-
- }
-
- case ConnectorEditPart.VISUAL_ID:
- {
-
- //modification of the template to avoid mistake of 65kb.
- return getViewChildrenForConnectorEditPart(view, parentElement);
-
- }
-
- case PropertyEditPart.VISUAL_ID:
- {
-
- //modification of the template to avoid mistake of 65kb.
- return getViewChildrenForPropertyEditPart(view, parentElement);
-
- }
-
- case ConstraintPropertyEditPart.VISUAL_ID:
- {
-
- //modification of the template to avoid mistake of 65kb.
- return getViewChildrenForConstraintPropertyEditPart(view, parentElement);
-
- }
-
- }
- return EMPTY_ARRAY;
- }
-
- /**
- * @generated
- */
- private Collection getLinksSourceByType(Collection edges, String type) {
- Collection result = new ArrayList();
- for(Iterator it = edges.iterator(); it.hasNext();) {
- Edge nextEdge = (Edge)it.next();
- View nextEdgeSource = nextEdge.getSource();
- if(type.equals(nextEdgeSource.getType()) && isOwnView(nextEdgeSource)) {
- result.add(nextEdgeSource);
- }
- }
- return result;
- }
-
- /**
- * @generated
- */
- private Collection getLinksTargetByType(Collection edges, String type) {
- Collection result = new ArrayList();
- for(Iterator it = edges.iterator(); it.hasNext();) {
- Edge nextEdge = (Edge)it.next();
- View nextEdgeTarget = nextEdge.getTarget();
- if(type.equals(nextEdgeTarget.getType()) && isOwnView(nextEdgeTarget)) {
- result.add(nextEdgeTarget);
- }
- }
- return result;
- }
-
- /**
- * @generated
- */
- private Collection getOutgoingLinksByType(Collection nodes, String type) {
- Collection result = new ArrayList();
- for(Iterator it = nodes.iterator(); it.hasNext();) {
- View nextNode = (View)it.next();
- result.addAll(selectViewsByType(nextNode.getSourceEdges(), type));
- }
- return result;
- }
-
- /**
- * @generated
- */
- private Collection getIncomingLinksByType(Collection nodes, String type) {
- Collection result = new ArrayList();
- for(Iterator it = nodes.iterator(); it.hasNext();) {
- View nextNode = (View)it.next();
- result.addAll(selectViewsByType(nextNode.getTargetEdges(), type));
- }
- return result;
- }
-
- /**
- * @generated
- */
- private Collection getChildrenByType(Collection nodes, String type) {
- Collection result = new ArrayList();
- for(Iterator it = nodes.iterator(); it.hasNext();) {
- View nextNode = (View)it.next();
- result.addAll(selectViewsByType(nextNode.getChildren(), type));
- }
- return result;
- }
-
- /**
- * @generated
- */
- private Collection getDiagramLinksByType(Collection diagrams, String type) {
- Collection result = new ArrayList();
- for(Iterator it = diagrams.iterator(); it.hasNext();) {
- Diagram nextDiagram = (Diagram)it.next();
- result.addAll(selectViewsByType(nextDiagram.getEdges(), type));
- }
- return result;
- }
-
- /**
- * @generated
- */
- 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;
- }
-
- /**
- * @generated
- */
- private boolean isOwnView(View view) {
- return ParametricEditPart.MODEL_ID.equals(SysmlVisualIDRegistry.getModelID(view));
- }
-
- /**
- * @generated
- */
- private Collection createNavigatorItems(Collection views, Object parent, boolean isLeafs) {
- Collection result = new ArrayList();
- for(Iterator it = views.iterator(); it.hasNext();) {
- result.add(new SysmlNavigatorItem((View)it.next(), parent, isLeafs));
- }
- return result;
- }
-
- /**
- * @generated
- */
- public Object getParent(Object element) {
- if(element instanceof SysmlAbstractNavigatorItem) {
- SysmlAbstractNavigatorItem abstractNavigatorItem = (SysmlAbstractNavigatorItem)element;
- return abstractNavigatorItem.getParent();
- }
- return null;
- }
-
- /**
- * @generated
- */
- public boolean hasChildren(Object element) {
- return element instanceof IFile || getChildren(element).length > 0;
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/navigator/SysmlNavigatorGroup.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/navigator/SysmlNavigatorGroup.java
deleted file mode 100644
index aff7bf87cf6..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/navigator/SysmlNavigatorGroup.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.navigator;
-
-import java.util.Collection;
-import java.util.LinkedList;
-
-/**
- * @generated
- */
-public class SysmlNavigatorGroup extends SysmlAbstractNavigatorItem {
-
- /**
- * @generated
- */
- private String myGroupName;
-
- /**
- * @generated
- */
- private String myIcon;
-
- /**
- * @generated
- */
- private Collection myChildren = new LinkedList();
-
- /**
- * @generated
- */
- SysmlNavigatorGroup(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.sysml.diagram.parametric.navigator.SysmlNavigatorGroup) {
- org.eclipse.papyrus.sysml.diagram.parametric.navigator.SysmlNavigatorGroup anotherGroup = (org.eclipse.papyrus.sysml.diagram.parametric.navigator.SysmlNavigatorGroup)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/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/navigator/SysmlNavigatorItem.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/navigator/SysmlNavigatorItem.java
deleted file mode 100644
index 11e87b66b3e..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/navigator/SysmlNavigatorItem.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.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 SysmlNavigatorItem extends SysmlAbstractNavigatorItem {
-
- /**
- * @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.sysml.diagram.parametric.navigator.SysmlNavigatorItem && (adapterType == View.class || adapterType == EObject.class)) {
- return ((org.eclipse.papyrus.sysml.diagram.parametric.navigator.SysmlNavigatorItem)adaptableObject).getView();
- }
- return null;
- }
-
- public Class[] getAdapterList() {
- return supportedTypes;
- }
- }, org.eclipse.papyrus.sysml.diagram.parametric.navigator.SysmlNavigatorItem.class);
- }
-
- /**
- * @generated
- */
- private View myView;
-
- /**
- * @generated
- */
- private boolean myLeaf = false;
-
- /**
- * @generated
- */
- public SysmlNavigatorItem(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.sysml.diagram.parametric.navigator.SysmlNavigatorItem) {
- return EcoreUtil.getURI(getView()).equals(EcoreUtil.getURI(((org.eclipse.papyrus.sysml.diagram.parametric.navigator.SysmlNavigatorItem)obj).getView()));
- }
- return super.equals(obj);
- }
-
- /**
- * @generated
- */
- public int hashCode() {
- return EcoreUtil.getURI(getView()).hashCode();
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/navigator/SysmlNavigatorLabelProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/navigator/SysmlNavigatorLabelProvider.java
deleted file mode 100644
index dc5dc547777..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/navigator/SysmlNavigatorLabelProvider.java
+++ /dev/null
@@ -1,274 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.navigator;
-
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.jface.viewers.ITreePathLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.TreePath;
-import org.eclipse.jface.viewers.ViewerLabel;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ConnectorEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ConnectorNameEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ConstraintPropertyEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ConstraintPropertyNameEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ParametricEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.Property2EditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.PropertyEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.PropertyName2EditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.PropertyNameEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlDiagramEditorPlugin;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlVisualIDRegistry;
-import org.eclipse.papyrus.sysml.diagram.parametric.providers.SysmlElementTypes;
-import org.eclipse.papyrus.sysml.diagram.parametric.providers.SysmlParserProvider;
-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 SysmlNavigatorLabelProvider extends LabelProvider implements ICommonLabelProvider, ITreePathLabelProvider {
-
- /**
- * @generated
- */
- static {
- SysmlDiagramEditorPlugin.getInstance().getImageRegistry().put("Navigator?UnknownElement", ImageDescriptor.getMissingImageDescriptor()); //$NON-NLS-1$
- SysmlDiagramEditorPlugin.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 SysmlNavigatorItem && !isOwnView(((SysmlNavigatorItem)element).getView())) {
- return;
- }
- label.setText(getText(element));
- label.setImage(getImage(element));
- }
-
- /**
- * @generated
- */
- public Image getImage(Object element) {
- if(element instanceof SysmlNavigatorGroup) {
- SysmlNavigatorGroup group = (SysmlNavigatorGroup)element;
- return SysmlDiagramEditorPlugin.getInstance().getBundledImage(group.getIcon());
- }
-
- if(element instanceof SysmlNavigatorItem) {
- SysmlNavigatorItem navigatorItem = (SysmlNavigatorItem)element;
- if(!isOwnView(navigatorItem.getView())) {
- return super.getImage(element);
- }
- return getImage(navigatorItem.getView());
- }
-
- return super.getImage(element);
- }
-
- /**
- * @generated
- */
- public Image getImage(View view) {
- switch(SysmlVisualIDRegistry.getVisualID(view)) {
- case ParametricEditPart.VISUAL_ID:
- return getImage("Navigator?Diagram?http://www.eclipse.org/papyurs/0.7.0/Resource?Resource", SysmlElementTypes.Resource_1000); //$NON-NLS-1$
- case Property2EditPart.VISUAL_ID:
- return getImage("Navigator?Node?http://www.eclipse.org/uml2/3.0.0/UML?Property", SysmlElementTypes.Property_3002); //$NON-NLS-1$
- case ConnectorEditPart.VISUAL_ID:
- return getImage("Navigator?Link?http://www.eclipse.org/uml2/3.0.0/UML?Connector", SysmlElementTypes.Connector_4001); //$NON-NLS-1$
- case PropertyEditPart.VISUAL_ID:
- return getImage("Navigator?TopLevelNode?http://www.eclipse.org/uml2/3.0.0/UML?Property", SysmlElementTypes.Property_2005); //$NON-NLS-1$
- case ConstraintPropertyEditPart.VISUAL_ID:
- return getImage("Navigator?TopLevelNode?http://www.eclipse.org/papyrus/0.7.0/SysML/Constraints?ConstraintProperty", SysmlElementTypes.ConstraintProperty_2003); //$NON-NLS-1$
- }
- return getImage("Navigator?UnknownElement", null); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- private Image getImage(String key, IElementType elementType) {
- ImageRegistry imageRegistry = SysmlDiagramEditorPlugin.getInstance().getImageRegistry();
- Image image = imageRegistry.get(key);
- if(image == null && elementType != null && SysmlElementTypes.isKnownElementType(elementType)) {
- image = SysmlElementTypes.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 SysmlNavigatorGroup) {
- SysmlNavigatorGroup group = (SysmlNavigatorGroup)element;
- return group.getGroupName();
- }
-
- if(element instanceof SysmlNavigatorItem) {
- SysmlNavigatorItem navigatorItem = (SysmlNavigatorItem)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(SysmlVisualIDRegistry.getVisualID(view)) {
- case ParametricEditPart.VISUAL_ID:
- return getResource_1000Text(view);
- case Property2EditPart.VISUAL_ID:
- return getProperty_3002Text(view);
- case ConnectorEditPart.VISUAL_ID:
- return getConnector_4001Text(view);
- case PropertyEditPart.VISUAL_ID:
- return getProperty_2005Text(view);
- case ConstraintPropertyEditPart.VISUAL_ID:
- return getConstraintProperty_2003Text(view);
- }
- return getUnknownElementText(view);
- }
-
- /**
- * @generated
- */
- private String getResource_1000Text(View view) {
- return ""; //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- private String getConstraintProperty_2003Text(View view) {
- IParser parser = SysmlParserProvider.getParser(SysmlElementTypes.ConstraintProperty_2003, view.getElement() != null ? view.getElement() : view, SysmlVisualIDRegistry.getType(ConstraintPropertyNameEditPart.VISUAL_ID));
- if(parser != null) {
- return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view), ParserOptions.NONE.intValue());
- } else {
- SysmlDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 5001); //$NON-NLS-1$
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- private String getProperty_2005Text(View view) {
- IParser parser = SysmlParserProvider.getParser(SysmlElementTypes.Property_2005, view.getElement() != null ? view.getElement() : view, SysmlVisualIDRegistry.getType(PropertyNameEditPart.VISUAL_ID));
- if(parser != null) {
- return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view), ParserOptions.NONE.intValue());
- } else {
- SysmlDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 5002); //$NON-NLS-1$
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- private String getProperty_3002Text(View view) {
- IParser parser = SysmlParserProvider.getParser(SysmlElementTypes.Property_3002, view.getElement() != null ? view.getElement() : view, SysmlVisualIDRegistry.getType(PropertyName2EditPart.VISUAL_ID));
- if(parser != null) {
- return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view), ParserOptions.NONE.intValue());
- } else {
- SysmlDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 5003); //$NON-NLS-1$
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- private String getConnector_4001Text(View view) {
- IParser parser = SysmlParserProvider.getParser(SysmlElementTypes.Connector_4001, view.getElement() != null ? view.getElement() : view, SysmlVisualIDRegistry.getType(ConnectorNameEditPart.VISUAL_ID));
- if(parser != null) {
- return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view), ParserOptions.NONE.intValue());
- } else {
- SysmlDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 6001); //$NON-NLS-1$
- 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 ParametricEditPart.MODEL_ID.equals(SysmlVisualIDRegistry.getModelID(view));
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/navigator/SysmlNavigatorLinkHelper.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/navigator/SysmlNavigatorLinkHelper.java
deleted file mode 100644
index 66c239fa7cc..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/navigator/SysmlNavigatorLinkHelper.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.navigator;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.emf.common.ui.URIEditorInput;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.GraphicalViewer;
-import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor;
-import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlDiagramEditorPlugin;
-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 SysmlNavigatorLinkHelper implements ILinkHelper {
-
- /**
- * @generated
- */
- private static IEditorInput getEditorInput(Diagram diagram) {
- Resource diagramResource = diagram.eResource();
- for(EObject nextEObject : diagramResource.getContents()) {
- if(nextEObject == diagram) {
- return new FileEditorInput(WorkspaceSynchronizer.getFile(diagramResource));
- }
- if(nextEObject instanceof Diagram) {
- break;
- }
- }
- URI uri = EcoreUtil.getURI(diagram);
- String editorName = uri.lastSegment() + '#' + diagram.eResource().getContents().indexOf(diagram);
- IEditorInput editorInput = new URIEditorInput(uri, editorName);
- return editorInput;
- }
-
- /**
- * @generated
- */
- public IStructuredSelection findSelection(IEditorInput anInput) {
- IDiagramDocument document = SysmlDiagramEditorPlugin.getInstance().getDocumentProvider().getDiagramDocument(anInput);
- if(document == null) {
- return StructuredSelection.EMPTY;
- }
- Diagram diagram = document.getDiagram();
- if(diagram == null || diagram.eResource() == null) {
- return StructuredSelection.EMPTY;
- }
- IFile file = WorkspaceSynchronizer.getFile(diagram.eResource());
- if(file != null) {
- SysmlNavigatorItem item = new SysmlNavigatorItem(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 SysmlAbstractNavigatorItem) {
- return;
- }
-
- SysmlAbstractNavigatorItem abstractNavigatorItem = (SysmlAbstractNavigatorItem)aSelection.getFirstElement();
- View navigatorView = null;
- if(abstractNavigatorItem instanceof SysmlNavigatorItem) {
- navigatorView = ((SysmlNavigatorItem)abstractNavigatorItem).getView();
- } else if(abstractNavigatorItem instanceof SysmlNavigatorGroup) {
- SysmlNavigatorGroup navigatorGroup = (SysmlNavigatorGroup)abstractNavigatorItem;
- if(navigatorGroup.getParent() instanceof SysmlNavigatorItem) {
- navigatorView = ((SysmlNavigatorItem)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/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/navigator/SysmlNavigatorSorter.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/navigator/SysmlNavigatorSorter.java
deleted file mode 100644
index 99cb6dba5f0..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/navigator/SysmlNavigatorSorter.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.navigator;
-
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlVisualIDRegistry;
-
-/**
- * @generated
- */
-public class SysmlNavigatorSorter extends ViewerSorter {
-
- /**
- * @generated
- */
- private static final int GROUP_CATEGORY = 4003;
-
- /**
- * @generated
- */
- public int category(Object element) {
- if(element instanceof SysmlNavigatorItem) {
- SysmlNavigatorItem item = (SysmlNavigatorItem)element;
- return SysmlVisualIDRegistry.getVisualID(item.getView());
- }
- return GROUP_CATEGORY;
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/parser/ParametricFrameParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/parser/ParametricFrameParser.java
new file mode 100644
index 00000000000..d7ab2f04f94
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/parser/ParametricFrameParser.java
@@ -0,0 +1,22 @@
+package org.eclipse.papyrus.sysml.diagram.parametric.parser;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.papyrus.sysml.constraints.ConstraintBlock;
+import org.eclipse.papyrus.uml.diagram.common.parser.NamedElementLabelParser;
+import org.eclipse.uml2.uml.util.UMLUtil;
+
+public class ParametricFrameParser extends NamedElementLabelParser {
+
+ @Override
+ public String getPrintString(IAdaptable element, int flags) {
+ String elementType = null;
+ if (element instanceof EObjectAdapter) {
+ Object realObject = ((EObjectAdapter)element).getRealObject();
+ if (realObject instanceof org.eclipse.uml2.uml.Class) {
+ elementType = UMLUtil.getStereotypeApplication(((org.eclipse.uml2.uml.Class)realObject), ConstraintBlock.class) != null ? "ConstraintBlock" : "Block";
+ }
+ }
+ return "par [" + elementType + "] " + super.getPrintString(element, flags);
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/parsers/AbstractParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/parsers/AbstractParser.java
deleted file mode 100644
index b7c8cb3c793..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/parsers/AbstractParser.java
+++ /dev/null
@@ -1,431 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.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.sysml.diagram.parametric.part.Messages;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlDiagramEditorPlugin;
-
-/**
- * @generated
- */
-public abstract class AbstractParser implements IParser {
-
- /**
- * @generated
- */
- protected final EAttribute[] features;
-
- /**
- * @generated
- */
- protected final EAttribute[] editableFeatures;
-
- /**
- * @generated
- */
- private String viewPattern;
-
- /**
- * @generated
- */
- private String editorPattern;
-
- /**
- * @generated
- */
- private String editPattern;
-
- /**
- * @generated
- */
- public AbstractParser(EAttribute[] features) {
- if(features == null || Arrays.asList(features).contains(null)) {
- throw new IllegalArgumentException();
- }
- this.editableFeatures = this.features = features;
- }
-
- /**
- * @generated
- */
- public AbstractParser(EAttribute[] features, EAttribute[] editableFeatures) {
- if(features == null || Arrays.asList(features).contains(null)) {
- throw new IllegalArgumentException();
- }
- this.features = features;
- if(editableFeatures == null || Arrays.asList(editableFeatures).contains(null)) {
- throw new IllegalArgumentException();
- }
- this.editableFeatures = editableFeatures;
- }
-
- /**
- * @generated
- */
- public 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[] getEditableValues(EObject element) {
- Object[] values = new Object[editableFeatures.length];
- for(int i = 0; i < editableFeatures.length; i++) {
- values[i] = getValue(element, editableFeatures[i]);
- }
- return values;
- }
-
- /**
- * @generated
- */
- 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, editableFeatures[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 != editableFeatures.length) {
- return ParserEditStatus.UNEDITABLE_STATUS;
- }
- for(int i = 0; i < values.length; i++) {
- Object value = getValidNewValue(editableFeatures[i], values[i]);
- if(value instanceof InvalidValue) {
- return new ParserEditStatus(SysmlDiagramEditorPlugin.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_UnexpectedValueType, iClass.getName()));
- }
- } else if(Character.TYPE.equals(iClass)) {
- if(value instanceof Character) {
- // ok
- } else if(value instanceof String) {
- String s = (String)value;
- if(s.length() == 0) {
- value = null;
- } else {
- value = new Character(s.charAt(0));
- }
- } else {
- value = new InvalidValue(NLS.bind(Messages.AbstractParser_UnexpectedValueType, iClass.getName()));
- }
- } else if(Byte.TYPE.equals(iClass)) {
- if(value instanceof Byte) {
- // ok
- } else if(value instanceof Number) {
- value = new Byte(((Number)value).byteValue());
- } else if(value instanceof String) {
- String s = (String)value;
- if(s.length() == 0) {
- value = null;
- } else {
- try {
- value = Byte.valueOf(s);
- } catch (NumberFormatException nfe) {
- value = new InvalidValue(NLS.bind(Messages.AbstractParser_WrongStringConversion, iClass.getName()));
- }
- }
- } else {
- value = new InvalidValue(NLS.bind(Messages.AbstractParser_UnexpectedValueType, iClass.getName()));
- }
- } else if(Short.TYPE.equals(iClass)) {
- if(value instanceof Short) {
- // ok
- } else if(value instanceof Number) {
- value = new Short(((Number)value).shortValue());
- } else if(value instanceof String) {
- String s = (String)value;
- if(s.length() == 0) {
- value = null;
- } else {
- try {
- value = Short.valueOf(s);
- } catch (NumberFormatException nfe) {
- value = new InvalidValue(NLS.bind(Messages.AbstractParser_WrongStringConversion, iClass.getName()));
- }
- }
- } else {
- value = new InvalidValue(NLS.bind(Messages.AbstractParser_UnexpectedValueType, iClass.getName()));
- }
- } else if(Integer.TYPE.equals(iClass)) {
- if(value instanceof Integer) {
- // ok
- } else if(value instanceof Number) {
- value = new Integer(((Number)value).intValue());
- } else if(value instanceof String) {
- String s = (String)value;
- if(s.length() == 0) {
- value = null;
- } else {
- try {
- value = Integer.valueOf(s);
- } catch (NumberFormatException nfe) {
- value = new InvalidValue(NLS.bind(Messages.AbstractParser_WrongStringConversion, iClass.getName()));
- }
- }
- } else {
- value = new InvalidValue(NLS.bind(Messages.AbstractParser_UnexpectedValueType, iClass.getName()));
- }
- } else if(Long.TYPE.equals(iClass)) {
- if(value instanceof Long) {
- // ok
- } else if(value instanceof Number) {
- value = new Long(((Number)value).longValue());
- } else if(value instanceof String) {
- String s = (String)value;
- if(s.length() == 0) {
- value = null;
- } else {
- try {
- value = Long.valueOf(s);
- } catch (NumberFormatException nfe) {
- value = new InvalidValue(NLS.bind(Messages.AbstractParser_WrongStringConversion, iClass.getName()));
- }
- }
- } else {
- value = new InvalidValue(NLS.bind(Messages.AbstractParser_UnexpectedValueType, iClass.getName()));
- }
- } else if(Float.TYPE.equals(iClass)) {
- if(value instanceof Float) {
- // ok
- } else if(value instanceof Number) {
- value = new Float(((Number)value).floatValue());
- } else if(value instanceof String) {
- String s = (String)value;
- if(s.length() == 0) {
- value = null;
- } else {
- try {
- value = Float.valueOf(s);
- } catch (NumberFormatException nfe) {
- value = new InvalidValue(NLS.bind(Messages.AbstractParser_WrongStringConversion, iClass.getName()));
- }
- }
- } else {
- value = new InvalidValue(NLS.bind(Messages.AbstractParser_UnexpectedValueType, iClass.getName()));
- }
- } else if(Double.TYPE.equals(iClass)) {
- if(value instanceof Double) {
- // ok
- } else if(value instanceof Number) {
- value = new Double(((Number)value).doubleValue());
- } else if(value instanceof String) {
- String s = (String)value;
- if(s.length() == 0) {
- value = null;
- } else {
- try {
- value = Double.valueOf(s);
- } catch (NumberFormatException nfe) {
- value = new InvalidValue(NLS.bind(Messages.AbstractParser_WrongStringConversion, iClass.getName()));
- }
- }
- } else {
- value = new InvalidValue(NLS.bind(Messages.AbstractParser_UnexpectedValueType, iClass.getName()));
- }
- } else if(type instanceof EEnum) {
- if(value instanceof String) {
- EEnumLiteral literal = ((EEnum)type).getEEnumLiteralByLiteral((String)value);
- if(literal == null) {
- value = new InvalidValue(NLS.bind(Messages.AbstractParser_UnknownLiteral, value));
- } else {
- value = literal.getInstance();
- }
- } else {
- value = new InvalidValue(NLS.bind(Messages.AbstractParser_UnexpectedValueType, String.class.getName()));
- }
- }
- }
- return value;
- }
-
- /**
- * @generated
- */
- protected class InvalidValue {
-
- /**
- * @generated
- */
- private String description;
-
- /**
- * @generated
- */
- public InvalidValue(String description) {
- this.description = description;
- }
-
- /**
- * @generated
- */
- public String toString() {
- return description;
- }
- }
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/parsers/MessageFormatParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/parsers/MessageFormatParser.java
deleted file mode 100644
index d3dc06d93a4..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/parsers/MessageFormatParser.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.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.sysml.diagram.parametric.part.Messages;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlDiagramEditorPlugin;
-
-/**
- * @generated
- */
-public class MessageFormatParser extends AbstractParser {
-
- /**
- * @generated
- */
- private String defaultPattern;
-
- /**
- * @generated
- */
- private String defaultEditablePattern;
-
- /**
- * @generated
- */
- private MessageFormat viewProcessor;
-
- /**
- * @generated
- */
- private MessageFormat editorProcessor;
-
- /**
- * @generated
- */
- private MessageFormat editProcessor;
-
- /**
- * @generated
- */
- public MessageFormatParser(EAttribute[] features) {
- super(features);
- }
-
- /**
- * @generated
- */
- public MessageFormatParser(EAttribute[] features, EAttribute[] editableFeatures) {
- super(features, editableFeatures);
- }
-
- /**
- * @generated
- */
- protected String 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 void setViewPattern(String viewPattern) {
- super.setViewPattern(viewPattern);
- viewProcessor = null;
- }
-
- /**
- * @generated
- */
- public void setEditorPattern(String editorPattern) {
- super.setEditorPattern(editorPattern);
- editorProcessor = null;
- }
-
- /**
- * @generated
- */
- protected MessageFormat getViewProcessor() {
- if(viewProcessor == null) {
- viewProcessor = new MessageFormat(getViewPattern() == null ? getDefaultPattern() : getViewPattern());
- }
- return viewProcessor;
- }
-
- /**
- * @generated
- */
- protected MessageFormat getEditorProcessor() {
- if(editorProcessor == null) {
- editorProcessor = new MessageFormat(getEditorPattern() == null ? getDefaultEditablePattern() : getEditorPattern());
- }
- return editorProcessor;
- }
-
- /**
- * @generated
- */
- protected String getDefaultEditablePattern() {
- if(defaultEditablePattern == null) {
- StringBuffer sb = new StringBuffer();
- for(int i = 0; i < editableFeatures.length; i++) {
- if(i > 0) {
- sb.append(' ');
- }
- sb.append('{');
- sb.append(i);
- sb.append('}');
- }
- defaultEditablePattern = sb.toString();
- }
- return defaultEditablePattern;
- }
-
- /**
- * @generated
- */
- public void setEditPattern(String editPattern) {
- super.setEditPattern(editPattern);
- editProcessor = null;
- }
-
- /**
- * @generated
- */
- protected MessageFormat getEditProcessor() {
- if(editProcessor == null) {
- editProcessor = new MessageFormat(getEditPattern() == null ? getDefaultEditablePattern() : getEditPattern());
- }
- return editProcessor;
- }
-
- /**
- * @generated
- */
- public String getEditString(IAdaptable adapter, int flags) {
- EObject element = (EObject)adapter.getAdapter(EObject.class);
- return getEditorProcessor().format(getEditableValues(element), new StringBuffer(), new FieldPosition(0)).toString();
- }
-
- /**
- * @generated
- */
- public IParserEditStatus isValidEditString(IAdaptable adapter, String editString) {
- ParsePosition pos = new ParsePosition(0);
- Object[] values = getEditProcessor().parse(editString, pos);
- if(values == null) {
- return new ParserEditStatus(SysmlDiagramEditorPlugin.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);
- }
-
- /**
- * @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();
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/DiagramEditorContextMenuProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/DiagramEditorContextMenuProvider.java
deleted file mode 100644
index d6dcf4d73a5..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/DiagramEditorContextMenuProvider.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.part;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.gef.EditPartViewer;
-import org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.ContributionItemService;
-import org.eclipse.gmf.runtime.diagram.ui.actions.ActionIds;
-import org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * @generated
- */
-public class DiagramEditorContextMenuProvider extends DiagramContextMenuProvider {
-
- /**
- * @generated
- */
- private IWorkbenchPart part;
-
- /**
- * @generated
- */
- public DiagramEditorContextMenuProvider(IWorkbenchPart part, EditPartViewer viewer) {
- super(part, viewer);
- this.part = part;
-
- }
-
- /**
- * @generated
- */
- public void buildContextMenu(final IMenuManager menu) {
- getViewer().flush();
- try {
- TransactionUtil.getEditingDomain((EObject)getViewer().getContents().getModel()).runExclusive(new Runnable() {
-
- public void run() {
- ContributionItemService.getInstance().contributeToPopupMenu(DiagramEditorContextMenuProvider.this, part);
- menu.remove(ActionIds.ACTION_DELETE_FROM_MODEL);
-
- }
- });
- } catch (Exception e) {
- SysmlDiagramEditorPlugin.getInstance().logError("Error building context menu", e);
- }
- }
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/LoadResourceAction.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/LoadResourceAction.java
deleted file mode 100644
index b213a7b412e..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/LoadResourceAction.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.part;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-/**
- * @generated
- */
-public class LoadResourceAction extends AbstractHandler {
-
- /**
- * @generated
- */
- public Object execute(ExecutionEvent event) throws ExecutionException {
- IEditorPart diagramEditor = HandlerUtil.getActiveEditorChecked(event);
- Shell shell = diagramEditor.getEditorSite().getShell();
- assert diagramEditor instanceof DiagramEditor;
- TransactionalEditingDomain editingDomain = ((DiagramEditor)diagramEditor).getEditingDomain();
- org.eclipse.emf.edit.ui.action.LoadResourceAction.LoadResourceDialog loadResourceDialog = new org.eclipse.emf.edit.ui.action.LoadResourceAction.LoadResourceDialog(shell, editingDomain);
- loadResourceDialog.open();
- return null;
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/Messages.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/Messages.java
deleted file mode 100644
index 4ba5d7ed6fc..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/Messages.java
+++ /dev/null
@@ -1,367 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.part;
-
-import org.eclipse.osgi.util.NLS;
-
-/**
- * @generated
- */
-public class Messages extends NLS {
-
- /**
- * @generated
- */
- static {
- NLS.initializeMessages("messages", Messages.class); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- private Messages() {
- }
-
- /**
- * @generated
- */
- public static String SysmlCreationWizardTitle;
-
- /**
- * @generated
- */
- public static String SysmlCreationWizard_DiagramModelFilePageTitle;
-
- /**
- * @generated
- */
- public static String SysmlCreationWizard_DiagramModelFilePageDescription;
-
- /**
- * @generated
- */
- public static String SysmlCreationWizard_DomainModelFilePageTitle;
-
- /**
- * @generated
- */
- public static String SysmlCreationWizard_DomainModelFilePageDescription;
-
- /**
- * @generated
- */
- public static String SysmlCreationWizardOpenEditorError;
-
- /**
- * @generated
- */
- public static String SysmlCreationWizardCreationError;
-
- /**
- * @generated
- */
- public static String SysmlCreationWizardPageExtensionError;
-
- /**
- * @generated
- */
- public static String SysmlDiagramEditorUtil_OpenModelResourceErrorDialogTitle;
-
- /**
- * @generated
- */
- public static String SysmlDiagramEditorUtil_OpenModelResourceErrorDialogMessage;
-
- /**
- * @generated
- */
- public static String SysmlDiagramEditorUtil_CreateDiagramProgressTask;
-
- /**
- * @generated
- */
- public static String SysmlDiagramEditorUtil_CreateDiagramCommandLabel;
-
- /**
- * @generated
- */
- public static String SysmlDocumentProvider_isModifiable;
-
- /**
- * @generated
- */
- public static String SysmlDocumentProvider_handleElementContentChanged;
-
- /**
- * @generated
- */
- public static String SysmlDocumentProvider_IncorrectInputError;
-
- /**
- * @generated
- */
- public static String SysmlDocumentProvider_NoDiagramInResourceError;
-
- /**
- * @generated
- */
- public static String SysmlDocumentProvider_DiagramLoadingError;
-
- /**
- * @generated
- */
- public static String SysmlDocumentProvider_UnsynchronizedFileSaveError;
-
- /**
- * @generated
- */
- public static String SysmlDocumentProvider_SaveDiagramTask;
-
- /**
- * @generated
- */
- public static String SysmlDocumentProvider_SaveNextResourceTask;
-
- /**
- * @generated
- */
- public static String SysmlDocumentProvider_SaveAsOperation;
-
- /**
- * @generated
- */
- public static String InitDiagramFile_ResourceErrorDialogTitle;
-
- /**
- * @generated
- */
- public static String InitDiagramFile_ResourceErrorDialogMessage;
-
- /**
- * @generated
- */
- public static String InitDiagramFile_WizardTitle;
-
- /**
- * @generated
- */
- public static String InitDiagramFile_OpenModelFileDialogTitle;
-
- /**
- * @generated
- */
- public static String SysmlNewDiagramFileWizard_CreationPageName;
-
- /**
- * @generated
- */
- public static String SysmlNewDiagramFileWizard_CreationPageTitle;
-
- /**
- * @generated
- */
- public static String SysmlNewDiagramFileWizard_CreationPageDescription;
-
- /**
- * @generated
- */
- public static String SysmlNewDiagramFileWizard_RootSelectionPageName;
-
- /**
- * @generated
- */
- public static String SysmlNewDiagramFileWizard_RootSelectionPageTitle;
-
- /**
- * @generated
- */
- public static String SysmlNewDiagramFileWizard_RootSelectionPageDescription;
-
- /**
- * @generated
- */
- public static String SysmlNewDiagramFileWizard_RootSelectionPageSelectionTitle;
-
- /**
- * @generated
- */
- public static String SysmlNewDiagramFileWizard_RootSelectionPageNoSelectionMessage;
-
- /**
- * @generated
- */
- public static String SysmlNewDiagramFileWizard_RootSelectionPageInvalidSelectionMessage;
-
- /**
- * @generated
- */
- public static String SysmlNewDiagramFileWizard_InitDiagramCommand;
-
- /**
- * @generated
- */
- public static String SysmlNewDiagramFileWizard_IncorrectRootError;
-
- /**
- * @generated
- */
- public static String SysmlDiagramEditor_SavingDeletedFile;
-
- /**
- * @generated
- */
- public static String SysmlDiagramEditor_SaveAsErrorTitle;
-
- /**
- * @generated
- */
- public static String SysmlDiagramEditor_SaveAsErrorMessage;
-
- /**
- * @generated
- */
- public static String SysmlDiagramEditor_SaveErrorTitle;
-
- /**
- * @generated
- */
- public static String SysmlDiagramEditor_SaveErrorMessage;
-
- /**
- * @generated
- */
- public static String SysmlElementChooserDialog_SelectModelElementTitle;
-
- /**
- * @generated
- */
- public static String ModelElementSelectionPageMessage;
-
- /**
- * @generated
- */
- public static String ValidateActionMessage;
-
- /**
- * @generated
- */
- public static String createParametric1Group_title;
-
- /**
- * @generated
- */
- public static String createConstraintProperty1CreationTool_title;
-
- /**
- * @generated
- */
- public static String createConstraintProperty1CreationTool_desc;
-
- /**
- * @generated
- */
- public static String createProperty2CreationTool_title;
-
- /**
- * @generated
- */
- public static String createProperty2CreationTool_desc;
-
- /**
- * @generated
- */
- public static String createConnector3CreationTool_title;
-
- /**
- * @generated
- */
- public static String createConnector3CreationTool_desc;
-
- /**
- * @generated
- */
- public static String CommandName_OpenDiagram;
-
- /**
- * @generated
- */
- public static String NavigatorGroupName_Resource_1000_links;
-
- /**
- * @generated
- */
- public static String NavigatorGroupName_Property_2005_incominglinks;
-
- /**
- * @generated
- */
- public static String NavigatorGroupName_Property_2005_outgoinglinks;
-
- /**
- * @generated
- */
- public static String NavigatorGroupName_Property_3002_incominglinks;
-
- /**
- * @generated
- */
- public static String NavigatorGroupName_Property_3002_outgoinglinks;
-
- /**
- * @generated
- */
- public static String NavigatorGroupName_Connector_4001_target;
-
- /**
- * @generated
- */
- public static String NavigatorGroupName_Connector_4001_source;
-
- /**
- * @generated
- */
- public static String NavigatorActionProvider_OpenDiagramActionName;
-
- /**
- * @generated
- */
- public static String AbstractParser_UnexpectedValueType;
-
- /**
- * @generated
- */
- public static String AbstractParser_WrongStringConversion;
-
- /**
- * @generated
- */
- public static String AbstractParser_UnknownLiteral;
-
- /**
- * @generated
- */
- public static String MessageFormatParser_InvalidInputError;
-
- /**
- * @generated
- */
- public static String SysmlModelingAssistantProviderTitle;
-
- /**
- * @generated
- */
- public static String SysmlModelingAssistantProviderMessage;
-
- // TODO: put accessor fields manually
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/ModelElementSelectionPage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/ModelElementSelectionPage.java
deleted file mode 100644
index 136fd3b48a1..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/ModelElementSelectionPage.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.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(SysmlDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory()));
- modelViewer.setLabelProvider(new AdapterFactoryLabelProvider(SysmlDiagramEditorPlugin.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/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlCreationWizard.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlCreationWizard.java
deleted file mode 100644
index dd958c59002..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlCreationWizard.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.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 SysmlCreationWizard extends Wizard implements INewWizard {
-
- /**
- * @generated
- */
- private IWorkbench workbench;
-
- /**
- * @generated
- */
- protected IStructuredSelection selection;
-
- /**
- * @generated
- */
- protected SysmlCreationWizardPage diagramModelFilePage;
-
- /**
- * @generated
- */
- protected SysmlCreationWizardPage 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.SysmlCreationWizardTitle);
- setDefaultPageImageDescriptor(SysmlDiagramEditorPlugin.getBundledImageDescriptor("icons/wizban/NewResourceWizard.gif")); //$NON-NLS-1$
- setNeedsProgressMonitor(true);
- }
-
- /**
- * @generated
- */
- public void addPages() {
- diagramModelFilePage = new SysmlCreationWizardPage("DiagramModelFile", getSelection(), "sysml_diagram"); //$NON-NLS-1$ //$NON-NLS-2$
- diagramModelFilePage.setTitle(Messages.SysmlCreationWizard_DiagramModelFilePageTitle);
- diagramModelFilePage.setDescription(Messages.SysmlCreationWizard_DiagramModelFilePageDescription);
- addPage(diagramModelFilePage);
-
- domainModelFilePage = new SysmlCreationWizardPage("DomainModelFile", getSelection(), "sysml") { //$NON-NLS-1$ //$NON-NLS-2$
-
- public void setVisible(boolean visible) {
- if(visible) {
- String fileName = diagramModelFilePage.getFileName();
- fileName = fileName.substring(0, fileName.length() - ".sysml_diagram".length()); //$NON-NLS-1$
- setFileName(SysmlDiagramEditorUtil.getUniqueFileName(getContainerFullPath(), fileName, "sysml")); //$NON-NLS-1$
- }
- super.setVisible(visible);
- }
- };
- domainModelFilePage.setTitle(Messages.SysmlCreationWizard_DomainModelFilePageTitle);
- domainModelFilePage.setDescription(Messages.SysmlCreationWizard_DomainModelFilePageDescription);
- addPage(domainModelFilePage);
- }
-
- /**
- * @generated
- */
- public boolean performFinish() {
- IRunnableWithProgress op = new WorkspaceModifyOperation(null) {
-
- protected void execute(IProgressMonitor monitor) throws CoreException, InterruptedException {
- diagram = SysmlDiagramEditorUtil.createDiagram(diagramModelFilePage.getURI(), domainModelFilePage.getURI(), monitor);
- if(isOpenNewlyCreatedDiagramEditor() && diagram != null) {
- try {
- SysmlDiagramEditorUtil.openDiagram(diagram);
- } catch (PartInitException e) {
- ErrorDialog.openError(getContainer().getShell(), Messages.SysmlCreationWizardOpenEditorError, 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.SysmlCreationWizardCreationError, null, ((CoreException)e.getTargetException()).getStatus());
- } else {
- SysmlDiagramEditorPlugin.getInstance().logError("Error creating diagram", e.getTargetException()); //$NON-NLS-1$
- }
- return false;
- }
- return diagram != null;
- }
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlCreationWizardPage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlCreationWizardPage.java
deleted file mode 100644
index 6aba0fe89cb..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlCreationWizardPage.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.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 SysmlCreationWizardPage extends WizardNewFileCreationPage {
-
- /**
- * @generated
- */
- private final String fileExtension;
-
- /**
- * @generated
- */
- public SysmlCreationWizardPage(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(SysmlDiagramEditorUtil.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.SysmlCreationWizardPageExtensionError, extension));
- return false;
- }
- return true;
- }
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlDiagramActionBarContributor.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlDiagramActionBarContributor.java
deleted file mode 100644
index b9d2b4adc58..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlDiagramActionBarContributor.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.part;
-
-import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramActionBarContributor;
-import org.eclipse.jface.action.GroupMarker;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.IWorkbenchPage;
-
-/**
- * @generated
- */
-public class SysmlDiagramActionBarContributor extends DiagramActionBarContributor {
-
- /**
- * @generated
- */
- protected Class getEditorClass() {
- return SysmlDiagramEditor.class;
- }
-
- /**
- * @generated
- */
- protected String getEditorId() {
- return SysmlDiagramEditor.ID;
- }
-
- /**
- * @generated
- */
- public void init(IActionBars bars, IWorkbenchPage page) {
- super.init(bars, page);
- // print preview
- IMenuManager fileMenu = bars.getMenuManager().findMenuUsingPath(IWorkbenchActionConstants.M_FILE);
- assert fileMenu != null;
- fileMenu.remove("pageSetupAction"); //$NON-NLS-1$
- IMenuManager editMenu = bars.getMenuManager().findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
- assert editMenu != null;
- if(editMenu.find("validationGroup") == null) { //$NON-NLS-1$
- editMenu.add(new GroupMarker("validationGroup")); //$NON-NLS-1$
- }
- IAction validateAction = new ValidateAction(page);
- editMenu.appendToGroup("validationGroup", validateAction); //$NON-NLS-1$
- }
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlDiagramEditor.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlDiagramEditor.java
deleted file mode 100644
index 55d95caf27b..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlDiagramEditor.java
+++ /dev/null
@@ -1,569 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.part;
-
-import java.util.EventObject;
-
-import org.eclipse.core.commands.operations.IUndoableOperation;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
-import org.eclipse.gef.GraphicalViewer;
-import org.eclipse.gef.KeyHandler;
-import org.eclipse.gef.Tool;
-import org.eclipse.gef.commands.CommandStackListener;
-import org.eclipse.gef.palette.PaletteRoot;
-import org.eclipse.gef.ui.palette.PaletteViewer;
-import org.eclipse.gef.ui.palette.PaletteViewerProvider;
-import org.eclipse.gmf.runtime.common.core.service.IProviderChangeListener;
-import org.eclipse.gmf.runtime.common.core.service.ProviderChangeEvent;
-import org.eclipse.gmf.runtime.common.ui.services.marker.MarkerNavigationService;
-import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
-import org.eclipse.gmf.runtime.diagram.ui.actions.ActionIds;
-import org.eclipse.gmf.runtime.diagram.ui.internal.parts.PaletteToolTransferDragSourceListener;
-import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument;
-import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocumentProvider;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.jface.util.LocalSelectionTransfer;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.papyrus.infra.gmfdiag.common.GmfMultiDiagramDocumentProvider;
-import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.papyrus.sysml.diagram.parametric.navigator.SysmlNavigatorItem;
-import org.eclipse.papyrus.uml.diagram.common.listeners.DropTargetListener;
-import org.eclipse.papyrus.uml.diagram.common.part.PapyrusPaletteContextMenuProvider;
-import org.eclipse.papyrus.uml.diagram.common.part.PapyrusPaletteViewer;
-import org.eclipse.papyrus.uml.diagram.common.part.UmlGmfDiagramEditor;
-import org.eclipse.papyrus.uml.diagram.common.service.PapyrusPaletteService;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.TransferData;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.ide.IGotoMarker;
-import org.eclipse.ui.navigator.resources.ProjectExplorer;
-import org.eclipse.ui.part.IShowInTargetList;
-import org.eclipse.ui.part.ShowInContext;
-
-/**
- * @generated
- */
-public class SysmlDiagramEditor extends UmlGmfDiagramEditor implements IProviderChangeListener, IGotoMarker {
-
- /**
- * @generated
- */
- public static final String ID = "org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlDiagramEditorID"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final String CONTEXT_ID = "org.eclipse.papyrus.sysml.diagram.parametric.ui.diagramContext"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- private KeyHandler paletteKeyHandler = null;
-
- /**
- * @generated
- */
- private MouseListener paletteMouseListener = null;
-
- /**
- * @generated
- */
- private IUndoableOperation savedOperation = null;
-
- /**
- * @generated
- */
- private TransactionalEditingDomain editingDomain;
-
- /**
- * @generated
- */
- private IDocumentProvider documentProvider;
-
- /**
- * @generated
- */
- public SysmlDiagramEditor(ServicesRegistry servicesRegistry, Diagram diagram) throws ServiceException {
- super(servicesRegistry, diagram);
-
- // adds a listener to the palette service, which reacts to palette customizations
- PapyrusPaletteService.getInstance().addProviderChangeListener(this);
-
- // Share the same editing provider
- editingDomain = servicesRegistry.getService(TransactionalEditingDomain.class);
- documentProvider = new GmfMultiDiagramDocumentProvider(editingDomain);
-
- // overrides editing domain created by super constructor
- setDocumentProvider(documentProvider);
-
- }
-
- /**
- * @generated
- */
- @Override
- protected String getContextID() {
- return CONTEXT_ID;
- }
-
- /**
- * @generated
- */
- @Override
- protected PaletteRoot createPaletteRoot(PaletteRoot existingPaletteRoot) {
- PaletteRoot paletteRoot;
- if(existingPaletteRoot == null) {
- paletteRoot = PapyrusPaletteService.getInstance().createPalette(this, getDefaultPaletteContent());
- } else {
- PapyrusPaletteService.getInstance().updatePalette(existingPaletteRoot, this, getDefaultPaletteContent());
- paletteRoot = existingPaletteRoot;
- }
- applyCustomizationsToPalette(paletteRoot);
- return paletteRoot;
- }
-
- /**
- * @generated
- */
- @Override
- protected PreferencesHint getPreferencesHint() {
- return SysmlDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT;
- }
-
- /**
- * @generated
- */
- @Override
- public String getContributorId() {
- return SysmlDiagramEditorPlugin.ID;
- }
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected final IDocumentProvider getDocumentProvider(IEditorInput input) {
- return documentProvider;
- }
-
- /**
- *
- * @see org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor#getKeyHandler()
- *
- * @return
- *
- * @generated NOT
- */
- @Override
- protected KeyHandler getKeyHandler() {
- //we remove all keybinding provided by GMF
- KeyHandler keyHandler = new KeyHandler();
- return keyHandler;
- }
-
- /**
- * @generated
- */
- @Override
- public TransactionalEditingDomain getEditingDomain() {
- return editingDomain;
- }
-
- /**
- * @generated
- */
- @Override
- protected final void setDocumentProvider(IEditorInput input) {
- // Already set in the constructor
- }
-
- /**
- * @generated
- */
- public void gotoMarker(IMarker marker) {
- MarkerNavigationService.getInstance().gotoMarker(this, marker);
- }
-
- /**
- * @generated
- */
- @Override
- public boolean isSaveAsAllowed() {
- return true;
- }
-
- /**
- * @generated
- */
- @Override
- public void doSaveAs() {
- performSaveAs(new NullProgressMonitor());
- }
-
- /**
- * @generated
- */
- @Override
- protected void performSaveAs(IProgressMonitor progressMonitor) {
- // Nothing
- }
-
- /**
- * @generated
- */
- @Override
- public ShowInContext getShowInContext() {
- return new ShowInContext(getEditorInput(), getNavigatorSelection());
- }
-
- /**
- * @generated
- */
- private ISelection getNavigatorSelection() {
- IDiagramDocument document = getDiagramDocument();
- if(document == null) {
- return StructuredSelection.EMPTY;
- }
- Diagram diagram = document.getDiagram();
- if(diagram == null || diagram.eResource() == null) {
- return StructuredSelection.EMPTY;
- }
- IFile file = WorkspaceSynchronizer.getFile(diagram.eResource());
- if(file != null) {
- SysmlNavigatorItem item = new SysmlNavigatorItem(diagram, file, false);
- return new StructuredSelection(item);
- }
- return StructuredSelection.EMPTY;
- }
-
- /**
- * @generated
- */
- @Override
- protected void configureGraphicalViewer() {
- super.configureGraphicalViewer();
- DiagramEditorContextMenuProvider provider = new DiagramEditorContextMenuProvider(this, getDiagramGraphicalViewer());
- getDiagramGraphicalViewer().setContextMenu(provider);
- getSite().registerContextMenu(ActionIds.DIAGRAM_EDITOR_CONTEXT_MENU, provider, getDiagramGraphicalViewer());
- }
-
- /**
- * @generated
- */
- @Override
- protected TransactionalEditingDomain createEditingDomain() {
- // Already configured
- return editingDomain;
- }
-
- /**
- * @generated
- */
- @Override
- protected void configureDiagramEditDomain() {
- super.configureDiagramEditDomain();
- getDiagramEditDomain().getDiagramCommandStack().addCommandStackListener(new CommandStackListener() {
-
- public void commandStackChanged(EventObject event) {
- firePropertyChange(IEditorPart.PROP_DIRTY);
- }
- });
- }
-
- /**
- * @generated
- */
- @Override
- public void doSave(IProgressMonitor progressMonitor) {
- // The saving of the resource is done by the CoreMultiDiagramEditor
- savedOperation = getOperationHistory().getUndoOperation(getUndoContext());
- }
-
- /**
- * @generated
- */
- @Override
- public boolean isDirty() {
- IUndoableOperation op = getOperationHistory().getUndoOperation(getUndoContext());
- return savedOperation != op;
- }
-
- /**
- * @generated
- */
- public void providerChanged(ProviderChangeEvent event) {
- // update the palette if the palette service has changed
- if(PapyrusPaletteService.getInstance().equals(event.getSource())) {
- PapyrusPaletteService.getInstance().updatePalette(getPaletteViewer().getPaletteRoot(), this, getDefaultPaletteContent());
- }
- }
-
- /**
- * @generated
- */
- @Override
- public void dispose() {
- // remove palette service listener
- // remove preference listener
- PapyrusPaletteService.getInstance().removeProviderChangeListener(this);
-
- super.dispose();
- }
-
- /**
- * @generated
- */
- protected PaletteViewer getPaletteViewer() {
- return getEditDomain().getPaletteViewer();
- }
-
- /**
- * @generated
- */
- @Override
- protected PaletteViewer constructPaletteViewer() {
- return new PapyrusPaletteViewer();
- }
-
- /**
- * @generated
- */
- @Override
- protected PaletteViewerProvider createPaletteViewerProvider() {
- getEditDomain().setPaletteRoot(createPaletteRoot(null));
- return new PaletteViewerProvider(getEditDomain()) {
-
- /**
- * Override to provide the additional behavior for the tools. Will intialize with a
- * PaletteEditPartFactory that has a TrackDragger that understand how to handle the
- * mouseDoubleClick event for shape creation tools. Also will initialize the palette
- * with a defaultTool that is the SelectToolEx that undestands how to handle the enter
- * key which will result in the creation of the shape also.
- */
- protected void configurePaletteViewer(PaletteViewer viewer) {
- super.configurePaletteViewer(viewer);
-
- // customize menu...
- viewer.setContextMenu(new PapyrusPaletteContextMenuProvider(viewer));
-
- viewer.getKeyHandler().setParent(getPaletteKeyHandler());
- viewer.getControl().addMouseListener(getPaletteMouseListener());
-
- // Add a transfer drag target listener that is supported on
- // palette template entries whose template is a creation tool.
- // This will enable drag and drop of the palette shape creation
- // tools.
- viewer.addDragSourceListener(new PaletteToolTransferDragSourceListener(viewer));
- viewer.setCustomizer(createPaletteCustomizer());
- }
-
- public PaletteViewer createPaletteViewer(Composite parent) {
- PaletteViewer pViewer = constructPaletteViewer();
- pViewer.createControl(parent);
- configurePaletteViewer(pViewer);
- hookPaletteViewer(pViewer);
- return pViewer;
- }
-
- /**
- * @return Palette Key Handler for the palette
- */
- private KeyHandler getPaletteKeyHandler() {
-
- if(paletteKeyHandler == null) {
-
- paletteKeyHandler = new KeyHandler() {
-
- /**
- * Processes a <i>key released </i> event. This method is called by the Tool
- * whenever a key is released, and the Tool is in the proper state. Override
- * to support pressing the enter key to create a shape or connection
- * (between two selected shapes)
- *
- * @param event
- * the KeyEvent
- * @return <code>true</code> if KeyEvent was handled in some way
- */
- public boolean keyReleased(KeyEvent event) {
-
- if(event.keyCode == SWT.Selection) {
-
- Tool tool = getPaletteViewer().getActiveTool().createTool();
-
- if(toolSupportsAccessibility(tool)) {
-
- tool.keyUp(event, getDiagramGraphicalViewer());
-
- // deactivate current selection
- getPaletteViewer().setActiveTool(null);
-
- return true;
- }
-
- }
- return super.keyReleased(event);
- }
-
- };
-
- }
- return paletteKeyHandler;
- }
-
- /**
- * @return Palette Mouse listener for the palette
- */
- private MouseListener getPaletteMouseListener() {
-
- if(paletteMouseListener == null) {
-
- paletteMouseListener = new MouseListener() {
-
- /**
- * Flag to indicate that the current active tool should be cleared after a
- * mouse double-click event.
- */
- private boolean clearActiveTool = false;
-
- /**
- * Override to support double-clicking a palette tool entry to create a
- * shape or connection (between two selected shapes).
- *
- * @see MouseListener#mouseDoubleClick(MouseEvent)
- */
- public void mouseDoubleClick(MouseEvent e) {
- Tool tool = getPaletteViewer().getActiveTool().createTool();
-
- if(toolSupportsAccessibility(tool)) {
-
- tool.setViewer(getDiagramGraphicalViewer());
- tool.setEditDomain(getDiagramGraphicalViewer().getEditDomain());
- tool.mouseDoubleClick(e, getDiagramGraphicalViewer());
-
- // Current active tool should be deactivated,
- // but if it is down here it will get
- // reactivated deep in GEF palette code after
- // receiving mouse up events.
- clearActiveTool = true;
- }
- }
-
- public void mouseDown(MouseEvent e) {
- // do nothing
- }
-
- public void mouseUp(MouseEvent e) {
- // Deactivate current active tool here if a
- // double-click was handled.
- if(clearActiveTool) {
- getPaletteViewer().setActiveTool(null);
- clearActiveTool = false;
- }
-
- }
- };
-
- }
- return paletteMouseListener;
- }
-
- };
- }
-
- /**
- * @generated
- */
- @Override
- public GraphicalViewer getGraphicalViewer() {
- return super.getGraphicalViewer();
- }
-
- /**
- * @generated
- */
- @Override
- protected void initializeGraphicalViewer() {
- super.initializeGraphicalViewer();
-
- // Enable Drop
- getDiagramGraphicalViewer().addDropTargetListener(new DropTargetListener(getDiagramGraphicalViewer(), LocalSelectionTransfer.getTransfer()) {
-
- @Override
- protected Object getJavaObject(TransferData data) {
- return LocalSelectionTransfer.getTransfer().nativeToJava(data);
- }
-
- @Override
- protected TransactionalEditingDomain getTransactionalEditingDomain() {
- return getEditingDomain();
- }
- });
-
- }
-
- /**
- * @generated
- */
- @Override
- public void selectionChanged(IWorkbenchPart part, ISelection selection) {
- if(getSite().getPage().getActiveEditor() instanceof IMultiDiagramEditor) {
- IMultiDiagramEditor editor = (IMultiDiagramEditor)getSite().getPage().getActiveEditor();
- // If not the active editor, ignore selection changed.
- if(this.equals(editor.getActiveEditor())) {
- updateActions(getSelectionActions());
- super.selectionChanged(part, selection);
- } else {
- super.selectionChanged(part, selection);
- }
- } else {
- super.selectionChanged(part, selection);
- }
- // from
- // org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor.selectionChanged(IWorkbenchPart,
- // ISelection)
- if(part == this) {
- rebuildStatusLine();
- }
- }
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlDiagramEditorPlugin.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlDiagramEditorPlugin.java
deleted file mode 100644
index 5b4bbbc846f..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlDiagramEditorPlugin.java
+++ /dev/null
@@ -1,333 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.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.ui.provider.ExtendedImageRegistry;
-import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.Activator;
-import org.eclipse.papyrus.resource.provider.ResourceItemProviderAdapterFactory;
-import org.eclipse.papyrus.sysml.activities.provider.ActivitiesItemProviderAdapterFactory;
-import org.eclipse.papyrus.sysml.allocations.provider.AllocationsItemProviderAdapterFactory;
-import org.eclipse.papyrus.sysml.blocks.provider.BlocksItemProviderAdapterFactory;
-import org.eclipse.papyrus.sysml.constraints.provider.ConstraintsItemProviderAdapterFactory;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.policies.SysmlBaseItemSemanticEditPolicy;
-import org.eclipse.papyrus.sysml.diagram.parametric.preferences.DiagramPreferenceInitializer;
-import org.eclipse.papyrus.sysml.diagram.parametric.providers.ElementInitializers;
-import org.eclipse.papyrus.sysml.modelelements.provider.ModelelementsItemProviderAdapterFactory;
-import org.eclipse.papyrus.sysml.portandflows.provider.PortandflowsItemProviderAdapterFactory;
-import org.eclipse.papyrus.sysml.requirements.provider.RequirementsItemProviderAdapterFactory;
-import org.eclipse.papyrus.uml.standard.provider.StandardItemProviderAdapterFactory;
-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 SysmlDiagramEditorPlugin extends AbstractUIPlugin {
-
- /**
- * @generated
- */
- public static final String ID = "org.eclipse.papyrus.sysml.diagram.parametric"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final PreferencesHint DIAGRAM_PREFERENCES_HINT = new PreferencesHint(ID);
-
- /**
- * @generated
- */
- private static SysmlDiagramEditorPlugin instance;
-
- /**
- * @generated
- */
- private ComposedAdapterFactory adapterFactory;
-
- /**
- * @generated
- */
- private SysmlDocumentProvider documentProvider;
-
- /**
- * @generated
- */
- private SysmlBaseItemSemanticEditPolicy.LinkConstraints linkConstraints;
-
- /**
- * @generated
- */
- private ElementInitializers initializers;
-
- /**
- * @generated
- */
- public SysmlDiagramEditorPlugin() {
- }
-
- /**
- * @generated
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- instance = this;
- PreferencesHint.registerPreferenceStore(DIAGRAM_PREFERENCES_HINT, getPreferenceStore());
- adapterFactory = createAdapterFactory();
- DiagramPreferenceInitializer diagramPreferenceInitializer = new DiagramPreferenceInitializer();
- diagramPreferenceInitializer.initializeDefaultPreferences();
- }
-
- /**
- * @generated
- */
- public void stop(BundleContext context) throws Exception {
- adapterFactory.dispose();
- adapterFactory = null;
- linkConstraints = null;
- initializers = null;
- instance = null;
- super.stop(context);
- }
-
- /**
- * @generated
- */
- public static SysmlDiagramEditorPlugin getInstance() {
- return instance;
- }
-
- /**
- * @generated
- */
- public IPreferenceStore getPreferenceStore() {
- IPreferenceStore store = Activator.getDefault().getPreferenceStore();
- return store;
- }
-
- /**
- * @generated
- */
- protected ComposedAdapterFactory createAdapterFactory() {
- ArrayList<AdapterFactory> factories = new ArrayList<AdapterFactory>();
- fillItemProviderFactories(factories);
- return new ComposedAdapterFactory(factories);
- }
-
- /**
- * @generated NOT
- */
- protected void fillItemProviderFactories(List factories) {
- // factories.add(new SysmlItemProviderAdapterFactory());
- factories.add(new ModelelementsItemProviderAdapterFactory());
- factories.add(new BlocksItemProviderAdapterFactory());
- factories.add(new PortandflowsItemProviderAdapterFactory());
- factories.add(new ConstraintsItemProviderAdapterFactory());
- factories.add(new ActivitiesItemProviderAdapterFactory());
- factories.add(new AllocationsItemProviderAdapterFactory());
- factories.add(new RequirementsItemProviderAdapterFactory());
- // factories.add(new InteractionsItemProviderAdapterFactory());
- // factories.add(new StatemachinesItemProviderAdapterFactory());
- // factories.add(new UsecasesItemProviderAdapterFactory());
- factories.add(new EcoreItemProviderAdapterFactory());
- factories.add(new StandardItemProviderAdapterFactory());
- factories.add(new UMLItemProviderAdapterFactory());
- factories.add(new ResourceItemProviderAdapterFactory());
- factories.add(new org.eclipse.emf.edit.provider.resource.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 SysmlDocumentProvider getDocumentProvider() {
- if(documentProvider == null) {
- documentProvider = new SysmlDocumentProvider();
- }
- return documentProvider;
- }
-
- /**
- * @generated
- */
- public SysmlBaseItemSemanticEditPolicy.LinkConstraints getLinkConstraints() {
- return linkConstraints;
- }
-
- /**
- * @generated
- */
- public void setLinkConstraints(SysmlBaseItemSemanticEditPolicy.LinkConstraints lc) {
- this.linkConstraints = lc;
- }
-
- /**
- * @generated
- */
- public ElementInitializers getElementInitializers() {
- return initializers;
- }
-
- /**
- * @generated
- */
- public void setElementInitializers(ElementInitializers i) {
- this.initializers = i;
- }
-
- /**
- * @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, SysmlDiagramEditorPlugin.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, SysmlDiagramEditorPlugin.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/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlDiagramEditorUtil.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlDiagramEditorUtil.java
deleted file mode 100644
index 12598f3753b..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlDiagramEditorUtil.java
+++ /dev/null
@@ -1,377 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.part;
-
-import java.io.IOException;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.OperationHistoryFactory;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.xmi.XMLResource;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.diagram.core.services.ViewService;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramGraphicalViewer;
-import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory;
-import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.papyrus.resource.ResourceFactory;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ParametricEditPart;
-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;
-
-/**
- * @generated
- */
-public class SysmlDiagramEditorUtil {
-
- /**
- * @generated
- */
- public static Map<?, ?> getSaveOptions() {
- HashMap<String, Object> saveOptions = new HashMap<String, Object>();
- saveOptions.put(XMLResource.OPTION_ENCODING, "UTF-8"); //$NON-NLS-1$
- saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER);
- return saveOptions;
- }
-
- /**
- * @generated
- */
- public static boolean openDiagram(Resource diagram) throws PartInitException {
- String path = diagram.getURI().toPlatformString(true);
- IResource workspaceResource = ResourcesPlugin.getWorkspace().getRoot().findMember(new Path(path));
- if(workspaceResource instanceof IFile) {
- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- return null != page.openEditor(new FileEditorInput((IFile)workspaceResource), SysmlDiagramEditor.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) {
- SysmlDiagramEditorPlugin.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 = SysmlDiagramEditorPlugin.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.SysmlDiagramEditorUtil_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.SysmlDiagramEditorUtil_CreateDiagramCommandLabel, Collections.EMPTY_LIST) {
-
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- org.eclipse.papyrus.resource.Resource model = createInitialModel();
- attachModelToResource(model, modelResource);
-
- Diagram diagram = ViewService.createDiagram(model, ParametricEditPart.MODEL_ID, SysmlDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
- if(diagram != null) {
- diagramResource.getContents().add(diagram);
- diagram.setName(diagramName);
- diagram.setElement(model);
- }
-
- try {
- modelResource.save(org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlDiagramEditorUtil.getSaveOptions());
- diagramResource.save(org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlDiagramEditorUtil.getSaveOptions());
- } catch (IOException e) {
-
- SysmlDiagramEditorPlugin.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) {
- SysmlDiagramEditorPlugin.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 org.eclipse.papyrus.resource.Resource createInitialModel() {
- return ResourceFactory.eINSTANCE.createResource();
- }
-
- /**
- * Store model element in the resource.
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- private static void attachModelToResource(org.eclipse.papyrus.resource.Resource model, Resource resource) {
- resource.getContents().add(model);
- }
-
- /**
- * @generated
- */
- public static void selectElementsInDiagram(IDiagramWorkbenchPart diagramPart, List<EditPart> editParts) {
- diagramPart.getDiagramGraphicalViewer().deselectAll();
-
- EditPart firstPrimary = null;
- for(EditPart nextPart : editParts) {
- diagramPart.getDiagramGraphicalViewer().appendSelection(nextPart);
- if(firstPrimary == null && nextPart instanceof IPrimaryEditPart) {
- firstPrimary = nextPart;
- }
- }
-
- if(!editParts.isEmpty()) {
- diagramPart.getDiagramGraphicalViewer().reveal(firstPrimary != null ? firstPrimary : (EditPart)editParts.get(0));
- }
- }
-
- /**
- * @generated
- */
- private static int findElementsInDiagramByID(DiagramEditPart diagramPart, EObject element, List<EditPart> editPartCollector) {
- IDiagramGraphicalViewer viewer = (IDiagramGraphicalViewer)diagramPart.getViewer();
- final int intialNumOfEditParts = editPartCollector.size();
-
- if(element instanceof View) { // support notation element lookup
- EditPart editPart = (EditPart)viewer.getEditPartRegistry().get(element);
- if(editPart != null) {
- editPartCollector.add(editPart);
- return 1;
- }
- }
-
- String elementID = EMFCoreUtil.getProxyID(element);
- @SuppressWarnings("unchecked")
- List<EditPart> associatedParts = viewer.findEditPartsForElement(elementID, IGraphicalEditPart.class);
- // perform the possible hierarchy disjoint -> take the top-most parts only
- for(EditPart nextPart : associatedParts) {
- EditPart parentPart = nextPart.getParent();
- while(parentPart != null && !associatedParts.contains(parentPart)) {
- parentPart = parentPart.getParent();
- }
- if(parentPart == null) {
- editPartCollector.add(nextPart);
- }
- }
-
- if(intialNumOfEditParts == editPartCollector.size()) {
- if(!associatedParts.isEmpty()) {
- editPartCollector.add(associatedParts.get(0));
- } else {
- if(element.eContainer() != null) {
- return findElementsInDiagramByID(diagramPart, element.eContainer(), editPartCollector);
- }
- }
- }
- return editPartCollector.size() - intialNumOfEditParts;
- }
-
- /**
- * @generated
- */
- public static View findView(DiagramEditPart diagramEditPart, EObject targetElement, LazyElement2ViewMap lazyElement2ViewMap) {
- boolean hasStructuralURI = false;
- if(targetElement.eResource() instanceof XMLResource) {
- hasStructuralURI = ((XMLResource)targetElement.eResource()).getID(targetElement) == null;
- }
-
- View view = null;
- LinkedList<EditPart> editPartHolder = new LinkedList<EditPart>();
- if(hasStructuralURI && !lazyElement2ViewMap.getElement2ViewMap().isEmpty()) {
- view = lazyElement2ViewMap.getElement2ViewMap().get(targetElement);
- } else if(findElementsInDiagramByID(diagramEditPart, targetElement, editPartHolder) > 0) {
- EditPart editPart = editPartHolder.get(0);
- view = editPart.getModel() instanceof View ? (View)editPart.getModel() : null;
- }
-
- return (view == null) ? diagramEditPart.getDiagramView() : view;
- }
-
- /**
- * @generated
- */
- public static class LazyElement2ViewMap {
-
- /**
- * @generated
- */
- private Map<EObject, View> element2ViewMap;
-
- /**
- * @generated
- */
- private View scope;
-
- /**
- * @generated
- */
- private Set<? extends EObject> elementSet;
-
- /**
- * @generated
- */
- public LazyElement2ViewMap(View scope, Set<? extends EObject> elements) {
- this.scope = scope;
- this.elementSet = elements;
- }
-
- /**
- * @generated
- */
- public final Map<EObject, View> getElement2ViewMap() {
- if(element2ViewMap == null) {
- element2ViewMap = new HashMap<EObject, View>();
- // map possible notation elements to itself as these can't be found by view.getElement()
- for(EObject element : elementSet) {
- if(element instanceof View) {
- View view = (View)element;
- if(view.getDiagram() == scope.getDiagram()) {
- element2ViewMap.put(element, view); // take only those that part of our diagram
- }
- }
- }
-
- buildElement2ViewMap(scope, element2ViewMap, elementSet);
- }
- return element2ViewMap;
- }
-
- /**
- * @generated
- */
- private static boolean buildElement2ViewMap(View parentView, Map<EObject, View> element2ViewMap, Set<? extends EObject> elements) {
- if(elements.size() == element2ViewMap.size()) {
- return true;
- }
-
- if(parentView.isSetElement() && !element2ViewMap.containsKey(parentView.getElement()) && elements.contains(parentView.getElement())) {
- element2ViewMap.put(parentView.getElement(), parentView);
- if(elements.size() == element2ViewMap.size()) {
- return true;
- }
- }
- boolean complete = false;
- for(Iterator<?> it = parentView.getChildren().iterator(); it.hasNext() && !complete;) {
- complete = buildElement2ViewMap((View)it.next(), element2ViewMap, elements);
- }
- for(Iterator<?> it = parentView.getSourceEdges().iterator(); it.hasNext() && !complete;) {
- complete = buildElement2ViewMap((View)it.next(), element2ViewMap, elements);
- }
- for(Iterator<?> it = parentView.getTargetEdges().iterator(); it.hasNext() && !complete;) {
- complete = buildElement2ViewMap((View)it.next(), element2ViewMap, elements);
- }
- return complete;
- }
- } // LazyElement2ViewMap
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlDiagramUpdateCommand.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlDiagramUpdateCommand.java
deleted file mode 100644
index 8e3daafffa6..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlDiagramUpdateCommand.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.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 SysmlDiagramUpdateCommand implements IHandler {
-
- /**
- * @generated
- */
- public void addHandlerListener(IHandlerListener handlerListener) {
- }
-
- /**
- * @generated
- */
- public void dispose() {
- }
-
- /**
- * @generated
- */
- public Object execute(ExecutionEvent event) throws ExecutionException {
- ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
- if(selection instanceof IStructuredSelection) {
- IStructuredSelection structuredSelection = (IStructuredSelection)selection;
- if(structuredSelection.size() != 1) {
- return null;
- }
- if(structuredSelection.getFirstElement() instanceof EditPart && ((EditPart)structuredSelection.getFirstElement()).getModel() instanceof View) {
- EObject modelElement = ((View)((EditPart)structuredSelection.getFirstElement()).getModel()).getElement();
- List editPolicies = CanonicalEditPolicy.getRegisteredEditPolicies(modelElement);
- for(Iterator it = editPolicies.iterator(); it.hasNext();) {
- CanonicalEditPolicy nextEditPolicy = (CanonicalEditPolicy)it.next();
- nextEditPolicy.refresh();
- }
-
- }
- }
- return null;
- }
-
- /**
- * @generated
- */
- public boolean isEnabled() {
- return true;
- }
-
- /**
- * @generated
- */
- public boolean isHandled() {
- return true;
- }
-
- /**
- * @generated
- */
- public void removeHandlerListener(IHandlerListener handlerListener) {
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlDiagramUpdater.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlDiagramUpdater.java
deleted file mode 100644
index 665a576ade9..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlDiagramUpdater.java
+++ /dev/null
@@ -1,359 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.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.common.util.EList;
-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.resource.util.ResourceUtil;
-import org.eclipse.papyrus.sysml.constraints.ConstraintProperty;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ConnectorEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ConstraintPropertyEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ParametricEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.Property2EditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.PropertyEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.providers.SysmlElementTypes;
-import org.eclipse.uml2.uml.Class;
-import org.eclipse.uml2.uml.ConnectableElement;
-import org.eclipse.uml2.uml.Connector;
-import org.eclipse.uml2.uml.ConnectorEnd;
-import org.eclipse.uml2.uml.Property;
-import org.eclipse.uml2.uml.StructuredClassifier;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class SysmlDiagramUpdater {
-
- /**
- * @generated
- */
- public static List<SysmlNodeDescriptor> getSemanticChildren(View view) {
- switch(SysmlVisualIDRegistry.getVisualID(view)) {
- case ParametricEditPart.VISUAL_ID:
- return getResource_1000SemanticChildren(view);
- case ConstraintPropertyEditPart.VISUAL_ID:
- return getConstraintProperty_2003SemanticChildren(view);
- }
- return Collections.emptyList();
- }
-
- /**
- * @generated NOT
- */
- public static List getConstraintProperty_2003SemanticChildren(View view) {
- if(!view.isSetElement()) {
- return Collections.EMPTY_LIST;
- }
- ConstraintProperty modelElement = (ConstraintProperty)view.getElement();
- List result = new LinkedList();
- {
- Property childElement = modelElement.getBase_Property();
- int visualID = SysmlVisualIDRegistry.getNodeVisualID(view, childElement);
- if(visualID == Property2EditPart.VISUAL_ID) {
- result.add(new SysmlNodeDescriptor(childElement, visualID));
- }
- }
- return result;
- /*
- * if (!view.isSetElement()) { return Collections.EMPTY_LIST; } ConstraintProperty
- * modelElement = (ConstraintProperty) view.getElement(); List result = new LinkedList();
- *
- * Object oclRuleResult = OCLUtils.runOclRule("self.base_Property.type", modelElement); if
- * (oclRuleResult != null) { if (oclRuleResult instanceof StructuredClassifier) {
- * StructuredClassifier aClass = (StructuredClassifier) oclRuleResult; for (Iterator it =
- * aClass.getAttributes().iterator(); it.hasNext();) { Property childElement = (Property)
- * it.next(); int visualID = SysmlVisualIDRegistry.getNodeVisualID(view, childElement); if
- * (visualID == Property2EditPart.VISUAL_ID) { result.add(new
- * SysmlNodeDescriptor(childElement, visualID)); //continue; } } } else { throw new
- * UnsupportedOperationException("Can't access with ..."); } }
- */
- }
-
- /**
- * @generated NOT
- */
- public static List getResource_1000SemanticChildren(View view) {
- if(!view.isSetElement()) {
- return Collections.EMPTY_LIST;
- }
- List result = new LinkedList();
- EObject eObject = view.getElement();
- // element is a block
- if(eObject instanceof Class) {
- Class modelElement = (Class)eObject;
- // we get the papyrus resource from the model object
- EList<EObject> eobjects = ResourceUtil.getResource(modelElement).getEobjects();
- for(Iterator it = eobjects.iterator(); it.hasNext();) {
- EObject childElement = (EObject)it.next();
- int visualID = SysmlVisualIDRegistry.getNodeVisualID(view, (EObject)childElement);
- if(visualID == ConstraintPropertyEditPart.VISUAL_ID) {
- result.add(new SysmlNodeDescriptor((EObject)childElement, visualID));
- continue;
- }
- }
- for(Iterator it = modelElement.getOwnedAttributes().iterator(); it.hasNext();) {
- EObject obj = (EObject)it.next();
- if(obj instanceof Property) {
- Property childElement = (Property)obj;
- int visualID = SysmlVisualIDRegistry.getNodeVisualID(view, childElement);
- if((visualID == PropertyEditPart.VISUAL_ID) && (childElement.getAppliedStereotype("SysML::Constraints::ConstraintProperty") == null)) {
- result.add(new SysmlNodeDescriptor(childElement, visualID));
- continue;
- }
- }
- }
- }
- return result;
- }
-
- /**
- * @generated
- */
- public static List<SysmlLinkDescriptor> getContainedLinks(View view) {
- switch(SysmlVisualIDRegistry.getVisualID(view)) {
- case ParametricEditPart.VISUAL_ID:
- return getResource_1000ContainedLinks(view);
- case ConstraintPropertyEditPart.VISUAL_ID:
- return getConstraintProperty_2003ContainedLinks(view);
- case PropertyEditPart.VISUAL_ID:
- return getProperty_2005ContainedLinks(view);
- case Property2EditPart.VISUAL_ID:
- return getProperty_3002ContainedLinks(view);
- case ConnectorEditPart.VISUAL_ID:
- return getConnector_4001ContainedLinks(view);
- }
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public static List<SysmlLinkDescriptor> getIncomingLinks(View view) {
- switch(SysmlVisualIDRegistry.getVisualID(view)) {
- case ConstraintPropertyEditPart.VISUAL_ID:
- return getConstraintProperty_2003IncomingLinks(view);
- case PropertyEditPart.VISUAL_ID:
- return getProperty_2005IncomingLinks(view);
- case Property2EditPart.VISUAL_ID:
- return getProperty_3002IncomingLinks(view);
- case ConnectorEditPart.VISUAL_ID:
- return getConnector_4001IncomingLinks(view);
- }
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public static List<SysmlLinkDescriptor> getOutgoingLinks(View view) {
- switch(SysmlVisualIDRegistry.getVisualID(view)) {
- case ConstraintPropertyEditPart.VISUAL_ID:
- return getConstraintProperty_2003OutgoingLinks(view);
- case PropertyEditPart.VISUAL_ID:
- return getProperty_2005OutgoingLinks(view);
- case Property2EditPart.VISUAL_ID:
- return getProperty_3002OutgoingLinks(view);
- case ConnectorEditPart.VISUAL_ID:
- return getConnector_4001OutgoingLinks(view);
- }
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public static List<SysmlLinkDescriptor> getResource_1000ContainedLinks(View view) {
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public static List<SysmlLinkDescriptor> getConstraintProperty_2003ContainedLinks(View view) {
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public static List<SysmlLinkDescriptor> getProperty_2005ContainedLinks(View view) {
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public static List<SysmlLinkDescriptor> getProperty_3002ContainedLinks(View view) {
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public static List<SysmlLinkDescriptor> getConnector_4001ContainedLinks(View view) {
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public static List<SysmlLinkDescriptor> getConstraintProperty_2003IncomingLinks(View view) {
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public static List<SysmlLinkDescriptor> getProperty_2005IncomingLinks(View view) {
- Property modelElement = (Property)view.getElement();
- Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
- LinkedList<SysmlLinkDescriptor> result = new LinkedList<SysmlLinkDescriptor>();
- result.addAll(getIncomingTypeModelFacetLinks_Connector_4001(modelElement, crossReferences));
- return result;
- }
-
- /**
- * @generated
- */
- public static List<SysmlLinkDescriptor> getProperty_3002IncomingLinks(View view) {
- Property modelElement = (Property)view.getElement();
- Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
- LinkedList<SysmlLinkDescriptor> result = new LinkedList<SysmlLinkDescriptor>();
- result.addAll(getIncomingTypeModelFacetLinks_Connector_4001(modelElement, crossReferences));
- return result;
- }
-
- /**
- * @generated
- */
- public static List<SysmlLinkDescriptor> getConnector_4001IncomingLinks(View view) {
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public static List<SysmlLinkDescriptor> getConstraintProperty_2003OutgoingLinks(View view) {
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public static List<SysmlLinkDescriptor> getProperty_2005OutgoingLinks(View view) {
- Property modelElement = (Property)view.getElement();
- LinkedList<SysmlLinkDescriptor> result = new LinkedList<SysmlLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Connector_4001(modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public static List<SysmlLinkDescriptor> getProperty_3002OutgoingLinks(View view) {
- Property modelElement = (Property)view.getElement();
- LinkedList<SysmlLinkDescriptor> result = new LinkedList<SysmlLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Connector_4001(modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public static List<SysmlLinkDescriptor> getConnector_4001OutgoingLinks(View view) {
- return Collections.emptyList();
- }
-
- /**
- * @generated NOT
- */
- private static Collection getIncomingTypeModelFacetLinks_Connector_4001(ConnectableElement 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.getConnectorEnd_Role() || false == setting.getEObject() instanceof ConnectorEnd) {
- continue;
- }
- ConnectorEnd connectorEnd = (ConnectorEnd)setting.getEObject();
- Connector link = (Connector)connectorEnd.getOwner();
- if(ConnectorEditPart.VISUAL_ID != SysmlVisualIDRegistry.getLinkWithClassVisualID(link)) {
- continue;
- }
- ConnectableElement src = null;
- EList<ConnectorEnd> ends = link.getEnds();
- if(ends != null && !ends.isEmpty()) {
- src = ends.get(0).getRole();
- }
- result.add(new SysmlLinkDescriptor(src, target, link, SysmlElementTypes.Connector_4001, ConnectorEditPart.VISUAL_ID));
- }
- return result;
- }
-
- /**
- * @generated NOT
- */
- private static Collection getOutgoingTypeModelFacetLinks_Connector_4001(ConnectableElement source) {
- StructuredClassifier 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 StructuredClassifier) {
- container = (StructuredClassifier)element;
- }
- }
- if(container == null) {
- return Collections.EMPTY_LIST;
- }
- Collection result = new LinkedList();
- for(Iterator links = container.getOwnedConnectors().iterator(); links.hasNext();) {
- EObject linkObject = (EObject)links.next();
- if(false == linkObject instanceof Connector) {
- continue;
- }
- Connector link = (Connector)linkObject;
- if(ConnectorEditPart.VISUAL_ID != SysmlVisualIDRegistry.getLinkWithClassVisualID(link)) {
- continue;
- }
-
- ConnectableElement src = null;
- ConnectableElement dst = null;
- EList<ConnectorEnd> ends = link.getEnds();
- if(ends != null && !ends.isEmpty() && ends.size() > 1) {
- src = ends.get(0).getRole();
- dst = ends.get(1).getRole();
- }
-
- if(src != source) {
- continue;
- }
- result.add(new SysmlLinkDescriptor(src, dst, link, SysmlElementTypes.Connector_4001, ConnectorEditPart.VISUAL_ID));
-
- }
- return result;
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlDocumentProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlDocumentProvider.java
deleted file mode 100644
index 3b0d09b93d1..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlDocumentProvider.java
+++ /dev/null
@@ -1,988 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.part;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceStatus;
-import org.eclipse.core.resources.IStorage;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.core.runtime.jobs.MultiRule;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.common.ui.URIEditorInput;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.util.EContentAdapter;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.transaction.NotificationFilter;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.diagram.core.DiagramEditingDomainFactory;
-import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.AbstractDocumentProvider;
-import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.DiagramDocument;
-import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument;
-import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocumentProvider;
-import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument;
-import org.eclipse.gmf.runtime.diagram.ui.resources.editor.internal.EditorStatusCodes;
-import org.eclipse.gmf.runtime.diagram.ui.resources.editor.internal.util.DiagramIOUtil;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactory;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.part.FileEditorInput;
-
-/**
- * @generated
- */
-public class SysmlDocumentProvider 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, SysmlDiagramEditorPlugin.ID, 0, NLS.bind(Messages.SysmlDocumentProvider_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, SysmlDiagramEditorPlugin.ID, 0, NLS.bind(Messages.SysmlDocumentProvider_IncorrectInputError, new Object[]{ element, "org.eclipse.ui.part.FileEditorInput", "org.eclipse.emf.common.ui.URIEditorInput" }), //$NON-NLS-1$ //$NON-NLS-2$
- null));
- }
- IDocument document = createEmptyDocument();
- setDocumentContent(document, (IEditorInput)element);
- setupDocument(element, document);
- return document;
- }
-
- /**
- * Sets up the given document as it would be provided for the given element. The content of the
- * document is not changed. This default implementation is empty. Subclasses may reimplement.
- *
- * @param element
- * the blue-print element
- * @param document
- * the document to set up
- * @generated
- */
- protected void setupDocument(Object element, IDocument document) {
- // for subclasses
- }
-
- /**
- * @generated
- */
- private long computeModificationStamp(ResourceSetInfo info) {
- int result = 0;
- for(Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) {
- Resource nextResource = it.next();
- IFile file = WorkspaceSynchronizer.getFile(nextResource);
- if(file != null) {
- if(file.getLocation() != null) {
- result += file.getLocation().toFile().lastModified();
- } else {
- result += file.getModificationStamp();
- }
- }
- }
- return result;
- }
-
- /**
- * @generated
- */
- 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.sysml.diagram.parametric.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.SysmlDocumentProvider_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, SysmlDiagramEditorPlugin.ID, 0, msg != null ? msg : Messages.SysmlDocumentProvider_DiagramLoadingError, e));
- }
- throw thrownExcp;
- }
- } else {
- throw new CoreException(new Status(IStatus.ERROR, SysmlDiagramEditorPlugin.ID, 0, NLS.bind(Messages.SysmlDocumentProvider_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) {
- LinkedList<IFile> files2Validate = new LinkedList<IFile>();
- for(Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) {
- Resource nextResource = it.next();
- IFile file = WorkspaceSynchronizer.getFile(nextResource);
- if(file != null && file.isReadOnly()) {
- files2Validate.add(file);
- }
- }
- ResourcesPlugin.getWorkspace().validateEdit((IFile[])files2Validate.toArray(new IFile[files2Validate.size()]), computationContext);
- }
-
- super.doValidateState(element, computationContext);
- }
-
- /**
- * @generated
- */
- public boolean isReadOnly(Object element) {
- ResourceSetInfo info = getResourceSetInfo(element);
- if(info != null) {
- if(info.isUpdateCache()) {
- try {
- updateCache(element);
- } catch (CoreException ex) {
- SysmlDiagramEditorPlugin.getInstance().logError(Messages.SysmlDocumentProvider_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) {
- SysmlDiagramEditorPlugin.getInstance().logError(Messages.SysmlDocumentProvider_isModifiable, ex);
- // Error message to log was initially taken from org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.internal.l10n.EditorMessages.StorageDocumentProvider_isModifiable
- }
- }
- return info.isModifiable();
- }
- return super.isModifiable(element);
- }
-
- /**
- * @generated
- */
- protected void updateCache(Object element) throws CoreException {
- ResourceSetInfo info = getResourceSetInfo(element);
- if(info != null) {
- for(Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) {
- Resource nextResource = it.next();
- IFile file = WorkspaceSynchronizer.getFile(nextResource);
- if(file != null && file.isReadOnly()) {
- info.setReadOnly(true);
- info.setModifiable(false);
- return;
- }
- }
- info.setReadOnly(false);
- info.setModifiable(true);
- return;
- }
- }
-
- /**
- * @generated
- */
- 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) {
- LinkedList<ISchedulingRule> rules = new LinkedList<ISchedulingRule>();
- for(Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) {
- Resource nextResource = it.next();
- IFile file = WorkspaceSynchronizer.getFile(nextResource);
- if(file != null) {
- rules.add(ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(file));
- }
- }
- return new MultiRule((ISchedulingRule[])rules.toArray(new ISchedulingRule[rules.size()]));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected ISchedulingRule getSaveRule(Object element) {
- ResourceSetInfo info = getResourceSetInfo(element);
- if(info != null) {
- LinkedList<ISchedulingRule> rules = new LinkedList<ISchedulingRule>();
- for(Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) {
- Resource nextResource = it.next();
- IFile file = WorkspaceSynchronizer.getFile(nextResource);
- if(file != null) {
- rules.add(computeSchedulingRule(file));
- }
- }
- return new MultiRule((ISchedulingRule[])rules.toArray(new ISchedulingRule[rules.size()]));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected ISchedulingRule getSynchronizeRule(Object element) {
- ResourceSetInfo info = getResourceSetInfo(element);
- if(info != null) {
- LinkedList<ISchedulingRule> rules = new LinkedList<ISchedulingRule>();
- for(Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) {
- Resource nextResource = it.next();
- IFile file = WorkspaceSynchronizer.getFile(nextResource);
- if(file != null) {
- rules.add(ResourcesPlugin.getWorkspace().getRuleFactory().refreshRule(file));
- }
- }
- return new MultiRule((ISchedulingRule[])rules.toArray(new ISchedulingRule[rules.size()]));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected ISchedulingRule getValidateStateRule(Object element) {
- ResourceSetInfo info = getResourceSetInfo(element);
- if(info != null) {
- LinkedList<ISchedulingRule> files = new LinkedList<ISchedulingRule>();
- for(Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) {
- Resource nextResource = it.next();
- IFile file = WorkspaceSynchronizer.getFile(nextResource);
- if(file != null) {
- files.add(file);
- }
- }
- return ResourcesPlugin.getWorkspace().getRuleFactory().validateEditRule((IFile[])files.toArray(new IFile[files.size()]));
- }
- return null;
- }
-
- /**
- * @generated
- */
- 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<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) {
- Resource nextResource = 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, SysmlDiagramEditorPlugin.ID, IResourceStatus.OUT_OF_SYNC_LOCAL, Messages.SysmlDocumentProvider_UnsynchronizedFileSaveError, null));
- }
- info.stopResourceListening();
- fireElementStateChanging(element);
- try {
- monitor.beginTask(Messages.SysmlDocumentProvider_SaveDiagramTask, info.getResourceSet().getResources().size() + 1); //"Saving diagram"
- for(Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) {
- Resource nextResource = it.next();
- monitor.setTaskName(NLS.bind(Messages.SysmlDocumentProvider_SaveNextResourceTask, nextResource.getURI()));
- if(nextResource.isLoaded() && !info.getEditingDomain().isReadOnly(nextResource)) {
- try {
- nextResource.save(SysmlDiagramEditorUtil.getSaveOptions());
- } catch (IOException e) {
- fireElementStateChangeFailed(element);
- throw new CoreException(new Status(IStatus.ERROR, SysmlDiagramEditorPlugin.ID, EditorStatusCodes.RESOURCE_FAILURE, e.getLocalizedMessage(), null));
- }
- }
- monitor.worked(1);
- }
- monitor.done();
- info.setModificationStamp(computeModificationStamp(info));
- } catch (RuntimeException x) {
- fireElementStateChangeFailed(element);
- throw x;
- } finally {
- info.startResourceListening();
- }
- } else {
- URI newResoruceURI;
- List<IFile> affectedFiles = null;
- if(element instanceof FileEditorInput) {
- IFile newFile = ((FileEditorInput)element).getFile();
- affectedFiles = Collections.singletonList(newFile);
- newResoruceURI = URI.createPlatformResourceURI(newFile.getFullPath().toString(), true);
- } else if(element instanceof URIEditorInput) {
- newResoruceURI = ((URIEditorInput)element).getURI();
- } else {
- fireElementStateChangeFailed(element);
- throw new CoreException(new Status(IStatus.ERROR, SysmlDiagramEditorPlugin.ID, 0, NLS.bind(Messages.SysmlDocumentProvider_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, SysmlDiagramEditorPlugin.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.SysmlDocumentProvider_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(SysmlDiagramEditorUtil.getSaveOptions());
- } catch (ExecutionException e) {
- fireElementStateChangeFailed(element);
- throw new CoreException(new Status(IStatus.ERROR, SysmlDiagramEditorPlugin.ID, 0, e.getLocalizedMessage(), null));
- } catch (IOException e) {
- fireElementStateChangeFailed(element);
- throw new CoreException(new Status(IStatus.ERROR, SysmlDiagramEditorPlugin.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) {
- SysmlDiagramEditorPlugin.getInstance().logError(Messages.SysmlDocumentProvider_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 LinkedList<Resource> myUnSynchronizedResources = new LinkedList<Resource>();
-
- /**
- * @generated
- */
- private IDiagramDocument myDocument;
-
- /**
- * @generated
- */
- private IEditorInput myEditorInput;
-
- /**
- * @generated
- */
- private boolean myUpdateCache = true;
-
- /**
- * @generated
- */
- private boolean myModifiable = false;
-
- /**
- * @generated
- */
- private boolean myReadOnly = true;
-
- /**
- * @generated
- */
- private ResourceSetModificationListener myResourceSetListener;
-
- /**
- * @generated
- */
- public ResourceSetInfo(IDiagramDocument document, IEditorInput editorInput) {
- super(document);
- myDocument = document;
- myEditorInput = editorInput;
- startResourceListening();
- myResourceSetListener = new ResourceSetModificationListener(this);
- getResourceSet().eAdapters().add(myResourceSetListener);
- }
-
- /**
- * @generated
- */
- public long getModificationStamp() {
- return myModificationStamp;
- }
-
- /**
- * @generated
- */
- public void setModificationStamp(long modificationStamp) {
- myModificationStamp = modificationStamp;
- }
-
- /**
- * @generated
- */
- public TransactionalEditingDomain getEditingDomain() {
- return myDocument.getEditingDomain();
- }
-
- /**
- * @generated
- */
- public ResourceSet getResourceSet() {
- return getEditingDomain().getResourceSet();
- }
-
- /**
- * @generated
- */
- public Iterator<Resource> getLoadedResourcesIterator() {
- return new ArrayList<Resource>(getResourceSet().getResources()).iterator();
- }
-
- /**
- * @generated
- */
- public IEditorInput getEditorInput() {
- return myEditorInput;
- }
-
- /**
- * @generated
- */
- public void dispose() {
- stopResourceListening();
- getResourceSet().eAdapters().remove(myResourceSetListener);
- for(Iterator<Resource> it = getLoadedResourcesIterator(); it.hasNext();) {
- Resource resource = it.next();
- resource.unload();
- }
- getEditingDomain().dispose();
- }
-
- /**
- * @generated
- */
- public boolean isSynchronized() {
- return myUnSynchronizedResources.size() == 0;
- }
-
- /**
- * @generated
- */
- public void setUnSynchronized(Resource resource) {
- myUnSynchronizedResources.add(resource);
- }
-
- /**
- * @generated
- */
- public void setSynchronized(Resource resource) {
- myUnSynchronizedResources.remove(resource);
- }
-
- /**
- * @generated
- */
- public final void stopResourceListening() {
- mySynchronizer.dispose();
- mySynchronizer = null;
- }
-
- /**
- * @generated
- */
- public final void startResourceListening() {
- mySynchronizer = new WorkspaceSynchronizer(getEditingDomain(), new SynchronizerDelegate());
- }
-
- /**
- * @generated
- */
- public boolean isUpdateCache() {
- return myUpdateCache;
- }
-
- /**
- * @generated
- */
- public void setUpdateCache(boolean update) {
- myUpdateCache = update;
- }
-
- /**
- * @generated
- */
- public boolean isModifiable() {
- return myModifiable;
- }
-
- /**
- * @generated
- */
- public void setModifiable(boolean modifiable) {
- myModifiable = modifiable;
- }
-
- /**
- * @generated
- */
- public boolean isReadOnly() {
- return myReadOnly;
- }
-
- /**
- * @generated
- */
- public void setReadOnly(boolean readOnly) {
- myReadOnly = readOnly;
- }
-
- /**
- * @generated
- */
- private class SynchronizerDelegate implements WorkspaceSynchronizer.Delegate {
-
- /**
- * @generated
- */
- 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/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlInitDiagramFileAction.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlInitDiagramFileAction.java
deleted file mode 100644
index d24c9252cfb..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlInitDiagramFileAction.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.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.sysml.diagram.parametric.edit.parts.ParametricEditPart;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * @generated
- */
-public class SysmlInitDiagramFileAction 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) {
- SysmlDiagramEditorPlugin.getInstance().logError("Unable to load resource: " + domainModelURI, ex); //$NON-NLS-1$
- }
- if(diagramRoot == null) {
- MessageDialog.openError(getShell(), Messages.InitDiagramFile_ResourceErrorDialogTitle, Messages.InitDiagramFile_ResourceErrorDialogMessage);
- return;
- }
- Wizard wizard = new SysmlNewDiagramFileWizard(domainModelURI, diagramRoot, editingDomain);
- wizard.setWindowTitle(NLS.bind(Messages.InitDiagramFile_WizardTitle, ParametricEditPart.MODEL_ID));
- SysmlDiagramEditorUtil.runWizard(getShell(), wizard, "InitDiagramFile"); //$NON-NLS-1$
- }
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlLinkDescriptor.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlLinkDescriptor.java
deleted file mode 100644
index 099c42c3ac1..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlLinkDescriptor.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.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 SysmlLinkDescriptor extends SysmlNodeDescriptor {
-
- /**
- * @generated
- */
- private EObject mySource;
-
- /**
- * @generated
- */
- private EObject myDestination;
-
- /**
- * @generated
- */
- private IAdaptable mySemanticAdapter;
-
- /**
- * @generated
- */
- private SysmlLinkDescriptor(EObject source, EObject destination, EObject linkElement, int linkVID) {
- super(linkElement, linkVID);
- mySource = source;
- myDestination = destination;
- }
-
- /**
- * @generated
- */
- public SysmlLinkDescriptor(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 SysmlLinkDescriptor(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/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlMatchingStrategy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlMatchingStrategy.java
deleted file mode 100644
index 67bdb8b2dd2..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlMatchingStrategy.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.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 SysmlMatchingStrategy implements IEditorMatchingStrategy {
-
- /**
- * @generated
- */
- public boolean matches(IEditorReference editorRef, IEditorInput input) {
- IEditorInput editorInput;
- try {
- editorInput = editorRef.getEditorInput();
- } catch (PartInitException e) {
- return false;
- }
-
- if(editorInput.equals(input)) {
- return true;
- }
- if(editorInput instanceof URIEditorInput && input instanceof URIEditorInput) {
- return ((URIEditorInput)editorInput).getURI().equals(((URIEditorInput)input).getURI());
- }
- return false;
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlNewDiagramFileWizard.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlNewDiagramFileWizard.java
deleted file mode 100644
index 665d8cbe43f..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlNewDiagramFileWizard.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.part;
-
-import java.io.IOException;
-import java.util.LinkedList;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.OperationHistoryFactory;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.diagram.core.services.ViewService;
-import org.eclipse.gmf.runtime.diagram.core.services.view.CreateDiagramViewOperation;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ParametricEditPart;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
-
-/**
- * @generated
- */
-public class SysmlNewDiagramFileWizard extends Wizard {
-
- /**
- * @generated
- */
- private WizardNewFileCreationPage myFileCreationPage;
-
- /**
- * @generated
- */
- private ModelElementSelectionPage diagramRootElementSelectionPage;
-
- /**
- * @generated
- */
- private TransactionalEditingDomain myEditingDomain;
-
- /**
- * @generated
- */
- public SysmlNewDiagramFileWizard(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.SysmlNewDiagramFileWizard_CreationPageName, StructuredSelection.EMPTY);
- myFileCreationPage.setTitle(Messages.SysmlNewDiagramFileWizard_CreationPageTitle);
- myFileCreationPage.setDescription(NLS.bind(Messages.SysmlNewDiagramFileWizard_CreationPageDescription, ParametricEditPart.MODEL_ID));
- IPath filePath;
- String fileName = URI.decode(domainModelURI.trimFileExtension().lastSegment());
- if(domainModelURI.isPlatformResource()) {
- filePath = new Path(domainModelURI.trimSegments(1).toPlatformString(true));
- } else if(domainModelURI.isFile()) {
- filePath = new Path(domainModelURI.trimSegments(1).toFileString());
- } else {
- // TODO : use some default path
- throw new IllegalArgumentException("Unsupported URI: " + domainModelURI); //$NON-NLS-1$
- }
- myFileCreationPage.setContainerFullPath(filePath);
- myFileCreationPage.setFileName(SysmlDiagramEditorUtil.getUniqueFileName(filePath, fileName, "sysml_diagram")); //$NON-NLS-1$
-
- diagramRootElementSelectionPage = new DiagramRootElementSelectionPage(Messages.SysmlNewDiagramFileWizard_RootSelectionPageName);
- diagramRootElementSelectionPage.setTitle(Messages.SysmlNewDiagramFileWizard_RootSelectionPageTitle);
- diagramRootElementSelectionPage.setDescription(Messages.SysmlNewDiagramFileWizard_RootSelectionPageDescription);
- diagramRootElementSelectionPage.setModelElement(diagramRoot);
-
- myEditingDomain = editingDomain;
- }
-
- /**
- * @generated
- */
- public void addPages() {
- addPage(myFileCreationPage);
- addPage(diagramRootElementSelectionPage);
- }
-
- /**
- * @generated
- */
- public boolean performFinish() {
- LinkedList<IFile> affectedFiles = new LinkedList<IFile>();
- IFile diagramFile = myFileCreationPage.createNewFile();
- SysmlDiagramEditorUtil.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.SysmlNewDiagramFileWizard_InitDiagramCommand, affectedFiles) {
-
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- int diagramVID = SysmlVisualIDRegistry.getDiagramVisualID(diagramRootElementSelectionPage.getModelElement());
- if(diagramVID != ParametricEditPart.VISUAL_ID) {
- return CommandResult.newErrorCommandResult(Messages.SysmlNewDiagramFileWizard_IncorrectRootError);
- }
- Diagram diagram = ViewService.createDiagram(diagramRootElementSelectionPage.getModelElement(), ParametricEditPart.MODEL_ID, SysmlDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
- diagramResource.getContents().add(diagram);
- return CommandResult.newOKCommandResult();
- }
- };
- try {
- OperationHistoryFactory.getOperationHistory().execute(command, new NullProgressMonitor(), null);
- diagramResource.save(SysmlDiagramEditorUtil.getSaveOptions());
- SysmlDiagramEditorUtil.openDiagram(diagramResource);
- } catch (ExecutionException e) {
- SysmlDiagramEditorPlugin.getInstance().logError("Unable to create model and diagram", e); //$NON-NLS-1$
- } catch (IOException ex) {
- SysmlDiagramEditorPlugin.getInstance().logError("Save operation failed for: " + diagramModelURI, ex); //$NON-NLS-1$
- } catch (PartInitException ex) {
- SysmlDiagramEditorPlugin.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.SysmlNewDiagramFileWizard_RootSelectionPageSelectionTitle;
- }
-
- /**
- * @generated
- */
- protected boolean validatePage() {
- if(selectedModelElement == null) {
- setErrorMessage(Messages.SysmlNewDiagramFileWizard_RootSelectionPageNoSelectionMessage);
- return false;
- }
- boolean result = ViewService.getInstance().provides(new CreateDiagramViewOperation(new EObjectAdapter(selectedModelElement), ParametricEditPart.MODEL_ID, SysmlDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT));
- setErrorMessage(result ? null : Messages.SysmlNewDiagramFileWizard_RootSelectionPageInvalidSelectionMessage);
- return result;
- }
- }
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlNodeDescriptor.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlNodeDescriptor.java
deleted file mode 100644
index cd2274b0853..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlNodeDescriptor.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.part;
-
-import org.eclipse.emf.ecore.EObject;
-
-/**
- * @generated
- */
-public class SysmlNodeDescriptor {
-
- /**
- * @generated
- */
- private final EObject myModelElement;
-
- /**
- * @generated
- */
- private final int myVisualID;
-
- /**
- * @generated
- */
- public SysmlNodeDescriptor(EObject modelElement, int visualID) {
- myModelElement = modelElement;
- myVisualID = visualID;
- }
-
- /**
- * @generated
- */
- public EObject getModelElement() {
- return myModelElement;
- }
-
- /**
- * @generated
- */
- public int getVisualID() {
- return myVisualID;
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlPaletteFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlPaletteFactory.java
deleted file mode 100644
index aa83177f224..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlPaletteFactory.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.part;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.gef.Tool;
-import org.eclipse.gmf.runtime.diagram.ui.services.palette.PaletteFactory;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.papyrus.sysml.diagram.parametric.providers.SysmlElementTypes;
-import org.eclipse.papyrus.uml.diagram.common.service.AspectUnspecifiedTypeConnectionTool;
-import org.eclipse.papyrus.uml.diagram.common.service.AspectUnspecifiedTypeCreationTool;
-
-/**
- * @generated
- */
-public class SysmlPaletteFactory extends PaletteFactory.Adapter {
-
- /**
- * @generated
- */
- private final static String CREATECONSTRAINTPROPERTY1CREATIONTOOL = "createConstraintProperty1CreationTool"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- private final static String CREATEPROPERTY2CREATIONTOOL = "createProperty2CreationTool"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- private final static String CREATECONNECTOR3CREATIONTOOL = "createConnector3CreationTool"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- public SysmlPaletteFactory() {
-
- }
-
- /**
- * @generated
- */
- public Tool createTool(String toolId) {
- if(toolId.equals(CREATECONSTRAINTPROPERTY1CREATIONTOOL)) {
- return createConstraintProperty1CreationTool();
- }
- if(toolId.equals(CREATEPROPERTY2CREATIONTOOL)) {
- return createProperty2CreationTool();
- }
- if(toolId.equals(CREATECONNECTOR3CREATIONTOOL)) {
- return createConnector3CreationTool();
- }
-
- // default return: null
- return null;
- }
-
- public Object getTemplate(String templateId) {
-
- // default return: null
- return null;
- }
-
- /**
- * @generated
- */
- private Tool createConstraintProperty1CreationTool() {
- List<IElementType> types = new ArrayList<IElementType>(1);
- types.add(SysmlElementTypes.ConstraintProperty_2003);
-
- Tool tool = new AspectUnspecifiedTypeCreationTool(types);
- return tool;
- }
-
- /**
- * @generated
- */
- private Tool createProperty2CreationTool() {
- List<IElementType> types = new ArrayList<IElementType>(2);
- types.add(SysmlElementTypes.Property_3002);
- types.add(SysmlElementTypes.Property_2005);
-
- Tool tool = new AspectUnspecifiedTypeCreationTool(types);
- return tool;
- }
-
- /**
- * @generated
- */
- private Tool createConnector3CreationTool() {
- List<IElementType> types = new ArrayList<IElementType>(1);
- types.add(SysmlElementTypes.Connector_4001);
-
- Tool tool = new AspectUnspecifiedTypeConnectionTool(types);
- return tool;
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlUriEditorInputTester.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlUriEditorInputTester.java
deleted file mode 100644
index f2a612d3103..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlUriEditorInputTester.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.part;
-
-import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.emf.common.ui.URIEditorInput;
-
-/**
- * @generated
- */
-public class SysmlUriEditorInputTester 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 "sysml_diagram".equals(editorInput.getURI().fileExtension()); //$NON-NLS-1$
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlVisualIDRegistry.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlVisualIDRegistry.java
deleted file mode 100644
index 26e18ffed28..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/SysmlVisualIDRegistry.java
+++ /dev/null
@@ -1,283 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.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.resource.Resource;
-import org.eclipse.papyrus.sysml.constraints.ConstraintsPackage;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ConnectorEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ConnectorNameEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ConstraintLabelEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ConstraintPropertyEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ConstraintPropertyNameEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ParametricEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.Property2EditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.PropertyEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.PropertyName2EditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.PropertyNameEditPart;
-import org.eclipse.papyrus.uml.diagram.common.providers.BaseViewInfo;
-import org.eclipse.papyrus.uml.diagram.common.providers.ViewInfo;
-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 SysmlVisualIDRegistry {
-
- /**
- * @generated
- */
- private static final String DEBUG_KEY = "org.eclipse.papyrus.sysml.diagram.parametric/debug/visualID"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static int getVisualID(View view) {
- if(view instanceof Diagram) {
- if(ParametricEditPart.MODEL_ID.equals(view.getType())) {
- return ParametricEditPart.VISUAL_ID;
- } else {
- return -1;
- }
- }
- return org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlVisualIDRegistry.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))) {
- SysmlDiagramEditorPlugin.getInstance().logError("Unable to parse view type as a visualID number: " + type);
- }
- }
- return -1;
- }
-
- /**
- * @generated
- */
- public static String getType(int visualID) {
- return Integer.toString(visualID);
- }
-
- /**
- * @generated NOT
- */
- public static int getDiagramVisualID(EObject domainElement) {
- if(domainElement == null) {
- return -1;
- }
- // test if it is a class for the parametric diagram
- if(UMLPackage.eINSTANCE.getClass_().equals(domainElement.eClass())) {
- return ParametricEditPart.VISUAL_ID;
- }
- return -1;
- }
-
- /**
- * @generated
- */
- public static int getNodeVisualID(View containerView, EObject domainElement) {
- if(domainElement == null) {
- return -1;
- }
- String containerModelID = org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlVisualIDRegistry.getModelID(containerView);
- if(!ParametricEditPart.MODEL_ID.equals(containerModelID)) {
- return -1;
- }
- int containerVisualID;
- if(ParametricEditPart.MODEL_ID.equals(containerModelID)) {
- containerVisualID = org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlVisualIDRegistry.getVisualID(containerView);
- } else {
- if(containerView instanceof Diagram) {
- containerVisualID = ParametricEditPart.VISUAL_ID;
- } else {
- return -1;
- }
- }
- switch(containerVisualID) {
- case ParametricEditPart.VISUAL_ID:
- if(ConstraintsPackage.eINSTANCE.getConstraintProperty().isSuperTypeOf(domainElement.eClass())
-
- ) {
- return ConstraintPropertyEditPart.VISUAL_ID;
- }
- if(UMLPackage.eINSTANCE.getProperty().isSuperTypeOf(domainElement.eClass())
-
- ) {
- return PropertyEditPart.VISUAL_ID;
- }
- break;
- case ConstraintPropertyEditPart.VISUAL_ID:
- if(UMLPackage.eINSTANCE.getProperty().isSuperTypeOf(domainElement.eClass())
-
- ) {
- return Property2EditPart.VISUAL_ID;
- }
- break;
- }
- return -1;
- }
-
- /**
- * @generated
- */
- public static boolean canCreateNode(View containerView, int nodeVisualID) {
- String containerModelID = org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlVisualIDRegistry.getModelID(containerView);
- if(!ParametricEditPart.MODEL_ID.equals(containerModelID)) {
- return false;
- }
- int containerVisualID;
- if(ParametricEditPart.MODEL_ID.equals(containerModelID)) {
- containerVisualID = org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlVisualIDRegistry.getVisualID(containerView);
- } else {
- if(containerView instanceof Diagram) {
- containerVisualID = ParametricEditPart.VISUAL_ID;
- } else {
- return false;
- }
- }
- switch(containerVisualID) {
- case ParametricEditPart.VISUAL_ID:
- if(ConstraintPropertyEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if(PropertyEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case ConstraintPropertyEditPart.VISUAL_ID:
- if(ConstraintPropertyNameEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if(ConstraintLabelEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if(Property2EditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case PropertyEditPart.VISUAL_ID:
- if(PropertyNameEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case Property2EditPart.VISUAL_ID:
- if(PropertyName2EditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case ConnectorEditPart.VISUAL_ID:
- if(ConnectorNameEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- }
- return false;
- }
-
- /**
- * @generated
- */
- public static int getLinkWithClassVisualID(EObject domainElement) {
- if(domainElement == null) {
- return -1;
- }
- if(UMLPackage.eINSTANCE.getConnector().isSuperTypeOf(domainElement.eClass())
-
- ) {
- return ConnectorEditPart.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(Resource element) {
- return true;
- }
-
- /**
- * @generated
- */
- private static ViewInfo diagramViewInfo = null;
-
- /**
- * @generated
- */
- public static ViewInfo getDiagramViewInfo() {
- if(diagramViewInfo == null) {
- diagramViewInfo = getResource_1000ViewInfo();
- }
- return diagramViewInfo;
- }
-
- /**
- * @generated
- */
- protected static ViewInfo getResource_1000ViewInfo() {
- ViewInfo root = new BaseViewInfo(1000, ViewInfo.Head, "", null, null);
- ViewInfo viewInfo = null;
- ViewInfo labelInfo = null;
-
- viewInfo = new BaseViewInfo(2003, ViewInfo.Node, "ConstraintProperty");
- root.addNode(1000, viewInfo);
-
- viewInfo = new BaseViewInfo(2005, ViewInfo.Node, "Property");
- root.addNode(1000, viewInfo);
-
- viewInfo = new BaseViewInfo(4001, ViewInfo.Edge, "");
- root.addNode(1000, viewInfo);
-
- labelInfo = new BaseViewInfo(6001, ViewInfo.Label, "", null, viewInfo);
- viewInfo.getChildren().add(labelInfo);
-
- viewInfo = new BaseViewInfo(3002, ViewInfo.Node, "Property");
-
- root.addNode(2003, viewInfo);
-
- return root;
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/ValidateAction.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/ValidateAction.java
deleted file mode 100644
index eeb491b040f..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/part/ValidateAction.java
+++ /dev/null
@@ -1,264 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.part;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.emf.common.util.Diagnostic;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.util.Diagnostician;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.emf.validation.model.EvaluationMode;
-import org.eclipse.emf.validation.model.IConstraintStatus;
-import org.eclipse.emf.validation.service.IBatchValidator;
-import org.eclipse.emf.validation.service.ModelValidationService;
-import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
-import org.eclipse.gef.EditPartViewer;
-import org.eclipse.gmf.runtime.diagram.ui.OffscreenEditPartFactory;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart;
-import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.papyrus.sysml.diagram.parametric.providers.SysmlMarkerNavigationProvider;
-import org.eclipse.papyrus.sysml.diagram.parametric.providers.SysmlValidationProvider;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation;
-
-/**
- * @generated
- */
-public class ValidateAction extends Action {
-
- /**
- * @generated
- */
- private IWorkbenchPage page;
-
- /**
- * @generated
- */
- public ValidateAction(IWorkbenchPage page) {
- setText(Messages.ValidateActionMessage);
- this.page = page;
- }
-
- /**
- * @generated
- */
- public void run() {
- IWorkbenchPart workbenchPart = page.getActivePart();
- if(workbenchPart instanceof IDiagramWorkbenchPart) {
- final IDiagramWorkbenchPart part = (IDiagramWorkbenchPart)workbenchPart;
- try {
- new WorkspaceModifyDelegatingOperation(new IRunnableWithProgress() {
-
- public void run(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
- runValidation(part.getDiagramEditPart(), part.getDiagram());
- }
- }).run(new NullProgressMonitor());
- } catch (Exception e) {
- SysmlDiagramEditorPlugin.getInstance().logError("Validation action failed", e); //$NON-NLS-1$
- }
- }
- }
-
- /**
- * @generated
- */
- public static void runValidation(View view) {
- try {
- if(SysmlDiagramEditorUtil.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) {
- SysmlDiagramEditorPlugin.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);
- SysmlValidationProvider.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) {
- SysmlMarkerNavigationProvider.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();
- SysmlDiagramEditorUtil.LazyElement2ViewMap element2ViewMap = new SysmlDiagramEditorUtil.LazyElement2ViewMap(diagramEditPart.getDiagramView(), collectTargetElements(rootStatus, new HashSet<EObject>(), allStatuses));
- for(Iterator it = allStatuses.iterator(); it.hasNext();) {
- IConstraintStatus nextStatus = (IConstraintStatus)it.next();
- View view = SysmlDiagramEditorUtil.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();
- SysmlDiagramEditorUtil.LazyElement2ViewMap element2ViewMap = new SysmlDiagramEditorUtil.LazyElement2ViewMap(diagramEditPart.getDiagramView(), collectTargetElements(rootStatus, new HashSet<EObject>(), allDiagnostics));
- for(Iterator it = emfValidationStatus.getChildren().iterator(); it.hasNext();) {
- Diagnostic nextDiagnostic = (Diagnostic)it.next();
- List data = nextDiagnostic.getData();
- if(data != null && !data.isEmpty() && data.get(0) instanceof EObject) {
- EObject element = (EObject)data.get(0);
- View view = SysmlDiagramEditorUtil.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;
- }
- SysmlMarkerNavigationProvider.addMarker(target, elementId, location, message, statusSeverity);
- }
-
- /**
- * @generated
- */
- private static int diagnosticToStatusSeverity(int diagnosticSeverity) {
- if(diagnosticSeverity == Diagnostic.OK) {
- return IStatus.OK;
- } else if(diagnosticSeverity == Diagnostic.INFO) {
- return IStatus.INFO;
- } else if(diagnosticSeverity == Diagnostic.WARNING) {
- return IStatus.WARNING;
- } else if(diagnosticSeverity == Diagnostic.ERROR || diagnosticSeverity == Diagnostic.CANCEL) {
- return IStatus.ERROR;
- }
- return IStatus.INFO;
- }
-
- /**
- * @generated
- */
- private static Set<EObject> collectTargetElements(IStatus status, Set<EObject> targetElementCollector, List 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<EObject> collectTargetElements(Diagnostic diagnostic, Set<EObject> targetElementCollector, List allDiagnostics) {
- List data = diagnostic.getData();
- EObject target = null;
- if(data != null && !data.isEmpty() && data.get(0) instanceof EObject) {
- target = (EObject)data.get(0);
- targetElementCollector.add(target);
- allDiagnostics.add(diagnostic);
- }
- if(diagnostic.getChildren() != null && !diagnostic.getChildren().isEmpty()) {
- for(Iterator it = diagnostic.getChildren().iterator(); it.hasNext();) {
- collectTargetElements((Diagnostic)it.next(), targetElementCollector, allDiagnostics);
- }
- }
- return targetElementCollector;
- }
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomDefaultSemanticEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomDefaultSemanticEditPolicy.java
new file mode 100644
index 00000000000..f2018499f68
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomDefaultSemanticEditPolicy.java
@@ -0,0 +1,94 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.parametric.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
+import org.eclipse.papyrus.gmf.diagram.common.provider.IGraphicalTypeRegistry;
+import org.eclipse.papyrus.sysml.diagram.parametric.provider.CustomGraphicalTypeRegistry;
+import org.eclipse.papyrus.sysml.diagram.parametric.provider.ElementTypes;
+import org.eclipse.papyrus.sysml.diagram.parametric.provider.GraphicalTypeRegistry;
+import org.eclipse.papyrus.uml.diagram.composite.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.uml.diagram.composite.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.infra.services.edit.utils.RequestParameterConstants;
+
+/**
+ * <pre>
+ * Custom semantic edit policy that replace DefaultSemanticEditPolicy
+ * in order to manage Class Diagram specific elements (reference
+ * relationships COMMENT_ANNOTATED_ELEMENT and CONSTRAINT_CONSTRAINED_ELEMENT).
+ * </pre>
+ */
+public class CustomDefaultSemanticEditPolicy extends DefaultSemanticEditPolicy {
+
+ /** Local graphical type registry for graphical elements */
+ private IGraphicalTypeRegistry registry = new CustomGraphicalTypeRegistry();
+
+ /** Local graphical type registry for inherited graphical elements */
+ private IGraphicalTypeRegistry inheritedRegistry = new GraphicalTypeRegistry();
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+
+ if(ElementTypes.COMMENT_ANNOTATED_ELEMENT == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+
+ if(ElementTypes.CONSTRAINT_CONSTRAINED_ELEMENT == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+
+ String newEdgeGraphicalType = registry.getEdgeGraphicalType(req.getElementType());
+
+ if(inheritedRegistry.isKnownEdgeType(newEdgeGraphicalType)) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ if(!registry.isKnownEdgeType(newEdgeGraphicalType)) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ return super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+
+ View reconnectedView = (View)req.getParameter(RequestParameterConstants.GRAPHICAL_RECONNECTED_EDGE);
+ String reconnectedViewType = (reconnectedView != null) ? reconnectedView.getType() : IGraphicalTypeRegistry.UNDEFINED_TYPE;
+
+ if(ElementTypes.COMMENT_ANNOTATED_ELEMENT.getSemanticHint().equals(reconnectedViewType)) {
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ }
+
+ if(ElementTypes.CONSTRAINT_CONSTRAINED_ELEMENT.getSemanticHint().equals(reconnectedViewType)) {
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomDragDropEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomDragDropEditPolicy.java
new file mode 100644
index 00000000000..cec8a5f41da
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomDragDropEditPolicy.java
@@ -0,0 +1,277 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.parametric.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+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.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest;
+import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.gmf.diagram.common.edit.policy.CommonDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.sysml.blocks.NestedConnectorEnd;
+import org.eclipse.papyrus.sysml.diagram.internalblock.dnd.helper.CustomLinkMappingHelper;
+import org.eclipse.papyrus.sysml.diagram.internalblock.provider.CustomGraphicalTypeRegistry;
+import org.eclipse.papyrus.sysml.service.types.utils.ConnectorUtils;
+import org.eclipse.papyrus.uml.diagram.common.commands.CommonDeferredCreateConnectionViewCommand;
+import org.eclipse.papyrus.uml.diagram.common.commands.SemanticAdapter;
+import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes;
+import org.eclipse.uml2.uml.Connector;
+import org.eclipse.uml2.uml.ConnectorEnd;
+import org.eclipse.uml2.uml.EncapsulatedClassifier;
+import org.eclipse.uml2.uml.Port;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.util.UMLUtil;
+
+/** Customization of the DND edit policy for the Internal Block Diagram */
+public class CustomDragDropEditPolicy extends CommonDiagramDragDropEditPolicy {
+
+ private ConnectorUtils utils = new ConnectorUtils();
+
+ /** Default constructor. */
+ public CustomDragDropEditPolicy() {
+ super(new CustomLinkMappingHelper());
+ registry = new CustomGraphicalTypeRegistry();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Set<String> getSpecificDropBehaviorTypes() {
+ Set<String> specificDropBehaviorTypes = new HashSet<String>();
+
+ specificDropBehaviorTypes.add(UMLGraphicalTypes.LINK_UML_CONNECTOR_ID);
+
+ return specificDropBehaviorTypes;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected ICommand getSpecificDropCommand(DropObjectsRequest dropRequest, EObject droppedEObject, String nodeType, String edgeType) {
+ if((UMLGraphicalTypes.LINK_UML_CONNECTOR_ID.equals(edgeType)) && (droppedEObject instanceof Connector)) {
+ return getConnectorDropCommand(dropRequest, (Connector)droppedEObject, edgeType);
+ }
+
+ return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE;
+ }
+
+ protected ICommand getConnectorDropCommand(DropObjectsRequest dropRequest, Connector droppedEObject, String edgeType) {
+
+ // Only manage binary link during drop
+ if(droppedEObject.getEnds().size() != 2) {
+ return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE;
+ }
+
+ ConnectorEnd source = droppedEObject.getEnds().get(0);
+ ConnectorEnd target = droppedEObject.getEnds().get(1);
+
+ // Find views in current diagram representing source and target
+ Collection<View> sourceViews = getViewsForConnectorEnd(source);
+ Collection<View> targetViews = getViewsForConnectorEnd(target);
+
+ IAdaptable sourceViewAdapter = null;
+ IAdaptable targetViewAdapter = null;
+
+ // If either a source or target lacks create view for these elements, abort...
+ if(sourceViews.isEmpty() || targetViews.isEmpty()) {
+ return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE;
+ }
+
+ View selectedSourceView = null;
+ View selectedTargetView = null;
+ // until a correct one is found, check that source and target views selected are correct given the current path for the connector...
+ for(View sourceView : sourceViews) {
+ View targetView = getFirstValidTargetViewForSource(sourceView, targetViews, droppedEObject);
+ if(targetView !=null) {
+ selectedSourceView = sourceView;
+ selectedTargetView = targetView;
+ break;
+ }
+ }
+
+
+ // Create source adapter
+ if(selectedSourceView!=null) { // sourceViewAdapter should still be null in this case
+ sourceViewAdapter = new SemanticAdapter(null, selectedSourceView);
+ } else {
+ return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE;
+ }
+
+ // Create target adapter
+ if(selectedTargetView!=null) { // targetViewAdapter should still be null in this case
+ targetViewAdapter = new SemanticAdapter(null, selectedTargetView);
+ } else {
+ return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE;
+ }
+
+ // Create a view for the dropped link between the source and target view adapters
+ IAdaptable droppedObjectAdapter = new SemanticAdapter(droppedEObject, null);
+
+ CreateConnectionViewRequest.ConnectionViewDescriptor linkdescriptor = new CreateConnectionViewRequest.ConnectionViewDescriptor(droppedObjectAdapter, edgeType, getDiagramPreferencesHint());
+
+ CommonDeferredCreateConnectionViewCommand createConnectionViewCommand = new CommonDeferredCreateConnectionViewCommand(getEditingDomain(), edgeType, sourceViewAdapter, targetViewAdapter, getViewer(), getDiagramPreferencesHint(), linkdescriptor, null);
+ createConnectionViewCommand.setElement(droppedEObject);
+
+ return createConnectionViewCommand;
+ }
+
+ /**
+ * get the first valid target view for the given source. the couple source/target is valid if the path to them from the future container is valid
+ * @param sourceView
+ * @param targetViews
+ * @return
+ */
+ private View getFirstValidTargetViewForSource(View sourceView, Collection<View> targetViews, Connector droppedConnector) {
+ for(View targetView : targetViews) {
+ if(isValidTargetViewForSource(sourceView, targetView, droppedConnector)) {
+ return targetView;
+ }
+ }
+
+ return null;
+ }
+
+ private boolean isValidTargetViewForSource(View sourceView, View targetView, Connector droppedConnector) {
+ if(!(utils.isCrossingEncapsulation(sourceView, targetView))) {
+ // no encapsulation. Computes the end paths
+ List<Property> sourceNestedPaths = utils.getNestedPropertyPath(sourceView, targetView);
+ List<Property> targetNestedPaths = utils.getNestedPropertyPath(targetView, sourceView);
+
+ // check this is compatible with current connector
+ ConnectorEnd sourceConnectorEnd = utils.getSourceConnectorEnd(droppedConnector);
+ NestedConnectorEnd nestedSourceConnectorEnd = UMLUtil.getStereotypeApplication(sourceConnectorEnd, NestedConnectorEnd.class);
+ if(nestedSourceConnectorEnd!=null) {
+ List<Property> currentSourceConnectorPropertyPath = nestedSourceConnectorEnd.getPropertyPath();
+ // compare the 2 list
+ if(!sourceNestedPaths.equals(currentSourceConnectorPropertyPath)) {
+ return false;
+ }
+
+ } else { // no end for the current connector, so the sourceNestedPath should be empty
+ if(!sourceNestedPaths.isEmpty()) {
+ return false;
+ }
+ }
+
+
+ ConnectorEnd targetConnectorEnd = utils.getTargetConnectorEnd(droppedConnector);
+ NestedConnectorEnd nestedTargetConnectorEnd = UMLUtil.getStereotypeApplication(targetConnectorEnd, NestedConnectorEnd.class);
+ if(nestedTargetConnectorEnd!=null) {
+ List<Property> currentTargetConnectorPropertyPath = nestedTargetConnectorEnd.getPropertyPath();
+ // compare the 2 list
+ if(!targetNestedPaths.equals(currentTargetConnectorPropertyPath)) {
+ return false;
+ }
+
+ } else { // no end for the current connector, so the targetNestedPaths should be empty
+ if(!targetNestedPaths.isEmpty()) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ /**
+ * This methods looks for views representing a given {@link ConnectorEnd} in the host diagram.
+ *
+ * @param end
+ * the {@link ConnectorEnd} to look for.
+ * @return the list of {@link View} representing the eObject.
+ */
+ protected Set<View> getViewsForConnectorEnd(ConnectorEnd end) {
+ Set<View> views = new HashSet<View>();
+
+ // Retrieve host diagram
+ View hostView = ((IGraphicalEditPart)getHost()).getNotationView();
+ View hostDiagram = (hostView instanceof Diagram) ? hostView : hostView.getDiagram();
+
+ // Retrieve all views for the ConnectorEnd role
+ EReference[] refs = { NotationPackage.eINSTANCE.getView_Element() };
+ @SuppressWarnings("unchecked")
+ Collection<View> relatedViews = EMFCoreUtil.getReferencers(end.getRole(), refs);
+
+ // TODO: We should filter views not only for the current diagram,
+ // but also consider only views nested within the owner of the connector that are closest to the host view
+ // (in case there are several instances of a Part within which the connector could appear).
+ // Connector connector = (Connector)end.getOwner();
+ // StructuredClassifier connectorOwner = (StructuredClassifier)connector.getOwner();
+ // Parse and select views from host diagram only
+ Iterator<View> it = relatedViews.iterator();
+ while(it.hasNext()) {
+ View currentView = it.next();
+ if(currentView.getDiagram() == hostDiagram) { // FIXME: Cf TODO above.
+
+ boolean isInView = false;
+ View containerView = currentView;
+ while(containerView != null && !(containerView instanceof Diagram)) {
+ if(containerView == getReferenceViewForConnectorEnd()) {
+ isInView = true;
+ }
+ containerView = ViewUtil.getContainerView(containerView);
+ }
+
+ if(isInView) {
+
+ EObject containerElement = ViewUtil.getContainerView(currentView).getElement();
+
+ // If the ConnectorEnd partWithPort is not null, only select Views for which
+ // the graphical parent reference partWithPort.
+ if(end.getPartWithPort() != null) {
+ if(containerElement == end.getPartWithPort()) {
+ views.add(currentView);
+ }
+ } else {
+ // If the role is a Port, its graphical parent is a EncapsulatedClassifier
+ if(end.getRole() instanceof Port) {
+ if(containerElement instanceof EncapsulatedClassifier) {
+ views.add(currentView);
+ } else if(containerElement instanceof Property) {
+ Property property = (Property)containerElement;
+ if(property.getType() == end.getRole().getOwner()) {
+ views.add(currentView);
+ }
+ }
+ } else { // No further test needed
+ views.add(currentView);
+ }
+
+ }
+ }
+ }
+ }
+
+ return views;
+ }
+
+ protected View getReferenceViewForConnectorEnd() {
+ return ((IGraphicalEditPart)getHost()).getNotationView();
+ }
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomParametricSemanticPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomParametricSemanticPolicy.java
new file mode 100644
index 00000000000..fe7adbbccb2
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomParametricSemanticPolicy.java
@@ -0,0 +1,38 @@
+package org.eclipse.papyrus.sysml.diagram.parametric.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.papyrus.sysml.diagram.common.edit.part.BlockPropertyCompositeEditPart;
+import org.eclipse.papyrus.sysml.diagram.common.edit.part.ConstraintBlockPropertyCompositeEditPart;
+import org.eclipse.papyrus.sysml.diagram.parametric.commands.CustomBindingConnectorCreateCommand;
+import org.eclipse.papyrus.sysml.diagram.parametric.edit.part.CustomBlockCompositeEditPartTN;
+import org.eclipse.papyrus.sysml.diagram.parametric.edit.policy.DiagramSemanticEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.edit.part.ConstraintParameterAffixedNodeEditPart;
+import org.eclipse.papyrus.uml.diagram.common.edit.part.PortAffixedNodeEditPart;
+import org.eclipse.uml2.uml.UMLPackage;
+
+public class CustomParametricSemanticPolicy extends DiagramSemanticEditPolicy {
+
+ @Override
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (req.getElementType().getEClass() == UMLPackage.eINSTANCE.getConnector()) {
+ if (getHost() instanceof CustomBlockCompositeEditPartTN) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ if (getHost() instanceof ConstraintBlockPropertyCompositeEditPart) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ if (getHost() instanceof ConstraintParameterAffixedNodeEditPart) {
+ return getGEFWrapper(new CustomBindingConnectorCreateCommand(req));
+ }
+ if (getHost() instanceof PortAffixedNodeEditPart) {
+ return getGEFWrapper(new CustomBindingConnectorCreateCommand(req));
+ }
+ if (getHost() instanceof BlockPropertyCompositeEditPart) {
+ return getGEFWrapper(new CustomBindingConnectorCreateCommand(req));
+ }
+ }
+ return super.getCreateRelationshipCommand(req);
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/StructureClassifierDropEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/StructureClassifierDropEditPolicy.java
new file mode 100644
index 00000000000..94dd1a8a147
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/StructureClassifierDropEditPolicy.java
@@ -0,0 +1,139 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.parametric.policies;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+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.requests.DropObjectsRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.commands.SelectAndExecuteCommand;
+import org.eclipse.papyrus.sysml.diagram.parametric.policies.CustomDragDropEditPolicy;
+import org.eclipse.papyrus.sysml.diagram.parametric.utils.BlockDropHelper;
+import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes;
+import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * <pre>
+ * Customization of the DND edit policy for the StructureClassifier compartments, that enables the direct
+ * creation of typed Part, Reference, Value, ActorPart or Property by dragging types in a Block structure compartment.
+ * </pre>
+ */
+public class StructureClassifierDropEditPolicy extends CustomDragDropEditPolicy {
+
+ /** Default constructor */
+ public StructureClassifierDropEditPolicy() {
+ super();
+ }
+
+ /**
+ * {@inheritedDoc}.
+ */
+ @Override
+ public Command getDropObjectsCommand(DropObjectsRequest dropRequest) {
+
+ BlockDropHelper helper = new BlockDropHelper(getEditingDomain());
+
+ // Single drop management possible drop action list can be proposed
+ if(dropRequest.getObjects().size() == 1) {
+
+ // List of available drop commands
+ final List<Command> commandChoice = new ArrayList<Command>();
+
+ // 1. Try to create a Part typed by the dropped object
+ Command dropAsTypedPart = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart)getHost(), SysMLElementTypes.PART_PROPERTY);
+ if((dropAsTypedPart != null) && (dropAsTypedPart.canExecute())) {
+ commandChoice.add(dropAsTypedPart);
+ }
+
+ // 2. Try to create a Reference typed by the dropped object
+ Command dropAsTypedReference = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart)getHost(), SysMLElementTypes.REFERENCE_PROPERTY);
+ if((dropAsTypedReference != null) && (dropAsTypedReference.canExecute())) {
+ commandChoice.add(dropAsTypedReference);
+ }
+
+ // 3. Try to create an ActorPart typed by the dropped object
+ Command dropAsTypedActorPart = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart)getHost(), SysMLElementTypes.ACTOR_PART_PROPERTY);
+ if((dropAsTypedActorPart != null) && (dropAsTypedActorPart.canExecute())) {
+ commandChoice.add(dropAsTypedActorPart);
+ }
+
+ // 4. Try to create a Value typed by the dropped object
+ Command dropAsTypedValue = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart)getHost(), SysMLElementTypes.VALUE_PROPERTY);
+ if((dropAsTypedValue != null) && (dropAsTypedValue.canExecute())) {
+ commandChoice.add(dropAsTypedValue);
+ }
+
+ // 5. Try to create a Property typed by the dropped object
+ Command dropAsTypedProperty = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart)getHost(), UMLElementTypes.PROPERTY);
+ if((dropAsTypedProperty != null) && (dropAsTypedProperty.canExecute())) {
+ commandChoice.add(dropAsTypedProperty);
+ }
+
+ // 6. Try to create a ConstraintProperty typed by the dropped object
+ Command dropAsTypedConstraintProperty = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart)getHost(), SysMLElementTypes.CONSTRAINT_PROPERTY);
+ if((dropAsTypedConstraintProperty != null) && (dropAsTypedConstraintProperty.canExecute())) {
+ commandChoice.add(dropAsTypedConstraintProperty);
+ }
+
+ // 7. Build default drop command (show view of the dropped object)
+ Command defaultDropCommand = super.getDropObjectsCommand(dropRequest);
+ defaultDropCommand.setLabel("Default drop (Show dropped object in diagram)");
+ if((defaultDropCommand != null) && (defaultDropCommand.canExecute())) {
+ commandChoice.add(defaultDropCommand);
+ }
+
+ // Prepare the selection command (if several command are available) or return the drop command
+ if(commandChoice.size() > 1) {
+ RunnableWithResult<ICommand> runnable;
+ Display.getDefault().syncExec(runnable = new RunnableWithResult.Impl<ICommand>() {
+
+ public void run() {
+ setResult(new SelectAndExecuteCommand("Select drop action for ", PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), commandChoice));
+ }
+ });
+
+ ICommand selectCommand = runnable.getResult();
+
+ return new ICommandProxy(selectCommand);
+
+ } else if(commandChoice.size() == 1) {
+ return commandChoice.get(0);
+ }
+
+ // else (command choice is empty)
+ return UnexecutableCommand.INSTANCE;
+
+ }
+
+ return super.getDropObjectsCommand(dropRequest);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected View getReferenceViewForConnectorEnd() {
+ return ViewUtil.getContainerView(super.getReferenceViewForConnectorEnd());
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/BlockPropertyCompositePreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/BlockPropertyCompositePreferencePage.java
new file mode 100644
index 00000000000..a3686290b78
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/BlockPropertyCompositePreferencePage.java
@@ -0,0 +1,42 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.parametric.preferences;
+
+import org.eclipse.gmf.runtime.common.ui.preferences.AbstractPreferencePage;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.swt.widgets.Composite;
+
+public class BlockPropertyCompositePreferencePage extends AbstractPreferencePage {
+
+ /** Constructor */
+ public BlockPropertyCompositePreferencePage() {
+ super();
+ }
+
+ /** Default preferences initializer */
+ public static void initDefaults(IPreferenceStore store) {
+ CustomBlockPropertyCompositePreferencePage.initDefaults(store);
+ /*CustomNestedBlockPropertyCompositePreferencePage.initDefaults(store);*/
+ }
+
+ @Override
+ protected void addFields(Composite parent) {
+
+ }
+
+ @Override
+ protected void initHelp() {
+
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ConnectorPreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ConnectorPreferencePage.java
deleted file mode 100644
index 031e4ffa005..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ConnectorPreferencePage.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.preferences;
-
-import java.util.Map;
-import java.util.TreeMap;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.AbstractPapyrusLinkPreferencePage;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ParametricEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlDiagramEditorPlugin;
-import org.eclipse.papyrus.uml.diagram.common.util.StringComparator;
-
-/**
- * @generated
- */
-public class ConnectorPreferencePage extends AbstractPapyrusLinkPreferencePage {
-
- /**
- * @generated
- */
- public ConnectorPreferencePage() {
- super();
- setPreferenceKey(ParametricEditPart.MODEL_ID + "_Connector");
- }
-
- /**
- * @generated
- */
- @Override
- protected String getBundleId() {
- return SysmlDiagramEditorPlugin.ID;
- }
-
- /**
- * @generated
- */
- public static void initDefaults(IPreferenceStore store) {
-
- String key = ParametricEditPart.MODEL_ID + "_Connector";
- Map<String, Boolean> map = getStaticLabelVisibilityPreferences();
- for(String role : map.keySet()) {
- String preferenceName = PreferenceConstantHelper.getLabelElementConstant(key, role, PreferenceConstantHelper.LABEL_VISIBILITY);
- store.setDefault(preferenceName, map.get(role));
- }
-
- }
-
- /**
- * @generated
- */
- private static TreeMap<String, String> getStaticLabelRole() {
- TreeMap<String, String> map = new TreeMap<String, String>(new StringComparator());
- map.put("Name", "platform:/plugin/org.eclipse.papyrus.uml.diagram.common/icons/label_role/name.png");//$NON-NLS-1$ //$NON-NLS-2$
- return map;
- }
-
- /**
- * @generated
- */
- private static TreeMap<String, Boolean> getStaticLabelVisibilityPreferences() {
- TreeMap<String, Boolean> map = new TreeMap<String, Boolean>();
-
- map.put("Name", Boolean.FALSE);//$NON-NLS-1$
-
- return map;
- }
-
- /**
- * @generated
- */
- protected TreeMap<String, String> getLabelRole() {
- return getStaticLabelRole();
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ConstraintParameterAsBorderItemPreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ConstraintParameterAsBorderItemPreferencePage.java
new file mode 100644
index 00000000000..3bba22ac76e
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ConstraintParameterAsBorderItemPreferencePage.java
@@ -0,0 +1,302 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.parametric.preferences;
+
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_DEFAULTVALUE;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_DERIVE;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_MODIFIERS;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_MULTIPLICITY;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_NAME;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_TYPE;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_UNDEFINED_TYPE;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_VISIBILITY;
+
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants;
+import org.eclipse.papyrus.sysml.diagram.common.preferences.LabelPreferenceHelper;
+import org.eclipse.papyrus.sysml.diagram.parametric.provider.ElementTypes;
+import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
+
+/**
+ * {@link Port} preference page.
+ */
+public class ConstraintParameterAsBorderItemPreferencePage extends ParametricDiagramNodePreferencePage {
+
+ /** Constant key to access preferences */
+ public static String prefKey = ElementTypes.DIAGRAM_ID + "_" + UMLGraphicalTypes.SHAPE_UML_PROPERTY_AS_AFFIXED_ID; //$NON-NLS-1$
+
+ public static String prefLabelKey = prefKey + "-" + UMLGraphicalTypes.AFFIXEDLABEL_UML_PORT_LABEL_ID; //$NON-NLS-1$
+
+ /** The labels default visibility for preferences */
+ public static final Map<String, Boolean> labelDefaultVisibilityMap;
+
+ /** Static attribute initialization */
+ static {
+ labelDefaultVisibilityMap = new LinkedHashMap<String, Boolean>();
+ labelDefaultVisibilityMap.put("Stereotype", Boolean.TRUE); //$NON-NLS-1$
+ labelDefaultVisibilityMap.put("Label", Boolean.TRUE); //$NON-NLS-1$
+
+ // Start of user code custom static initializations
+ // End of user code
+
+ Collections.unmodifiableMap(labelDefaultVisibilityMap);
+ }
+
+ /** Constructor */
+ public ConstraintParameterAsBorderItemPreferencePage() {
+ super();
+ setPreferenceKey(ElementTypes.DIAGRAM_ID + "_" + UMLGraphicalTypes.SHAPE_UML_PROPERTY_AS_AFFIXED_ID); //$NON-NLS-1$
+ }
+
+ /** Default preferences initializer */
+ public static void initDefaults(IPreferenceStore store) {
+ store.setDefault(LabelPreferenceHelper.getPreferenceConstant(prefLabelKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE), DISP_NAME | DISP_TYPE | DISP_MULTIPLICITY | DISP_UNDEFINED_TYPE);
+
+ store.setDefault(PreferenceConstantHelper.getElementConstant(prefKey, PreferenceConstantHelper.WIDTH), 20);
+ store.setDefault(PreferenceConstantHelper.getElementConstant(prefKey, PreferenceConstantHelper.HEIGHT), 20);
+ store.setDefault(PreferenceConstantHelper.getElementConstant(prefKey, PreferenceConstantHelper.ELEMENTICON), 0);
+
+ // Initialize default visibility for labels in preference page.
+ for(String labelName : labelDefaultVisibilityMap.keySet()) {
+ String showLabelKey = PreferenceConstantHelper.getCompartmentElementConstant(prefKey, labelName, PreferenceConstantHelper.LABEL_VISIBILITY);
+ store.setDefault(showLabelKey, labelDefaultVisibilityMap.get(labelName));
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void initializeLabelsList() {
+ for(String name : labelDefaultVisibilityMap.keySet()) {
+ this.labelsList.add(name);
+ }
+ }
+
+ /** buttons to select the display mask of the label */
+ protected Button bttnVisibility, bttnDerive, bttnName, bttnType, bttnUndefined_Type, bttnMultiplicity, bttnDefault_Multiplicity, bttnDefaultValue, bttnModifiers;
+
+ private String labelDisplayPreferenceKey = LabelPreferenceHelper.getPreferenceConstant(prefLabelKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE);
+
+ /** current property display style */
+ private int propertyValue = getPreferenceStore().getInt(labelDisplayPreferenceKey);
+
+ /**
+ * Creates a button with the {@link SWT#CHECK} style.
+ *
+ * @param parent
+ * the parent of the button
+ * @param label
+ * the label of the button
+ * @param mask
+ * the value controlled by the button
+ * @return the button created
+ */
+ protected Button createCheckButton(Composite parent, String label, int mask) {
+ Button button = new Button(parent, SWT.CHECK);
+ button.setText(label);
+ button.addSelectionListener(new AppearenceSelectionListener(mask));
+ return button;
+ }
+
+ /**
+ * Creates the group and check boxes to choose the kind of display
+ *
+ * @param parent
+ * the parent composite that holds the group
+ */
+ protected void createLabelPreferencesButtons(Composite parent) {
+ // create group that host the buttons
+ Group group = new Group(parent, SWT.SHADOW_NONE);
+ group.setText("Label Display");
+ group.setLayout(new FormLayout());
+
+ FormData data;
+
+ bttnVisibility = createCheckButton(group, "Visibility", DISP_VISIBILITY);
+ data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.top = new FormAttachment(0, 0);
+ bttnVisibility.setLayoutData(data);
+
+ bttnDerive = createCheckButton(group, "Derive", DISP_DERIVE);
+ data = new FormData();
+ data.left = new FormAttachment(bttnVisibility, 85);
+ data.top = new FormAttachment(0, 0);
+ bttnDerive.setLayoutData(data);
+
+ bttnName = createCheckButton(group, "Name", DISP_NAME);
+ data = new FormData();
+ data.left = new FormAttachment(bttnDerive, 85);
+ data.top = new FormAttachment(0, 0);
+ bttnName.setLayoutData(data);
+
+ bttnType = createCheckButton(group, "Type", DISP_TYPE);
+ data = new FormData();
+ data.left = new FormAttachment(bttnName, 85);
+ data.top = new FormAttachment(0, 0);
+ bttnType.setLayoutData(data);
+
+ bttnUndefined_Type = createCheckButton(group, "Undefined_Type", DISP_UNDEFINED_TYPE);
+ data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.top = new FormAttachment(bttnVisibility, ITabbedPropertyConstants.HSPACE);
+ bttnUndefined_Type.setLayoutData(data);
+
+ bttnMultiplicity = createCheckButton(group, "Multiplicity", DISP_MULTIPLICITY);
+ data = new FormData();
+ data.left = new FormAttachment(bttnVisibility, 85);
+ data.top = new FormAttachment(bttnVisibility, ITabbedPropertyConstants.HSPACE);
+ bttnMultiplicity.setLayoutData(data);
+
+ bttnDefault_Multiplicity = createCheckButton(group, "Default_Multiplicity", DISP_DEFAULT_MULTIPLICITY);
+ data = new FormData();
+ data.left = new FormAttachment(bttnDerive, 85);
+ data.top = new FormAttachment(bttnVisibility, ITabbedPropertyConstants.HSPACE);
+ bttnDefault_Multiplicity.setLayoutData(data);
+
+ bttnDefaultValue = createCheckButton(group, "DefaultValue", DISP_DEFAULTVALUE);
+ data = new FormData();
+ data.left = new FormAttachment(bttnName, 85);
+ data.top = new FormAttachment(bttnVisibility, ITabbedPropertyConstants.HSPACE);
+ bttnDefaultValue.setLayoutData(data);
+
+ bttnModifiers = createCheckButton(group, "Modifiers", DISP_MODIFIERS);
+ data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.top = new FormAttachment(bttnUndefined_Type, ITabbedPropertyConstants.HSPACE);
+ bttnModifiers.setLayoutData(data);
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void createPageContents(Composite parent) {
+ super.createPageContents(parent);
+
+ // adds the label preferences check boxes
+ createLabelPreferencesButtons(parent);
+
+ refreshButtons();
+ }
+
+ /**
+ * Load the default preferences of the fields contained in this page
+ */
+ protected void loadDefaultPreferences() {
+ propertyValue = getPreferenceStore().getDefaultInt(labelDisplayPreferenceKey);
+ refreshButtons();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void performDefaults() {
+ loadDefaultPreferences();
+ super.performDefaults();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean performOk() {
+ storePreferences();
+ return super.performOk();
+ }
+
+ /**
+ * Refresh the buttons that manages the display.
+ */
+ protected void refreshButtons() {
+
+ bttnVisibility.setSelection((propertyValue & DISP_VISIBILITY) == DISP_VISIBILITY);
+ bttnDerive.setSelection((propertyValue & DISP_DERIVE) == DISP_DERIVE);
+ bttnName.setSelection((propertyValue & DISP_NAME) == DISP_NAME);
+ bttnType.setSelection((propertyValue & DISP_TYPE) == DISP_TYPE);
+ bttnUndefined_Type.setSelection((propertyValue & DISP_UNDEFINED_TYPE) == DISP_UNDEFINED_TYPE);
+ bttnMultiplicity.setSelection((propertyValue & DISP_MULTIPLICITY) == DISP_MULTIPLICITY);
+ bttnDefault_Multiplicity.setSelection((propertyValue & DISP_DEFAULT_MULTIPLICITY) == DISP_DEFAULT_MULTIPLICITY);
+ bttnDefaultValue.setSelection((propertyValue & DISP_DEFAULTVALUE) == DISP_DEFAULTVALUE);
+ bttnModifiers.setSelection((propertyValue & DISP_MODIFIERS) == DISP_MODIFIERS);
+
+ }
+
+ /**
+ * Stores the values of the fields contained in this page into the preference store.
+ */
+ protected void storePreferences() {
+ super.storePreferences();
+ IPreferenceStore store = getPreferenceStore();
+ // checks the stored value and the actual one, so does not refresh diagram if it is not
+ // needed
+ if(propertyValue != store.getInt(labelDisplayPreferenceKey)) {
+ store.setValue(labelDisplayPreferenceKey, propertyValue);
+ }
+ }
+
+ /**
+ * Listeners for the check buttons that select the display.
+ */
+ private class AppearenceSelectionListener implements SelectionListener {
+
+ /** The constant which refers the element to display or not. */
+ final private int style;
+
+ /**
+ * Default Constructor.
+ *
+ * @param style
+ */
+ public AppearenceSelectionListener(int style) {
+ this.style = style;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void widgetSelected(SelectionEvent e) {
+ // add or remove the flag to the display property value (invert the current value)
+ propertyValue = propertyValue ^ style;
+ // refresh buttons to show current values
+ refreshButtons();
+ }
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ConstraintPropertyPreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ConstraintPropertyPreferencePage.java
deleted file mode 100644
index 90fd061e82a..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ConstraintPropertyPreferencePage.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.preferences;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.AbstractPapyrusNodePreferencePage;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ParametricEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlDiagramEditorPlugin;
-
-/**
- * @generated
- */
-public class ConstraintPropertyPreferencePage extends AbstractPapyrusNodePreferencePage {
-
- /**
- * @generated
- */
- public ConstraintPropertyPreferencePage() {
- super();
- setPreferenceKey(ParametricEditPart.MODEL_ID + "_ConstraintProperty");
- }
-
- /**
- * @generated
- */
- @Override
- protected String getBundleId() {
- return SysmlDiagramEditorPlugin.ID;
- }
-
- /**
- * @generated
- */
- public static void initDefaults(IPreferenceStore store) {
-
- String key = ParametricEditPart.MODEL_ID + "_ConstraintProperty";
- store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.WIDTH), 40);
- store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.HEIGHT), 40);
-
- //org.eclipse.jface.preference.PreferenceConverter.setDefault(store, org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_FILL), new org.eclipse.swt.graphics.RGB(255, 255, 255));
- //org.eclipse.jface.preference.PreferenceConverter.setDefault(store, org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_LINE), new org.eclipse.swt.graphics.RGB(0, 0, 0));
-
- // Set the default for the gradient
- //store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.GRADIENT_POLICY),false);
- //org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter gradientPreferenceConverter = new org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter(
- // new org.eclipse.swt.graphics.RGB(255, 255, 255),
- // new org.eclipse.swt.graphics.RGB(0, 0, 0), 0, 0);
- //store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_GRADIENT), gradientPreferenceConverter.getPreferenceValue());
-
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomBlockPropertyCompositePreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomBlockPropertyCompositePreferencePage.java
new file mode 100644
index 00000000000..5d84d21d9f4
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomBlockPropertyCompositePreferencePage.java
@@ -0,0 +1,327 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.parametric.preferences;
+
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_DEFAULTVALUE;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_DERIVE;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_MODIFIERS;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_MULTIPLICITY;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_NAME;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_TYPE;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_UNDEFINED_TYPE;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_VISIBILITY;
+
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants;
+import org.eclipse.papyrus.sysml.diagram.common.preferences.LabelPreferenceHelper;
+import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes;
+import org.eclipse.papyrus.sysml.diagram.parametric.provider.ElementTypes;
+import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
+
+/**
+ * Preference page for Part and References.
+ */
+public class CustomBlockPropertyCompositePreferencePage extends ParametricDiagramNodePreferencePage {
+
+ /** Constant key to access preferences */
+ public static String prefKey = ElementTypes.DIAGRAM_ID + "_" + SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID; //$NON-NLS-1$
+
+ public static String prefLabelKey = prefKey + "-" + UMLGraphicalTypes.LABEL_UML_PROPERTY_LABEL_ID; //$NON-NLS-1$
+
+ /** The compartments default visibility for preferences */
+ public static final Map<String, Boolean> compartmentDefaultVisibilityMap;
+
+ /** The compartment titles default visibility for preferences */
+ public static final Map<String, Boolean> compartmentTitleDefaultVisibilityMap;
+
+ /** Static attribute initialization */
+ static {
+ compartmentDefaultVisibilityMap = new LinkedHashMap<String, Boolean>();
+ compartmentDefaultVisibilityMap.put("structure", Boolean.TRUE); //$NON-NLS-1$
+
+ compartmentTitleDefaultVisibilityMap = new LinkedHashMap<String, Boolean>();
+ compartmentTitleDefaultVisibilityMap.put("structure", Boolean.TRUE); //$NON-NLS-1$
+
+ // Start of user code custom static initializations
+ compartmentTitleDefaultVisibilityMap.remove("structure"); //$NON-NLS-1$
+ compartmentTitleDefaultVisibilityMap.put("structure", Boolean.FALSE); //$NON-NLS-1$
+ // End of user code
+
+ Collections.unmodifiableMap(compartmentDefaultVisibilityMap);
+ Collections.unmodifiableMap(compartmentTitleDefaultVisibilityMap);
+ }
+
+ /** Constructor */
+ public CustomBlockPropertyCompositePreferencePage() {
+ super();
+ setPreferenceKey(ElementTypes.DIAGRAM_ID + "_" + SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID); //$NON-NLS-1$
+ }
+
+ /** Default preferences initializer */
+ public static void initDefaults(IPreferenceStore store) {
+ // Start of user code custom default initializations
+ store.setDefault(PreferenceConstantHelper.getElementConstant(prefKey, PreferenceConstantHelper.WIDTH), 200);
+ store.setDefault(PreferenceConstantHelper.getElementConstant(prefKey, PreferenceConstantHelper.HEIGHT), 100);
+ store.setDefault(LabelPreferenceHelper.getPreferenceConstant(prefLabelKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE), DISP_NAME | DISP_TYPE | DISP_UNDEFINED_TYPE);
+ // End of user code
+
+ // Initialize default visibility for compartments in preference page.
+ for(String compartmentName : compartmentDefaultVisibilityMap.keySet()) {
+ String showCompartmentKey = PreferenceConstantHelper.getCompartmentElementConstant(prefKey, compartmentName, PreferenceConstantHelper.COMPARTMENT_VISIBILITY);
+ store.setDefault(showCompartmentKey, compartmentDefaultVisibilityMap.get(compartmentName));
+ }
+
+ // Initialize default title visibility for compartments in preference page.
+ for(String compartmentName : compartmentTitleDefaultVisibilityMap.keySet()) {
+ String showCompartmentTitleKey = PreferenceConstantHelper.getCompartmentElementConstant(prefKey, compartmentName, PreferenceConstantHelper.COMPARTMENT_NAME_VISIBILITY);
+ store.setDefault(showCompartmentTitleKey, compartmentTitleDefaultVisibilityMap.get(compartmentName));
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void initializeCompartmentNamesList() {
+ for(String name : compartmentDefaultVisibilityMap.keySet()) {
+ this.compartmentNamesList.add(name);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void initializeCompartmentTitlesList() {
+ for(String name : compartmentTitleDefaultVisibilityMap.keySet()) {
+ this.compartmentTitlesList.add(name);
+ }
+ }
+
+ /** buttons to select the display mask of the label */
+ protected Button bttnVisibility, bttnDerive, bttnName, bttnType, bttnUndefined_Type, bttnMultiplicity, bttnDefault_Multiplicity, bttnDefaultValue, bttnModifiers;
+
+ private String labelDisplayPreferenceKey = LabelPreferenceHelper.getPreferenceConstant(prefLabelKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE);
+
+ /** current property display style */
+ private int propertyValue = getPreferenceStore().getInt(labelDisplayPreferenceKey);
+
+ /**
+ * Creates a button with the {@link SWT#CHECK} style.
+ *
+ * @param parent
+ * the parent of the button
+ * @param label
+ * the label of the button
+ * @param mask
+ * the value controlled by the button
+ * @return the button created
+ */
+ protected Button createCheckButton(Composite parent, String label, int mask) {
+ Button button = new Button(parent, SWT.CHECK);
+ button.setText(label);
+ button.addSelectionListener(new AppearenceSelectionListener(mask));
+ return button;
+ }
+
+ /**
+ * Creates the group and check boxes to choose the kind of display
+ *
+ * @param parent
+ * the parent composite that holds the group
+ */
+ protected void createLabelPreferencesButtons(Composite parent) {
+ // create group that host the buttons
+ Group group = new Group(parent, SWT.SHADOW_NONE);
+ group.setText("Label Display");
+ group.setLayout(new FormLayout());
+
+ FormData data;
+
+ bttnVisibility = createCheckButton(group, "Visibility", DISP_VISIBILITY);
+ data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.top = new FormAttachment(0, 0);
+ bttnVisibility.setLayoutData(data);
+
+ bttnDerive = createCheckButton(group, "Derive", DISP_DERIVE);
+ data = new FormData();
+ data.left = new FormAttachment(bttnVisibility, 85);
+ data.top = new FormAttachment(0, 0);
+ bttnDerive.setLayoutData(data);
+
+ bttnName = createCheckButton(group, "Name", DISP_NAME);
+ data = new FormData();
+ data.left = new FormAttachment(bttnDerive, 85);
+ data.top = new FormAttachment(0, 0);
+ bttnName.setLayoutData(data);
+
+ bttnType = createCheckButton(group, "Type", DISP_TYPE);
+ data = new FormData();
+ data.left = new FormAttachment(bttnName, 85);
+ data.top = new FormAttachment(0, 0);
+ bttnType.setLayoutData(data);
+
+ bttnUndefined_Type = createCheckButton(group, "Undefined_Type", DISP_UNDEFINED_TYPE);
+ data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.top = new FormAttachment(bttnVisibility, ITabbedPropertyConstants.HSPACE);
+ bttnUndefined_Type.setLayoutData(data);
+
+ bttnMultiplicity = createCheckButton(group, "Multiplicity", DISP_MULTIPLICITY);
+ data = new FormData();
+ data.left = new FormAttachment(bttnVisibility, 85);
+ data.top = new FormAttachment(bttnVisibility, ITabbedPropertyConstants.HSPACE);
+ bttnMultiplicity.setLayoutData(data);
+
+ bttnDefault_Multiplicity = createCheckButton(group, "Default_Multiplicity", DISP_DEFAULT_MULTIPLICITY);
+ data = new FormData();
+ data.left = new FormAttachment(bttnDerive, 85);
+ data.top = new FormAttachment(bttnVisibility, ITabbedPropertyConstants.HSPACE);
+ bttnDefault_Multiplicity.setLayoutData(data);
+
+ bttnDefaultValue = createCheckButton(group, "DefaultValue", DISP_DEFAULTVALUE);
+ data = new FormData();
+ data.left = new FormAttachment(bttnName, 85);
+ data.top = new FormAttachment(bttnVisibility, ITabbedPropertyConstants.HSPACE);
+ bttnDefaultValue.setLayoutData(data);
+
+ bttnModifiers = createCheckButton(group, "Modifiers", DISP_MODIFIERS);
+ data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.top = new FormAttachment(bttnUndefined_Type, ITabbedPropertyConstants.HSPACE);
+ bttnModifiers.setLayoutData(data);
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void createPageContents(Composite parent) {
+ super.createPageContents(parent);
+
+ // adds the label preferences check boxes
+ createLabelPreferencesButtons(parent);
+
+ refreshButtons();
+ }
+
+ /**
+ * Load the default preferences of the fields contained in this page
+ */
+ protected void loadDefaultPreferences() {
+ propertyValue = getPreferenceStore().getDefaultInt(labelDisplayPreferenceKey);
+ refreshButtons();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void performDefaults() {
+ loadDefaultPreferences();
+ super.performDefaults();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean performOk() {
+ storePreferences();
+ return super.performOk();
+ }
+
+ /**
+ * Refresh the buttons that manages the display.
+ */
+ protected void refreshButtons() {
+
+ bttnVisibility.setSelection((propertyValue & DISP_VISIBILITY) == DISP_VISIBILITY);
+ bttnDerive.setSelection((propertyValue & DISP_DERIVE) == DISP_DERIVE);
+ bttnName.setSelection((propertyValue & DISP_NAME) == DISP_NAME);
+ bttnType.setSelection((propertyValue & DISP_TYPE) == DISP_TYPE);
+ bttnUndefined_Type.setSelection((propertyValue & DISP_UNDEFINED_TYPE) == DISP_UNDEFINED_TYPE);
+ bttnMultiplicity.setSelection((propertyValue & DISP_MULTIPLICITY) == DISP_MULTIPLICITY);
+ bttnDefault_Multiplicity.setSelection((propertyValue & DISP_DEFAULT_MULTIPLICITY) == DISP_DEFAULT_MULTIPLICITY);
+ bttnDefaultValue.setSelection((propertyValue & DISP_DEFAULTVALUE) == DISP_DEFAULTVALUE);
+ bttnModifiers.setSelection((propertyValue & DISP_MODIFIERS) == DISP_MODIFIERS);
+
+ }
+
+ /**
+ * Stores the values of the fields contained in this page into the preference store.
+ */
+ protected void storePreferences() {
+ super.storePreferences();
+ IPreferenceStore store = getPreferenceStore();
+ // checks the stored value and the actual one, so does not refresh diagram if it is not
+ // needed
+ if(propertyValue != store.getInt(labelDisplayPreferenceKey)) {
+ store.setValue(labelDisplayPreferenceKey, propertyValue);
+ }
+ }
+
+ /**
+ * Listeners for the check buttons that select the display.
+ */
+ private class AppearenceSelectionListener implements SelectionListener {
+
+ /** The constant which refers the element to display or not. */
+ final private int style;
+
+ /**
+ * Default Constructor.
+ *
+ * @param style
+ */
+ public AppearenceSelectionListener(int style) {
+ this.style = style;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void widgetSelected(SelectionEvent e) {
+ // add or remove the flag to the display property value (invert the current value)
+ propertyValue = propertyValue ^ style;
+ // refresh buttons to show current values
+ refreshButtons();
+ }
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomConnectorPreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomConnectorPreferencePage.java
new file mode 100644
index 00000000000..8c200be32ca
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomConnectorPreferencePage.java
@@ -0,0 +1,464 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.parametric.preferences;
+
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_MULTIPLICITY;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_NAME;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_TYPE;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_UNDEFINED_TYPE;
+
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants;
+import org.eclipse.papyrus.sysml.diagram.common.preferences.LabelPreferenceHelper;
+import org.eclipse.papyrus.sysml.diagram.parametric.provider.ElementTypes;
+import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+
+/**
+ * {@link Connector} preference page.
+ */
+public class CustomConnectorPreferencePage extends ParametricDiagramLinkPreferencePage {
+
+ /** Constant key to access preferences */
+ public static String prefKey = ElementTypes.DIAGRAM_ID + "_" + UMLGraphicalTypes.LINK_UML_CONNECTOR_ID; //$NON-NLS-1$
+
+ /** The labels default visibility for preferences */
+ public static final Map<String, Boolean> labelDefaultVisibilityMap;
+
+ /** Static attribute initialization */
+ static {
+ labelDefaultVisibilityMap = new LinkedHashMap<String, Boolean>();
+ labelDefaultVisibilityMap.put("Stereotype", Boolean.TRUE); //$NON-NLS-1$
+ labelDefaultVisibilityMap.put("Label", Boolean.TRUE); //$NON-NLS-1$
+ labelDefaultVisibilityMap.put("SourceMultiplicity", Boolean.TRUE); //$NON-NLS-1$
+ labelDefaultVisibilityMap.put("TargetMultiplicity", Boolean.TRUE); //$NON-NLS-1$
+
+ // Start of user code custom static initializations
+ // End of user code
+
+ Collections.unmodifiableMap(labelDefaultVisibilityMap);
+ }
+
+ /** Constructor */
+ public CustomConnectorPreferencePage() {
+ super();
+ setPreferenceKey(ElementTypes.DIAGRAM_ID + "_" + UMLGraphicalTypes.LINK_UML_CONNECTOR_ID); //$NON-NLS-1$
+ }
+
+ /** Default preferences initializer */
+ public static void initDefaults(IPreferenceStore store) {
+ // Start of user code custom default initializations
+
+ // Label default masks initialization
+ store.setDefault(LabelPreferenceHelper.getPreferenceConstant(labelKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE), DISP_NAME | DISP_TYPE);
+ store.setDefault(LabelPreferenceHelper.getPreferenceConstant(sourceMultLabelKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE), DISP_MULTIPLICITY);
+ store.setDefault(LabelPreferenceHelper.getPreferenceConstant(targetMultLabelKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE), DISP_MULTIPLICITY);
+
+ // End of user code
+
+ // Initialize default visibility for labels in preference page.
+ for(String labelName : labelDefaultVisibilityMap.keySet()) {
+ String showLabelKey = PreferenceConstantHelper.getCompartmentElementConstant(prefKey, labelName, PreferenceConstantHelper.LABEL_VISIBILITY);
+ store.setDefault(showLabelKey, labelDefaultVisibilityMap.get(labelName));
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void initializeLabelsList() {
+ for(String name : labelDefaultVisibilityMap.keySet()) {
+ this.labelsList.add(name);
+ }
+ }
+
+ // Label display mask management in preference page
+
+ /** buttons to select the display mask of the label */
+ protected Button bttnName, bttnType, bttnUndefined_Type;
+
+ /** buttons to select the display mask of the source labels */
+ protected Button bttnSourceMultMultiplicity, bttnSourceMultDefault_Multiplicity;
+
+ /** buttons to select the display mask of the target labels */
+ protected Button bttnTargetMultMultiplicity, bttnTargetMultDefault_Multiplicity;
+
+ /** Preference keys */
+ public static String labelKey = ElementTypes.DIAGRAM_ID + "_" + UMLGraphicalTypes.LINK_UML_CONNECTOR_ID + "-" + UMLGraphicalTypes.LINKLABEL_UML_CONNECTOR_LABEL_ID; //$NON-NLS-1$
+
+ public static String sourceMultLabelKey = ElementTypes.DIAGRAM_ID + "_" + UMLGraphicalTypes.LINK_UML_CONNECTOR_ID + "-" + UMLGraphicalTypes.LINKLABEL_UML_CONNECTOR_SOURCE_MULTIPLICITY_ID; //$NON-NLS-1$
+
+ public static String targetMultLabelKey = ElementTypes.DIAGRAM_ID + "_" + UMLGraphicalTypes.LINK_UML_CONNECTOR_ID + "-" + UMLGraphicalTypes.LINKLABEL_UML_CONNECTOR_TARGET_MULTIPLICITY_ID; //$NON-NLS-1$
+
+ private String labelDisplayPreferenceKey = LabelPreferenceHelper.getPreferenceConstant(labelKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE);
+
+ private String sourceMultLabelDisplayPreferenceKey = LabelPreferenceHelper.getPreferenceConstant(sourceMultLabelKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE);
+
+ private String targetMultLabelDisplayPreferenceKey = LabelPreferenceHelper.getPreferenceConstant(targetMultLabelKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE);
+
+ /** Current property display styles for labels */
+ private int labelDisplayValue = getPreferenceStore().getInt(labelDisplayPreferenceKey);
+
+ private int sourceMultDisplayValue = getPreferenceStore().getInt(sourceMultLabelDisplayPreferenceKey);
+
+ private int targetMultDisplayValue = getPreferenceStore().getInt(targetMultLabelDisplayPreferenceKey);
+
+ /**
+ * Creates the group and check boxes to choose the kind of display
+ *
+ * @param parent
+ * the parent composite that holds the group
+ */
+ protected void createLabelPreferencesButtons(Composite parent) {
+ // create group that host the buttons
+ Group group = new Group(parent, SWT.SHADOW_NONE);
+ group.setText("Label Display");
+ group.setLayout(new FormLayout());
+
+ FormData data;
+
+ bttnName = createLabelCheckButton(group, "Name", DISP_NAME);
+ data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.top = new FormAttachment(0, 0);
+ bttnName.setLayoutData(data);
+
+ bttnType = createLabelCheckButton(group, "Type", DISP_TYPE);
+ data = new FormData();
+ data.left = new FormAttachment(bttnName, 85);
+ data.top = new FormAttachment(0, 0);
+ bttnType.setLayoutData(data);
+
+ bttnUndefined_Type = createLabelCheckButton(group, "Undefined_Type", DISP_UNDEFINED_TYPE);
+ data = new FormData();
+ data.left = new FormAttachment(bttnType, 85);
+ data.top = new FormAttachment(0, 0);
+ bttnUndefined_Type.setLayoutData(data);
+ }
+
+ /**
+ * Creates the group and check boxes to choose the kind of display
+ *
+ * @param parent
+ * the parent composite that holds the group
+ */
+ protected void createSourceMultLabelPreferencesButtons(Composite parent) {
+ // create group that host the buttons
+ Group group = new Group(parent, SWT.SHADOW_NONE);
+ group.setText("Source Multiplicity Label Display");
+ group.setLayout(new FormLayout());
+
+ FormData data;
+
+ bttnSourceMultMultiplicity = createSourceMultCheckButton(group, "Multiplicity", DISP_MULTIPLICITY);
+ data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.top = new FormAttachment(0, 0);
+ bttnSourceMultMultiplicity.setLayoutData(data);
+
+ bttnSourceMultDefault_Multiplicity = createSourceMultCheckButton(group, "Default_Multiplicity", DISP_DEFAULT_MULTIPLICITY);
+ data = new FormData();
+ data.left = new FormAttachment(bttnSourceMultMultiplicity, 85);
+ data.top = new FormAttachment(0, 0);
+ bttnSourceMultDefault_Multiplicity.setLayoutData(data);
+ }
+
+ /**
+ * Creates the group and check boxes to choose the kind of display
+ *
+ * @param parent
+ * the parent composite that holds the group
+ */
+ protected void createTargetMultLabelPreferencesButtons(Composite parent) {
+ // create group that host the buttons
+ Group group = new Group(parent, SWT.SHADOW_NONE);
+ group.setText("Target Multiplicity Label Display");
+ group.setLayout(new FormLayout());
+
+ FormData data;
+
+ bttnTargetMultMultiplicity = createTargetMultCheckButton(group, "Multiplicity", DISP_MULTIPLICITY);
+ data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.top = new FormAttachment(0, 0);
+ bttnTargetMultMultiplicity.setLayoutData(data);
+
+ bttnTargetMultDefault_Multiplicity = createTargetMultCheckButton(group, "Default_Multiplicity", DISP_DEFAULT_MULTIPLICITY);
+ data = new FormData();
+ data.left = new FormAttachment(bttnTargetMultMultiplicity, 85);
+ data.top = new FormAttachment(0, 0);
+ bttnTargetMultDefault_Multiplicity.setLayoutData(data);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void createPageContents(Composite parent) {
+ super.createPageContents(parent);
+
+ // adds the label preferences check boxes
+ createLabelPreferencesButtons(parent);
+ createSourceMultLabelPreferencesButtons(parent);
+ createTargetMultLabelPreferencesButtons(parent);
+
+ refreshButtons();
+ }
+
+ /**
+ * Load the default preferences of the fields contained in this page
+ */
+ protected void loadDefaultPreferences() {
+ labelDisplayValue = getPreferenceStore().getDefaultInt(labelDisplayPreferenceKey);
+ sourceMultDisplayValue = getPreferenceStore().getDefaultInt(sourceMultLabelDisplayPreferenceKey);
+ targetMultDisplayValue = getPreferenceStore().getDefaultInt(targetMultLabelDisplayPreferenceKey);
+
+ refreshButtons();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void performDefaults() {
+ loadDefaultPreferences();
+ super.performDefaults();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean performOk() {
+ storePreferences();
+ return super.performOk();
+ }
+
+ /**
+ * Refresh the buttons that manages the display.
+ */
+ protected void refreshButtons() {
+
+ // Label refresh buttons
+ bttnName.setSelection((labelDisplayValue & DISP_NAME) == DISP_NAME);
+ bttnType.setSelection((labelDisplayValue & DISP_TYPE) == DISP_TYPE);
+ bttnUndefined_Type.setSelection((labelDisplayValue & DISP_UNDEFINED_TYPE) == DISP_UNDEFINED_TYPE);
+
+ // Source Label Buttons
+ bttnSourceMultMultiplicity.setSelection((sourceMultDisplayValue & DISP_MULTIPLICITY) == DISP_MULTIPLICITY);
+ bttnSourceMultDefault_Multiplicity.setSelection((sourceMultDisplayValue & DISP_DEFAULT_MULTIPLICITY) == DISP_DEFAULT_MULTIPLICITY);
+
+ // Target Label Buttons
+ bttnTargetMultMultiplicity.setSelection((targetMultDisplayValue & DISP_MULTIPLICITY) == DISP_MULTIPLICITY);
+ bttnTargetMultDefault_Multiplicity.setSelection((targetMultDisplayValue & DISP_DEFAULT_MULTIPLICITY) == DISP_DEFAULT_MULTIPLICITY);
+
+ }
+
+ /**
+ * Stores the values of the fields contained in this page into the preference store.
+ */
+ protected void storePreferences() {
+ super.storePreferences();
+ IPreferenceStore store = getPreferenceStore();
+ // checks the stored value and the actual one, so does not refresh diagram if it is not
+ // needed
+ if(labelDisplayValue != store.getInt(labelDisplayPreferenceKey)) {
+ store.setValue(labelDisplayPreferenceKey, labelDisplayValue);
+ }
+ if(sourceMultDisplayValue != store.getInt(sourceMultLabelDisplayPreferenceKey)) {
+ store.setValue(sourceMultLabelDisplayPreferenceKey, sourceMultDisplayValue);
+ }
+ if(targetMultDisplayValue != store.getInt(targetMultLabelDisplayPreferenceKey)) {
+ store.setValue(targetMultLabelDisplayPreferenceKey, targetMultDisplayValue);
+ }
+ }
+
+ /**
+ * Creates a button with the {@link SWT#CHECK} style.
+ *
+ * @param parent
+ * the parent of the button
+ * @param label
+ * the label of the button
+ * @param mask
+ * the value controlled by the button
+ * @return the button created
+ */
+ protected Button createLabelCheckButton(Composite parent, String label, int mask) {
+ Button button = new Button(parent, SWT.CHECK);
+ button.setText(label);
+ button.addSelectionListener(new LabelAppearenceSelectionListener(mask));
+ return button;
+ }
+
+ /**
+ * Creates a button with the {@link SWT#CHECK} style.
+ *
+ * @param parent
+ * the parent of the button
+ * @param label
+ * the label of the button
+ * @param mask
+ * the value controlled by the button
+ * @return the button created
+ */
+ protected Button createSourceMultCheckButton(Composite parent, String label, int mask) {
+ Button button = new Button(parent, SWT.CHECK);
+ button.setText(label);
+ button.addSelectionListener(new SourceMultAppearenceSelectionListener(mask));
+ return button;
+ }
+
+ /**
+ * Creates a button with the {@link SWT#CHECK} style.
+ *
+ * @param parent
+ * the parent of the button
+ * @param label
+ * the label of the button
+ * @param mask
+ * the value controlled by the button
+ * @return the button created
+ */
+ protected Button createTargetMultCheckButton(Composite parent, String label, int mask) {
+ Button button = new Button(parent, SWT.CHECK);
+ button.setText(label);
+ button.addSelectionListener(new TargetMultAppearenceSelectionListener(mask));
+ return button;
+ }
+
+ /**
+ * Listeners for the check buttons that select the label display.
+ */
+ private class LabelAppearenceSelectionListener implements SelectionListener {
+
+ /** The constant which refers the element to display or not. */
+ final private int style;
+
+ /**
+ * Default Constructor.
+ *
+ * @param style
+ */
+ public LabelAppearenceSelectionListener(int style) {
+ this.style = style;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void widgetSelected(SelectionEvent e) {
+ // add or remove the flag to the display property value (invert the current value)
+ labelDisplayValue = labelDisplayValue ^ style;
+
+ // refresh buttons to show current values
+ refreshButtons();
+ }
+ }
+
+ /**
+ * Listeners for the check buttons that select the source multiplicity display.
+ */
+ private class SourceMultAppearenceSelectionListener implements SelectionListener {
+
+ /** The constant which refers the element to display or not. */
+ final private int style;
+
+ /**
+ * Default Constructor.
+ *
+ * @param style
+ */
+ public SourceMultAppearenceSelectionListener(int style) {
+ this.style = style;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void widgetSelected(SelectionEvent e) {
+ // add or remove the flag to the display property value (invert the current value)
+ sourceMultDisplayValue = sourceMultDisplayValue ^ style;
+
+ // refresh buttons to show current values
+ refreshButtons();
+ }
+ }
+
+ /**
+ * Listeners for the check buttons that select the target multiplicity display.
+ */
+ private class TargetMultAppearenceSelectionListener implements SelectionListener {
+
+ /** The constant which refers the element to display or not. */
+ final private int style;
+
+ /**
+ * Default Constructor.
+ *
+ * @param style
+ */
+ public TargetMultAppearenceSelectionListener(int style) {
+ this.style = style;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void widgetSelected(SelectionEvent e) {
+ // add or remove the flag to the display property value (invert the current value)
+ targetMultDisplayValue = targetMultDisplayValue ^ style;
+
+ // refresh buttons to show current values
+ refreshButtons();
+ }
+ }
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomConstraintPropertyCompositePreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomConstraintPropertyCompositePreferencePage.java
new file mode 100644
index 00000000000..78f3e67d396
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomConstraintPropertyCompositePreferencePage.java
@@ -0,0 +1,327 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.parametric.preferences;
+
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_DEFAULTVALUE;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_DERIVE;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_MODIFIERS;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_MULTIPLICITY;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_NAME;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_TYPE;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_UNDEFINED_TYPE;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_VISIBILITY;
+
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants;
+import org.eclipse.papyrus.sysml.diagram.common.preferences.LabelPreferenceHelper;
+import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes;
+import org.eclipse.papyrus.sysml.diagram.parametric.provider.ElementTypes;
+import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
+
+/**
+ * Preference page for Part and References.
+ */
+public class CustomConstraintPropertyCompositePreferencePage extends ParametricDiagramNodePreferencePage {
+
+ /** Constant key to access preferences */
+ public static String prefKey = ElementTypes.DIAGRAM_ID + "_" + SysMLGraphicalTypes.SHAPE_SYSML_CONSTRAINTBLOCKPROPERTY_AS_COMPOSITE_ID; //$NON-NLS-1$
+
+ public static String prefLabelKey = prefKey + "-" + UMLGraphicalTypes.LABEL_UML_PROPERTY_LABEL_ID; //$NON-NLS-1$
+
+ /** The compartments default visibility for preferences */
+ public static final Map<String, Boolean> compartmentDefaultVisibilityMap;
+
+ /** The compartment titles default visibility for preferences */
+ public static final Map<String, Boolean> compartmentTitleDefaultVisibilityMap;
+
+ /** Static attribute initialization */
+ static {
+ compartmentDefaultVisibilityMap = new LinkedHashMap<String, Boolean>();
+ compartmentDefaultVisibilityMap.put("structure", Boolean.TRUE); //$NON-NLS-1$
+
+ compartmentTitleDefaultVisibilityMap = new LinkedHashMap<String, Boolean>();
+ compartmentTitleDefaultVisibilityMap.put("structure", Boolean.TRUE); //$NON-NLS-1$
+
+ // Start of user code custom static initializations
+ compartmentTitleDefaultVisibilityMap.remove("structure"); //$NON-NLS-1$
+ compartmentTitleDefaultVisibilityMap.put("structure", Boolean.FALSE); //$NON-NLS-1$
+ // End of user code
+
+ Collections.unmodifiableMap(compartmentDefaultVisibilityMap);
+ Collections.unmodifiableMap(compartmentTitleDefaultVisibilityMap);
+ }
+
+ /** Constructor */
+ public CustomConstraintPropertyCompositePreferencePage() {
+ super();
+ setPreferenceKey(ElementTypes.DIAGRAM_ID + "_" + SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID); //$NON-NLS-1$
+ }
+
+ /** Default preferences initializer */
+ public static void initDefaults(IPreferenceStore store) {
+ // Start of user code custom default initializations
+// store.setDefault(PreferenceConstantHelper.getElementConstant(prefKey, PreferenceConstantHelper.WIDTH), 200);
+// store.setDefault(PreferenceConstantHelper.getElementConstant(prefKey, PreferenceConstantHelper.HEIGHT), 100);
+ store.setDefault(LabelPreferenceHelper.getPreferenceConstant(prefLabelKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE), DISP_NAME | DISP_TYPE | DISP_UNDEFINED_TYPE);
+ // End of user code
+
+ // Initialize default visibility for compartments in preference page.
+ for(String compartmentName : compartmentDefaultVisibilityMap.keySet()) {
+ String showCompartmentKey = PreferenceConstantHelper.getCompartmentElementConstant(prefKey, compartmentName, PreferenceConstantHelper.COMPARTMENT_VISIBILITY);
+ store.setDefault(showCompartmentKey, compartmentDefaultVisibilityMap.get(compartmentName));
+ }
+
+ // Initialize default title visibility for compartments in preference page.
+ for(String compartmentName : compartmentTitleDefaultVisibilityMap.keySet()) {
+ String showCompartmentTitleKey = PreferenceConstantHelper.getCompartmentElementConstant(prefKey, compartmentName, PreferenceConstantHelper.COMPARTMENT_NAME_VISIBILITY);
+ store.setDefault(showCompartmentTitleKey, compartmentTitleDefaultVisibilityMap.get(compartmentName));
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void initializeCompartmentNamesList() {
+ for(String name : compartmentDefaultVisibilityMap.keySet()) {
+ this.compartmentNamesList.add(name);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void initializeCompartmentTitlesList() {
+ for(String name : compartmentTitleDefaultVisibilityMap.keySet()) {
+ this.compartmentTitlesList.add(name);
+ }
+ }
+
+ /** buttons to select the display mask of the label */
+ protected Button bttnVisibility, bttnDerive, bttnName, bttnType, bttnUndefined_Type, bttnMultiplicity, bttnDefault_Multiplicity, bttnDefaultValue, bttnModifiers;
+
+ private String labelDisplayPreferenceKey = LabelPreferenceHelper.getPreferenceConstant(prefLabelKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE);
+
+ /** current property display style */
+ private int propertyValue = getPreferenceStore().getInt(labelDisplayPreferenceKey);
+
+ /**
+ * Creates a button with the {@link SWT#CHECK} style.
+ *
+ * @param parent
+ * the parent of the button
+ * @param label
+ * the label of the button
+ * @param mask
+ * the value controlled by the button
+ * @return the button created
+ */
+ protected Button createCheckButton(Composite parent, String label, int mask) {
+ Button button = new Button(parent, SWT.CHECK);
+ button.setText(label);
+ button.addSelectionListener(new AppearenceSelectionListener(mask));
+ return button;
+ }
+
+ /**
+ * Creates the group and check boxes to choose the kind of display
+ *
+ * @param parent
+ * the parent composite that holds the group
+ */
+ protected void createLabelPreferencesButtons(Composite parent) {
+ // create group that host the buttons
+ Group group = new Group(parent, SWT.SHADOW_NONE);
+ group.setText("Label Display");
+ group.setLayout(new FormLayout());
+
+ FormData data;
+
+ bttnVisibility = createCheckButton(group, "Visibility", DISP_VISIBILITY);
+ data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.top = new FormAttachment(0, 0);
+ bttnVisibility.setLayoutData(data);
+
+ bttnDerive = createCheckButton(group, "Derive", DISP_DERIVE);
+ data = new FormData();
+ data.left = new FormAttachment(bttnVisibility, 85);
+ data.top = new FormAttachment(0, 0);
+ bttnDerive.setLayoutData(data);
+
+ bttnName = createCheckButton(group, "Name", DISP_NAME);
+ data = new FormData();
+ data.left = new FormAttachment(bttnDerive, 85);
+ data.top = new FormAttachment(0, 0);
+ bttnName.setLayoutData(data);
+
+ bttnType = createCheckButton(group, "Type", DISP_TYPE);
+ data = new FormData();
+ data.left = new FormAttachment(bttnName, 85);
+ data.top = new FormAttachment(0, 0);
+ bttnType.setLayoutData(data);
+
+ bttnUndefined_Type = createCheckButton(group, "Undefined_Type", DISP_UNDEFINED_TYPE);
+ data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.top = new FormAttachment(bttnVisibility, ITabbedPropertyConstants.HSPACE);
+ bttnUndefined_Type.setLayoutData(data);
+
+ bttnMultiplicity = createCheckButton(group, "Multiplicity", DISP_MULTIPLICITY);
+ data = new FormData();
+ data.left = new FormAttachment(bttnVisibility, 85);
+ data.top = new FormAttachment(bttnVisibility, ITabbedPropertyConstants.HSPACE);
+ bttnMultiplicity.setLayoutData(data);
+
+ bttnDefault_Multiplicity = createCheckButton(group, "Default_Multiplicity", DISP_DEFAULT_MULTIPLICITY);
+ data = new FormData();
+ data.left = new FormAttachment(bttnDerive, 85);
+ data.top = new FormAttachment(bttnVisibility, ITabbedPropertyConstants.HSPACE);
+ bttnDefault_Multiplicity.setLayoutData(data);
+
+ bttnDefaultValue = createCheckButton(group, "DefaultValue", DISP_DEFAULTVALUE);
+ data = new FormData();
+ data.left = new FormAttachment(bttnName, 85);
+ data.top = new FormAttachment(bttnVisibility, ITabbedPropertyConstants.HSPACE);
+ bttnDefaultValue.setLayoutData(data);
+
+ bttnModifiers = createCheckButton(group, "Modifiers", DISP_MODIFIERS);
+ data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.top = new FormAttachment(bttnUndefined_Type, ITabbedPropertyConstants.HSPACE);
+ bttnModifiers.setLayoutData(data);
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void createPageContents(Composite parent) {
+ super.createPageContents(parent);
+
+ // adds the label preferences check boxes
+ createLabelPreferencesButtons(parent);
+
+ refreshButtons();
+ }
+
+ /**
+ * Load the default preferences of the fields contained in this page
+ */
+ protected void loadDefaultPreferences() {
+ propertyValue = getPreferenceStore().getDefaultInt(labelDisplayPreferenceKey);
+ refreshButtons();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void performDefaults() {
+ loadDefaultPreferences();
+ super.performDefaults();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean performOk() {
+ storePreferences();
+ return super.performOk();
+ }
+
+ /**
+ * Refresh the buttons that manages the display.
+ */
+ protected void refreshButtons() {
+
+ bttnVisibility.setSelection((propertyValue & DISP_VISIBILITY) == DISP_VISIBILITY);
+ bttnDerive.setSelection((propertyValue & DISP_DERIVE) == DISP_DERIVE);
+ bttnName.setSelection((propertyValue & DISP_NAME) == DISP_NAME);
+ bttnType.setSelection((propertyValue & DISP_TYPE) == DISP_TYPE);
+ bttnUndefined_Type.setSelection((propertyValue & DISP_UNDEFINED_TYPE) == DISP_UNDEFINED_TYPE);
+ bttnMultiplicity.setSelection((propertyValue & DISP_MULTIPLICITY) == DISP_MULTIPLICITY);
+ bttnDefault_Multiplicity.setSelection((propertyValue & DISP_DEFAULT_MULTIPLICITY) == DISP_DEFAULT_MULTIPLICITY);
+ bttnDefaultValue.setSelection((propertyValue & DISP_DEFAULTVALUE) == DISP_DEFAULTVALUE);
+ bttnModifiers.setSelection((propertyValue & DISP_MODIFIERS) == DISP_MODIFIERS);
+
+ }
+
+ /**
+ * Stores the values of the fields contained in this page into the preference store.
+ */
+ protected void storePreferences() {
+ super.storePreferences();
+ IPreferenceStore store = getPreferenceStore();
+ // checks the stored value and the actual one, so does not refresh diagram if it is not
+ // needed
+ if(propertyValue != store.getInt(labelDisplayPreferenceKey)) {
+ store.setValue(labelDisplayPreferenceKey, propertyValue);
+ }
+ }
+
+ /**
+ * Listeners for the check buttons that select the display.
+ */
+ private class AppearenceSelectionListener implements SelectionListener {
+
+ /** The constant which refers the element to display or not. */
+ final private int style;
+
+ /**
+ * Default Constructor.
+ *
+ * @param style
+ */
+ public AppearenceSelectionListener(int style) {
+ this.style = style;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void widgetSelected(SelectionEvent e) {
+ // add or remove the flag to the display property value (invert the current value)
+ propertyValue = propertyValue ^ style;
+ // refresh buttons to show current values
+ refreshButtons();
+ }
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomPreferenceInitializer.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomPreferenceInitializer.java
new file mode 100644
index 00000000000..907960e23ca
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomPreferenceInitializer.java
@@ -0,0 +1,80 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.parametric.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes;
+import org.eclipse.papyrus.sysml.diagram.parametric.Activator;
+import org.eclipse.papyrus.sysml.diagram.parametric.provider.ElementTypes;
+import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes;
+
+/**
+ * Custom preferences initializer.
+ */
+public class CustomPreferenceInitializer extends ParametricDiagramPreferenceInitializer {
+
+ protected IPreferenceStore getPreferenceStore() {
+ return Activator.getInstance().getPreferenceStore();
+ }
+
+ @Override
+ public void initializeDefaultPreferences() {
+ super.initializeDefaultPreferences();
+
+ IPreferenceStore store = getPreferenceStore();
+
+ PortAsBorderItemPreferencePage.initDefaults(store);
+ ConstraintParameterAsBorderItemPreferencePage.initDefaults(store);
+ FlowPortAsBorderItemPreferencePage.initDefaults(store);
+ BlockPropertyCompositePreferencePage.initDefaults(store);
+ CustomConstraintPropertyCompositePreferencePage.initDefaults(store);
+ CustomConnectorPreferencePage.initDefaults(store);
+
+ // Initialize default positions for labels.
+ initDefaultPosition(UMLGraphicalTypes.LINK_UML_DEPENDENCY_ID, UMLGraphicalTypes.LINKLABEL_UML_NAMEDELEMENT_NAME_ID, 0, -10);
+ initDefaultPosition(UMLGraphicalTypes.LINK_UML_DEPENDENCY_ID, UMLGraphicalTypes.LINKLABEL_UML_APPLIEDSTEREOTYPE_ID, 0, -30);
+
+ initDefaultPosition(UMLGraphicalTypes.LINK_UML_CONNECTOR_ID, UMLGraphicalTypes.LINKLABEL_UML_CONNECTOR_LABEL_ID, 0, -10);
+ initDefaultPosition(UMLGraphicalTypes.LINK_UML_CONNECTOR_ID, UMLGraphicalTypes.LINKLABEL_UML_APPLIEDSTEREOTYPE_ID, 0, -30);
+ initDefaultPosition(UMLGraphicalTypes.LINK_UML_CONNECTOR_ID, UMLGraphicalTypes.LINKLABEL_UML_CONNECTOR_SOURCE_MULTIPLICITY_ID, 0, 10);
+ initDefaultPosition(UMLGraphicalTypes.LINK_UML_CONNECTOR_ID, UMLGraphicalTypes.LINKLABEL_UML_CONNECTOR_TARGET_MULTIPLICITY_ID, 0, 10);
+
+ initDefaultPosition(UMLGraphicalTypes.SHAPE_UML_PORT_AS_AFFIXED_ID, UMLGraphicalTypes.AFFIXEDLABEL_UML_PORT_LABEL_ID, 30, 0);
+ initDefaultPosition(UMLGraphicalTypes.SHAPE_UML_PORT_AS_AFFIXED_ID, UMLGraphicalTypes.AFFIXEDLABEL_UML_APPLIEDSTEREOTYPE_ID, 30, -20);
+
+ initDefaultPosition(SysMLGraphicalTypes.SHAPE_SYSML_FLOWPORT_AS_AFFIXED_ID, SysMLGraphicalTypes.AFFIXEDLABEL_SYSML_FLOWPORT_LABEL_ID, 30, 0);
+ initDefaultPosition(SysMLGraphicalTypes.SHAPE_SYSML_FLOWPORT_AS_AFFIXED_ID, UMLGraphicalTypes.AFFIXEDLABEL_UML_APPLIEDSTEREOTYPE_ID, 30, -20);
+ }
+
+ /**
+ * Initialize default position of a link label in preferences.
+ *
+ * @param parentGraphicalType
+ * the graphical type of the view owning the label
+ * @param graphicalType
+ * the graphical type of the label
+ * @param x
+ * @param y
+ */
+ protected void initDefaultPosition(String parentGraphicalType, String graphicalType, int x, int y) {
+ IPreferenceStore store = getPreferenceStore();
+
+ String xKey = PreferenceConstantHelper.getElementConstant(ElementTypes.DIAGRAM_ID + "_" + parentGraphicalType + "-" + graphicalType, PreferenceConstantHelper.LOCATION_X);
+ String yKey = PreferenceConstantHelper.getElementConstant(ElementTypes.DIAGRAM_ID + "_" + parentGraphicalType + "-" + graphicalType, PreferenceConstantHelper.LOCATION_Y);
+
+ store.setDefault(xKey, x);
+ store.setDefault(yKey, y);
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/DiagramAppearancePreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/DiagramAppearancePreferencePage.java
deleted file mode 100644
index ac8ef06f668..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/DiagramAppearancePreferencePage.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.preferences;
-
-import org.eclipse.gmf.runtime.diagram.ui.preferences.AppearancePreferencePage;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlDiagramEditorPlugin;
-
-/**
- * @generated
- */
-public class DiagramAppearancePreferencePage extends AppearancePreferencePage {
-
- /**
- * @generated
- */
- public DiagramAppearancePreferencePage() {
- setPreferenceStore(SysmlDiagramEditorPlugin.getInstance().getPreferenceStore());
-
- }
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/DiagramConnectionsPreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/DiagramConnectionsPreferencePage.java
deleted file mode 100644
index 5434ff57fdb..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/DiagramConnectionsPreferencePage.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.preferences;
-
-import org.eclipse.gmf.runtime.diagram.ui.preferences.ConnectionsPreferencePage;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlDiagramEditorPlugin;
-
-/**
- * @generated
- */
-public class DiagramConnectionsPreferencePage extends ConnectionsPreferencePage {
-
- /**
- * @generated
- */
- public DiagramConnectionsPreferencePage() {
- setPreferenceStore(SysmlDiagramEditorPlugin.getInstance().getPreferenceStore());
-
- }
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/DiagramGeneralPreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/DiagramGeneralPreferencePage.java
deleted file mode 100644
index a6f94f2690f..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/DiagramGeneralPreferencePage.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.preferences;
-
-import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.DiagramPreferencePage;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ParametricEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlDiagramEditorPlugin;
-
-/**
- * @generated
- */
-public class DiagramGeneralPreferencePage extends DiagramPreferencePage {
-
- /**
- * @generated
- */
- public DiagramGeneralPreferencePage() {
- setPreferenceStore(SysmlDiagramEditorPlugin.getInstance().getPreferenceStore());
- setPreferenceKey(ParametricEditPart.MODEL_ID);
-
- }
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/DiagramPreferenceInitializer.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/DiagramPreferenceInitializer.java
deleted file mode 100644
index 3a217ec08c0..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/DiagramPreferenceInitializer.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.preferences;
-
-import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlDiagramEditorPlugin;
-
-/**
- * @generated
- */
-public class DiagramPreferenceInitializer extends AbstractPreferenceInitializer {
-
- /**
- * @generated
- */
- public void initializeDefaultPreferences() {
- IPreferenceStore store = getPreferenceStore();
-
- ConstraintPropertyPreferencePage.initDefaults(store);
-
- PropertyPreferencePage.initDefaults(store);
-
- ConnectorPreferencePage.initDefaults(store);
-
- }
-
- /**
- * @generated
- */
- protected IPreferenceStore getPreferenceStore() {
- return SysmlDiagramEditorPlugin.getInstance().getPreferenceStore();
- }
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/DiagramPrintingPreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/DiagramPrintingPreferencePage.java
deleted file mode 100644
index 4965ef42992..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/DiagramPrintingPreferencePage.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.preferences;
-
-import org.eclipse.gmf.runtime.diagram.ui.preferences.PrintingPreferencePage;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlDiagramEditorPlugin;
-
-/**
- * @generated
- */
-public class DiagramPrintingPreferencePage extends PrintingPreferencePage {
-
- /**
- * @generated
- */
- public DiagramPrintingPreferencePage() {
- setPreferenceStore(SysmlDiagramEditorPlugin.getInstance().getPreferenceStore());
-
- }
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/DiagramRulersAndGridPreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/DiagramRulersAndGridPreferencePage.java
deleted file mode 100644
index fd700ed4eda..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/DiagramRulersAndGridPreferencePage.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.preferences;
-
-import org.eclipse.gmf.runtime.diagram.ui.preferences.RulerGridPreferencePage;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlDiagramEditorPlugin;
-
-/**
- * @generated
- */
-public class DiagramRulersAndGridPreferencePage extends RulerGridPreferencePage {
-
- /**
- * @generated
- */
- public DiagramRulersAndGridPreferencePage() {
- setPreferenceStore(SysmlDiagramEditorPlugin.getInstance().getPreferenceStore());
-
- }
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/FlowPortAsBorderItemPreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/FlowPortAsBorderItemPreferencePage.java
new file mode 100644
index 00000000000..277a5cdfc3a
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/FlowPortAsBorderItemPreferencePage.java
@@ -0,0 +1,310 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.parametric.preferences;
+
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_DEFAULTVALUE;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_DERIVE;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_DIRECTION;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_MODIFIERS;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_MULTIPLICITY;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_NAME;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_TYPE;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_UNDEFINED_TYPE;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_VISIBILITY;
+
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants;
+import org.eclipse.papyrus.sysml.diagram.common.preferences.LabelPreferenceHelper;
+import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes;
+import org.eclipse.papyrus.sysml.diagram.parametric.provider.ElementTypes;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
+
+/**
+ * FlowPort preference page.
+ */
+public class FlowPortAsBorderItemPreferencePage extends ParametricDiagramNodePreferencePage {
+
+ /** Constant key to access preferences */
+ public static String prefKey = ElementTypes.DIAGRAM_ID + "_" + SysMLGraphicalTypes.SHAPE_SYSML_FLOWPORT_AS_AFFIXED_ID; //$NON-NLS-1$
+
+ public static String prefLabelKey = prefKey + "-" + SysMLGraphicalTypes.AFFIXEDLABEL_SYSML_FLOWPORT_LABEL_ID; //$NON-NLS-1$
+
+ /** The labels default visibility for preferences */
+ public static final Map<String, Boolean> labelDefaultVisibilityMap;
+
+ /** Static attribute initialization */
+ static {
+ labelDefaultVisibilityMap = new LinkedHashMap<String, Boolean>();
+ labelDefaultVisibilityMap.put("Stereotype", Boolean.TRUE); //$NON-NLS-1$
+ labelDefaultVisibilityMap.put("Label", Boolean.TRUE); //$NON-NLS-1$
+
+ // Start of user code custom static initializations
+ // End of user code
+
+ Collections.unmodifiableMap(labelDefaultVisibilityMap);
+ }
+
+ /** Constructor */
+ public FlowPortAsBorderItemPreferencePage() {
+ super();
+ setPreferenceKey(ElementTypes.DIAGRAM_ID + "_" + SysMLGraphicalTypes.SHAPE_SYSML_FLOWPORT_AS_AFFIXED_ID); //$NON-NLS-1$
+ }
+
+ /** Default preferences initializer */
+ public static void initDefaults(IPreferenceStore store) {
+
+ store.setDefault(LabelPreferenceHelper.getPreferenceConstant(prefLabelKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE), DISP_DIRECTION | DISP_NAME | DISP_TYPE | DISP_UNDEFINED_TYPE);
+
+ store.setDefault(PreferenceConstantHelper.getElementConstant(prefKey, PreferenceConstantHelper.WIDTH), 20);
+ store.setDefault(PreferenceConstantHelper.getElementConstant(prefKey, PreferenceConstantHelper.HEIGHT), 20);
+
+ // Initialize default visibility for labels in preference page.
+ for(String labelName : labelDefaultVisibilityMap.keySet()) {
+ String showLabelKey = PreferenceConstantHelper.getCompartmentElementConstant(prefKey, labelName, PreferenceConstantHelper.LABEL_VISIBILITY);
+ store.setDefault(showLabelKey, labelDefaultVisibilityMap.get(labelName));
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void initializeLabelsList() {
+ for(String name : labelDefaultVisibilityMap.keySet()) {
+ this.labelsList.add(name);
+ }
+ }
+
+ /** buttons to select the display mask of the label */
+ protected Button bttnDirection, bttnVisibility, bttnDerive, bttnName, bttnType, bttnUndefined_Type, bttnMultiplicity, bttnDefault_Multiplicity, bttnDefaultValue, bttnModifiers;
+
+ private String labelDisplayPreferenceKey = LabelPreferenceHelper.getPreferenceConstant(prefLabelKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE);
+
+ /** current property display style */
+ private int propertyValue = getPreferenceStore().getInt(labelDisplayPreferenceKey);
+
+ /**
+ * Creates a button with the {@link SWT#CHECK} style.
+ *
+ * @param parent
+ * the parent of the button
+ * @param label
+ * the label of the button
+ * @param mask
+ * the value controlled by the button
+ * @return the button created
+ */
+ protected Button createCheckButton(Composite parent, String label, int mask) {
+ Button button = new Button(parent, SWT.CHECK);
+ button.setText(label);
+ button.addSelectionListener(new AppearenceSelectionListener(mask));
+ return button;
+ }
+
+ /**
+ * Creates the group and check boxes to choose the kind of display
+ *
+ * @param parent
+ * the parent composite that holds the group
+ */
+ protected void createLabelPreferencesButtons(Composite parent) {
+ // create group that host the buttons
+ Group group = new Group(parent, SWT.SHADOW_NONE);
+ group.setText("Label Display");
+ group.setLayout(new FormLayout());
+
+ FormData data;
+
+ bttnDirection = createCheckButton(group, "Direction", DISP_DIRECTION);
+ data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.top = new FormAttachment(0, 0);
+ bttnDirection.setLayoutData(data);
+
+ bttnVisibility = createCheckButton(group, "Visibility", DISP_VISIBILITY);
+ data = new FormData();
+ data.left = new FormAttachment(bttnDirection, 85);
+ data.top = new FormAttachment(0, 0);
+ bttnVisibility.setLayoutData(data);
+
+ bttnDerive = createCheckButton(group, "Derive", DISP_DERIVE);
+ data = new FormData();
+ data.left = new FormAttachment(bttnVisibility, 85);
+ data.top = new FormAttachment(0, 0);
+ bttnDerive.setLayoutData(data);
+
+ bttnName = createCheckButton(group, "Name", DISP_NAME);
+ data = new FormData();
+ data.left = new FormAttachment(bttnDerive, 85);
+ data.top = new FormAttachment(0, 0);
+ bttnName.setLayoutData(data);
+
+ bttnType = createCheckButton(group, "Type", DISP_TYPE);
+ data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.top = new FormAttachment(bttnDirection, ITabbedPropertyConstants.HSPACE);
+ bttnType.setLayoutData(data);
+
+ bttnUndefined_Type = createCheckButton(group, "Undefined_Type", DISP_UNDEFINED_TYPE);
+ data = new FormData();
+ data.left = new FormAttachment(bttnDirection, 85);
+ data.top = new FormAttachment(bttnDirection, ITabbedPropertyConstants.HSPACE);
+ bttnUndefined_Type.setLayoutData(data);
+
+ bttnMultiplicity = createCheckButton(group, "Multiplicity", DISP_MULTIPLICITY);
+ data = new FormData();
+ data.left = new FormAttachment(bttnVisibility, 85);
+ data.top = new FormAttachment(bttnDirection, ITabbedPropertyConstants.HSPACE);
+ bttnMultiplicity.setLayoutData(data);
+
+ bttnDefault_Multiplicity = createCheckButton(group, "Default_Multiplicity", DISP_DEFAULT_MULTIPLICITY);
+ data = new FormData();
+ data.left = new FormAttachment(bttnDerive, 85);
+ data.top = new FormAttachment(bttnDirection, ITabbedPropertyConstants.HSPACE);
+ bttnDefault_Multiplicity.setLayoutData(data);
+
+ bttnDefaultValue = createCheckButton(group, "DefaultValue", DISP_DEFAULTVALUE);
+ data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.top = new FormAttachment(bttnType, ITabbedPropertyConstants.HSPACE);
+ bttnDefaultValue.setLayoutData(data);
+
+ bttnModifiers = createCheckButton(group, "Modifiers", DISP_MODIFIERS);
+ data = new FormData();
+ data.left = new FormAttachment(bttnDirection, 85);
+ data.top = new FormAttachment(bttnType, ITabbedPropertyConstants.HSPACE);
+ bttnModifiers.setLayoutData(data);
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void createPageContents(Composite parent) {
+ super.createPageContents(parent);
+
+ // adds the label preferences check boxes
+ createLabelPreferencesButtons(parent);
+
+ refreshButtons();
+ }
+
+ /**
+ * Load the default preferences of the fields contained in this page
+ */
+ protected void loadDefaultPreferences() {
+ propertyValue = getPreferenceStore().getDefaultInt(labelDisplayPreferenceKey);
+ refreshButtons();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void performDefaults() {
+ loadDefaultPreferences();
+ super.performDefaults();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean performOk() {
+ storePreferences();
+ return super.performOk();
+ }
+
+ /**
+ * Refresh the buttons that manages the display.
+ */
+ protected void refreshButtons() {
+
+ bttnDirection.setSelection((propertyValue & DISP_DIRECTION) == DISP_DIRECTION);
+ bttnVisibility.setSelection((propertyValue & DISP_VISIBILITY) == DISP_VISIBILITY);
+ bttnDerive.setSelection((propertyValue & DISP_DERIVE) == DISP_DERIVE);
+ bttnName.setSelection((propertyValue & DISP_NAME) == DISP_NAME);
+ bttnType.setSelection((propertyValue & DISP_TYPE) == DISP_TYPE);
+ bttnUndefined_Type.setSelection((propertyValue & DISP_UNDEFINED_TYPE) == DISP_UNDEFINED_TYPE);
+ bttnMultiplicity.setSelection((propertyValue & DISP_MULTIPLICITY) == DISP_MULTIPLICITY);
+ bttnDefault_Multiplicity.setSelection((propertyValue & DISP_DEFAULT_MULTIPLICITY) == DISP_DEFAULT_MULTIPLICITY);
+ bttnDefaultValue.setSelection((propertyValue & DISP_DEFAULTVALUE) == DISP_DEFAULTVALUE);
+ bttnModifiers.setSelection((propertyValue & DISP_MODIFIERS) == DISP_MODIFIERS);
+
+ }
+
+ /**
+ * Stores the values of the fields contained in this page into the preference store.
+ */
+ protected void storePreferences() {
+ super.storePreferences();
+ IPreferenceStore store = getPreferenceStore();
+ // checks the stored value and the actual one, so does not refresh diagram if it is not
+ // needed
+ if(propertyValue != store.getInt(labelDisplayPreferenceKey)) {
+ store.setValue(labelDisplayPreferenceKey, propertyValue);
+ }
+ }
+
+ /**
+ * Listeners for the check buttons that select the display.
+ */
+ private class AppearenceSelectionListener implements SelectionListener {
+
+ /** The constant which refers the element to display or not. */
+ final private int style;
+
+ /**
+ * Default Constructor.
+ *
+ * @param style
+ */
+ public AppearenceSelectionListener(int style) {
+ this.style = style;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void widgetSelected(SelectionEvent e) {
+ // add or remove the flag to the display property value (invert the current value)
+ propertyValue = propertyValue ^ style;
+ // refresh buttons to show current values
+ refreshButtons();
+ }
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/PortAsBorderItemPreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/PortAsBorderItemPreferencePage.java
new file mode 100644
index 00000000000..5848eef2df0
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/PortAsBorderItemPreferencePage.java
@@ -0,0 +1,301 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.parametric.preferences;
+
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_DEFAULTVALUE;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_DERIVE;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_MODIFIERS;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_MULTIPLICITY;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_NAME;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_TYPE;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_UNDEFINED_TYPE;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_VISIBILITY;
+
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants;
+import org.eclipse.papyrus.sysml.diagram.common.preferences.LabelPreferenceHelper;
+import org.eclipse.papyrus.sysml.diagram.parametric.provider.ElementTypes;
+import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
+
+/**
+ * {@link Port} preference page.
+ */
+public class PortAsBorderItemPreferencePage extends ParametricDiagramNodePreferencePage {
+
+ /** Constant key to access preferences */
+ public static String prefKey = ElementTypes.DIAGRAM_ID + "_" + UMLGraphicalTypes.SHAPE_UML_PORT_AS_AFFIXED_ID; //$NON-NLS-1$
+
+ public static String prefLabelKey = prefKey + "-" + UMLGraphicalTypes.AFFIXEDLABEL_UML_PORT_LABEL_ID; //$NON-NLS-1$
+
+ /** The labels default visibility for preferences */
+ public static final Map<String, Boolean> labelDefaultVisibilityMap;
+
+ /** Static attribute initialization */
+ static {
+ labelDefaultVisibilityMap = new LinkedHashMap<String, Boolean>();
+ labelDefaultVisibilityMap.put("Stereotype", Boolean.TRUE); //$NON-NLS-1$
+ labelDefaultVisibilityMap.put("Label", Boolean.TRUE); //$NON-NLS-1$
+
+ // Start of user code custom static initializations
+ // End of user code
+
+ Collections.unmodifiableMap(labelDefaultVisibilityMap);
+ }
+
+ /** Constructor */
+ public PortAsBorderItemPreferencePage() {
+ super();
+ setPreferenceKey(ElementTypes.DIAGRAM_ID + "_" + UMLGraphicalTypes.SHAPE_UML_PORT_AS_AFFIXED_ID); //$NON-NLS-1$
+ }
+
+ /** Default preferences initializer */
+ public static void initDefaults(IPreferenceStore store) {
+ store.setDefault(LabelPreferenceHelper.getPreferenceConstant(prefLabelKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE), DISP_NAME | DISP_TYPE | DISP_MULTIPLICITY | DISP_UNDEFINED_TYPE);
+
+ store.setDefault(PreferenceConstantHelper.getElementConstant(prefKey, PreferenceConstantHelper.WIDTH), 20);
+ store.setDefault(PreferenceConstantHelper.getElementConstant(prefKey, PreferenceConstantHelper.HEIGHT), 20);
+
+ // Initialize default visibility for labels in preference page.
+ for(String labelName : labelDefaultVisibilityMap.keySet()) {
+ String showLabelKey = PreferenceConstantHelper.getCompartmentElementConstant(prefKey, labelName, PreferenceConstantHelper.LABEL_VISIBILITY);
+ store.setDefault(showLabelKey, labelDefaultVisibilityMap.get(labelName));
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void initializeLabelsList() {
+ for(String name : labelDefaultVisibilityMap.keySet()) {
+ this.labelsList.add(name);
+ }
+ }
+
+ /** buttons to select the display mask of the label */
+ protected Button bttnVisibility, bttnDerive, bttnName, bttnType, bttnUndefined_Type, bttnMultiplicity, bttnDefault_Multiplicity, bttnDefaultValue, bttnModifiers;
+
+ private String labelDisplayPreferenceKey = LabelPreferenceHelper.getPreferenceConstant(prefLabelKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE);
+
+ /** current property display style */
+ private int propertyValue = getPreferenceStore().getInt(labelDisplayPreferenceKey);
+
+ /**
+ * Creates a button with the {@link SWT#CHECK} style.
+ *
+ * @param parent
+ * the parent of the button
+ * @param label
+ * the label of the button
+ * @param mask
+ * the value controlled by the button
+ * @return the button created
+ */
+ protected Button createCheckButton(Composite parent, String label, int mask) {
+ Button button = new Button(parent, SWT.CHECK);
+ button.setText(label);
+ button.addSelectionListener(new AppearenceSelectionListener(mask));
+ return button;
+ }
+
+ /**
+ * Creates the group and check boxes to choose the kind of display
+ *
+ * @param parent
+ * the parent composite that holds the group
+ */
+ protected void createLabelPreferencesButtons(Composite parent) {
+ // create group that host the buttons
+ Group group = new Group(parent, SWT.SHADOW_NONE);
+ group.setText("Label Display");
+ group.setLayout(new FormLayout());
+
+ FormData data;
+
+ bttnVisibility = createCheckButton(group, "Visibility", DISP_VISIBILITY);
+ data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.top = new FormAttachment(0, 0);
+ bttnVisibility.setLayoutData(data);
+
+ bttnDerive = createCheckButton(group, "Derive", DISP_DERIVE);
+ data = new FormData();
+ data.left = new FormAttachment(bttnVisibility, 85);
+ data.top = new FormAttachment(0, 0);
+ bttnDerive.setLayoutData(data);
+
+ bttnName = createCheckButton(group, "Name", DISP_NAME);
+ data = new FormData();
+ data.left = new FormAttachment(bttnDerive, 85);
+ data.top = new FormAttachment(0, 0);
+ bttnName.setLayoutData(data);
+
+ bttnType = createCheckButton(group, "Type", DISP_TYPE);
+ data = new FormData();
+ data.left = new FormAttachment(bttnName, 85);
+ data.top = new FormAttachment(0, 0);
+ bttnType.setLayoutData(data);
+
+ bttnUndefined_Type = createCheckButton(group, "Undefined_Type", DISP_UNDEFINED_TYPE);
+ data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.top = new FormAttachment(bttnVisibility, ITabbedPropertyConstants.HSPACE);
+ bttnUndefined_Type.setLayoutData(data);
+
+ bttnMultiplicity = createCheckButton(group, "Multiplicity", DISP_MULTIPLICITY);
+ data = new FormData();
+ data.left = new FormAttachment(bttnVisibility, 85);
+ data.top = new FormAttachment(bttnVisibility, ITabbedPropertyConstants.HSPACE);
+ bttnMultiplicity.setLayoutData(data);
+
+ bttnDefault_Multiplicity = createCheckButton(group, "Default_Multiplicity", DISP_DEFAULT_MULTIPLICITY);
+ data = new FormData();
+ data.left = new FormAttachment(bttnDerive, 85);
+ data.top = new FormAttachment(bttnVisibility, ITabbedPropertyConstants.HSPACE);
+ bttnDefault_Multiplicity.setLayoutData(data);
+
+ bttnDefaultValue = createCheckButton(group, "DefaultValue", DISP_DEFAULTVALUE);
+ data = new FormData();
+ data.left = new FormAttachment(bttnName, 85);
+ data.top = new FormAttachment(bttnVisibility, ITabbedPropertyConstants.HSPACE);
+ bttnDefaultValue.setLayoutData(data);
+
+ bttnModifiers = createCheckButton(group, "Modifiers", DISP_MODIFIERS);
+ data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.top = new FormAttachment(bttnUndefined_Type, ITabbedPropertyConstants.HSPACE);
+ bttnModifiers.setLayoutData(data);
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void createPageContents(Composite parent) {
+ super.createPageContents(parent);
+
+ // adds the label preferences check boxes
+ createLabelPreferencesButtons(parent);
+
+ refreshButtons();
+ }
+
+ /**
+ * Load the default preferences of the fields contained in this page
+ */
+ protected void loadDefaultPreferences() {
+ propertyValue = getPreferenceStore().getDefaultInt(labelDisplayPreferenceKey);
+ refreshButtons();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void performDefaults() {
+ loadDefaultPreferences();
+ super.performDefaults();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean performOk() {
+ storePreferences();
+ return super.performOk();
+ }
+
+ /**
+ * Refresh the buttons that manages the display.
+ */
+ protected void refreshButtons() {
+
+ bttnVisibility.setSelection((propertyValue & DISP_VISIBILITY) == DISP_VISIBILITY);
+ bttnDerive.setSelection((propertyValue & DISP_DERIVE) == DISP_DERIVE);
+ bttnName.setSelection((propertyValue & DISP_NAME) == DISP_NAME);
+ bttnType.setSelection((propertyValue & DISP_TYPE) == DISP_TYPE);
+ bttnUndefined_Type.setSelection((propertyValue & DISP_UNDEFINED_TYPE) == DISP_UNDEFINED_TYPE);
+ bttnMultiplicity.setSelection((propertyValue & DISP_MULTIPLICITY) == DISP_MULTIPLICITY);
+ bttnDefault_Multiplicity.setSelection((propertyValue & DISP_DEFAULT_MULTIPLICITY) == DISP_DEFAULT_MULTIPLICITY);
+ bttnDefaultValue.setSelection((propertyValue & DISP_DEFAULTVALUE) == DISP_DEFAULTVALUE);
+ bttnModifiers.setSelection((propertyValue & DISP_MODIFIERS) == DISP_MODIFIERS);
+
+ }
+
+ /**
+ * Stores the values of the fields contained in this page into the preference store.
+ */
+ protected void storePreferences() {
+ super.storePreferences();
+ IPreferenceStore store = getPreferenceStore();
+ // checks the stored value and the actual one, so does not refresh diagram if it is not
+ // needed
+ if(propertyValue != store.getInt(labelDisplayPreferenceKey)) {
+ store.setValue(labelDisplayPreferenceKey, propertyValue);
+ }
+ }
+
+ /**
+ * Listeners for the check buttons that select the display.
+ */
+ private class AppearenceSelectionListener implements SelectionListener {
+
+ /** The constant which refers the element to display or not. */
+ final private int style;
+
+ /**
+ * Default Constructor.
+ *
+ * @param style
+ */
+ public AppearenceSelectionListener(int style) {
+ this.style = style;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void widgetSelected(SelectionEvent e) {
+ // add or remove the flag to the display property value (invert the current value)
+ propertyValue = propertyValue ^ style;
+ // refresh buttons to show current values
+ refreshButtons();
+ }
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/PropertyPreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/PropertyPreferencePage.java
deleted file mode 100644
index 543e336780a..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/PropertyPreferencePage.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.preferences;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.AbstractPapyrusNodePreferencePage;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ParametricEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlDiagramEditorPlugin;
-
-/**
- * @generated
- */
-public class PropertyPreferencePage extends AbstractPapyrusNodePreferencePage {
-
- /**
- * @generated
- */
- public PropertyPreferencePage() {
- super();
- setPreferenceKey(ParametricEditPart.MODEL_ID + "_Property");
- }
-
- /**
- * @generated
- */
- @Override
- protected String getBundleId() {
- return SysmlDiagramEditorPlugin.ID;
- }
-
- /**
- * @generated
- */
- public static void initDefaults(IPreferenceStore store) {
-
- String key = ParametricEditPart.MODEL_ID + "_Property";
- store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.WIDTH), 40);
- store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.HEIGHT), 40);
-
- //org.eclipse.jface.preference.PreferenceConverter.setDefault(store, org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_FILL), new org.eclipse.swt.graphics.RGB(255, 255, 255));
- //org.eclipse.jface.preference.PreferenceConverter.setDefault(store, org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_LINE), new org.eclipse.swt.graphics.RGB(0, 0, 0));
-
- // Set the default for the gradient
- //store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.GRADIENT_POLICY),false);
- //org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter gradientPreferenceConverter = new org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter(
- // new org.eclipse.swt.graphics.RGB(255, 255, 255),
- // new org.eclipse.swt.graphics.RGB(0, 0, 0), 0, 0);
- //store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_GRADIENT), gradientPreferenceConverter.getPreferenceValue());
-
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/provider/CustomEditPolicyProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/provider/CustomEditPolicyProvider.java
new file mode 100644
index 00000000000..9a5df313ee8
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/provider/CustomEditPolicyProvider.java
@@ -0,0 +1,188 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.parametric.provider;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+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.editparts.ResizableCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.CreateEditPoliciesOperation;
+import org.eclipse.papyrus.gmf.diagram.common.edit.policy.DefaultCreationEditPolicy;
+import org.eclipse.papyrus.gmf.diagram.common.edit.policy.DefaultGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.gmf.diagram.common.edit.policy.DefaultXYLayoutEditPolicy;
+import org.eclipse.papyrus.sysml.diagram.common.edit.part.BlockCompositeEditPart;
+import org.eclipse.papyrus.sysml.diagram.common.edit.part.BlockPropertyCompositeEditPart;
+import org.eclipse.papyrus.sysml.diagram.common.edit.part.BlockPropertyStructureCompartmentEditPart;
+import org.eclipse.papyrus.sysml.diagram.common.edit.part.ConstraintBlockPropertyCompositeEditPart;
+import org.eclipse.papyrus.sysml.diagram.common.edit.part.FlowPortAffixedNodeEditPart;
+import org.eclipse.papyrus.sysml.diagram.common.edit.part.StructureCompartmentEditPart;
+import org.eclipse.papyrus.sysml.diagram.common.edit.policy.CustomDuplicatePasteEditPolicy;
+import org.eclipse.papyrus.sysml.diagram.internalblock.edit.part.InternalBlockDiagramEditPart;
+import org.eclipse.papyrus.sysml.diagram.internalblock.edit.policy.CustomBlockCompositeSemanticEditPolicy;
+import org.eclipse.papyrus.sysml.diagram.internalblock.edit.policy.CustomBlockPropertyCompositeDropEditPolicy;
+import org.eclipse.papyrus.sysml.diagram.internalblock.edit.policy.CustomBlockPropertyStructureCompartmentEditPartDropEditPolicy;
+import org.eclipse.papyrus.sysml.diagram.internalblock.edit.policy.CustomDefaultSemanticEditPolicy;
+import org.eclipse.papyrus.sysml.diagram.internalblock.edit.policy.CustomDiagramDropEditPolicy;
+import org.eclipse.papyrus.sysml.diagram.internalblock.edit.policy.CustomDragDropEditPolicy;
+import org.eclipse.papyrus.sysml.diagram.internalblock.edit.policy.EncapsulatedClassifierDropEditPolicy;
+import org.eclipse.papyrus.sysml.diagram.parametric.policies.StructureClassifierDropEditPolicy;
+import org.eclipse.papyrus.sysml.diagram.internalblock.edit.policy.TypedElementDropEditPolicy;
+import org.eclipse.papyrus.sysml.diagram.parametric.edit.part.CustomBlockCompositeEditPartTN;
+import org.eclipse.papyrus.sysml.diagram.parametric.edit.part.ParametricDiagramEditPart;
+import org.eclipse.papyrus.sysml.diagram.parametric.policies.CustomParametricSemanticPolicy;
+import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementBorderEditPart;
+import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementEditPart;
+import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementLinkEditPart;
+import org.eclipse.papyrus.uml.diagram.common.edit.part.ConnectorEditPart;
+import org.eclipse.papyrus.uml.diagram.common.edit.part.ConstraintParameterAffixedNodeEditPart;
+import org.eclipse.papyrus.uml.diagram.common.edit.part.DependencyEditPart;
+import org.eclipse.papyrus.uml.diagram.common.edit.part.PortAffixedNodeEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.DuplicatePasteEditPolicy;
+import org.eclipse.papyrus.uml.diagram.composite.edit.parts.CommentEditPart;
+import org.eclipse.papyrus.uml.diagram.composite.edit.parts.CommentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ConstraintEditPart;
+import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ConstraintEditPartCN;
+
+/**
+ * Custom edit policy provider.
+ */
+public class CustomEditPolicyProvider extends ParametricDiagramEditPolicyProvider {
+
+ @Override
+ public boolean provides(IOperation operation) {
+
+ CreateEditPoliciesOperation epOperation = (CreateEditPoliciesOperation)operation;
+ if(!(epOperation.getEditPart() instanceof IGraphicalEditPart)) {
+ return false;
+ }
+
+ // Make sure this concern Parametric Diagram only
+ IGraphicalEditPart gep = (IGraphicalEditPart)epOperation.getEditPart();
+ String diagramType = gep.getNotationView().getDiagram().getType();
+ if(!ElementTypes.DIAGRAM_ID.equals(diagramType)) {
+ return false;
+ }
+
+ // provides for the main diagram edit part
+ if(gep instanceof ParametricDiagramEditPart) {
+ return true;
+ }
+
+ // Provides for edit parts that represent nodes in Internal Block diagram
+ if(gep instanceof AbstractElementEditPart) {
+ return true;
+ }
+ if(gep instanceof AbstractElementBorderEditPart) {
+ return true;
+ }
+
+ // Provides for edit parts that represent edges in Internal Block diagram
+ if(gep instanceof AbstractElementLinkEditPart) {
+ return true;
+ }
+
+ if(gep instanceof ResizableCompartmentEditPart) {
+ return true;
+ }
+
+ return super.provides(operation);
+ }
+
+ @Override
+ public void createEditPolicies(EditPart editPart) {
+ super.createEditPolicies(editPart);
+
+ if(editPart instanceof InternalBlockDiagramEditPart) {
+ editPart.installEditPolicy(DuplicatePasteEditPolicy.PASTE_ROLE, new CustomDuplicatePasteEditPolicy());
+ editPart.installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDropEditPolicy());
+ // no installation of other policies.
+ return;
+ }
+
+ editPart.installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDragDropEditPolicy());
+
+ if((editPart instanceof ConstraintEditPart) || (editPart instanceof ConstraintEditPartCN)) {
+ editPart.installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomDefaultSemanticEditPolicy());
+ editPart.installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy());
+ editPart.installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
+ }
+
+ if((editPart instanceof CommentEditPart) || (editPart instanceof CommentEditPartCN)) {
+ editPart.installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomDefaultSemanticEditPolicy());
+ editPart.installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy());
+ editPart.installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
+ }
+
+ if(editPart instanceof FlowPortAffixedNodeEditPart) {
+ editPart.installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new TypedElementDropEditPolicy());
+ editPart.installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomParametricSemanticPolicy());
+ }
+
+ if(editPart instanceof PortAffixedNodeEditPart) {
+ editPart.installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new TypedElementDropEditPolicy());
+ editPart.installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomParametricSemanticPolicy());
+ }
+
+ if(editPart instanceof BlockPropertyCompositeEditPart) {
+ editPart.installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomBlockPropertyCompositeDropEditPolicy());
+ editPart.installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomParametricSemanticPolicy());
+ }
+
+ /*
+ * if(editPart instanceof NestedBlockPropertyCompositeEditPart) {
+ * editPart.installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomBlockPropertyCompositeDropEditPolicy());
+ * editPart.installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomNestedBlockPropertyCompositeSemanticEditPolicy());
+ * }
+ */
+
+ if(editPart instanceof BlockPropertyStructureCompartmentEditPart) {
+ editPart.installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomBlockPropertyStructureCompartmentEditPartDropEditPolicy());
+ editPart.installEditPolicy(EditPolicy.LAYOUT_ROLE, new DefaultXYLayoutEditPolicy());
+ }
+
+ if(editPart instanceof BlockCompositeEditPart) {
+ editPart.installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new EncapsulatedClassifierDropEditPolicy());
+ editPart.installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomBlockCompositeSemanticEditPolicy());
+ }
+
+ if(editPart instanceof StructureCompartmentEditPart) {
+ editPart.installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new StructureClassifierDropEditPolicy());
+ editPart.installEditPolicy(EditPolicy.LAYOUT_ROLE, new DefaultXYLayoutEditPolicy());
+ }
+
+ if(editPart instanceof DependencyEditPart) {
+ editPart.installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomDefaultSemanticEditPolicy());
+ }
+
+ if(editPart instanceof ConnectorEditPart) {
+ editPart.installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomDefaultSemanticEditPolicy());
+ }
+
+ if(editPart instanceof ConstraintBlockPropertyCompositeEditPart) {
+ editPart.installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomBlockPropertyCompositeDropEditPolicy());
+ editPart.installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomParametricSemanticPolicy());
+ }
+ if(editPart instanceof ConstraintParameterAffixedNodeEditPart) {
+ editPart.installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new TypedElementDropEditPolicy());
+ editPart.installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomParametricSemanticPolicy());
+ }
+ if(editPart instanceof CustomBlockCompositeEditPartTN) {
+ editPart.installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomParametricSemanticPolicy());
+ }
+
+ }
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/provider/ParserProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/provider/ParserProvider.java
new file mode 100644
index 00000000000..f42d1cf88f5
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/provider/ParserProvider.java
@@ -0,0 +1,107 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.parametric.provider;
+
+import java.util.HashMap;
+import java.util.Map;
+
+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.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.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.sysml.diagram.common.parser.FlowPortLabelParser;
+import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes;
+import org.eclipse.papyrus.sysml.diagram.parametric.parser.ParametricFrameParser;
+import org.eclipse.papyrus.uml.diagram.common.parser.ConnectorLabelParser;
+import org.eclipse.papyrus.uml.diagram.common.parser.ConstraintLabelParser;
+import org.eclipse.papyrus.uml.diagram.common.parser.MultiplicityElementLabelParser;
+import org.eclipse.papyrus.uml.diagram.common.parser.NamedElementLabelParser;
+import org.eclipse.papyrus.uml.diagram.common.parser.PropertyLabelParser;
+import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes;
+
+/**
+ * Parser provider for labels used by this diagram.
+ */
+public class ParserProvider extends AbstractProvider implements IParserProvider {
+
+ /** map from graphical hint to parsers */
+ private static final Map<String, IParser> graphicalHintToParser = new HashMap<String, IParser>();
+
+ static {
+ graphicalHintToParser.put(SysMLGraphicalTypes.LABEL_SYSML_BLOCK_NAME_ID, new ParametricFrameParser());
+ graphicalHintToParser.put(UMLGraphicalTypes.LABEL_UML_PROPERTY_LABEL_ID, new PropertyLabelParser());
+ graphicalHintToParser.put(UMLGraphicalTypes.SHAPE_UML_CONSTRAINT_AS_LABEL_ID, new ConstraintLabelParser());
+
+ graphicalHintToParser.put(UMLGraphicalTypes.AFFIXEDLABEL_UML_PORT_LABEL_ID, new PropertyLabelParser());
+ graphicalHintToParser.put(SysMLGraphicalTypes.AFFIXEDLABEL_SYSML_FLOWPORT_LABEL_ID, new FlowPortLabelParser());
+
+ graphicalHintToParser.put(UMLGraphicalTypes.LINKLABEL_UML_NAMEDELEMENT_NAME_ID, new NamedElementLabelParser());
+ graphicalHintToParser.put(UMLGraphicalTypes.LINKLABEL_UML_CONNECTOR_LABEL_ID, new ConnectorLabelParser());
+ graphicalHintToParser.put(UMLGraphicalTypes.LINKLABEL_UML_CONNECTOR_SOURCE_MULTIPLICITY_ID, new MultiplicityElementLabelParser());
+ graphicalHintToParser.put(UMLGraphicalTypes.LINKLABEL_UML_CONNECTOR_TARGET_MULTIPLICITY_ID, new MultiplicityElementLabelParser());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean provides(IOperation operation) {
+ if(operation instanceof GetParserOperation) {
+ IAdaptable hint = ((GetParserOperation)operation).getHint();
+
+ if(!ElementTypes.DIAGRAM_ID.equals(getDiagramType(hint))) {
+ return false;
+ }
+
+ return getParser(hint) != null;
+ }
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public IParser getParser(IAdaptable hint) {
+ String parserHint = (String)hint.getAdapter(String.class);
+ if(parserHint != null) {
+ IParser parser = graphicalHintToParser.get(parserHint);
+ if(parser != null) {
+ return parser;
+ }
+ }
+
+ View view = (View)hint.getAdapter(View.class);
+ if(view != null) {
+ IParser parser = graphicalHintToParser.get(view.getType());
+ if(parser != null) {
+ return parser;
+ }
+ }
+
+ return null;
+ }
+
+ private String getDiagramType(IAdaptable hint) {
+ Diagram diagram = (Diagram)hint.getAdapter(Diagram.class);
+ if(diagram != null) {
+ return diagram.getType();
+ }
+
+ return "undefined";
+ }
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/providers/ElementInitializers.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/providers/ElementInitializers.java
deleted file mode 100644
index 6d0aabf99a3..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/providers/ElementInitializers.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.providers;
-
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlDiagramEditorPlugin;
-
-/**
- * @generated
- */
-public class ElementInitializers {
-
- protected ElementInitializers() {
- // use #getInstance to access cached instance
- }
-
- /**
- * @generated
- */
- public static ElementInitializers getInstance() {
- ElementInitializers cached = SysmlDiagramEditorPlugin.getInstance().getElementInitializers();
- if(cached == null) {
- SysmlDiagramEditorPlugin.getInstance().setElementInitializers(cached = new ElementInitializers());
- }
- return cached;
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/providers/SysmlEditPartProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/providers/SysmlEditPartProvider.java
deleted file mode 100644
index 96765925ad2..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/providers/SysmlEditPartProvider.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.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.sysml.diagram.parametric.edit.parts.ParametricEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.SysmlEditPartFactory;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlVisualIDRegistry;
-
-/**
- * @generated
- */
-public class SysmlEditPartProvider extends AbstractEditPartProvider {
-
- /**
- * @generated
- */
- private EditPartFactory factory;
-
- /**
- * @generated
- */
- private boolean allowCaching;
-
- /**
- * @generated
- */
- private WeakReference cachedPart;
-
- /**
- * @generated
- */
- private WeakReference cachedView;
-
- /**
- * @generated
- */
- public SysmlEditPartProvider() {
- setFactory(new SysmlEditPartFactory());
- 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(!ParametricEditPart.MODEL_ID.equals(SysmlVisualIDRegistry.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/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/providers/SysmlElementTypes.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/providers/SysmlElementTypes.java
deleted file mode 100644
index 68610eb87ab..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/providers/SysmlElementTypes.java
+++ /dev/null
@@ -1,252 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.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.resource.ResourcePackage;
-import org.eclipse.papyrus.sysml.constraints.ConstraintsPackage;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ConnectorEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ConstraintPropertyEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ParametricEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.Property2EditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.PropertyEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlDiagramEditorPlugin;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class SysmlElementTypes {
-
- /**
- * @generated
- */
- private SysmlElementTypes() {
- }
-
- /**
- * @generated
- */
- private static Map<IElementType, ENamedElement> elements;
-
- /**
- * @generated
- */
- private static ImageRegistry imageRegistry;
-
- /**
- * @generated
- */
- private static Set<IElementType> KNOWN_ELEMENT_TYPES;
-
- /**
- * @generated
- */
- public static final IElementType Resource_1000 = getElementType("org.eclipse.papyrus.sysml.diagram.parametric.Resource_1000"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType ConstraintProperty_2003 = getElementType("org.eclipse.papyrus.sysml.diagram.parametric.ConstraintProperty_2003"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType Property_2005 = getElementType("org.eclipse.papyrus.sysml.diagram.parametric.Property_2005"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType Property_3002 = getElementType("org.eclipse.papyrus.sysml.diagram.parametric.Property_3002"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType Connector_4001 = getElementType("org.eclipse.papyrus.sysml.diagram.parametric.Connector_4001"); //$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 SysmlDiagramEditorPlugin.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<IElementType, ENamedElement>();
-
- elements.put(Resource_1000, ResourcePackage.eINSTANCE.getResource());
-
- elements.put(ConstraintProperty_2003, ConstraintsPackage.eINSTANCE.getConstraintProperty());
-
- elements.put(Property_2005, UMLPackage.eINSTANCE.getProperty());
-
- elements.put(Property_3002, UMLPackage.eINSTANCE.getProperty());
-
- elements.put(Connector_4001, UMLPackage.eINSTANCE.getConnector());
- }
- 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<IElementType>();
- KNOWN_ELEMENT_TYPES.add(Resource_1000);
- KNOWN_ELEMENT_TYPES.add(ConstraintProperty_2003);
- KNOWN_ELEMENT_TYPES.add(Property_2005);
- KNOWN_ELEMENT_TYPES.add(Property_3002);
- KNOWN_ELEMENT_TYPES.add(Connector_4001);
- }
- return KNOWN_ELEMENT_TYPES.contains(elementType);
- }
-
- /**
- * @generated
- */
- public static IElementType getElementType(int visualID) {
- switch(visualID) {
- case ParametricEditPart.VISUAL_ID:
- return Resource_1000;
- case ConstraintPropertyEditPart.VISUAL_ID:
- return ConstraintProperty_2003;
- case PropertyEditPart.VISUAL_ID:
- return Property_2005;
- case Property2EditPart.VISUAL_ID:
- return Property_3002;
- case ConnectorEditPart.VISUAL_ID:
- return Connector_4001;
- }
- return null;
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/providers/SysmlIconProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/providers/SysmlIconProvider.java
deleted file mode 100644
index 59bfd52ef86..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/providers/SysmlIconProvider.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.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 SysmlIconProvider extends AbstractProvider implements IIconProvider {
-
- /**
- * @generated
- */
- public Image getIcon(IAdaptable hint, int flags) {
- return SysmlElementTypes.getImage(hint);
- }
-
- /**
- * @generated
- */
- public boolean provides(IOperation operation) {
- if(operation instanceof GetIconOperation) {
- return ((GetIconOperation)operation).execute(this) != null;
- }
- return false;
- }
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/providers/SysmlMarkerNavigationProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/providers/SysmlMarkerNavigationProvider.java
deleted file mode 100644
index 208d2957396..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/providers/SysmlMarkerNavigationProvider.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.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.sysml.diagram.parametric.part.SysmlDiagramEditorPlugin;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlDiagramEditorUtil;
-
-/**
- * @generated
- */
-public class SysmlMarkerNavigationProvider extends AbstractModelMarkerNavigationProvider {
-
- /**
- * @generated
- */
- public static final String MARKER_TYPE = SysmlDiagramEditorPlugin.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) {
- SysmlDiagramEditorUtil.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) {
- SysmlDiagramEditorPlugin.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) {
- SysmlDiagramEditorPlugin.getInstance().logError("Failed to create validation marker", e); //$NON-NLS-1$
- }
- return marker;
- }
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/providers/SysmlModelingAssistantProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/providers/SysmlModelingAssistantProvider.java
deleted file mode 100644
index d156ebcf763..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/providers/SysmlModelingAssistantProvider.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.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.sysml.diagram.parametric.edit.parts.ConstraintPropertyEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ParametricEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.Property2EditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.PropertyEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.Messages;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlDiagramEditorPlugin;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.dialogs.ElementListSelectionDialog;
-
-/**
- * @generated
- */
-public class SysmlModelingAssistantProvider extends ModelingAssistantProvider {
-
- /**
- * @generated
- */
- public List getTypesForPopupBar(IAdaptable host) {
- IGraphicalEditPart editPart = (IGraphicalEditPart)host.getAdapter(IGraphicalEditPart.class);
- if(editPart instanceof ParametricEditPart) {
- ArrayList<IElementType> types = new ArrayList<IElementType>(2);
- types.add(SysmlElementTypes.ConstraintProperty_2003);
- types.add(SysmlElementTypes.Property_2005);
- return types;
- }
- if(editPart instanceof ConstraintPropertyEditPart) {
- ArrayList<IElementType> types = new ArrayList<IElementType>(1);
- types.add(SysmlElementTypes.Property_3002);
- return types;
- }
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- public List getRelTypesOnSource(IAdaptable source) {
- IGraphicalEditPart sourceEditPart = (IGraphicalEditPart)source.getAdapter(IGraphicalEditPart.class);
- if(sourceEditPart instanceof PropertyEditPart) {
- return ((PropertyEditPart)sourceEditPart).getMARelTypesOnSource();
- }
- if(sourceEditPart instanceof Property2EditPart) {
- return ((Property2EditPart)sourceEditPart).getMARelTypesOnSource();
- }
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- public List getRelTypesOnTarget(IAdaptable target) {
- IGraphicalEditPart targetEditPart = (IGraphicalEditPart)target.getAdapter(IGraphicalEditPart.class);
- if(targetEditPart instanceof PropertyEditPart) {
- return ((PropertyEditPart)targetEditPart).getMARelTypesOnTarget();
- }
- if(targetEditPart instanceof Property2EditPart) {
- return ((Property2EditPart)targetEditPart).getMARelTypesOnTarget();
- }
- 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 PropertyEditPart) {
- return ((PropertyEditPart)sourceEditPart).getMARelTypesOnSourceAndTarget(targetEditPart);
- }
- if(sourceEditPart instanceof Property2EditPart) {
- return ((Property2EditPart)sourceEditPart).getMARelTypesOnSourceAndTarget(targetEditPart);
- }
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- public List getTypesForSource(IAdaptable target, IElementType relationshipType) {
- IGraphicalEditPart targetEditPart = (IGraphicalEditPart)target.getAdapter(IGraphicalEditPart.class);
- if(targetEditPart instanceof PropertyEditPart) {
- return ((PropertyEditPart)targetEditPart).getMATypesForSource(relationshipType);
- }
- if(targetEditPart instanceof Property2EditPart) {
- return ((Property2EditPart)targetEditPart).getMATypesForSource(relationshipType);
- }
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- public List getTypesForTarget(IAdaptable source, IElementType relationshipType) {
- IGraphicalEditPart sourceEditPart = (IGraphicalEditPart)source.getAdapter(IGraphicalEditPart.class);
- if(sourceEditPart instanceof PropertyEditPart) {
- return ((PropertyEditPart)sourceEditPart).getMATypesForTarget(relationshipType);
- }
- if(sourceEditPart instanceof Property2EditPart) {
- return ((Property2EditPart)sourceEditPart).getMATypesForTarget(relationshipType);
- }
- 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();
- HashSet<EObject> elements = new HashSet<EObject>();
- for(Iterator<EObject> it = diagram.getElement().eAllContents(); it.hasNext();) {
- EObject element = it.next();
- if(isApplicableElement(element, types)) {
- elements.add(element);
- }
- }
- if(elements.isEmpty()) {
- return null;
- }
- return selectElement((EObject[])elements.toArray(new EObject[elements.size()]));
- }
-
- /**
- * @generated
- */
- 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(SysmlDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory());
- ElementListSelectionDialog dialog = new ElementListSelectionDialog(shell, labelProvider);
- dialog.setMessage(Messages.SysmlModelingAssistantProviderMessage);
- dialog.setTitle(Messages.SysmlModelingAssistantProviderTitle);
- dialog.setMultipleSelection(false);
- dialog.setElements(elements);
- EObject selected = null;
- if(dialog.open() == Window.OK) {
- selected = (EObject)dialog.getFirstResult();
- }
- return selected;
- }
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/providers/SysmlParserProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/providers/SysmlParserProvider.java
deleted file mode 100644
index 069a3928697..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/providers/SysmlParserProvider.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.providers;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.common.core.service.AbstractProvider;
-import org.eclipse.gmf.runtime.common.core.service.IOperation;
-import org.eclipse.gmf.runtime.common.ui.services.parser.GetParserOperation;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserProvider;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ParserHintAdapter;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ConnectorNameEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ConstraintLabelEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ConstraintPropertyNameEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.PropertyName2EditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.PropertyNameEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.parsers.ConnectorLabelParser;
-import org.eclipse.papyrus.sysml.diagram.parametric.parsers.ConstraintLabelParser;
-import org.eclipse.papyrus.sysml.diagram.parametric.parsers.ConstraintPropertyLabelParser;
-import org.eclipse.papyrus.sysml.diagram.parametric.parsers.PropertyLabelParser;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlVisualIDRegistry;
-
-/**
- * @generated
- */
-public class SysmlParserProvider extends AbstractProvider implements IParserProvider {
-
- /**
- * @generated
- */
- private ConstraintPropertyLabelParser constraintPropertyLabel_5001Parser;
-
- /**
- * @generated
- */
- private IParser getConstraintPropertyLabel_5001Parser() {
- if(constraintPropertyLabel_5001Parser == null) {
- constraintPropertyLabel_5001Parser = new ConstraintPropertyLabelParser();
- }
- return constraintPropertyLabel_5001Parser;
- }
-
- /**
- * @generated
- */
- private ConstraintLabelParser constraintPropertyLabel_5004Parser;
-
- /**
- * @generated
- */
- private IParser getConstraintPropertyLabel_5004Parser() {
- if(constraintPropertyLabel_5004Parser == null) {
- constraintPropertyLabel_5004Parser = new ConstraintLabelParser();
- }
- return constraintPropertyLabel_5004Parser;
- }
-
- /**
- * @generated
- */
- private PropertyLabelParser propertyName_5002Parser;
-
- /**
- * @generated
- */
- private IParser getPropertyName_5002Parser() {
- if(propertyName_5002Parser == null) {
- propertyName_5002Parser = new PropertyLabelParser();
- }
- return propertyName_5002Parser;
- }
-
- /**
- * @generated
- */
- private PropertyLabelParser propertyName_5003Parser;
-
- /**
- * @generated
- */
- private IParser getPropertyName_5003Parser() {
- if(propertyName_5003Parser == null) {
- propertyName_5003Parser = new PropertyLabelParser();
- }
- return propertyName_5003Parser;
- }
-
- /**
- * @generated
- */
- private ConnectorLabelParser connectorName_6001Parser;
-
- /**
- * @generated
- */
- private IParser getConnectorName_6001Parser() {
- if(connectorName_6001Parser == null) {
- connectorName_6001Parser = new ConnectorLabelParser();
- }
- return connectorName_6001Parser;
- }
-
- /**
- * @generated
- */
- protected IParser getParser(int visualID) {
- switch(visualID) {
- case ConstraintPropertyNameEditPart.VISUAL_ID:
- return getConstraintPropertyLabel_5001Parser();
- case ConstraintLabelEditPart.VISUAL_ID:
- return getConstraintPropertyLabel_5004Parser();
- case PropertyNameEditPart.VISUAL_ID:
- return getPropertyName_5002Parser();
- case PropertyName2EditPart.VISUAL_ID:
- return getPropertyName_5003Parser();
- case ConnectorNameEditPart.VISUAL_ID:
- return getConnectorName_6001Parser();
- }
- return null;
- }
-
- /**
- * Utility method that consults ParserService
- *
- * @generated
- */
- public static IParser getParser(IElementType type, EObject object, String parserHint) {
- return ParserService.getInstance().getParser(new HintAdapter(type, object, parserHint));
- }
-
- /**
- * @generated
- */
- public IParser getParser(IAdaptable hint) {
- String vid = (String)hint.getAdapter(String.class);
- if(vid != null) {
- return getParser(SysmlVisualIDRegistry.getVisualID(vid));
- }
- View view = (View)hint.getAdapter(View.class);
- if(view != null) {
- return getParser(SysmlVisualIDRegistry.getVisualID(view));
- }
- return null;
- }
-
- /**
- * @generated
- */
- public boolean provides(IOperation operation) {
- if(operation instanceof GetParserOperation) {
- IAdaptable hint = ((GetParserOperation)operation).getHint();
- if(SysmlElementTypes.getElement(hint) == null) {
- return false;
- }
- return getParser(hint) != null;
- }
- return false;
- }
-
- /**
- * @generated
- */
- private static class HintAdapter extends ParserHintAdapter {
-
- /**
- * @generated
- */
- private final IElementType elementType;
-
- /**
- * @generated
- */
- public HintAdapter(IElementType type, EObject object, String parserHint) {
- super(object, parserHint);
- assert type != null;
- elementType = type;
- }
-
- /**
- * @generated
- */
- public Object getAdapter(Class adapter) {
- if(IElementType.class.equals(adapter)) {
- return elementType;
- }
- return super.getAdapter(adapter);
- }
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/providers/SysmlValidationProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/providers/SysmlValidationProvider.java
deleted file mode 100644
index d2ef28d8f7c..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/providers/SysmlValidationProvider.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.providers;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.validation.AbstractModelConstraint;
-import org.eclipse.emf.validation.IValidationContext;
-import org.eclipse.emf.validation.model.IClientSelector;
-import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.sysml.blocks.NestedConnectorEnd;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ParametricEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.helper.ModelValidationHelper;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlDiagramEditorPlugin;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlVisualIDRegistry;
-import org.eclipse.uml2.uml.Connector;
-import org.eclipse.uml2.uml.ConnectorEnd;
-import org.eclipse.uml2.uml.Property;
-
-/**
- * @generated
- */
-public class SysmlValidationProvider {
-
- /**
- * @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) {
- SysmlDiagramEditorPlugin.getInstance().logError("Validation failed", e); //$NON-NLS-1$
- }
- } else {
- task.run();
- }
- }
-
- /**
- * @generated
- */
- static boolean isInDefaultEditorContext(Object object) {
- if(shouldConstraintsBePrivate() && !constraintsActive) {
- return false;
- }
- if(object instanceof View) {
- return constraintsActive && ParametricEditPart.MODEL_ID.equals(SysmlVisualIDRegistry.getModelID((View)object));
- }
- return true;
- }
-
- /**
- * @generated
- */
- public static class DefaultCtx implements IClientSelector {
-
- /**
- * @generated
- */
- public boolean selects(Object object) {
- return isInDefaultEditorContext(object);
- }
- }
-
- /**
- * @generated
- */
- public static class Adapter1 extends AbstractModelConstraint {
-
- /**
- * @generated
- */
- public IStatus validate(IValidationContext ctx) {
- Connector context = (Connector)ctx.getTarget();
- return ModelValidationHelper.validateConnector(context, ctx);
- }
- }
-
- /**
- * @generated
- */
- public static class Adapter2 extends AbstractModelConstraint {
-
- /**
- * @generated
- */
- public IStatus validate(IValidationContext ctx) {
- Property context = (Property)ctx.getTarget();
- return ModelValidationHelper.validateProperty(context, ctx);
- }
- }
-
- /**
- * @generated
- */
- public static class Adapter3 extends AbstractModelConstraint {
-
- /**
- * @generated
- */
- public IStatus validate(IValidationContext ctx) {
- ConnectorEnd context = (ConnectorEnd)ctx.getTarget();
- return ModelValidationHelper.validateConnectorEnd(context, ctx);
- }
- }
-
- /**
- * @generated
- */
- public static class Adapter4 extends AbstractModelConstraint {
-
- /**
- * @generated
- */
- public IStatus validate(IValidationContext ctx) {
- NestedConnectorEnd context = (NestedConnectorEnd)ctx.getTarget();
- return ModelValidationHelper.validateNestedConnectorEnd(context, ctx);
- }
- }
-
- /**
- * @generated
- */
- static String formatElement(EObject object) {
- return EMFCoreUtil.getQualifiedName(object, true);
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/providers/SysmlViewProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/providers/SysmlViewProvider.java
deleted file mode 100644
index 626f32b3c17..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/providers/SysmlViewProvider.java
+++ /dev/null
@@ -1,489 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.providers;
-
-import java.util.ArrayList;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EcoreFactory;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.gmf.runtime.common.core.service.AbstractProvider;
-import org.eclipse.gmf.runtime.common.core.service.IOperation;
-import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
-import org.eclipse.gmf.runtime.diagram.core.providers.IViewProvider;
-import org.eclipse.gmf.runtime.diagram.core.services.view.CreateDiagramViewOperation;
-import org.eclipse.gmf.runtime.diagram.core.services.view.CreateEdgeViewOperation;
-import org.eclipse.gmf.runtime.diagram.core.services.view.CreateNodeViewOperation;
-import org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewForKindOperation;
-import org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewOperation;
-import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
-import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
-import org.eclipse.gmf.runtime.notation.Connector;
-import org.eclipse.gmf.runtime.notation.DecorationNode;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.Edge;
-import org.eclipse.gmf.runtime.notation.FillStyle;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.Location;
-import org.eclipse.gmf.runtime.notation.MeasurementUnit;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.NotationFactory;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.RelativeBendpoints;
-import org.eclipse.gmf.runtime.notation.Shape;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceConverter;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
-import org.eclipse.papyrus.sysml.constraints.ConstraintProperty;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ConnectorEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ConnectorNameEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ConstraintLabelEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ConstraintPropertyEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ConstraintPropertyNameEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.ParametricEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.Property2EditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.PropertyEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.PropertyName2EditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.parts.PropertyNameEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.uml2.uml.Property;
-import org.eclipse.uml2.uml.StructuredClassifier;
-import org.eclipse.uml2.uml.Type;
-
-/**
- * @generated
- */
-public class SysmlViewProvider extends AbstractProvider implements IViewProvider {
-
- /**
- * @generated
- */
- public final boolean provides(IOperation operation) {
- if(operation instanceof CreateViewForKindOperation) {
- return provides((CreateViewForKindOperation)operation);
- }
- assert operation instanceof CreateViewOperation;
- if(operation instanceof CreateDiagramViewOperation) {
- return provides((CreateDiagramViewOperation)operation);
- } else if(operation instanceof CreateEdgeViewOperation) {
- return provides((CreateEdgeViewOperation)operation);
- } else if(operation instanceof CreateNodeViewOperation) {
- return provides((CreateNodeViewOperation)operation);
- }
- return false;
- }
-
- /**
- * @generated
- */
- protected boolean provides(CreateViewForKindOperation op) {
- /*
- * if (op.getViewKind() == Node.class)
- * return getNodeViewClass(op.getSemanticAdapter(), op.getContainerView(), op.getSemanticHint()) != null;
- * if (op.getViewKind() == Edge.class)
- * return getEdgeViewClass(op.getSemanticAdapter(), op.getContainerView(), op.getSemanticHint()) != null;
- */
-
- // check Diagram Type should be the class diagram
- String modelID = SysmlVisualIDRegistry.getModelID(op.getContainerView());
- if(!getDiagramProvidedId().equals(modelID)) {
- return false;
- }
-
- int visualID = SysmlVisualIDRegistry.getVisualID(op.getSemanticHint());
- if(Node.class.isAssignableFrom(op.getViewKind())) {
- return SysmlVisualIDRegistry.canCreateNode(op.getContainerView(), visualID);
- }
-
- return true;
- }
-
- /**
- * @generated
- */
- protected String getDiagramProvidedId() {
- /*
- * Indicates for which diagram this provider works for.
- * <p>
- * This method can be overloaded when diagram editor inherits from another one, but should never be <code>null</code>
- * </p>
- *
- * @return the unique identifier of the diagram for which views are provided.
- */
- return ParametricEditPart.MODEL_ID;
- }
-
- /**
- * @generated
- */
- protected boolean provides(CreateDiagramViewOperation op) {
- return ParametricEditPart.MODEL_ID.equals(op.getSemanticHint()) && SysmlVisualIDRegistry.getDiagramVisualID(getSemanticElement(op.getSemanticAdapter())) != -1;
- }
-
- /**
- * @generated
- */
- protected boolean provides(CreateNodeViewOperation op) {
- if(op.getContainerView() == null) {
- return false;
- }
- IElementType elementType = getSemanticElementType(op.getSemanticAdapter());
- EObject domainElement = getSemanticElement(op.getSemanticAdapter());
- int visualID;
- if(op.getSemanticHint() == null) {
- // Semantic hint is not specified. Can be a result of call from CanonicalEditPolicy.
- // In this situation there should be NO elementType, visualID will be determined
- // by VisualIDRegistry.getNodeVisualID() for domainElement.
- if(elementType != null || domainElement == null) {
- return false;
- }
- visualID = SysmlVisualIDRegistry.getNodeVisualID(op.getContainerView(), domainElement);
- } else {
- visualID = SysmlVisualIDRegistry.getVisualID(op.getSemanticHint());
- if(elementType != null) {
- if(!SysmlElementTypes.isKnownElementType(elementType) || (!(elementType instanceof IHintedType))) {
- return false; // foreign element type
- }
- String elementTypeHint = ((IHintedType)elementType).getSemanticHint();
- if(!op.getSemanticHint().equals(elementTypeHint)) {
- return false; // if semantic hint is specified it should be the same as in element type
- }
- if(domainElement != null && visualID != SysmlVisualIDRegistry.getNodeVisualID(op.getContainerView(), domainElement)) {
- return false; // visual id for node EClass should match visual id from element type
- }
- } else {
- if(!ParametricEditPart.MODEL_ID.equals(SysmlVisualIDRegistry.getModelID(op.getContainerView()))) {
- return false; // foreign diagram
- }
- switch(visualID) {
- case ConstraintPropertyEditPart.VISUAL_ID:
- case Property2EditPart.VISUAL_ID:
- case PropertyEditPart.VISUAL_ID:
- if(domainElement == null || visualID != SysmlVisualIDRegistry.getNodeVisualID(op.getContainerView(), domainElement)) {
- return false; // visual id in semantic hint should match visual id for domain element
- }
- break;
- default:
- return false;
- }
- }
- }
- return ConstraintPropertyEditPart.VISUAL_ID == visualID || PropertyEditPart.VISUAL_ID == visualID || Property2EditPart.VISUAL_ID == visualID;
- }
-
- /**
- * @generated
- */
- protected boolean provides(CreateEdgeViewOperation op) {
- IElementType elementType = getSemanticElementType(op.getSemanticAdapter());
- if(!SysmlElementTypes.isKnownElementType(elementType) || (!(elementType instanceof IHintedType))) {
- return false; // foreign element type
- }
- String elementTypeHint = ((IHintedType)elementType).getSemanticHint();
- if(elementTypeHint == null || (op.getSemanticHint() != null && !elementTypeHint.equals(op.getSemanticHint()))) {
- return false; // our hint is visual id and must be specified, and it should be the same as in element type
- }
- int visualID = SysmlVisualIDRegistry.getVisualID(elementTypeHint);
- EObject domainElement = getSemanticElement(op.getSemanticAdapter());
- if(domainElement != null && visualID != SysmlVisualIDRegistry.getLinkWithClassVisualID(domainElement)) {
- return false; // visual id for link EClass should match visual id from element type
- }
- return true;
- }
-
- /**
- * @generated
- */
- public Diagram createDiagram(IAdaptable semanticAdapter, String diagramKind, PreferencesHint preferencesHint) {
- Diagram diagram = NotationFactory.eINSTANCE.createDiagram();
- diagram.getStyles().add(NotationFactory.eINSTANCE.createDiagramStyle());
- diagram.setType(ParametricEditPart.MODEL_ID);
- diagram.setElement(getSemanticElement(semanticAdapter));
- diagram.setMeasurementUnit(MeasurementUnit.PIXEL_LITERAL);
- return diagram;
- }
-
- /**
- * @generated
- */
- public Node createNode(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
- final EObject domainElement = getSemanticElement(semanticAdapter);
- final int visualID;
- if(semanticHint == null) {
- visualID = SysmlVisualIDRegistry.getNodeVisualID(containerView, domainElement);
- } else {
- visualID = SysmlVisualIDRegistry.getVisualID(semanticHint);
- }
- switch(visualID) {
- case ConstraintPropertyEditPart.VISUAL_ID:
- return createConstraintProperty_2003(domainElement, containerView, index, persisted, preferencesHint);
- case PropertyEditPart.VISUAL_ID:
- return createProperty_2005(domainElement, containerView, index, persisted, preferencesHint);
- case Property2EditPart.VISUAL_ID:
- return createProperty_3002(domainElement, containerView, index, persisted, preferencesHint);
- }
- // can't happen, provided #provides(CreateNodeViewOperation) is correct
- return null;
- }
-
- /**
- * @generated
- */
- public Edge createEdge(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
- IElementType elementType = getSemanticElementType(semanticAdapter);
- String elementTypeHint = ((IHintedType)elementType).getSemanticHint();
- switch(SysmlVisualIDRegistry.getVisualID(elementTypeHint)) {
- case ConnectorEditPart.VISUAL_ID:
- return createConnector_4001(getSemanticElement(semanticAdapter), containerView, index, persisted, preferencesHint);
- }
- // can never happen, provided #provides(CreateEdgeViewOperation) is correct
- return null;
- }
-
- /**
- * @generated NOT
- */
- public Node createConstraintProperty_2003(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Shape node = NotationFactory.eINSTANCE.createShape();
- node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(SysmlVisualIDRegistry.getType(ConstraintPropertyEditPart.VISUAL_ID));
- ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
- // node.setElement(((ConstraintProperty) domainElement).getBase_Property());
-
- stampShortcut(containerView, node);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore();
-
- initForegroundFromPrefs(node, prefStore, "ConstraintProperty");
-
- initFontStyleFromPrefs(node, prefStore, "ConstraintProperty");
-
- initBackgroundFromPrefs(node, prefStore, "ConstraintProperty");
-
- Node label5001 = createLabel(node, SysmlVisualIDRegistry.getType(ConstraintPropertyNameEditPart.VISUAL_ID));
- Node label5004 = createLabel(node, SysmlVisualIDRegistry.getType(ConstraintLabelEditPart.VISUAL_ID));
-
- // create the associated properties
- Type type = ((ConstraintProperty)domainElement).getBase_Property().getType();
- if(type != null && type instanceof StructuredClassifier) {
- for(Property property : ((StructuredClassifier)type).getOwnedAttributes()) {
- createProperty_3002(property, node, index, persisted, preferencesHint);
- }
- }
- return node;
- }
-
- /**
- * @generated
- */
- public Node createProperty_2005(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Shape node = NotationFactory.eINSTANCE.createShape();
- node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(SysmlVisualIDRegistry.getType(PropertyEditPart.VISUAL_ID));
- ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
- stampShortcut(containerView, node);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initForegroundFromPrefs(node, prefStore, "Property");
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Property");
-
- PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node, prefStore, "Property");
-
- Node label5002 = createLabel(node, SysmlVisualIDRegistry.getType(PropertyNameEditPart.VISUAL_ID));
-
- return node;
- }
-
- /**
- * @generated
- */
- public Node createProperty_3002(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Shape node = NotationFactory.eINSTANCE.createShape();
- node.getStyles().add(NotationFactory.eINSTANCE.createHintedDiagramLinkStyle());
- node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(SysmlVisualIDRegistry.getType(Property2EditPart.VISUAL_ID));
- ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initForegroundFromPrefs(node, prefStore, "Property");
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Property");
-
- PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node, prefStore, "Property");
-
- Node label5003 = createLabel(node, SysmlVisualIDRegistry.getType(PropertyName2EditPart.VISUAL_ID));
- label5003.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
-
- Location location5003 = (Location)label5003.getLayoutConstraint();
- location5003.setX(0);
- location5003.setY(5);
-
- return node;
- }
-
- /**
- * @generated
- */
- public Edge createConnector_4001(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Connector edge = NotationFactory.eINSTANCE.createConnector();
- edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());
- RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints();
- ArrayList<RelativeBendpoint> points = new ArrayList<RelativeBendpoint>(2);
- points.add(new RelativeBendpoint());
- points.add(new RelativeBendpoint());
- bendpoints.setPoints(points);
- edge.setBendpoints(bendpoints);
- ViewUtil.insertChildView(containerView, edge, index, persisted);
- edge.setType(SysmlVisualIDRegistry.getType(ConnectorEditPart.VISUAL_ID));
- edge.setElement(domainElement);
- // initializePreferences
- final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initForegroundFromPrefs(edge, prefStore, "Connector");
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge, prefStore, "Connector");
-
- //org.eclipse.gmf.runtime.notation.Routing routing = org.eclipse.gmf.runtime.notation.Routing.get(prefStore.getInt(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_LINE_STYLE));
- //if (routing != null) {
- // org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(edge, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing);
- //}
-
- PreferenceInitializerForElementHelper.initRountingFromPrefs(edge, prefStore, "Connector");
-
- Node label6001 = createLabel(edge, SysmlVisualIDRegistry.getType(ConnectorNameEditPart.VISUAL_ID));
- label6001.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
- Location location6001 = (Location)label6001.getLayoutConstraint();
- location6001.setX(0);
- location6001.setY(40);
-
- PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(edge, prefStore, "Connector");
-
- return edge;
- }
-
- /**
- * @generated
- */
- protected void stampShortcut(View containerView, Node target) {
- if(!ParametricEditPart.MODEL_ID.equals(SysmlVisualIDRegistry.getModelID(containerView))) {
- EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
- shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
- shortcutAnnotation.getDetails().put("modelID", ParametricEditPart.MODEL_ID); //$NON-NLS-1$
- target.getEAnnotations().add(shortcutAnnotation);
- }
- }
-
- /**
- * @generated
- */
- protected Node createLabel(View owner, String hint) {
- DecorationNode rv = NotationFactory.eINSTANCE.createDecorationNode();
- rv.setType(hint);
- ViewUtil.insertChildView(owner, rv, ViewUtil.APPEND, true);
- return rv;
- }
-
- /**
- * @generated
- */
- protected EObject getSemanticElement(IAdaptable semanticAdapter) {
- if(semanticAdapter == null) {
- return null;
- }
- EObject eObject = (EObject)semanticAdapter.getAdapter(EObject.class);
- if(eObject != null) {
- return EMFCoreUtil.resolve(TransactionUtil.getEditingDomain(eObject), eObject);
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected IElementType getSemanticElementType(IAdaptable semanticAdapter) {
- if(semanticAdapter == null) {
- return null;
- }
- return (IElementType)semanticAdapter.getAdapter(IElementType.class);
- }
-
- /**
- * @generated
- */
- private void initFontStyleFromPrefs(View view, final IPreferenceStore store, String elementName) {
- String fontConstant = PreferenceConstantHelper.getElementConstant(elementName, PreferenceConstantHelper.FONT);
- String fontColorConstant = PreferenceConstantHelper.getElementConstant(elementName, PreferenceConstantHelper.COLOR_FONT);
-
- FontStyle viewFontStyle = (FontStyle)view.getStyle(NotationPackage.Literals.FONT_STYLE);
- if(viewFontStyle != null) {
- FontData fontData = PreferenceConverter.getFontData(store, fontConstant);
- viewFontStyle.setFontName(fontData.getName());
- viewFontStyle.setFontHeight(fontData.getHeight());
- viewFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0);
- viewFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0);
-
- org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter.getColor(store, fontColorConstant);
- viewFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
- }
- }
-
- /**
- * @generated
- */
- private void initForegroundFromPrefs(View view, final IPreferenceStore store, String elementName) {
- String lineColorConstant = PreferenceConstantHelper.getElementConstant(elementName, PreferenceConstantHelper.COLOR_LINE);
- org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor(store, lineColorConstant);
- ViewUtil.setStructuralFeatureValue(view, NotationPackage.eINSTANCE.getLineStyle_LineColor(), FigureUtilities.RGBToInteger(lineRGB));
- }
-
- /**
- * @generated
- */
- private void initBackgroundFromPrefs(View view, final IPreferenceStore store, String elementName) {
- String fillColorConstant = PreferenceConstantHelper.getElementConstant(elementName, PreferenceConstantHelper.COLOR_FILL);
- String gradientColorConstant = PreferenceConstantHelper.getElementConstant(elementName, PreferenceConstantHelper.COLOR_GRADIENT);
- String gradientPolicyConstant = PreferenceConstantHelper.getElementConstant(elementName, PreferenceConstantHelper.GRADIENT_POLICY);
-
- org.eclipse.swt.graphics.RGB fillRGB = PreferenceConverter.getColor(store, fillColorConstant);
- ViewUtil.setStructuralFeatureValue(view, NotationPackage.eINSTANCE.getFillStyle_FillColor(), FigureUtilities.RGBToInteger(fillRGB));
-
- FillStyle fillStyle = (FillStyle)view.getStyle(NotationPackage.Literals.FILL_STYLE);
- fillStyle.setFillColor(FigureUtilities.RGBToInteger(fillRGB).intValue());
-
- ;
- if(store.getBoolean(gradientPolicyConstant)) {
- GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(store.getString(gradientColorConstant));
- fillStyle.setGradient(gradientPreferenceConverter.getGradientData());
- fillStyle.setTransparency(gradientPreferenceConverter.getTransparency());
- }
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/sheet/SysmlPropertySection.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/sheet/SysmlPropertySection.java
deleted file mode 100644
index 5ffcc9dabaa..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/sheet/SysmlPropertySection.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.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 SysmlPropertySection 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/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/sheet/SysmlSheetLabelProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/sheet/SysmlSheetLabelProvider.java
deleted file mode 100644
index c4f8dcb6faf..00000000000
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/sheet/SysmlSheetLabelProvider.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.sheet;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.viewers.BaseLabelProvider;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.papyrus.sysml.diagram.parametric.navigator.SysmlNavigatorGroup;
-import org.eclipse.papyrus.sysml.diagram.parametric.part.SysmlVisualIDRegistry;
-import org.eclipse.papyrus.sysml.diagram.parametric.providers.SysmlElementTypes;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * @generated
- */
-public class SysmlSheetLabelProvider extends BaseLabelProvider implements ILabelProvider {
-
- /**
- * @generated
- */
- public String getText(Object element) {
- element = unwrap(element);
- if(element instanceof SysmlNavigatorGroup) {
- return ((SysmlNavigatorGroup)element).getGroupName();
- }
- IElementType etype = getElementType(getView(element));
- return etype == null ? "" : etype.getDisplayName();
- }
-
- /**
- * @generated
- */
- public Image getImage(Object element) {
- IElementType etype = getElementType(getView(unwrap(element)));
- return etype == null ? null : SysmlElementTypes.getImage(etype);
- }
-
- /**
- * @generated
- */
- private Object unwrap(Object element) {
- if(element instanceof IStructuredSelection) {
- return ((IStructuredSelection)element).getFirstElement();
- }
- return element;
- }
-
- /**
- * @generated
- */
- private View getView(Object element) {
- if(element instanceof View) {
- return (View)element;
- }
- if(element instanceof IAdaptable) {
- return (View)((IAdaptable)element).getAdapter(View.class);
- }
- return null;
- }
-
- /**
- * @generated
- */
- private IElementType getElementType(View view) {
- // For intermediate views climb up the containment hierarchy to find the one associated with an element type.
- while(view != null) {
- int vid = SysmlVisualIDRegistry.getVisualID(view);
- IElementType etype = SysmlElementTypes.getElementType(vid);
- if(etype != null) {
- return etype;
- }
- view = view.eContainer() instanceof View ? (View)view.eContainer() : null;
- }
- return null;
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/utils/BlockDropHelper.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/utils/BlockDropHelper.java
new file mode 100644
index 00000000000..f1fff6394d6
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/utils/BlockDropHelper.java
@@ -0,0 +1,239 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.parametric.utils;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+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.ICommand;
+import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter;
+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.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor;
+import org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.ISpecializationType;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.ViewDescriptorUtil;
+import org.eclipse.papyrus.infra.services.edit.commands.ConfigureFeatureCommandFactory;
+import org.eclipse.papyrus.infra.services.edit.commands.IConfigureCommandFactory;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.common.helper.ElementHelper;
+import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes;
+import org.eclipse.uml2.uml.Actor;
+import org.eclipse.uml2.uml.Association;
+import org.eclipse.uml2.uml.DataType;
+import org.eclipse.uml2.uml.Type;
+import org.eclipse.uml2.uml.TypedElement;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * This class provides convenience methods to create Block specific drop action (Part or Reference creation).
+ */
+public class BlockDropHelper extends ElementHelper {
+
+ public BlockDropHelper(TransactionalEditingDomain editDomain) {
+ this.editDomain = editDomain;
+ }
+
+ public Command getDropAsStructureItemOnPart(DropObjectsRequest request, GraphicalEditPart host, IElementType elementType) {
+ String label = "";
+ if(elementType == SysMLElementTypes.PART_PROPERTY) {
+ label = "Create a new Part";
+ }
+ if(elementType == SysMLElementTypes.REFERENCE_PROPERTY) {
+ label = "Create a new Reference";
+ }
+ if(elementType == SysMLElementTypes.ACTOR_PART_PROPERTY) {
+ label = "Create a new ActorPart";
+ }
+ if(elementType == SysMLElementTypes.VALUE_PROPERTY) {
+ label = "Create a new Value";
+ }
+ if(elementType == UMLElementTypes.PROPERTY) {
+ label = "Create a new Property";
+ }
+ CompoundCommand cc = new CompoundCommand(label);
+
+ Object droppedEObject = request.getObjects().get(0);
+ if(!isValidStructureItemType(droppedEObject, elementType)) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ // Verify target nature
+ EObject target = getHostEObject(host);
+ if((!(target instanceof TypedElement)) || (((TypedElement)target).getType() == null)) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ // The target type has to be a Block (will hold the created Port)
+ Type targetType = ((TypedElement)target).getType();
+ if(!((ISpecializationType)SysMLElementTypes.BLOCK).getMatcher().matches(targetType)) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ // Prepare a command for the element creation and the drop in diagram
+
+ // 1. Prepare creation command
+ ICommand createElementCommand = null;
+ CreateElementRequest createElementRequest = new CreateElementRequest(getEditingDomain(), targetType, elementType);
+ createElementRequest.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new ConfigureFeatureCommandFactory(UMLPackage.eINSTANCE.getTypedElement_Type(), request.getObjects().get(0)));
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(targetType);
+ if(provider != null) {
+ createElementCommand = provider.getEditCommand(createElementRequest);
+ }
+ IAdaptable createElementRequestAdapter = new CreateElementRequestAdapter(createElementRequest);
+
+ // 2. Prepare the drop command
+ ViewDescriptor descriptor = new ViewDescriptor(createElementRequestAdapter, Node.class, /* explicit semantic hint is mandatory */ null, ViewDescriptorUtil.PERSISTED, host.getDiagramPreferencesHint());
+ CreateViewRequest createViewRequest = new CreateViewRequest(descriptor);
+ createViewRequest.setLocation(request.getLocation().getCopy());
+ Command viewCreateCommand = host.getCommand(createViewRequest);
+
+ // 3. Create the compound command
+ cc.add(new ICommandProxy(createElementCommand));
+ cc.add(viewCreateCommand);
+
+ return cc;
+ }
+
+ public Command getDropAsStructureItem(DropObjectsRequest request, GraphicalEditPart host, IElementType elementType) {
+ Object droppedEObject = request.getObjects().get(0);
+ String label = "";
+
+ // Filter part/reference : a property type by a ConstraintBlock MUST be a ConstraintProperty
+ if(elementType == SysMLElementTypes.PART_PROPERTY) {
+ label = "Create a new Part";
+ if (droppedEObject instanceof Type) {
+ if (((ISpecializationType)SysMLElementTypes.CONSTRAINT_BLOCK).getMatcher().matches((Type)droppedEObject)) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ }
+ }
+ if(elementType == SysMLElementTypes.REFERENCE_PROPERTY) {
+ label = "Create a new Reference";
+ if (droppedEObject instanceof Type) {
+ if (((ISpecializationType)SysMLElementTypes.CONSTRAINT_BLOCK).getMatcher().matches((Type)droppedEObject)) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ }
+ }
+ if(elementType == SysMLElementTypes.ACTOR_PART_PROPERTY) {
+ label = "Create a new ActorPart";
+ }
+ if(elementType == SysMLElementTypes.VALUE_PROPERTY) {
+ label = "Create a new Value";
+ }
+ if(elementType == UMLElementTypes.PROPERTY) {
+ label = "Create a new Property";
+ }
+
+ if(elementType == SysMLElementTypes.CONSTRAINT_PROPERTY) {
+ label = "Create a new ConstraintProperty";
+ // Constraint Property on ConstraintBlock strictly
+ if (droppedEObject instanceof Type) {
+ if (!((ISpecializationType)SysMLElementTypes.CONSTRAINT_BLOCK).getMatcher().matches((Type)droppedEObject)) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ }
+ }
+ CompoundCommand cc = new CompoundCommand(label);
+
+ if(!isValidStructureItemType(droppedEObject, elementType)) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ // Prepare a command for the element creation and the drop in diagram
+
+ // 1. Prepare creation command
+ ICommand createElementCommand = null;
+ CreateElementRequest createElementRequest = new CreateElementRequest(getEditingDomain(), getHostEObject(host), elementType);
+ createElementRequest.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new ConfigureFeatureCommandFactory(UMLPackage.eINSTANCE.getTypedElement_Type(), request.getObjects().get(0)));
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(getHostEObject(host));
+ if(provider != null) {
+ createElementCommand = provider.getEditCommand(createElementRequest);
+ }
+ IAdaptable createElementRequestAdapter = new CreateElementRequestAdapter(createElementRequest);
+
+ // 2. Prepare the drop command
+ ViewDescriptor descriptor = new ViewDescriptor(createElementRequestAdapter, Node.class, /* explicit semantic hint is mandatory */ null, ViewDescriptorUtil.PERSISTED, host.getDiagramPreferencesHint());
+ CreateViewRequest createViewRequest = new CreateViewRequest(descriptor);
+ createViewRequest.setLocation(request.getLocation().getCopy());
+ Command viewCreateCommand = host.getCommand(createViewRequest);
+
+ // 3. Create the compound command
+ cc.add(new ICommandProxy(createElementCommand));
+ cc.add(viewCreateCommand);
+
+ return cc;
+ }
+
+ private boolean isValidStructureItemType(Object object, IElementType elementType) {
+ boolean isValid = false;
+
+ if((object != null) && (object instanceof Type) && !(object instanceof Association)) {
+
+ Type type = (Type)object;
+ if((elementType == SysMLElementTypes.PART_PROPERTY) || (elementType == SysMLElementTypes.REFERENCE_PROPERTY)) {
+ if(((ISpecializationType)SysMLElementTypes.BLOCK).getMatcher().matches(type)) {
+ isValid = true;
+ }
+ }
+ if(elementType == SysMLElementTypes.ACTOR_PART_PROPERTY) {
+ if(type instanceof Actor) {
+ isValid = true;
+ }
+ }
+ if(elementType == SysMLElementTypes.VALUE_PROPERTY) {
+ if(((ISpecializationType)SysMLElementTypes.VALUE_TYPE).getMatcher().matches(type) || (type instanceof DataType)) {
+ isValid = true;
+ }
+ }
+ if((elementType == SysMLElementTypes.CONSTRAINT_PROPERTY)) {
+ if(((ISpecializationType)SysMLElementTypes.BLOCK).getMatcher().matches(type)) {
+ isValid = true;
+ }
+ }
+ if(elementType == UMLElementTypes.PROPERTY) {
+ if(!((ISpecializationType)SysMLElementTypes.BLOCK).getMatcher().matches(type)
+ && !(type instanceof Actor)
+ && !(type instanceof DataType)
+ && !((ISpecializationType)SysMLElementTypes.VALUE_TYPE).getMatcher().matches(type)) {
+ isValid = true;
+ }
+ }
+ }
+
+ return isValid;
+ }
+
+ /**
+ * return the host Edit Part's semantic element, if the semantic element
+ * is <code>null</code> or unresolvable it will return <code>null</code>
+ *
+ * @return EObject
+ */
+ protected EObject getHostEObject(GraphicalEditPart host) {
+ return ViewUtil.resolveSemanticElement((View)host.getModel());
+ }
+}

Back to the top