diff options
author | atischenko | 2015-01-25 14:46:25 +0000 |
---|---|---|
committer | atischenko | 2015-01-25 14:46:25 +0000 |
commit | 21b329e8f6fe6db0055d4c6db71e4f9bd720fd75 (patch) | |
tree | 00231d5587ba0feab2fe2a79429c5a62f1612c23 /plugins | |
parent | dba99fb3a8703629505cd59e5f7f49722db34158 (diff) | |
download | org.eclipse.papyrus-21b329e8f6fe6db0055d4c6db71e4f9bd720fd75.tar.gz org.eclipse.papyrus-21b329e8f6fe6db0055d4c6db71e4f9bd720fd75.tar.xz org.eclipse.papyrus-21b329e8f6fe6db0055d4c6db71e4f9bd720fd75.zip |
Merge Object Actions in activityD to master.
- ReadIsClassifiedObjectAction
- ReclassifyObjectAction
Signed-off-by: atischenko <montages.t7@gmail.com>
Diffstat (limited to 'plugins')
78 files changed, 25880 insertions, 44 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/messages.properties b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/messages.properties index 67ebdbba545..bc7014eb26d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/messages.properties +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/messages.properties @@ -564,3 +564,7 @@ ClearAssociationAction3CreationTool_title=Clear Association Action ClearAssociationAction3CreationTool_desc=Create a Clear Association Action ReadExtentAction4CreationTool_title=Read Extent Action ReadExtentAction4CreationTool_desc=Create a Read Extent Action +ReclassifyObjectAction4CreationTool_title=Reclassify Object Action +ReclassifyObjectAction4CreationTool_desc=Create a ReclassifyObjectAction +ReadIsClassifiedObjectAction5CreationTool_title=Read Is Classified Object Action +ReadIsClassifiedObjectAction5CreationTool_desc=Create a Read Is Classified Object Action diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/model/activityDiagram.gmfgen b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/model/activityDiagram.gmfgen index 05faf5d93be..74dc0ebae15 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/model/activityDiagram.gmfgen +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/model/activityDiagram.gmfgen @@ -13367,7 +13367,7 @@ </labels> <labels xsi:type="gmfgen:GenExternalNodeLabel" - visualID="5401" + visualID="5402" editPartClassName="ReadExtentActionFloatingNameEditPart" itemSemanticEditPolicyClassName="ReadExtentActionFloatingNameItemSemanticEditPolicy"> <diagramRunTimeClass @@ -13474,6 +13474,837 @@ parser="/0/@labelParsers/@implementations.1"/> </labels> </childNodes> + <childNodes + visualID="3121" + childNodes="/0/@diagram/@childNodes.135 /0/@diagram/@childNodes.136 /0/@diagram/@childNodes.137" + containers="/0/@diagram/@compartments.14 /0/@diagram/@compartments.3 /0/@diagram/@compartments.5 /0/@diagram/@compartments.6 /0/@diagram/@compartments.7 /0/@diagram/@compartments.8 /0/@diagram/@compartments.9 /0/@diagram/@compartments.10"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <elementType + xsi:type="gmfgen:SpecializationType" + displayName="ReclassifyObjectAction"> + <metamodelType + href="../../org.eclipse.papyrus.uml.diagram.common/model/GenericUML.gmfgen#//@diagram/@topLevelNodes.172/@elementType"/> + </elementType> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusRoundedNodeFigure"/> + <behaviour + xsi:type="gmfgen:OpenDiagramBehaviour"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.RequestConstants.REQ_CREATE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.edit.policies.CreateActionLocalConditionEditPolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.edit.policies.ObjectFlowWithPinsCreationEditPolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.RequestConstants.REQ_DELETE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.edit.policies.DeleteActionViewEditPolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ChangeStereotypedShapeEditPolicy.CHANGE_SHAPE_POLICY" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.edit.policies.ActivityDiagramChangeStereotypedShapeEditpolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.edit.policies.CustomDiagramDragDropEditPolicy"/> + <modelFacet> + <metaClass + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/ReclassifyObjectAction"/> + <containmentMetaFeature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Activity/ownedNode"/> + <childMetaFeature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Activity/ownedNode"/> + <modelElementInitializer + xsi:type="gmfgen:GenFeatureSeqInitializer"> + <initializers + xsi:type="gmfgen:GenFeatureValueSpec" + value="/0/@expressionProviders/@providers.0/@expressions.0"> + <feature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/> + </initializers> + </modelElementInitializer> + </modelFacet> + <labels + visualID="5199" + editPartClassName="ReclassifyObjectActionNameEditPart"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:ParentAssignedViewmap" + getterName="getNameLabel" + figureQualifiedClassName="org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel"/> + <modelFacet + xsi:type="gmfgen:FeatureLabelModelFacet" + parser="/0/@labelParsers/@implementations.0"> + <metaFeatures + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/> + </modelFacet> + </labels> + <labels + xsi:type="gmfgen:GenExternalNodeLabel" + visualID="5401" + editPartClassName="ReclassifyObjectActionFloatingNameEditPart" + itemSemanticEditPolicyClassName="ReclassifyObjectActionFloatingNameItemSemanticEditPolicy"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE" + editPolicyQualifiedClassName="org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy"/> + <modelFacet + xsi:type="gmfgen:FeatureLabelModelFacet" + parser="/0/@labelParsers/@implementations.0" + viewPattern="" + editorPattern="" + editPattern=""> + <metaFeatures + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/> + </modelFacet> + </labels> + </childNodes> + <childNodes + xsi:type="gmfgen:GenChildSideAffixedNode" + visualID="3141" + editPartClassName="InputPinInReclassifyObjectActionAsObjectEditPart" + itemSemanticEditPolicyClassName="InputPinInReclassifyObjectActionAsObjectItemSemanticEditPolicy" + canonicalEditPolicyClassName="InputPinInReclassifyObjectActionAsObjectCanonicalEditPolicy" + graphicalNodeEditPolicyClassName="InputPinInReclassifyObjectActionAsObjectGraphicalNodeEditPolicy" + createCommandClassName="InputPinInReclassifyObjectActionAsObjectCreateCommand" + containers="/0/@diagram/@childNodes.134"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <elementType + xsi:type="gmfgen:SpecializationType"> + <metamodelType + href="../../org.eclipse.papyrus.uml.diagram.common/model/GenericUML.gmfgen#//@diagram/@topLevelNodes.75/@elementType"/> + </elementType> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.figures.InputPinFigure"> + <attributes + xsi:type="gmfgen:DefaultSizeAttributes" + width="16" + height="16"/> + </viewmap> + <behaviour + xsi:type="gmfgen:OpenDiagramBehaviour"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.EditPolicy.LAYOUT_ROLE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.edit.policies.PinLayoutEditPolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.RequestConstants.REQ_DELETE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.edit.policies.NoDeleteFromDiagramEditPolicy"/> + <modelFacet + modelElementSelector="/0/@expressionProviders/@providers.1/@expressions.115"> + <metaClass + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/InputPin"/> + <containmentMetaFeature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/ReclassifyObjectAction/object"/> + <childMetaFeature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/ReclassifyObjectAction/object"/> + <modelElementInitializer + xsi:type="gmfgen:GenFeatureSeqInitializer"> + <initializers + xsi:type="gmfgen:GenFeatureValueSpec" + value="/0/@expressionProviders/@providers.0/@expressions.0"> + <feature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/> + </initializers> + </modelElementInitializer> + </modelFacet> + <labels + xsi:type="gmfgen:GenExternalNodeLabel" + visualID="5237" + editPartClassName="InputPinInReclassifyObjectActionAsObjectLabelEditPart" + itemSemanticEditPolicyClassName="InputPinInReclassifyObjectActionAsObjectLabelItemSemanticEditPolicy"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.figures.SimpleLabel"/> + <modelFacet + parser="/0/@labelParsers/@implementations.6"/> + </labels> + <labels + xsi:type="gmfgen:GenExternalNodeLabel" + visualID="5238" + editPartClassName="InputPinInReclassifyObjectActionAsObjectAppliedStereotypeLabelEditPart" + itemSemanticEditPolicyClassName="InputPinInReclassifyObjectActionAsObjectAppliedStereotypeLabelItemSemanticEditPolicy"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy"/> + <modelFacet + parser="/0/@labelParsers/@implementations.1"/> + </labels> + </childNodes> + <childNodes + xsi:type="gmfgen:GenChildSideAffixedNode" + visualID="3154" + editPartClassName="ValuePinInReclassifyObjectActionAsObjectEditPart" + itemSemanticEditPolicyClassName="ValuePinInReclassifyObjectActionAsObjectItemSemanticEditPolicy" + canonicalEditPolicyClassName="ValuePinInReclassifyObjectActionAsObjectCanonicalEditPolicy" + graphicalNodeEditPolicyClassName="ValuePinInReclassifyObjectActionAsObjectGraphicalNodeEditPolicy" + createCommandClassName="ValuePinInReclassifyObjectActionAsObjectCreateCommand" + containers="/0/@diagram/@childNodes.134"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <elementType + xsi:type="gmfgen:SpecializationType"> + <metamodelType + href="../../org.eclipse.papyrus.uml.diagram.common/model/GenericUML.gmfgen#//@diagram/@topLevelNodes.191/@elementType"/> + </elementType> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.figures.PinFigure"> + <attributes + xsi:type="gmfgen:DefaultSizeAttributes" + width="16" + height="16"/> + </viewmap> + <behaviour + xsi:type="gmfgen:OpenDiagramBehaviour"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.EditPolicy.LAYOUT_ROLE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.edit.policies.PinLayoutEditPolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.RequestConstants.REQ_DELETE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.edit.policies.NoDeleteFromDiagramEditPolicy"/> + <modelFacet + modelElementSelector="/0/@expressionProviders/@providers.1/@expressions.116"> + <metaClass + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/ValuePin"/> + <containmentMetaFeature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/ReclassifyObjectAction/object"/> + <childMetaFeature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/ReclassifyObjectAction/object"/> + <modelElementInitializer + xsi:type="gmfgen:GenFeatureSeqInitializer"> + <initializers + xsi:type="gmfgen:GenFeatureValueSpec" + value="/0/@expressionProviders/@providers.0/@expressions.0"> + <feature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/> + </initializers> + </modelElementInitializer> + </modelFacet> + <labels + xsi:type="gmfgen:GenExternalNodeLabel" + visualID="5302" + editPartClassName="ValuePinInReclassifyObjectActionAsObjectLabelEditPart" + itemSemanticEditPolicyClassName="ValuePinInReclassifyObjectActionAsObjectLabelItemSemanticEditPolicy"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.figures.SimpleLabel"/> + <modelFacet + parser="/0/@labelParsers/@implementations.6"/> + </labels> + <labels + xsi:type="gmfgen:GenExternalNodeLabel" + visualID="5303" + editPartClassName="ValuePinInReclassifyObjectActionAsObjectValueEditPart" + itemSemanticEditPolicyClassName="ValuePinInReclassifyObjectActionAsObjectValueItemSemanticEditPolicy"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.figures.SimpleLabel"/> + <modelFacet + parser="/0/@labelParsers/@implementations.7"/> + </labels> + <labels + xsi:type="gmfgen:GenExternalNodeLabel" + visualID="5304" + editPartClassName="ValuePinInReclassifyObjectActionAsObjectAppliedStereotypeLabelEditPart" + itemSemanticEditPolicyClassName="ValuePinInReclassifyObjectActionAsObjectAppliedStereotypeLabelItemSemanticEditPolicy"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy"/> + <modelFacet + parser="/0/@labelParsers/@implementations.1"/> + </labels> + </childNodes> + <childNodes + xsi:type="gmfgen:GenChildSideAffixedNode" + visualID="3167" + editPartClassName="ActionPinInReclassifyObjectActionAsObjectEditPart" + itemSemanticEditPolicyClassName="ActionPinInReclassifyObjectActionAsObjectItemSemanticEditPolicy" + canonicalEditPolicyClassName="ActionPinInReclassifyObjectActionAsObjectCanonicalEditPolicy" + graphicalNodeEditPolicyClassName="ActionPinInReclassifyObjectActionAsObjectGraphicalNodeEditPolicy" + createCommandClassName="ActionPinInReclassifyObjectActionAsObjectCreateCommand" + containers="/0/@diagram/@childNodes.134"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <elementType + xsi:type="gmfgen:SpecializationType"> + <metamodelType + href="../../org.eclipse.papyrus.uml.diagram.common/model/GenericUML.gmfgen#//@diagram/@topLevelNodes.91/@elementType"/> + </elementType> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.figures.PinFigure"> + <attributes + xsi:type="gmfgen:DefaultSizeAttributes" + width="16" + height="16"/> + </viewmap> + <behaviour + xsi:type="gmfgen:OpenDiagramBehaviour"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.EditPolicy.LAYOUT_ROLE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.edit.policies.PinLayoutEditPolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.RequestConstants.REQ_DELETE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.edit.policies.NoDeleteFromDiagramEditPolicy"/> + <modelFacet + modelElementSelector="/0/@expressionProviders/@providers.1/@expressions.114"> + <metaClass + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/ActionInputPin"/> + <containmentMetaFeature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/ReclassifyObjectAction/object"/> + <childMetaFeature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/ReclassifyObjectAction/object"/> + <modelElementInitializer + xsi:type="gmfgen:GenFeatureSeqInitializer"> + <initializers + xsi:type="gmfgen:GenFeatureValueSpec" + value="/0/@expressionProviders/@providers.0/@expressions.0"> + <feature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/> + </initializers> + </modelElementInitializer> + </modelFacet> + <labels + xsi:type="gmfgen:GenExternalNodeLabel" + visualID="5305" + editPartClassName="ActionPinInReclassifyObjectActionAsObjectLabelEditPart" + itemSemanticEditPolicyClassName="ActionPinInReclassifyObjectActionAsObjectLabelItemSemanticEditPolicy"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.figures.SimpleLabel"/> + <modelFacet + parser="/0/@labelParsers/@implementations.6"/> + </labels> + <labels + xsi:type="gmfgen:GenExternalNodeLabel" + visualID="5306" + editPartClassName="ActionPinInReclassifyObjectActionAsObjectValueEditPart" + itemSemanticEditPolicyClassName="ActionPinInReclassifyObjectActionAsObjectValueItemSemanticEditPolicy"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.figures.SimpleLabel"/> + <modelFacet + parser="/0/@labelParsers/@implementations.7"/> + </labels> + <labels + xsi:type="gmfgen:GenExternalNodeLabel" + visualID="5307" + editPartClassName="ActionPinInReclassifyObjectActionAsObjectAppliedStereotypeLabelEditPart" + itemSemanticEditPolicyClassName="ActionPinInReclassifyObjectActionAsObjectAppliedStereotypeLabelItemSemanticEditPolicy"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy"/> + <modelFacet + parser="/0/@labelParsers/@implementations.1"/> + </labels> + </childNodes> + <childNodes + visualID="3122" + childNodes="/0/@diagram/@childNodes.139 /0/@diagram/@childNodes.140 /0/@diagram/@childNodes.141 /0/@diagram/@childNodes.142" + containers="/0/@diagram/@compartments.14 /0/@diagram/@compartments.3 /0/@diagram/@compartments.5 /0/@diagram/@compartments.6 /0/@diagram/@compartments.7 /0/@diagram/@compartments.8 /0/@diagram/@compartments.9 /0/@diagram/@compartments.10"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <elementType + xsi:type="gmfgen:SpecializationType" + displayName="ReadIsClassifiedObjectAction"> + <metamodelType + href="../../org.eclipse.papyrus.uml.diagram.common/model/GenericUML.gmfgen#//@diagram/@topLevelNodes.165/@elementType"/> + </elementType> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusRoundedNodeFigure"/> + <behaviour + xsi:type="gmfgen:OpenDiagramBehaviour"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.RequestConstants.REQ_CREATE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.edit.policies.CreateActionLocalConditionEditPolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.edit.policies.ObjectFlowWithPinsCreationEditPolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.RequestConstants.REQ_DELETE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.edit.policies.DeleteActionViewEditPolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ChangeStereotypedShapeEditPolicy.CHANGE_SHAPE_POLICY" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.edit.policies.ActivityDiagramChangeStereotypedShapeEditpolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.edit.policies.CustomDiagramDragDropEditPolicy"/> + <modelFacet> + <metaClass + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/ReadIsClassifiedObjectAction"/> + <containmentMetaFeature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Activity/ownedNode"/> + <childMetaFeature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Activity/ownedNode"/> + <modelElementInitializer + xsi:type="gmfgen:GenFeatureSeqInitializer"> + <initializers + xsi:type="gmfgen:GenFeatureValueSpec" + value="/0/@expressionProviders/@providers.0/@expressions.0"> + <feature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/> + </initializers> + </modelElementInitializer> + </modelFacet> + <labels + visualID="5200"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:ParentAssignedViewmap" + getterName="getNameLabel" + figureQualifiedClassName="org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel"/> + <modelFacet + xsi:type="gmfgen:FeatureLabelModelFacet" + parser="/0/@labelParsers/@implementations.0"> + <metaFeatures + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/> + </modelFacet> + </labels> + <labels + xsi:type="gmfgen:GenExternalNodeLabel" + visualID="5403" + editPartClassName="ReadIsClassifiedObjectActionFloatingNameEditPart" + itemSemanticEditPolicyClassName="ReadIsClassifiedObjectActionFloatingNameItemSemanticEditPolicy"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE" + editPolicyQualifiedClassName="org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy"/> + <modelFacet + xsi:type="gmfgen:FeatureLabelModelFacet" + parser="/0/@labelParsers/@implementations.0" + viewPattern="" + editorPattern="" + editPattern=""> + <metaFeatures + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/> + </modelFacet> + </labels> + </childNodes> + <childNodes + xsi:type="gmfgen:GenChildSideAffixedNode" + visualID="3130" + editPartClassName="OutputPinInReadIsClassifiedObjectActionEditPart" + itemSemanticEditPolicyClassName="OutputPinInReadIsClassifiedObjectActionItemSemanticEditPolicy" + canonicalEditPolicyClassName="OutputPinInReadIsClassifiedObjectActionCanonicalEditPolicy" + graphicalNodeEditPolicyClassName="OutputPinInReadIsClassifiedObjectActionGraphicalNodeEditPolicy" + createCommandClassName="OutputPinInReadIsClassifiedObjectActionCreateCommand" + containers="/0/@diagram/@childNodes.138" + preferredSideName="EAST"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <elementType + xsi:type="gmfgen:SpecializationType" + displayName="OutputPin"> + <metamodelType + href="../../org.eclipse.papyrus.uml.diagram.common/model/GenericUML.gmfgen#//@diagram/@topLevelNodes.76/@elementType"/> + </elementType> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.figures.OutputPinFigure"> + <attributes + xsi:type="gmfgen:DefaultSizeAttributes" + width="16" + height="16"/> + </viewmap> + <behaviour + xsi:type="gmfgen:OpenDiagramBehaviour"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.EditPolicy.LAYOUT_ROLE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.edit.policies.PinLayoutEditPolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.RequestConstants.REQ_DELETE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.edit.policies.NoDeleteFromDiagramEditPolicy"/> + <modelFacet> + <metaClass + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/OutputPin"/> + <containmentMetaFeature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/ReadIsClassifiedObjectAction/result"/> + <childMetaFeature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/ReadIsClassifiedObjectAction/result"/> + <modelElementInitializer + xsi:type="gmfgen:GenFeatureSeqInitializer"> + <initializers + xsi:type="gmfgen:GenFeatureValueSpec" + value="/0/@expressionProviders/@providers.0/@expressions.0"> + <feature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/> + </initializers> + </modelElementInitializer> + </modelFacet> + <labels + xsi:type="gmfgen:GenExternalNodeLabel" + visualID="5213" + editPartClassName="OutputPinInReadIsClassifiedObjectActionLabelEditPart" + itemSemanticEditPolicyClassName="OutputPinInReadIsClassifiedObjectActionLabelItemSemanticEditPolicy"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.figures.SimpleLabel"/> + <modelFacet + parser="/0/@labelParsers/@implementations.6"/> + </labels> + <labels + xsi:type="gmfgen:GenExternalNodeLabel" + visualID="5214" + editPartClassName="OutputPinInReadIsClassifiedObjectActionAppliedStereotypeLabelEditPart" + itemSemanticEditPolicyClassName="OutputPinInReadIsClassifiedObjectActionAppliedStereotypeLabelItemSemanticEditPolicy"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy"/> + <modelFacet + parser="/0/@labelParsers/@implementations.1"/> + </labels> + </childNodes> + <childNodes + xsi:type="gmfgen:GenChildSideAffixedNode" + visualID="3142" + editPartClassName="InputPinInReadIsClassifiedObjectActionAsObjectEditPart" + itemSemanticEditPolicyClassName="InputPinInReadIsClassifiedObjectActionAsObjectItemSemanticEditPolicy" + canonicalEditPolicyClassName="InputPinInReadIsClassifiedObjectActionAsObjectCanonicalEditPolicy" + graphicalNodeEditPolicyClassName="InputPinInReadIsClassifiedObjectActionAsObjectGraphicalNodeEditPolicy" + createCommandClassName="InputPinInReadIsClassifiedObjectActionAsObjectCreateCommand" + containers="/0/@diagram/@childNodes.138"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <elementType + xsi:type="gmfgen:SpecializationType"> + <metamodelType + href="../../org.eclipse.papyrus.uml.diagram.common/model/GenericUML.gmfgen#//@diagram/@topLevelNodes.75/@elementType"/> + </elementType> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.figures.InputPinFigure"> + <attributes + xsi:type="gmfgen:DefaultSizeAttributes" + width="16" + height="16"/> + </viewmap> + <behaviour + xsi:type="gmfgen:OpenDiagramBehaviour"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.EditPolicy.LAYOUT_ROLE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.edit.policies.PinLayoutEditPolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.RequestConstants.REQ_DELETE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.edit.policies.NoDeleteFromDiagramEditPolicy"/> + <modelFacet + modelElementSelector="/0/@expressionProviders/@providers.1/@expressions.119"> + <metaClass + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/InputPin"/> + <containmentMetaFeature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/ReadIsClassifiedObjectAction/object"/> + <childMetaFeature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/ReadIsClassifiedObjectAction/object"/> + <modelElementInitializer + xsi:type="gmfgen:GenFeatureSeqInitializer"> + <initializers + xsi:type="gmfgen:GenFeatureValueSpec" + value="/0/@expressionProviders/@providers.0/@expressions.0"> + <feature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/> + </initializers> + </modelElementInitializer> + </modelFacet> + <labels + xsi:type="gmfgen:GenExternalNodeLabel" + visualID="5239" + editPartClassName="InputPinInReadIsClassifiedObjectActionAsObjectLabelEditPart" + itemSemanticEditPolicyClassName="InputPinInReadIsClassifiedObjectActionAsObjectLabelItemSemanticEditPolicy"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.figures.SimpleLabel"/> + <modelFacet + parser="/0/@labelParsers/@implementations.6"/> + </labels> + <labels + xsi:type="gmfgen:GenExternalNodeLabel" + visualID="5240" + editPartClassName="InputPinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart" + itemSemanticEditPolicyClassName="InputPinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelItemSemanticEditPolicy"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy"/> + <modelFacet + parser="/0/@labelParsers/@implementations.1"/> + </labels> + </childNodes> + <childNodes + xsi:type="gmfgen:GenChildSideAffixedNode" + visualID="3155" + editPartClassName="ValuePinInReadIsClassifiedObjectActionAsObjectEditPart" + itemSemanticEditPolicyClassName="ValuePinInReadIsClassifiedObjectActionAsObjectItemSemanticEditPolicy" + canonicalEditPolicyClassName="ValuePinInReadIsClassifiedObjectActionAsObjectCanonicalEditPolicy" + graphicalNodeEditPolicyClassName="ValuePinInReadIsClassifiedObjectActionAsObjectGraphicalNodeEditPolicy" + createCommandClassName="ValuePinInReadIsClassifiedObjectActionAsObjectCreateCommand" + containers="/0/@diagram/@childNodes.138"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <elementType + xsi:type="gmfgen:SpecializationType"> + <metamodelType + href="../../org.eclipse.papyrus.uml.diagram.common/model/GenericUML.gmfgen#//@diagram/@topLevelNodes.191/@elementType"/> + </elementType> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.figures.PinFigure"> + <attributes + xsi:type="gmfgen:DefaultSizeAttributes" + width="16" + height="16"/> + </viewmap> + <behaviour + xsi:type="gmfgen:OpenDiagramBehaviour"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.EditPolicy.LAYOUT_ROLE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.edit.policies.PinLayoutEditPolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.RequestConstants.REQ_DELETE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.edit.policies.NoDeleteFromDiagramEditPolicy"/> + <modelFacet + modelElementSelector="/0/@expressionProviders/@providers.1/@expressions.117"> + <metaClass + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/ValuePin"/> + <containmentMetaFeature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/ReadIsClassifiedObjectAction/object"/> + <childMetaFeature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/ReadIsClassifiedObjectAction/object"/> + <modelElementInitializer + xsi:type="gmfgen:GenFeatureSeqInitializer"> + <initializers + xsi:type="gmfgen:GenFeatureValueSpec" + value="/0/@expressionProviders/@providers.0/@expressions.0"> + <feature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/> + </initializers> + </modelElementInitializer> + </modelFacet> + <labels + xsi:type="gmfgen:GenExternalNodeLabel" + visualID="5308" + editPartClassName="ValuePinInReadIsClassifiedObjectActionAsObjectLabelEditPart" + itemSemanticEditPolicyClassName="ValuePinInReadIsClassifiedObjectActionAsObjectLabelItemSemanticEditPolicy"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.figures.SimpleLabel"/> + <modelFacet + parser="/0/@labelParsers/@implementations.6"/> + </labels> + <labels + xsi:type="gmfgen:GenExternalNodeLabel" + visualID="5309" + editPartClassName="ValuePinInReadIsClassifiedObjectActionAsObjectValueEditPart" + itemSemanticEditPolicyClassName="ValuePinInReadIsClassifiedObjectActionAsObjectValueItemSemanticEditPolicy"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.figures.SimpleLabel"/> + <modelFacet + parser="/0/@labelParsers/@implementations.7"/> + </labels> + <labels + xsi:type="gmfgen:GenExternalNodeLabel" + visualID="5310" + editPartClassName="ValuePinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart" + itemSemanticEditPolicyClassName="ValuePinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelItemSemanticEditPolicy"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy"/> + <modelFacet + parser="/0/@labelParsers/@implementations.1"/> + </labels> + </childNodes> + <childNodes + xsi:type="gmfgen:GenChildSideAffixedNode" + visualID="3168" + editPartClassName="ActionPinInReadIsClassifiedObjectActionAsObjectEditPart" + itemSemanticEditPolicyClassName="ActionPinInReadIsClassifiedObjectActionAsObjectItemSemanticEditPolicy" + canonicalEditPolicyClassName="ActionPinInReadIsClassifiedObjectActionAsObjectCanonicalEditPolicy" + graphicalNodeEditPolicyClassName="ActionPinInReadIsClassifiedObjectActionAsObjectGraphicalNodeEditPolicy" + createCommandClassName="ActionPinInReadIsClassifiedObjectActionAsObjectCreateCommand" + containers="/0/@diagram/@childNodes.138"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <elementType + xsi:type="gmfgen:SpecializationType"> + <metamodelType + href="../../org.eclipse.papyrus.uml.diagram.common/model/GenericUML.gmfgen#//@diagram/@topLevelNodes.91/@elementType"/> + </elementType> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.figures.PinFigure"> + <attributes + xsi:type="gmfgen:DefaultSizeAttributes" + width="16" + height="16"/> + </viewmap> + <behaviour + xsi:type="gmfgen:OpenDiagramBehaviour"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.EditPolicy.LAYOUT_ROLE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.edit.policies.PinLayoutEditPolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.RequestConstants.REQ_DELETE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.edit.policies.NoDeleteFromDiagramEditPolicy"/> + <modelFacet + modelElementSelector="/0/@expressionProviders/@providers.1/@expressions.118"> + <metaClass + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/ActionInputPin"/> + <containmentMetaFeature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/ReadIsClassifiedObjectAction/object"/> + <childMetaFeature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/ReadIsClassifiedObjectAction/object"/> + <modelElementInitializer + xsi:type="gmfgen:GenFeatureSeqInitializer"> + <initializers + xsi:type="gmfgen:GenFeatureValueSpec" + value="/0/@expressionProviders/@providers.0/@expressions.0"> + <feature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/> + </initializers> + </modelElementInitializer> + </modelFacet> + <labels + xsi:type="gmfgen:GenExternalNodeLabel" + visualID="5311" + editPartClassName="ActionPinInReadIsClassifiedObjectActionAsObjectLabelEditPart" + itemSemanticEditPolicyClassName="ActionPinInReadIsClassifiedObjectActionAsObjectLabelItemSemanticEditPolicy"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.figures.SimpleLabel"/> + <modelFacet + parser="/0/@labelParsers/@implementations.6"/> + </labels> + <labels + xsi:type="gmfgen:GenExternalNodeLabel" + visualID="5312" + editPartClassName="ActionPinInReadIsClassifiedObjectActionAsObjectValueEditPart" + itemSemanticEditPolicyClassName="ActionPinInReadIsClassifiedObjectActionAsObjectValueItemSemanticEditPolicy"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.figures.SimpleLabel"/> + <modelFacet + parser="/0/@labelParsers/@implementations.7"/> + </labels> + <labels + xsi:type="gmfgen:GenExternalNodeLabel" + visualID="5313" + editPartClassName="ActionPinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart" + itemSemanticEditPolicyClassName="ActionPinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelItemSemanticEditPolicy"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy"/> + <modelFacet + parser="/0/@labelParsers/@implementations.1"/> + </labels> + </childNodes> <topLevelNodes visualID="2001" editPartClassName="ActivityEditPart" @@ -14171,7 +15002,7 @@ itemSemanticEditPolicyClassName="ActivityActivityContentCompartmentItemSemanticEditPolicy" notationViewFactoryClassName="ActivityActivityContentCompartmentViewFactory" canonicalEditPolicyClassName="ActivityActivityContentCompartmentCanonicalEditPolicy" - childNodes="/0/@diagram/@childNodes.3 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.16 /0/@diagram/@childNodes.24 /0/@diagram/@childNodes.25 /0/@diagram/@childNodes.26 /0/@diagram/@childNodes.27 /0/@diagram/@childNodes.28 /0/@diagram/@childNodes.29 /0/@diagram/@childNodes.30 /0/@diagram/@childNodes.31 /0/@diagram/@childNodes.32 /0/@diagram/@childNodes.33 /0/@diagram/@childNodes.34 /0/@diagram/@childNodes.35 /0/@diagram/@childNodes.36 /0/@diagram/@childNodes.37 /0/@diagram/@childNodes.44 /0/@diagram/@childNodes.52 /0/@diagram/@childNodes.54 /0/@diagram/@childNodes.56 /0/@diagram/@childNodes.57 /0/@diagram/@childNodes.60 /0/@diagram/@childNodes.64 /0/@diagram/@childNodes.65 /0/@diagram/@childNodes.67 /0/@diagram/@childNodes.68 /0/@diagram/@childNodes.69 /0/@diagram/@childNodes.70 /0/@diagram/@childNodes.72 /0/@diagram/@childNodes.73 /0/@diagram/@childNodes.76 /0/@diagram/@childNodes.79 /0/@diagram/@childNodes.83 /0/@diagram/@childNodes.85 /0/@diagram/@childNodes.87 /0/@diagram/@childNodes.90 /0/@diagram/@childNodes.92 /0/@diagram/@childNodes.93 /0/@diagram/@childNodes.94 /0/@diagram/@childNodes.102 /0/@diagram/@childNodes.110 /0/@diagram/@childNodes.115 /0/@diagram/@childNodes.119 /0/@diagram/@childNodes.124 /0/@diagram/@childNodes.128 /0/@diagram/@childNodes.132" + childNodes="/0/@diagram/@childNodes.3 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.16 /0/@diagram/@childNodes.24 /0/@diagram/@childNodes.25 /0/@diagram/@childNodes.26 /0/@diagram/@childNodes.27 /0/@diagram/@childNodes.28 /0/@diagram/@childNodes.29 /0/@diagram/@childNodes.30 /0/@diagram/@childNodes.31 /0/@diagram/@childNodes.32 /0/@diagram/@childNodes.33 /0/@diagram/@childNodes.34 /0/@diagram/@childNodes.35 /0/@diagram/@childNodes.36 /0/@diagram/@childNodes.37 /0/@diagram/@childNodes.44 /0/@diagram/@childNodes.52 /0/@diagram/@childNodes.54 /0/@diagram/@childNodes.56 /0/@diagram/@childNodes.57 /0/@diagram/@childNodes.60 /0/@diagram/@childNodes.64 /0/@diagram/@childNodes.65 /0/@diagram/@childNodes.67 /0/@diagram/@childNodes.68 /0/@diagram/@childNodes.69 /0/@diagram/@childNodes.70 /0/@diagram/@childNodes.72 /0/@diagram/@childNodes.73 /0/@diagram/@childNodes.76 /0/@diagram/@childNodes.79 /0/@diagram/@childNodes.83 /0/@diagram/@childNodes.85 /0/@diagram/@childNodes.87 /0/@diagram/@childNodes.90 /0/@diagram/@childNodes.92 /0/@diagram/@childNodes.93 /0/@diagram/@childNodes.94 /0/@diagram/@childNodes.102 /0/@diagram/@childNodes.110 /0/@diagram/@childNodes.115 /0/@diagram/@childNodes.119 /0/@diagram/@childNodes.124 /0/@diagram/@childNodes.128 /0/@diagram/@childNodes.132 /0/@diagram/@childNodes.134 /0/@diagram/@childNodes.138" title="ActivityFigureContentCompartment" canCollapse="false" needsTitle="false" @@ -14245,7 +15076,7 @@ itemSemanticEditPolicyClassName="ExpansionRegionStructuredActivityNodeContentCompartmentItemSemanticEditPolicy" notationViewFactoryClassName="ExpansionRegionStructuredActivityNodeContentCompartmentViewFactory" canonicalEditPolicyClassName="ExpansionRegionStructuredActivityNodeContentCompartmentCanonicalEditPolicy" - childNodes="/0/@diagram/@childNodes.3 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.16 /0/@diagram/@childNodes.32 /0/@diagram/@childNodes.33 /0/@diagram/@childNodes.34 /0/@diagram/@childNodes.35 /0/@diagram/@childNodes.36 /0/@diagram/@childNodes.37 /0/@diagram/@childNodes.44 /0/@diagram/@childNodes.52 /0/@diagram/@childNodes.54 /0/@diagram/@childNodes.56 /0/@diagram/@childNodes.57 /0/@diagram/@childNodes.60 /0/@diagram/@childNodes.64 /0/@diagram/@childNodes.65 /0/@diagram/@childNodes.70 /0/@diagram/@childNodes.24 /0/@diagram/@childNodes.25 /0/@diagram/@childNodes.26 /0/@diagram/@childNodes.27 /0/@diagram/@childNodes.28 /0/@diagram/@childNodes.29 /0/@diagram/@childNodes.30 /0/@diagram/@childNodes.31 /0/@diagram/@childNodes.73 /0/@diagram/@childNodes.76 /0/@diagram/@childNodes.79 /0/@diagram/@childNodes.83 /0/@diagram/@childNodes.85 /0/@diagram/@childNodes.87 /0/@diagram/@childNodes.90 /0/@diagram/@childNodes.92 /0/@diagram/@childNodes.69 /0/@diagram/@childNodes.93 /0/@diagram/@childNodes.94 /0/@diagram/@childNodes.102 /0/@diagram/@childNodes.110 /0/@diagram/@childNodes.115 /0/@diagram/@childNodes.119 /0/@diagram/@childNodes.124 /0/@diagram/@childNodes.128 /0/@diagram/@childNodes.132" + childNodes="/0/@diagram/@childNodes.3 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.16 /0/@diagram/@childNodes.32 /0/@diagram/@childNodes.33 /0/@diagram/@childNodes.34 /0/@diagram/@childNodes.35 /0/@diagram/@childNodes.36 /0/@diagram/@childNodes.37 /0/@diagram/@childNodes.44 /0/@diagram/@childNodes.52 /0/@diagram/@childNodes.54 /0/@diagram/@childNodes.56 /0/@diagram/@childNodes.57 /0/@diagram/@childNodes.60 /0/@diagram/@childNodes.64 /0/@diagram/@childNodes.65 /0/@diagram/@childNodes.70 /0/@diagram/@childNodes.24 /0/@diagram/@childNodes.25 /0/@diagram/@childNodes.26 /0/@diagram/@childNodes.27 /0/@diagram/@childNodes.28 /0/@diagram/@childNodes.29 /0/@diagram/@childNodes.30 /0/@diagram/@childNodes.31 /0/@diagram/@childNodes.73 /0/@diagram/@childNodes.76 /0/@diagram/@childNodes.79 /0/@diagram/@childNodes.83 /0/@diagram/@childNodes.85 /0/@diagram/@childNodes.87 /0/@diagram/@childNodes.90 /0/@diagram/@childNodes.92 /0/@diagram/@childNodes.69 /0/@diagram/@childNodes.93 /0/@diagram/@childNodes.94 /0/@diagram/@childNodes.102 /0/@diagram/@childNodes.110 /0/@diagram/@childNodes.115 /0/@diagram/@childNodes.119 /0/@diagram/@childNodes.124 /0/@diagram/@childNodes.128 /0/@diagram/@childNodes.132 /0/@diagram/@childNodes.134 /0/@diagram/@childNodes.138" title="StructuredActivityNodeContentCompartment" canCollapse="false" needsTitle="false" @@ -14280,7 +15111,7 @@ itemSemanticEditPolicyClassName="LoopNodeStructuredActivityNodeContentCompartmentItemSemanticEditPolicy" notationViewFactoryClassName="LoopNodeStructuredActivityNodeContentCompartmentViewFactory" canonicalEditPolicyClassName="LoopNodeStructuredActivityNodeContentCompartmentCanonicalEditPolicy" - childNodes="/0/@diagram/@childNodes.3 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.16 /0/@diagram/@childNodes.32 /0/@diagram/@childNodes.33 /0/@diagram/@childNodes.34 /0/@diagram/@childNodes.35 /0/@diagram/@childNodes.36 /0/@diagram/@childNodes.37 /0/@diagram/@childNodes.44 /0/@diagram/@childNodes.52 /0/@diagram/@childNodes.54 /0/@diagram/@childNodes.56 /0/@diagram/@childNodes.57 /0/@diagram/@childNodes.60 /0/@diagram/@childNodes.64 /0/@diagram/@childNodes.65 /0/@diagram/@childNodes.70 /0/@diagram/@childNodes.24 /0/@diagram/@childNodes.25 /0/@diagram/@childNodes.26 /0/@diagram/@childNodes.27 /0/@diagram/@childNodes.28 /0/@diagram/@childNodes.29 /0/@diagram/@childNodes.30 /0/@diagram/@childNodes.31 /0/@diagram/@childNodes.73 /0/@diagram/@childNodes.76 /0/@diagram/@childNodes.79 /0/@diagram/@childNodes.83 /0/@diagram/@childNodes.85 /0/@diagram/@childNodes.87 /0/@diagram/@childNodes.90 /0/@diagram/@childNodes.92 /0/@diagram/@childNodes.69 /0/@diagram/@childNodes.93 /0/@diagram/@childNodes.94 /0/@diagram/@childNodes.102 /0/@diagram/@childNodes.110 /0/@diagram/@childNodes.115 /0/@diagram/@childNodes.119 /0/@diagram/@childNodes.124 /0/@diagram/@childNodes.128 /0/@diagram/@childNodes.132" + childNodes="/0/@diagram/@childNodes.3 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.16 /0/@diagram/@childNodes.32 /0/@diagram/@childNodes.33 /0/@diagram/@childNodes.34 /0/@diagram/@childNodes.35 /0/@diagram/@childNodes.36 /0/@diagram/@childNodes.37 /0/@diagram/@childNodes.44 /0/@diagram/@childNodes.52 /0/@diagram/@childNodes.54 /0/@diagram/@childNodes.56 /0/@diagram/@childNodes.57 /0/@diagram/@childNodes.60 /0/@diagram/@childNodes.64 /0/@diagram/@childNodes.65 /0/@diagram/@childNodes.70 /0/@diagram/@childNodes.24 /0/@diagram/@childNodes.25 /0/@diagram/@childNodes.26 /0/@diagram/@childNodes.27 /0/@diagram/@childNodes.28 /0/@diagram/@childNodes.29 /0/@diagram/@childNodes.30 /0/@diagram/@childNodes.31 /0/@diagram/@childNodes.73 /0/@diagram/@childNodes.76 /0/@diagram/@childNodes.79 /0/@diagram/@childNodes.83 /0/@diagram/@childNodes.85 /0/@diagram/@childNodes.87 /0/@diagram/@childNodes.90 /0/@diagram/@childNodes.92 /0/@diagram/@childNodes.69 /0/@diagram/@childNodes.93 /0/@diagram/@childNodes.94 /0/@diagram/@childNodes.102 /0/@diagram/@childNodes.110 /0/@diagram/@childNodes.115 /0/@diagram/@childNodes.119 /0/@diagram/@childNodes.124 /0/@diagram/@childNodes.128 /0/@diagram/@childNodes.132 /0/@diagram/@childNodes.134 /0/@diagram/@childNodes.138" title="StructuredActivityNodeContentCompartment" canCollapse="false" needsTitle="false" @@ -14315,7 +15146,7 @@ itemSemanticEditPolicyClassName="SequenceNodeStructuredActivityNodeContentCompartmentItemSemanticEditPolicy" notationViewFactoryClassName="SequenceNodeStructuredActivityNodeContentCompartmentViewFactory" canonicalEditPolicyClassName="SequenceNodeStructuredActivityNodeContentCompartmentCanonicalEditPolicy" - childNodes="/0/@diagram/@childNodes.3 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.16 /0/@diagram/@childNodes.32 /0/@diagram/@childNodes.33 /0/@diagram/@childNodes.34 /0/@diagram/@childNodes.35 /0/@diagram/@childNodes.36 /0/@diagram/@childNodes.37 /0/@diagram/@childNodes.44 /0/@diagram/@childNodes.52 /0/@diagram/@childNodes.54 /0/@diagram/@childNodes.56 /0/@diagram/@childNodes.57 /0/@diagram/@childNodes.60 /0/@diagram/@childNodes.64 /0/@diagram/@childNodes.65 /0/@diagram/@childNodes.70 /0/@diagram/@childNodes.24 /0/@diagram/@childNodes.25 /0/@diagram/@childNodes.26 /0/@diagram/@childNodes.27 /0/@diagram/@childNodes.28 /0/@diagram/@childNodes.29 /0/@diagram/@childNodes.30 /0/@diagram/@childNodes.31 /0/@diagram/@childNodes.73 /0/@diagram/@childNodes.76 /0/@diagram/@childNodes.79 /0/@diagram/@childNodes.83 /0/@diagram/@childNodes.85 /0/@diagram/@childNodes.87 /0/@diagram/@childNodes.90 /0/@diagram/@childNodes.92 /0/@diagram/@childNodes.69 /0/@diagram/@childNodes.93 /0/@diagram/@childNodes.94 /0/@diagram/@childNodes.102 /0/@diagram/@childNodes.110 /0/@diagram/@childNodes.115 /0/@diagram/@childNodes.119 /0/@diagram/@childNodes.124 /0/@diagram/@childNodes.128 /0/@diagram/@childNodes.132" + childNodes="/0/@diagram/@childNodes.3 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.16 /0/@diagram/@childNodes.32 /0/@diagram/@childNodes.33 /0/@diagram/@childNodes.34 /0/@diagram/@childNodes.35 /0/@diagram/@childNodes.36 /0/@diagram/@childNodes.37 /0/@diagram/@childNodes.44 /0/@diagram/@childNodes.52 /0/@diagram/@childNodes.54 /0/@diagram/@childNodes.56 /0/@diagram/@childNodes.57 /0/@diagram/@childNodes.60 /0/@diagram/@childNodes.64 /0/@diagram/@childNodes.65 /0/@diagram/@childNodes.70 /0/@diagram/@childNodes.24 /0/@diagram/@childNodes.25 /0/@diagram/@childNodes.26 /0/@diagram/@childNodes.27 /0/@diagram/@childNodes.28 /0/@diagram/@childNodes.29 /0/@diagram/@childNodes.30 /0/@diagram/@childNodes.31 /0/@diagram/@childNodes.73 /0/@diagram/@childNodes.76 /0/@diagram/@childNodes.79 /0/@diagram/@childNodes.83 /0/@diagram/@childNodes.85 /0/@diagram/@childNodes.87 /0/@diagram/@childNodes.90 /0/@diagram/@childNodes.92 /0/@diagram/@childNodes.69 /0/@diagram/@childNodes.93 /0/@diagram/@childNodes.94 /0/@diagram/@childNodes.102 /0/@diagram/@childNodes.110 /0/@diagram/@childNodes.115 /0/@diagram/@childNodes.119 /0/@diagram/@childNodes.124 /0/@diagram/@childNodes.128 /0/@diagram/@childNodes.132 /0/@diagram/@childNodes.134 /0/@diagram/@childNodes.138" title="StructuredActivityNodeContentCompartment" canCollapse="false" needsTitle="false" @@ -14350,7 +15181,7 @@ itemSemanticEditPolicyClassName="StructuredActivityNodeStructuredActivityNodeContentCompartmentItemSemanticEditPolicy" notationViewFactoryClassName="StructuredActivityNodeStructuredActivityNodeContentCompartmentViewFactory" canonicalEditPolicyClassName="StructuredActivityNodeStructuredActivityNodeContentCompartmentCanonicalEditPolicy" - childNodes="/0/@diagram/@childNodes.3 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.16 /0/@diagram/@childNodes.32 /0/@diagram/@childNodes.33 /0/@diagram/@childNodes.34 /0/@diagram/@childNodes.35 /0/@diagram/@childNodes.36 /0/@diagram/@childNodes.37 /0/@diagram/@childNodes.44 /0/@diagram/@childNodes.52 /0/@diagram/@childNodes.54 /0/@diagram/@childNodes.56 /0/@diagram/@childNodes.57 /0/@diagram/@childNodes.60 /0/@diagram/@childNodes.64 /0/@diagram/@childNodes.65 /0/@diagram/@childNodes.70 /0/@diagram/@childNodes.24 /0/@diagram/@childNodes.25 /0/@diagram/@childNodes.26 /0/@diagram/@childNodes.27 /0/@diagram/@childNodes.28 /0/@diagram/@childNodes.29 /0/@diagram/@childNodes.30 /0/@diagram/@childNodes.31 /0/@diagram/@childNodes.73 /0/@diagram/@childNodes.76 /0/@diagram/@childNodes.79 /0/@diagram/@childNodes.83 /0/@diagram/@childNodes.85 /0/@diagram/@childNodes.87 /0/@diagram/@childNodes.90 /0/@diagram/@childNodes.92 /0/@diagram/@childNodes.69 /0/@diagram/@childNodes.93 /0/@diagram/@childNodes.94 /0/@diagram/@childNodes.102 /0/@diagram/@childNodes.110 /0/@diagram/@childNodes.115 /0/@diagram/@childNodes.119 /0/@diagram/@childNodes.124 /0/@diagram/@childNodes.128 /0/@diagram/@childNodes.132" + childNodes="/0/@diagram/@childNodes.3 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.16 /0/@diagram/@childNodes.32 /0/@diagram/@childNodes.33 /0/@diagram/@childNodes.34 /0/@diagram/@childNodes.35 /0/@diagram/@childNodes.36 /0/@diagram/@childNodes.37 /0/@diagram/@childNodes.44 /0/@diagram/@childNodes.52 /0/@diagram/@childNodes.54 /0/@diagram/@childNodes.56 /0/@diagram/@childNodes.57 /0/@diagram/@childNodes.60 /0/@diagram/@childNodes.64 /0/@diagram/@childNodes.65 /0/@diagram/@childNodes.70 /0/@diagram/@childNodes.24 /0/@diagram/@childNodes.25 /0/@diagram/@childNodes.26 /0/@diagram/@childNodes.27 /0/@diagram/@childNodes.28 /0/@diagram/@childNodes.29 /0/@diagram/@childNodes.30 /0/@diagram/@childNodes.31 /0/@diagram/@childNodes.73 /0/@diagram/@childNodes.76 /0/@diagram/@childNodes.79 /0/@diagram/@childNodes.83 /0/@diagram/@childNodes.85 /0/@diagram/@childNodes.87 /0/@diagram/@childNodes.90 /0/@diagram/@childNodes.92 /0/@diagram/@childNodes.69 /0/@diagram/@childNodes.93 /0/@diagram/@childNodes.94 /0/@diagram/@childNodes.102 /0/@diagram/@childNodes.110 /0/@diagram/@childNodes.115 /0/@diagram/@childNodes.119 /0/@diagram/@childNodes.124 /0/@diagram/@childNodes.128 /0/@diagram/@childNodes.132 /0/@diagram/@childNodes.134 /0/@diagram/@childNodes.138" title="StructuredActivityNodeContentCompartment" canCollapse="false" needsTitle="false" @@ -14385,7 +15216,7 @@ itemSemanticEditPolicyClassName="ActivityPartitionActivityPartitionContentCompartmentItemSemanticEditPolicy" notationViewFactoryClassName="ActivityPartitionActivityPartitionContentCompartmentViewFactory" canonicalEditPolicyClassName="ActivityPartitionActivityPartitionContentCompartmentCanonicalEditPolicy" - childNodes="/0/@diagram/@childNodes.3 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.16 /0/@diagram/@childNodes.32 /0/@diagram/@childNodes.33 /0/@diagram/@childNodes.34 /0/@diagram/@childNodes.35 /0/@diagram/@childNodes.36 /0/@diagram/@childNodes.37 /0/@diagram/@childNodes.44 /0/@diagram/@childNodes.52 /0/@diagram/@childNodes.54 /0/@diagram/@childNodes.56 /0/@diagram/@childNodes.57 /0/@diagram/@childNodes.60 /0/@diagram/@childNodes.64 /0/@diagram/@childNodes.65 /0/@diagram/@childNodes.70 /0/@diagram/@childNodes.67 /0/@diagram/@childNodes.24 /0/@diagram/@childNodes.25 /0/@diagram/@childNodes.26 /0/@diagram/@childNodes.27 /0/@diagram/@childNodes.28 /0/@diagram/@childNodes.29 /0/@diagram/@childNodes.30 /0/@diagram/@childNodes.31 /0/@diagram/@childNodes.73 /0/@diagram/@childNodes.76 /0/@diagram/@childNodes.79 /0/@diagram/@childNodes.83 /0/@diagram/@childNodes.85 /0/@diagram/@childNodes.87 /0/@diagram/@childNodes.90 /0/@diagram/@childNodes.92 /0/@diagram/@childNodes.69 /0/@diagram/@childNodes.93 /0/@diagram/@childNodes.94 /0/@diagram/@childNodes.102 /0/@diagram/@childNodes.110 /0/@diagram/@childNodes.115 /0/@diagram/@childNodes.119 /0/@diagram/@childNodes.124 /0/@diagram/@childNodes.128 /0/@diagram/@childNodes.132" + childNodes="/0/@diagram/@childNodes.3 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.16 /0/@diagram/@childNodes.32 /0/@diagram/@childNodes.33 /0/@diagram/@childNodes.34 /0/@diagram/@childNodes.35 /0/@diagram/@childNodes.36 /0/@diagram/@childNodes.37 /0/@diagram/@childNodes.44 /0/@diagram/@childNodes.52 /0/@diagram/@childNodes.54 /0/@diagram/@childNodes.56 /0/@diagram/@childNodes.57 /0/@diagram/@childNodes.60 /0/@diagram/@childNodes.64 /0/@diagram/@childNodes.65 /0/@diagram/@childNodes.70 /0/@diagram/@childNodes.67 /0/@diagram/@childNodes.24 /0/@diagram/@childNodes.25 /0/@diagram/@childNodes.26 /0/@diagram/@childNodes.27 /0/@diagram/@childNodes.28 /0/@diagram/@childNodes.29 /0/@diagram/@childNodes.30 /0/@diagram/@childNodes.31 /0/@diagram/@childNodes.73 /0/@diagram/@childNodes.76 /0/@diagram/@childNodes.79 /0/@diagram/@childNodes.83 /0/@diagram/@childNodes.85 /0/@diagram/@childNodes.87 /0/@diagram/@childNodes.90 /0/@diagram/@childNodes.92 /0/@diagram/@childNodes.69 /0/@diagram/@childNodes.93 /0/@diagram/@childNodes.94 /0/@diagram/@childNodes.102 /0/@diagram/@childNodes.110 /0/@diagram/@childNodes.115 /0/@diagram/@childNodes.119 /0/@diagram/@childNodes.124 /0/@diagram/@childNodes.128 /0/@diagram/@childNodes.132 /0/@diagram/@childNodes.134 /0/@diagram/@childNodes.138" title="ActivityPartitionContentCompartment" canCollapse="false" needsTitle="false" @@ -14420,7 +15251,7 @@ itemSemanticEditPolicyClassName="InterruptibleActivityRegionInterruptibleActivityRegionContentCompartmentItemSemanticEditPolicy" notationViewFactoryClassName="InterruptibleActivityRegionInterruptibleActivityRegionContentCompartmentViewFactory" canonicalEditPolicyClassName="InterruptibleActivityRegionInterruptibleActivityRegionContentCompartmentCanonicalEditPolicy" - childNodes="/0/@diagram/@childNodes.3 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.16 /0/@diagram/@childNodes.32 /0/@diagram/@childNodes.33 /0/@diagram/@childNodes.34 /0/@diagram/@childNodes.35 /0/@diagram/@childNodes.36 /0/@diagram/@childNodes.37 /0/@diagram/@childNodes.44 /0/@diagram/@childNodes.52 /0/@diagram/@childNodes.54 /0/@diagram/@childNodes.56 /0/@diagram/@childNodes.57 /0/@diagram/@childNodes.60 /0/@diagram/@childNodes.64 /0/@diagram/@childNodes.65 /0/@diagram/@childNodes.70 /0/@diagram/@childNodes.24 /0/@diagram/@childNodes.25 /0/@diagram/@childNodes.26 /0/@diagram/@childNodes.27 /0/@diagram/@childNodes.28 /0/@diagram/@childNodes.29 /0/@diagram/@childNodes.30 /0/@diagram/@childNodes.31 /0/@diagram/@childNodes.73 /0/@diagram/@childNodes.76 /0/@diagram/@childNodes.79 /0/@diagram/@childNodes.83 /0/@diagram/@childNodes.85 /0/@diagram/@childNodes.87 /0/@diagram/@childNodes.90 /0/@diagram/@childNodes.92 /0/@diagram/@childNodes.69 /0/@diagram/@childNodes.93 /0/@diagram/@childNodes.94 /0/@diagram/@childNodes.102 /0/@diagram/@childNodes.110 /0/@diagram/@childNodes.115 /0/@diagram/@childNodes.119 /0/@diagram/@childNodes.124 /0/@diagram/@childNodes.128 /0/@diagram/@childNodes.132" + childNodes="/0/@diagram/@childNodes.3 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.16 /0/@diagram/@childNodes.32 /0/@diagram/@childNodes.33 /0/@diagram/@childNodes.34 /0/@diagram/@childNodes.35 /0/@diagram/@childNodes.36 /0/@diagram/@childNodes.37 /0/@diagram/@childNodes.44 /0/@diagram/@childNodes.52 /0/@diagram/@childNodes.54 /0/@diagram/@childNodes.56 /0/@diagram/@childNodes.57 /0/@diagram/@childNodes.60 /0/@diagram/@childNodes.64 /0/@diagram/@childNodes.65 /0/@diagram/@childNodes.70 /0/@diagram/@childNodes.24 /0/@diagram/@childNodes.25 /0/@diagram/@childNodes.26 /0/@diagram/@childNodes.27 /0/@diagram/@childNodes.28 /0/@diagram/@childNodes.29 /0/@diagram/@childNodes.30 /0/@diagram/@childNodes.31 /0/@diagram/@childNodes.73 /0/@diagram/@childNodes.76 /0/@diagram/@childNodes.79 /0/@diagram/@childNodes.83 /0/@diagram/@childNodes.85 /0/@diagram/@childNodes.87 /0/@diagram/@childNodes.90 /0/@diagram/@childNodes.92 /0/@diagram/@childNodes.69 /0/@diagram/@childNodes.93 /0/@diagram/@childNodes.94 /0/@diagram/@childNodes.102 /0/@diagram/@childNodes.110 /0/@diagram/@childNodes.115 /0/@diagram/@childNodes.119 /0/@diagram/@childNodes.124 /0/@diagram/@childNodes.128 /0/@diagram/@childNodes.132 /0/@diagram/@childNodes.134 /0/@diagram/@childNodes.138" title="InterruptibleActivityRegionContentCompartment" canCollapse="false" needsTitle="false" @@ -14540,7 +15371,7 @@ itemSemanticEditPolicyClassName="ActivityCNContentCompartmentItemSemanticEditPolicy" notationViewFactoryClassName="ActivityActivityContentCompartmentViewFactory" canonicalEditPolicyClassName="ActivityCNContentCompartmentCanonicalEditPolicy" - childNodes="/0/@diagram/@childNodes.3 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.16 /0/@diagram/@childNodes.24 /0/@diagram/@childNodes.25 /0/@diagram/@childNodes.26 /0/@diagram/@childNodes.27 /0/@diagram/@childNodes.28 /0/@diagram/@childNodes.29 /0/@diagram/@childNodes.30 /0/@diagram/@childNodes.31 /0/@diagram/@childNodes.32 /0/@diagram/@childNodes.33 /0/@diagram/@childNodes.34 /0/@diagram/@childNodes.35 /0/@diagram/@childNodes.36 /0/@diagram/@childNodes.37 /0/@diagram/@childNodes.44 /0/@diagram/@childNodes.52 /0/@diagram/@childNodes.54 /0/@diagram/@childNodes.56 /0/@diagram/@childNodes.57 /0/@diagram/@childNodes.60 /0/@diagram/@childNodes.64 /0/@diagram/@childNodes.65 /0/@diagram/@childNodes.67 /0/@diagram/@childNodes.68 /0/@diagram/@childNodes.69 /0/@diagram/@childNodes.70 /0/@diagram/@childNodes.72 /0/@diagram/@childNodes.73 /0/@diagram/@childNodes.76 /0/@diagram/@childNodes.79 /0/@diagram/@childNodes.83 /0/@diagram/@childNodes.85 /0/@diagram/@childNodes.87 /0/@diagram/@childNodes.90 /0/@diagram/@childNodes.92 /0/@diagram/@childNodes.51 /0/@diagram/@childNodes.94 /0/@diagram/@childNodes.102 /0/@diagram/@childNodes.110 /0/@diagram/@childNodes.115 /0/@diagram/@childNodes.119 /0/@diagram/@childNodes.124 /0/@diagram/@childNodes.128 /0/@diagram/@childNodes.132" + childNodes="/0/@diagram/@childNodes.3 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.16 /0/@diagram/@childNodes.24 /0/@diagram/@childNodes.25 /0/@diagram/@childNodes.26 /0/@diagram/@childNodes.27 /0/@diagram/@childNodes.28 /0/@diagram/@childNodes.29 /0/@diagram/@childNodes.30 /0/@diagram/@childNodes.31 /0/@diagram/@childNodes.32 /0/@diagram/@childNodes.33 /0/@diagram/@childNodes.34 /0/@diagram/@childNodes.35 /0/@diagram/@childNodes.36 /0/@diagram/@childNodes.37 /0/@diagram/@childNodes.44 /0/@diagram/@childNodes.52 /0/@diagram/@childNodes.54 /0/@diagram/@childNodes.56 /0/@diagram/@childNodes.57 /0/@diagram/@childNodes.60 /0/@diagram/@childNodes.64 /0/@diagram/@childNodes.65 /0/@diagram/@childNodes.67 /0/@diagram/@childNodes.68 /0/@diagram/@childNodes.69 /0/@diagram/@childNodes.70 /0/@diagram/@childNodes.72 /0/@diagram/@childNodes.73 /0/@diagram/@childNodes.76 /0/@diagram/@childNodes.79 /0/@diagram/@childNodes.83 /0/@diagram/@childNodes.85 /0/@diagram/@childNodes.87 /0/@diagram/@childNodes.90 /0/@diagram/@childNodes.92 /0/@diagram/@childNodes.51 /0/@diagram/@childNodes.94 /0/@diagram/@childNodes.102 /0/@diagram/@childNodes.110 /0/@diagram/@childNodes.115 /0/@diagram/@childNodes.119 /0/@diagram/@childNodes.124 /0/@diagram/@childNodes.128 /0/@diagram/@childNodes.132 /0/@diagram/@childNodes.134 /0/@diagram/@childNodes.138" title="ActivityFigureContentCompartment" canCollapse="false" needsTitle="false" @@ -14752,28 +15583,28 @@ description="Create an Output Pin" largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/OutputPin.gif" smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/OutputPin.gif" - genNodes="/0/@diagram/@childNodes.10 /0/@diagram/@childNodes.15 /0/@diagram/@childNodes.20 /0/@diagram/@childNodes.53 /0/@diagram/@childNodes.55 /0/@diagram/@childNodes.71 /0/@diagram/@childNodes.61 /0/@diagram/@childNodes.62 /0/@diagram/@childNodes.63 /0/@diagram/@childNodes.95 /0/@diagram/@childNodes.103 /0/@diagram/@childNodes.111 /0/@diagram/@childNodes.120 /0/@diagram/@childNodes.133"/> + genNodes="/0/@diagram/@childNodes.10 /0/@diagram/@childNodes.15 /0/@diagram/@childNodes.20 /0/@diagram/@childNodes.53 /0/@diagram/@childNodes.55 /0/@diagram/@childNodes.71 /0/@diagram/@childNodes.61 /0/@diagram/@childNodes.62 /0/@diagram/@childNodes.63 /0/@diagram/@childNodes.95 /0/@diagram/@childNodes.103 /0/@diagram/@childNodes.111 /0/@diagram/@childNodes.120 /0/@diagram/@childNodes.133 /0/@diagram/@childNodes.139"/> <entries xsi:type="gmfgen:ToolEntry" title="Input Pin" description="Create an Input Pin" largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/InputPin.gif" smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/InputPin.gif" - genNodes="/0/@diagram/@childNodes.9 /0/@diagram/@childNodes.14 /0/@diagram/@childNodes.19 /0/@diagram/@childNodes.47 /0/@diagram/@childNodes.66 /0/@diagram/@childNodes.96 /0/@diagram/@childNodes.99 /0/@diagram/@childNodes.104 /0/@diagram/@childNodes.105 /0/@diagram/@childNodes.112 /0/@diagram/@childNodes.116 /0/@diagram/@childNodes.121 /0/@diagram/@childNodes.125"/> + genNodes="/0/@diagram/@childNodes.9 /0/@diagram/@childNodes.14 /0/@diagram/@childNodes.19 /0/@diagram/@childNodes.47 /0/@diagram/@childNodes.66 /0/@diagram/@childNodes.96 /0/@diagram/@childNodes.99 /0/@diagram/@childNodes.104 /0/@diagram/@childNodes.105 /0/@diagram/@childNodes.112 /0/@diagram/@childNodes.116 /0/@diagram/@childNodes.121 /0/@diagram/@childNodes.125 /0/@diagram/@childNodes.135 /0/@diagram/@childNodes.140"/> <entries xsi:type="gmfgen:ToolEntry" title="Action Input Pin" description="Create an Action Input Pin" largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/ActionInputPin.gif" smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/ActionInputPin.gif" - genNodes="/0/@diagram/@childNodes.8 /0/@diagram/@childNodes.13 /0/@diagram/@childNodes.17 /0/@diagram/@childNodes.45 /0/@diagram/@childNodes.98 /0/@diagram/@childNodes.101 /0/@diagram/@childNodes.108 /0/@diagram/@childNodes.109 /0/@diagram/@childNodes.114 /0/@diagram/@childNodes.118 /0/@diagram/@childNodes.123 /0/@diagram/@childNodes.127 /0/@diagram/@childNodes.131"/> + genNodes="/0/@diagram/@childNodes.8 /0/@diagram/@childNodes.13 /0/@diagram/@childNodes.17 /0/@diagram/@childNodes.45 /0/@diagram/@childNodes.98 /0/@diagram/@childNodes.101 /0/@diagram/@childNodes.108 /0/@diagram/@childNodes.109 /0/@diagram/@childNodes.114 /0/@diagram/@childNodes.118 /0/@diagram/@childNodes.123 /0/@diagram/@childNodes.127 /0/@diagram/@childNodes.131 /0/@diagram/@childNodes.137 /0/@diagram/@childNodes.142"/> <entries xsi:type="gmfgen:ToolEntry" title="Value Pin" description="Create a Value Pin" largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/ValuePin.gif" smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/ValuePin.gif" - genNodes="/0/@diagram/@childNodes.7 /0/@diagram/@childNodes.12 /0/@diagram/@childNodes.18 /0/@diagram/@childNodes.46 /0/@diagram/@childNodes.97 /0/@diagram/@childNodes.100 /0/@diagram/@childNodes.106 /0/@diagram/@childNodes.107 /0/@diagram/@childNodes.113 /0/@diagram/@childNodes.117 /0/@diagram/@childNodes.122 /0/@diagram/@childNodes.126 /0/@diagram/@childNodes.130"/> + genNodes="/0/@diagram/@childNodes.7 /0/@diagram/@childNodes.12 /0/@diagram/@childNodes.18 /0/@diagram/@childNodes.46 /0/@diagram/@childNodes.97 /0/@diagram/@childNodes.100 /0/@diagram/@childNodes.106 /0/@diagram/@childNodes.107 /0/@diagram/@childNodes.113 /0/@diagram/@childNodes.117 /0/@diagram/@childNodes.122 /0/@diagram/@childNodes.126 /0/@diagram/@childNodes.130 /0/@diagram/@childNodes.136 /0/@diagram/@childNodes.141"/> </entries> <entries xsi:type="gmfgen:ToolGroup" @@ -14889,6 +15720,20 @@ largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/ReadSelfAction.gif" smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/ReadSelfAction.gif" genNodes="/0/@diagram/@childNodes.70"/> + <entries + xsi:type="gmfgen:ToolEntry" + title="Reclassify Object Action" + description="Create a ReclassifyObjectAction" + largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/ReclassifyObjectAction.gif" + smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/ReclassifyObjectAction.gif" + genNodes="/0/@diagram/@childNodes.134"/> + <entries + xsi:type="gmfgen:ToolEntry" + title="Read Is Classified Object Action" + description="Create a Read Is Classified Object Action" + largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/ReadIsClassifiedObjectAction.gif" + smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/ReadIsClassifiedObjectAction.gif" + genNodes="/0/@diagram/@childNodes.138"/> </entries> <entries xsi:type="gmfgen:ToolGroup" @@ -22311,16 +23156,34 @@ <expressions xsi:type="gmfgen:GenConstraint" body="if self.owner.oclIsKindOf(ClearAssociationAction) and self.oclIsTypeOf(ActionInputPin)
then self.owner.oclAsType(ClearAssociationAction).object = self
else false endif"/> + <expressions + xsi:type="gmfgen:GenConstraint" + body="if self.owner.oclIsKindOf(ReclassifyObjectAction) and self.oclIsTypeOf(ActionInputPin)
then self.owner.oclAsType(ReclassifyObjectAction).object = self
else false endif"/> + <expressions + xsi:type="gmfgen:GenConstraint" + body="if self.owner.oclIsKindOf(ReclassifyObjectAction) and self.oclIsTypeOf(InputPin)
then self.owner.oclAsType(ReclassifyObjectAction).object = self
else false endif"/> + <expressions + xsi:type="gmfgen:GenConstraint" + body="if self.owner.oclIsKindOf(ReclassifyObjectAction) and self.oclIsTypeOf(ValuePin)
then self.owner.oclAsType(ReclassifyObjectAction).object = self
else false endif"/> + <expressions + xsi:type="gmfgen:GenConstraint" + body="if self.owner.oclIsKindOf(ReadIsClassifiedObjectAction) and self.oclIsTypeOf(ValuePin)
then self.owner.oclAsType(ReadIsClassifiedObjectAction).object = self
else false endif"/> + <expressions + xsi:type="gmfgen:GenConstraint" + body="if self.owner.oclIsKindOf(ReadIsClassifiedObjectAction) and self.oclIsTypeOf(ActionInputPin)
then self.owner.oclAsType(ReadIsClassifiedObjectAction).object = self
else false endif"/> + <expressions + xsi:type="gmfgen:GenConstraint" + body="if self.owner.oclIsKindOf(ReadIsClassifiedObjectAction) and self.oclIsTypeOf(InputPin)
then self.owner.oclAsType(ReadIsClassifiedObjectAction).object = self
else false endif"/> </providers> </expressionProviders> <labelParsers extensibleViaService="true"> <implementations xsi:type="gmfgen:PredefinedParser" - uses="/0/@diagram/@childNodes.6/@labels.0/@modelFacet /0/@diagram/@childNodes.24/@labels.0/@modelFacet /0/@diagram/@childNodes.25/@labels.0/@modelFacet /0/@diagram/@childNodes.26/@labels.0/@modelFacet /0/@diagram/@childNodes.27/@labels.0/@modelFacet /0/@diagram/@childNodes.28/@labels.0/@modelFacet /0/@diagram/@childNodes.29/@labels.0/@modelFacet /0/@diagram/@childNodes.30/@labels.0/@modelFacet /0/@diagram/@childNodes.31/@labels.0/@modelFacet /0/@diagram/@childNodes.37/@labels.0/@modelFacet /0/@diagram/@childNodes.44/@labels.0/@modelFacet /0/@diagram/@childNodes.54/@labels.0/@modelFacet /0/@diagram/@childNodes.67/@labels.0/@modelFacet /0/@diagram/@childNodes.70/@labels.0/@modelFacet /0/@diagram/@childNodes.73/@labels.0/@modelFacet /0/@diagram/@childNodes.76/@labels.0/@modelFacet /0/@diagram/@childNodes.79/@labels.0/@modelFacet /0/@diagram/@childNodes.83/@labels.0/@modelFacet /0/@diagram/@childNodes.85/@labels.0/@modelFacet /0/@diagram/@childNodes.87/@labels.0/@modelFacet /0/@diagram/@childNodes.90/@labels.0/@modelFacet /0/@diagram/@childNodes.72/@labels.0/@modelFacet /0/@diagram/@topLevelNodes.0/@labels.0/@modelFacet /0/@diagram/@links.2/@labels.0/@modelFacet /0/@diagram/@links.3/@labels.0/@modelFacet /0/@diagram/@childNodes.93/@labels.0/@modelFacet /0/@diagram/@childNodes.67/@labels.1/@modelFacet /0/@diagram/@childNodes.90/@labels.1/@modelFacet /0/@diagram/@childNodes.87/@labels.1/@modelFacet /0/@diagram/@childNodes.16/@labels.1/@modelFacet /0/@diagram/@childNodes.79/@labels.1/@modelFacet /0/@diagram/@childNodes.85/@labels.1/@modelFacet /0/@diagram/@childNodes.83/@labels.1/@modelFacet /0/@diagram/@childNodes.76/@labels.1/@modelFacet /0/@diagram/@childNodes.73/@labels.1/@modelFacet /0/@diagram/@childNodes.70/@labels.1/@modelFacet /0/@diagram/@childNodes.54/@labels.1/@modelFacet /0/@diagram/@childNodes.37/@labels.1/@modelFacet /0/@diagram/@childNodes.6/@labels.1/@modelFacet /0/@diagram/@childNodes.11/@labels.1/@modelFacet /0/@diagram/@childNodes.92/@labels.2/@modelFacet /0/@diagram/@childNodes.36/@labels.2/@modelFacet /0/@diagram/@childNodes.44/@labels.1/@modelFacet /0/@diagram/@childNodes.4/@labels.0/@modelFacet /0/@diagram/@childNodes.3/@labels.0/@modelFacet /0/@diagram/@childNodes.5/@labels.0/@modelFacet /0/@diagram/@childNodes.32/@labels.0/@modelFacet /0/@diagram/@childNodes.33/@labels.0/@modelFacet /0/@diagram/@childNodes.34/@labels.0/@modelFacet /0/@diagram/@childNodes.35/@labels.0/@modelFacet /0/@diagram/@childNodes.52/@labels.3/@modelFacet /0/@diagram/@childNodes.94/@labels.0/@modelFacet /0/@diagram/@childNodes.94/@labels.1/@modelFacet /0/@diagram/@childNodes.102/@labels.0/@modelFacet /0/@diagram/@childNodes.102/@labels.1/@modelFacet /0/@diagram/@childNodes.110/@labels.0/@modelFacet /0/@diagram/@childNodes.110/@labels.1/@modelFacet /0/@diagram/@childNodes.115/@labels.0/@modelFacet /0/@diagram/@childNodes.115/@labels.1/@modelFacet /0/@diagram/@childNodes.119/@labels.0/@modelFacet /0/@diagram/@childNodes.119/@labels.1/@modelFacet /0/@diagram/@childNodes.124/@labels.1/@modelFacet /0/@diagram/@childNodes.124/@labels.0/@modelFacet /0/@diagram/@childNodes.128/@labels.0/@modelFacet /0/@diagram/@childNodes.128/@labels.1/@modelFacet /0/@diagram/@childNodes.132/@labels.0/@modelFacet /0/@diagram/@childNodes.132/@labels.1/@modelFacet"/> + uses="/0/@diagram/@childNodes.6/@labels.0/@modelFacet /0/@diagram/@childNodes.24/@labels.0/@modelFacet /0/@diagram/@childNodes.25/@labels.0/@modelFacet /0/@diagram/@childNodes.26/@labels.0/@modelFacet /0/@diagram/@childNodes.27/@labels.0/@modelFacet /0/@diagram/@childNodes.28/@labels.0/@modelFacet /0/@diagram/@childNodes.29/@labels.0/@modelFacet /0/@diagram/@childNodes.30/@labels.0/@modelFacet /0/@diagram/@childNodes.31/@labels.0/@modelFacet /0/@diagram/@childNodes.37/@labels.0/@modelFacet /0/@diagram/@childNodes.44/@labels.0/@modelFacet /0/@diagram/@childNodes.54/@labels.0/@modelFacet /0/@diagram/@childNodes.67/@labels.0/@modelFacet /0/@diagram/@childNodes.70/@labels.0/@modelFacet /0/@diagram/@childNodes.73/@labels.0/@modelFacet /0/@diagram/@childNodes.76/@labels.0/@modelFacet /0/@diagram/@childNodes.79/@labels.0/@modelFacet /0/@diagram/@childNodes.83/@labels.0/@modelFacet /0/@diagram/@childNodes.85/@labels.0/@modelFacet /0/@diagram/@childNodes.87/@labels.0/@modelFacet /0/@diagram/@childNodes.90/@labels.0/@modelFacet /0/@diagram/@childNodes.72/@labels.0/@modelFacet /0/@diagram/@topLevelNodes.0/@labels.0/@modelFacet /0/@diagram/@links.2/@labels.0/@modelFacet /0/@diagram/@links.3/@labels.0/@modelFacet /0/@diagram/@childNodes.93/@labels.0/@modelFacet /0/@diagram/@childNodes.67/@labels.1/@modelFacet /0/@diagram/@childNodes.90/@labels.1/@modelFacet /0/@diagram/@childNodes.87/@labels.1/@modelFacet /0/@diagram/@childNodes.16/@labels.1/@modelFacet /0/@diagram/@childNodes.79/@labels.1/@modelFacet /0/@diagram/@childNodes.85/@labels.1/@modelFacet /0/@diagram/@childNodes.83/@labels.1/@modelFacet /0/@diagram/@childNodes.76/@labels.1/@modelFacet /0/@diagram/@childNodes.73/@labels.1/@modelFacet /0/@diagram/@childNodes.70/@labels.1/@modelFacet /0/@diagram/@childNodes.54/@labels.1/@modelFacet /0/@diagram/@childNodes.37/@labels.1/@modelFacet /0/@diagram/@childNodes.6/@labels.1/@modelFacet /0/@diagram/@childNodes.11/@labels.1/@modelFacet /0/@diagram/@childNodes.92/@labels.2/@modelFacet /0/@diagram/@childNodes.36/@labels.2/@modelFacet /0/@diagram/@childNodes.44/@labels.1/@modelFacet /0/@diagram/@childNodes.4/@labels.0/@modelFacet /0/@diagram/@childNodes.3/@labels.0/@modelFacet /0/@diagram/@childNodes.5/@labels.0/@modelFacet /0/@diagram/@childNodes.32/@labels.0/@modelFacet /0/@diagram/@childNodes.33/@labels.0/@modelFacet /0/@diagram/@childNodes.34/@labels.0/@modelFacet /0/@diagram/@childNodes.35/@labels.0/@modelFacet /0/@diagram/@childNodes.52/@labels.3/@modelFacet /0/@diagram/@childNodes.94/@labels.0/@modelFacet /0/@diagram/@childNodes.94/@labels.1/@modelFacet /0/@diagram/@childNodes.102/@labels.0/@modelFacet /0/@diagram/@childNodes.102/@labels.1/@modelFacet /0/@diagram/@childNodes.110/@labels.0/@modelFacet /0/@diagram/@childNodes.110/@labels.1/@modelFacet /0/@diagram/@childNodes.115/@labels.0/@modelFacet /0/@diagram/@childNodes.115/@labels.1/@modelFacet /0/@diagram/@childNodes.119/@labels.0/@modelFacet /0/@diagram/@childNodes.119/@labels.1/@modelFacet /0/@diagram/@childNodes.124/@labels.1/@modelFacet /0/@diagram/@childNodes.124/@labels.0/@modelFacet /0/@diagram/@childNodes.128/@labels.0/@modelFacet /0/@diagram/@childNodes.128/@labels.1/@modelFacet /0/@diagram/@childNodes.132/@labels.0/@modelFacet /0/@diagram/@childNodes.132/@labels.1/@modelFacet /0/@diagram/@childNodes.134/@labels.0/@modelFacet /0/@diagram/@childNodes.134/@labels.1/@modelFacet /0/@diagram/@childNodes.138/@labels.0/@modelFacet /0/@diagram/@childNodes.138/@labels.1/@modelFacet"/> <implementations xsi:type="gmfgen:CustomParser" - uses="/0/@diagram/@childNodes.89/@labels.1/@modelFacet /0/@diagram/@childNodes.49/@labels.2/@modelFacet /0/@diagram/@childNodes.82/@labels.1/@modelFacet /0/@diagram/@childNodes.53/@labels.1/@modelFacet /0/@diagram/@childNodes.81/@labels.1/@modelFacet /0/@diagram/@childNodes.12/@labels.2/@modelFacet /0/@diagram/@childNodes.22/@labels.2/@modelFacet /0/@diagram/@childNodes.45/@labels.2/@modelFacet /0/@diagram/@childNodes.47/@labels.1/@modelFacet /0/@diagram/@childNodes.23/@labels.1/@modelFacet /0/@diagram/@links.2/@labels.6/@modelFacet /0/@diagram/@childNodes.19/@labels.1/@modelFacet /0/@diagram/@childNodes.4/@labels.1/@modelFacet /0/@diagram/@childNodes.15/@labels.1/@modelFacet /0/@diagram/@childNodes.43/@labels.1/@modelFacet /0/@diagram/@childNodes.80/@labels.1/@modelFacet /0/@diagram/@childNodes.91/@labels.2/@modelFacet /0/@diagram/@childNodes.84/@labels.1/@modelFacet /0/@diagram/@childNodes.13/@labels.2/@modelFacet /0/@diagram/@childNodes.35/@labels.2/@modelFacet /0/@diagram/@childNodes.9/@labels.1/@modelFacet /0/@diagram/@childNodes.33/@labels.1/@modelFacet /0/@diagram/@childNodes.88/@labels.1/@modelFacet /0/@diagram/@childNodes.20/@labels.1/@modelFacet /0/@diagram/@childNodes.52/@labels.2/@modelFacet /0/@diagram/@childNodes.41/@labels.2/@modelFacet /0/@diagram/@childNodes.32/@labels.2/@modelFacet /0/@diagram/@childNodes.77/@labels.1/@modelFacet /0/@diagram/@childNodes.8/@labels.2/@modelFacet /0/@diagram/@childNodes.34/@labels.1/@modelFacet /0/@diagram/@links.3/@labels.3/@modelFacet /0/@diagram/@childNodes.74/@labels.1/@modelFacet /0/@diagram/@childNodes.86/@labels.1/@modelFacet /0/@diagram/@childNodes.17/@labels.2/@modelFacet /0/@diagram/@childNodes.50/@labels.1/@modelFacet /0/@diagram/@childNodes.78/@labels.1/@modelFacet /0/@diagram/@childNodes.10/@labels.1/@modelFacet /0/@diagram/@childNodes.21/@labels.2/@modelFacet /0/@diagram/@childNodes.14/@labels.1/@modelFacet /0/@diagram/@childNodes.55/@labels.1/@modelFacet /0/@diagram/@childNodes.71/@labels.1/@modelFacet /0/@diagram/@childNodes.39/@labels.2/@modelFacet /0/@diagram/@childNodes.18/@labels.2/@modelFacet /0/@diagram/@childNodes.42/@labels.2/@modelFacet /0/@diagram/@childNodes.3/@labels.1/@modelFacet /0/@diagram/@childNodes.46/@labels.2/@modelFacet /0/@diagram/@childNodes.48/@labels.2/@modelFacet /0/@diagram/@childNodes.7/@labels.2/@modelFacet /0/@diagram/@childNodes.38/@labels.2/@modelFacet /0/@diagram/@childNodes.5/@labels.1/@modelFacet /0/@diagram/@childNodes.40/@labels.1/@modelFacet /0/@diagram/@childNodes.66/@labels.1/@modelFacet /0/@diagram/@childNodes.63/@labels.1/@modelFacet /0/@diagram/@childNodes.62/@labels.1/@modelFacet /0/@diagram/@childNodes.61/@labels.1/@modelFacet /0/@diagram/@childNodes.95/@labels.1/@modelFacet /0/@diagram/@childNodes.96/@labels.1/@modelFacet /0/@diagram/@childNodes.97/@labels.2/@modelFacet /0/@diagram/@childNodes.98/@labels.2/@modelFacet /0/@diagram/@childNodes.100/@labels.2/@modelFacet /0/@diagram/@childNodes.101/@labels.2/@modelFacet /0/@diagram/@childNodes.103/@labels.1/@modelFacet /0/@diagram/@childNodes.104/@labels.1/@modelFacet /0/@diagram/@childNodes.105/@labels.1/@modelFacet /0/@diagram/@childNodes.106/@labels.2/@modelFacet /0/@diagram/@childNodes.107/@labels.2/@modelFacet /0/@diagram/@childNodes.108/@labels.2/@modelFacet /0/@diagram/@childNodes.109/@labels.2/@modelFacet /0/@diagram/@childNodes.111/@labels.1/@modelFacet /0/@diagram/@childNodes.112/@labels.1/@modelFacet /0/@diagram/@childNodes.113/@labels.2/@modelFacet /0/@diagram/@childNodes.114/@labels.2/@modelFacet /0/@diagram/@childNodes.116/@labels.1/@modelFacet /0/@diagram/@childNodes.117/@labels.2/@modelFacet /0/@diagram/@childNodes.118/@labels.2/@modelFacet /0/@diagram/@childNodes.120/@labels.1/@modelFacet /0/@diagram/@childNodes.121/@labels.1/@modelFacet /0/@diagram/@childNodes.122/@labels.2/@modelFacet /0/@diagram/@childNodes.123/@labels.2/@modelFacet /0/@diagram/@childNodes.125/@labels.1/@modelFacet /0/@diagram/@childNodes.126/@labels.2/@modelFacet /0/@diagram/@childNodes.127/@labels.2/@modelFacet /0/@diagram/@childNodes.129/@labels.1/@modelFacet /0/@diagram/@childNodes.130/@labels.2/@modelFacet /0/@diagram/@childNodes.131/@labels.2/@modelFacet /0/@diagram/@childNodes.133/@labels.1/@modelFacet" + uses="/0/@diagram/@childNodes.89/@labels.1/@modelFacet /0/@diagram/@childNodes.49/@labels.2/@modelFacet /0/@diagram/@childNodes.82/@labels.1/@modelFacet /0/@diagram/@childNodes.53/@labels.1/@modelFacet /0/@diagram/@childNodes.81/@labels.1/@modelFacet /0/@diagram/@childNodes.12/@labels.2/@modelFacet /0/@diagram/@childNodes.22/@labels.2/@modelFacet /0/@diagram/@childNodes.45/@labels.2/@modelFacet /0/@diagram/@childNodes.47/@labels.1/@modelFacet /0/@diagram/@childNodes.23/@labels.1/@modelFacet /0/@diagram/@links.2/@labels.6/@modelFacet /0/@diagram/@childNodes.19/@labels.1/@modelFacet /0/@diagram/@childNodes.4/@labels.1/@modelFacet /0/@diagram/@childNodes.15/@labels.1/@modelFacet /0/@diagram/@childNodes.43/@labels.1/@modelFacet /0/@diagram/@childNodes.80/@labels.1/@modelFacet /0/@diagram/@childNodes.91/@labels.2/@modelFacet /0/@diagram/@childNodes.84/@labels.1/@modelFacet /0/@diagram/@childNodes.13/@labels.2/@modelFacet /0/@diagram/@childNodes.35/@labels.2/@modelFacet /0/@diagram/@childNodes.9/@labels.1/@modelFacet /0/@diagram/@childNodes.33/@labels.1/@modelFacet /0/@diagram/@childNodes.88/@labels.1/@modelFacet /0/@diagram/@childNodes.20/@labels.1/@modelFacet /0/@diagram/@childNodes.52/@labels.2/@modelFacet /0/@diagram/@childNodes.41/@labels.2/@modelFacet /0/@diagram/@childNodes.32/@labels.2/@modelFacet /0/@diagram/@childNodes.77/@labels.1/@modelFacet /0/@diagram/@childNodes.8/@labels.2/@modelFacet /0/@diagram/@childNodes.34/@labels.1/@modelFacet /0/@diagram/@links.3/@labels.3/@modelFacet /0/@diagram/@childNodes.74/@labels.1/@modelFacet /0/@diagram/@childNodes.86/@labels.1/@modelFacet /0/@diagram/@childNodes.17/@labels.2/@modelFacet /0/@diagram/@childNodes.50/@labels.1/@modelFacet /0/@diagram/@childNodes.78/@labels.1/@modelFacet /0/@diagram/@childNodes.10/@labels.1/@modelFacet /0/@diagram/@childNodes.21/@labels.2/@modelFacet /0/@diagram/@childNodes.14/@labels.1/@modelFacet /0/@diagram/@childNodes.55/@labels.1/@modelFacet /0/@diagram/@childNodes.71/@labels.1/@modelFacet /0/@diagram/@childNodes.39/@labels.2/@modelFacet /0/@diagram/@childNodes.18/@labels.2/@modelFacet /0/@diagram/@childNodes.42/@labels.2/@modelFacet /0/@diagram/@childNodes.3/@labels.1/@modelFacet /0/@diagram/@childNodes.46/@labels.2/@modelFacet /0/@diagram/@childNodes.48/@labels.2/@modelFacet /0/@diagram/@childNodes.7/@labels.2/@modelFacet /0/@diagram/@childNodes.38/@labels.2/@modelFacet /0/@diagram/@childNodes.5/@labels.1/@modelFacet /0/@diagram/@childNodes.40/@labels.1/@modelFacet /0/@diagram/@childNodes.66/@labels.1/@modelFacet /0/@diagram/@childNodes.63/@labels.1/@modelFacet /0/@diagram/@childNodes.62/@labels.1/@modelFacet /0/@diagram/@childNodes.61/@labels.1/@modelFacet /0/@diagram/@childNodes.95/@labels.1/@modelFacet /0/@diagram/@childNodes.96/@labels.1/@modelFacet /0/@diagram/@childNodes.97/@labels.2/@modelFacet /0/@diagram/@childNodes.98/@labels.2/@modelFacet /0/@diagram/@childNodes.100/@labels.2/@modelFacet /0/@diagram/@childNodes.101/@labels.2/@modelFacet /0/@diagram/@childNodes.103/@labels.1/@modelFacet /0/@diagram/@childNodes.104/@labels.1/@modelFacet /0/@diagram/@childNodes.105/@labels.1/@modelFacet /0/@diagram/@childNodes.106/@labels.2/@modelFacet /0/@diagram/@childNodes.107/@labels.2/@modelFacet /0/@diagram/@childNodes.108/@labels.2/@modelFacet /0/@diagram/@childNodes.109/@labels.2/@modelFacet /0/@diagram/@childNodes.111/@labels.1/@modelFacet /0/@diagram/@childNodes.112/@labels.1/@modelFacet /0/@diagram/@childNodes.113/@labels.2/@modelFacet /0/@diagram/@childNodes.114/@labels.2/@modelFacet /0/@diagram/@childNodes.116/@labels.1/@modelFacet /0/@diagram/@childNodes.117/@labels.2/@modelFacet /0/@diagram/@childNodes.118/@labels.2/@modelFacet /0/@diagram/@childNodes.120/@labels.1/@modelFacet /0/@diagram/@childNodes.121/@labels.1/@modelFacet /0/@diagram/@childNodes.122/@labels.2/@modelFacet /0/@diagram/@childNodes.123/@labels.2/@modelFacet /0/@diagram/@childNodes.125/@labels.1/@modelFacet /0/@diagram/@childNodes.126/@labels.2/@modelFacet /0/@diagram/@childNodes.127/@labels.2/@modelFacet /0/@diagram/@childNodes.129/@labels.1/@modelFacet /0/@diagram/@childNodes.130/@labels.2/@modelFacet /0/@diagram/@childNodes.131/@labels.2/@modelFacet /0/@diagram/@childNodes.133/@labels.1/@modelFacet /0/@diagram/@childNodes.135/@labels.1/@modelFacet /0/@diagram/@childNodes.136/@labels.2/@modelFacet /0/@diagram/@childNodes.137/@labels.2/@modelFacet /0/@diagram/@childNodes.139/@labels.1/@modelFacet /0/@diagram/@childNodes.142/@labels.2/@modelFacet /0/@diagram/@childNodes.141/@labels.2/@modelFacet /0/@diagram/@childNodes.140/@labels.1/@modelFacet" qualifiedName="org.eclipse.papyrus.uml.diagram.common.parser.stereotype.AppliedStereotypeParser"/> <implementations xsi:type="gmfgen:CustomParser" @@ -22340,11 +23203,11 @@ qualifiedName="org.eclipse.papyrus.uml.diagram.activity.parser.custom.CallBehaviorActionParser"/> <implementations xsi:type="gmfgen:CustomParser" - uses="/0/@diagram/@childNodes.15/@labels.0/@modelFacet /0/@diagram/@childNodes.71/@labels.0/@modelFacet /0/@diagram/@childNodes.10/@labels.0/@modelFacet /0/@diagram/@childNodes.42/@labels.0/@modelFacet /0/@diagram/@childNodes.14/@labels.0/@modelFacet /0/@diagram/@childNodes.21/@labels.0/@modelFacet /0/@diagram/@childNodes.88/@labels.0/@modelFacet /0/@diagram/@childNodes.8/@labels.0/@modelFacet /0/@diagram/@childNodes.47/@labels.0/@modelFacet /0/@diagram/@childNodes.50/@labels.0/@modelFacet /0/@diagram/@childNodes.86/@labels.0/@modelFacet /0/@diagram/@childNodes.78/@labels.0/@modelFacet /0/@diagram/@childNodes.89/@labels.0/@modelFacet /0/@diagram/@childNodes.12/@labels.0/@modelFacet /0/@diagram/@childNodes.38/@labels.0/@modelFacet /0/@diagram/@childNodes.22/@labels.0/@modelFacet /0/@diagram/@childNodes.7/@labels.0/@modelFacet /0/@diagram/@childNodes.17/@labels.0/@modelFacet /0/@diagram/@childNodes.81/@labels.0/@modelFacet /0/@diagram/@childNodes.39/@labels.0/@modelFacet /0/@diagram/@childNodes.48/@labels.0/@modelFacet /0/@diagram/@childNodes.91/@labels.0/@modelFacet /0/@diagram/@childNodes.49/@labels.0/@modelFacet /0/@diagram/@childNodes.45/@labels.0/@modelFacet /0/@diagram/@childNodes.77/@labels.0/@modelFacet /0/@diagram/@childNodes.82/@labels.0/@modelFacet /0/@diagram/@childNodes.80/@labels.0/@modelFacet /0/@diagram/@childNodes.20/@labels.0/@modelFacet /0/@diagram/@childNodes.40/@labels.0/@modelFacet /0/@diagram/@childNodes.23/@labels.0/@modelFacet /0/@diagram/@childNodes.74/@labels.0/@modelFacet /0/@diagram/@childNodes.53/@labels.0/@modelFacet /0/@diagram/@childNodes.13/@labels.0/@modelFacet /0/@diagram/@childNodes.9/@labels.0/@modelFacet /0/@diagram/@childNodes.19/@labels.0/@modelFacet /0/@diagram/@childNodes.41/@labels.0/@modelFacet /0/@diagram/@childNodes.84/@labels.0/@modelFacet /0/@diagram/@childNodes.18/@labels.0/@modelFacet /0/@diagram/@childNodes.43/@labels.0/@modelFacet /0/@diagram/@childNodes.55/@labels.0/@modelFacet /0/@diagram/@childNodes.46/@labels.0/@modelFacet /0/@diagram/@childNodes.66/@labels.0/@modelFacet /0/@diagram/@childNodes.63/@labels.0/@modelFacet /0/@diagram/@childNodes.62/@labels.0/@modelFacet /0/@diagram/@childNodes.61/@labels.0/@modelFacet /0/@diagram/@childNodes.95/@labels.0/@modelFacet /0/@diagram/@childNodes.96/@labels.0/@modelFacet /0/@diagram/@childNodes.97/@labels.0/@modelFacet /0/@diagram/@childNodes.98/@labels.0/@modelFacet /0/@diagram/@childNodes.99/@labels.0/@modelFacet /0/@diagram/@childNodes.100/@labels.0/@modelFacet /0/@diagram/@childNodes.101/@labels.0/@modelFacet /0/@diagram/@childNodes.103/@labels.0/@modelFacet /0/@diagram/@childNodes.104/@labels.0/@modelFacet /0/@diagram/@childNodes.105/@labels.0/@modelFacet /0/@diagram/@childNodes.106/@labels.0/@modelFacet /0/@diagram/@childNodes.107/@labels.0/@modelFacet /0/@diagram/@childNodes.108/@labels.0/@modelFacet /0/@diagram/@childNodes.109/@labels.0/@modelFacet /0/@diagram/@childNodes.111/@labels.0/@modelFacet /0/@diagram/@childNodes.112/@labels.0/@modelFacet /0/@diagram/@childNodes.113/@labels.0/@modelFacet /0/@diagram/@childNodes.114/@labels.0/@modelFacet /0/@diagram/@childNodes.116/@labels.0/@modelFacet /0/@diagram/@childNodes.117/@labels.0/@modelFacet /0/@diagram/@childNodes.118/@labels.0/@modelFacet /0/@diagram/@childNodes.120/@labels.0/@modelFacet /0/@diagram/@childNodes.121/@labels.0/@modelFacet /0/@diagram/@childNodes.122/@labels.0/@modelFacet /0/@diagram/@childNodes.123/@labels.0/@modelFacet /0/@diagram/@childNodes.125/@labels.0/@modelFacet /0/@diagram/@childNodes.126/@labels.0/@modelFacet /0/@diagram/@childNodes.127/@labels.0/@modelFacet /0/@diagram/@childNodes.129/@labels.0/@modelFacet /0/@diagram/@childNodes.130/@labels.0/@modelFacet /0/@diagram/@childNodes.131/@labels.0/@modelFacet /0/@diagram/@childNodes.133/@labels.0/@modelFacet" + uses="/0/@diagram/@childNodes.15/@labels.0/@modelFacet /0/@diagram/@childNodes.71/@labels.0/@modelFacet /0/@diagram/@childNodes.10/@labels.0/@modelFacet /0/@diagram/@childNodes.42/@labels.0/@modelFacet /0/@diagram/@childNodes.14/@labels.0/@modelFacet /0/@diagram/@childNodes.21/@labels.0/@modelFacet /0/@diagram/@childNodes.88/@labels.0/@modelFacet /0/@diagram/@childNodes.8/@labels.0/@modelFacet /0/@diagram/@childNodes.47/@labels.0/@modelFacet /0/@diagram/@childNodes.50/@labels.0/@modelFacet /0/@diagram/@childNodes.86/@labels.0/@modelFacet /0/@diagram/@childNodes.78/@labels.0/@modelFacet /0/@diagram/@childNodes.89/@labels.0/@modelFacet /0/@diagram/@childNodes.12/@labels.0/@modelFacet /0/@diagram/@childNodes.38/@labels.0/@modelFacet /0/@diagram/@childNodes.22/@labels.0/@modelFacet /0/@diagram/@childNodes.7/@labels.0/@modelFacet /0/@diagram/@childNodes.17/@labels.0/@modelFacet /0/@diagram/@childNodes.81/@labels.0/@modelFacet /0/@diagram/@childNodes.39/@labels.0/@modelFacet /0/@diagram/@childNodes.48/@labels.0/@modelFacet /0/@diagram/@childNodes.91/@labels.0/@modelFacet /0/@diagram/@childNodes.49/@labels.0/@modelFacet /0/@diagram/@childNodes.45/@labels.0/@modelFacet /0/@diagram/@childNodes.77/@labels.0/@modelFacet /0/@diagram/@childNodes.82/@labels.0/@modelFacet /0/@diagram/@childNodes.80/@labels.0/@modelFacet /0/@diagram/@childNodes.20/@labels.0/@modelFacet /0/@diagram/@childNodes.40/@labels.0/@modelFacet /0/@diagram/@childNodes.23/@labels.0/@modelFacet /0/@diagram/@childNodes.74/@labels.0/@modelFacet /0/@diagram/@childNodes.53/@labels.0/@modelFacet /0/@diagram/@childNodes.13/@labels.0/@modelFacet /0/@diagram/@childNodes.9/@labels.0/@modelFacet /0/@diagram/@childNodes.19/@labels.0/@modelFacet /0/@diagram/@childNodes.41/@labels.0/@modelFacet /0/@diagram/@childNodes.84/@labels.0/@modelFacet /0/@diagram/@childNodes.18/@labels.0/@modelFacet /0/@diagram/@childNodes.43/@labels.0/@modelFacet /0/@diagram/@childNodes.55/@labels.0/@modelFacet /0/@diagram/@childNodes.46/@labels.0/@modelFacet /0/@diagram/@childNodes.66/@labels.0/@modelFacet /0/@diagram/@childNodes.63/@labels.0/@modelFacet /0/@diagram/@childNodes.62/@labels.0/@modelFacet /0/@diagram/@childNodes.61/@labels.0/@modelFacet /0/@diagram/@childNodes.95/@labels.0/@modelFacet /0/@diagram/@childNodes.96/@labels.0/@modelFacet /0/@diagram/@childNodes.97/@labels.0/@modelFacet /0/@diagram/@childNodes.98/@labels.0/@modelFacet /0/@diagram/@childNodes.99/@labels.0/@modelFacet /0/@diagram/@childNodes.100/@labels.0/@modelFacet /0/@diagram/@childNodes.101/@labels.0/@modelFacet /0/@diagram/@childNodes.103/@labels.0/@modelFacet /0/@diagram/@childNodes.104/@labels.0/@modelFacet /0/@diagram/@childNodes.105/@labels.0/@modelFacet /0/@diagram/@childNodes.106/@labels.0/@modelFacet /0/@diagram/@childNodes.107/@labels.0/@modelFacet /0/@diagram/@childNodes.108/@labels.0/@modelFacet /0/@diagram/@childNodes.109/@labels.0/@modelFacet /0/@diagram/@childNodes.111/@labels.0/@modelFacet /0/@diagram/@childNodes.112/@labels.0/@modelFacet /0/@diagram/@childNodes.113/@labels.0/@modelFacet /0/@diagram/@childNodes.114/@labels.0/@modelFacet /0/@diagram/@childNodes.116/@labels.0/@modelFacet /0/@diagram/@childNodes.117/@labels.0/@modelFacet /0/@diagram/@childNodes.118/@labels.0/@modelFacet /0/@diagram/@childNodes.120/@labels.0/@modelFacet /0/@diagram/@childNodes.121/@labels.0/@modelFacet /0/@diagram/@childNodes.122/@labels.0/@modelFacet /0/@diagram/@childNodes.123/@labels.0/@modelFacet /0/@diagram/@childNodes.125/@labels.0/@modelFacet /0/@diagram/@childNodes.126/@labels.0/@modelFacet /0/@diagram/@childNodes.127/@labels.0/@modelFacet /0/@diagram/@childNodes.129/@labels.0/@modelFacet /0/@diagram/@childNodes.130/@labels.0/@modelFacet /0/@diagram/@childNodes.131/@labels.0/@modelFacet /0/@diagram/@childNodes.133/@labels.0/@modelFacet /0/@diagram/@childNodes.135/@labels.0/@modelFacet /0/@diagram/@childNodes.136/@labels.0/@modelFacet /0/@diagram/@childNodes.137/@labels.0/@modelFacet /0/@diagram/@childNodes.139/@labels.0/@modelFacet /0/@diagram/@childNodes.142/@labels.0/@modelFacet /0/@diagram/@childNodes.141/@labels.0/@modelFacet /0/@diagram/@childNodes.140/@labels.0/@modelFacet" qualifiedName="org.eclipse.papyrus.uml.diagram.activity.parser.custom.PinParser"/> <implementations xsi:type="gmfgen:CustomParser" - uses="/0/@diagram/@childNodes.8/@labels.1/@modelFacet /0/@diagram/@childNodes.21/@labels.1/@modelFacet /0/@diagram/@childNodes.42/@labels.1/@modelFacet /0/@diagram/@childNodes.38/@labels.1/@modelFacet /0/@diagram/@childNodes.39/@labels.1/@modelFacet /0/@diagram/@childNodes.22/@labels.1/@modelFacet /0/@diagram/@childNodes.13/@labels.1/@modelFacet /0/@diagram/@childNodes.17/@labels.1/@modelFacet /0/@diagram/@childNodes.12/@labels.1/@modelFacet /0/@diagram/@childNodes.49/@labels.1/@modelFacet /0/@diagram/@childNodes.91/@labels.1/@modelFacet /0/@diagram/@childNodes.46/@labels.1/@modelFacet /0/@diagram/@childNodes.41/@labels.1/@modelFacet /0/@diagram/@childNodes.18/@labels.1/@modelFacet /0/@diagram/@childNodes.7/@labels.1/@modelFacet /0/@diagram/@childNodes.48/@labels.1/@modelFacet /0/@diagram/@childNodes.45/@labels.1/@modelFacet /0/@diagram/@childNodes.97/@labels.1/@modelFacet /0/@diagram/@childNodes.98/@labels.1/@modelFacet /0/@diagram/@childNodes.99/@labels.1/@modelFacet /0/@diagram/@childNodes.100/@labels.1/@modelFacet /0/@diagram/@childNodes.101/@labels.1/@modelFacet /0/@diagram/@childNodes.106/@labels.1/@modelFacet /0/@diagram/@childNodes.107/@labels.1/@modelFacet /0/@diagram/@childNodes.108/@labels.1/@modelFacet /0/@diagram/@childNodes.109/@labels.1/@modelFacet /0/@diagram/@childNodes.113/@labels.1/@modelFacet /0/@diagram/@childNodes.114/@labels.1/@modelFacet /0/@diagram/@childNodes.117/@labels.1/@modelFacet /0/@diagram/@childNodes.118/@labels.1/@modelFacet /0/@diagram/@childNodes.122/@labels.1/@modelFacet /0/@diagram/@childNodes.123/@labels.1/@modelFacet /0/@diagram/@childNodes.126/@labels.1/@modelFacet /0/@diagram/@childNodes.127/@labels.1/@modelFacet /0/@diagram/@childNodes.130/@labels.1/@modelFacet /0/@diagram/@childNodes.131/@labels.1/@modelFacet" + uses="/0/@diagram/@childNodes.8/@labels.1/@modelFacet /0/@diagram/@childNodes.21/@labels.1/@modelFacet /0/@diagram/@childNodes.42/@labels.1/@modelFacet /0/@diagram/@childNodes.38/@labels.1/@modelFacet /0/@diagram/@childNodes.39/@labels.1/@modelFacet /0/@diagram/@childNodes.22/@labels.1/@modelFacet /0/@diagram/@childNodes.13/@labels.1/@modelFacet /0/@diagram/@childNodes.17/@labels.1/@modelFacet /0/@diagram/@childNodes.12/@labels.1/@modelFacet /0/@diagram/@childNodes.49/@labels.1/@modelFacet /0/@diagram/@childNodes.91/@labels.1/@modelFacet /0/@diagram/@childNodes.46/@labels.1/@modelFacet /0/@diagram/@childNodes.41/@labels.1/@modelFacet /0/@diagram/@childNodes.18/@labels.1/@modelFacet /0/@diagram/@childNodes.7/@labels.1/@modelFacet /0/@diagram/@childNodes.48/@labels.1/@modelFacet /0/@diagram/@childNodes.45/@labels.1/@modelFacet /0/@diagram/@childNodes.97/@labels.1/@modelFacet /0/@diagram/@childNodes.98/@labels.1/@modelFacet /0/@diagram/@childNodes.99/@labels.1/@modelFacet /0/@diagram/@childNodes.100/@labels.1/@modelFacet /0/@diagram/@childNodes.101/@labels.1/@modelFacet /0/@diagram/@childNodes.106/@labels.1/@modelFacet /0/@diagram/@childNodes.107/@labels.1/@modelFacet /0/@diagram/@childNodes.108/@labels.1/@modelFacet /0/@diagram/@childNodes.109/@labels.1/@modelFacet /0/@diagram/@childNodes.113/@labels.1/@modelFacet /0/@diagram/@childNodes.114/@labels.1/@modelFacet /0/@diagram/@childNodes.117/@labels.1/@modelFacet /0/@diagram/@childNodes.118/@labels.1/@modelFacet /0/@diagram/@childNodes.122/@labels.1/@modelFacet /0/@diagram/@childNodes.123/@labels.1/@modelFacet /0/@diagram/@childNodes.126/@labels.1/@modelFacet /0/@diagram/@childNodes.127/@labels.1/@modelFacet /0/@diagram/@childNodes.130/@labels.1/@modelFacet /0/@diagram/@childNodes.131/@labels.1/@modelFacet /0/@diagram/@childNodes.136/@labels.1/@modelFacet /0/@diagram/@childNodes.137/@labels.1/@modelFacet /0/@diagram/@childNodes.142/@labels.1/@modelFacet /0/@diagram/@childNodes.141/@labels.1/@modelFacet" qualifiedName="org.eclipse.papyrus.uml.diagram.activity.parser.custom.PinValueParser"/> <implementations xsi:type="gmfgen:CustomParser" @@ -22431,13 +23294,13 @@ <extensionNodes xsi:type="papyrusgmfgenextension:ExtendedGenView" comment="add superclass for floating Label" - genView="/0/@diagram/@childNodes.67/@labels.1 /0/@diagram/@childNodes.87/@labels.1 /0/@diagram/@childNodes.90/@labels.1 /0/@diagram/@childNodes.16/@labels.1 /0/@diagram/@childNodes.6/@labels.1 /0/@diagram/@childNodes.37/@labels.1 /0/@diagram/@childNodes.54/@labels.1 /0/@diagram/@childNodes.70/@labels.1 /0/@diagram/@childNodes.73/@labels.1 /0/@diagram/@childNodes.76/@labels.1 /0/@diagram/@childNodes.79/@labels.1 /0/@diagram/@childNodes.83/@labels.1 /0/@diagram/@childNodes.85/@labels.1 /0/@diagram/@childNodes.11/@labels.1 /0/@diagram/@childNodes.92/@labels.2 /0/@diagram/@childNodes.36/@labels.2 /0/@diagram/@childNodes.44/@labels.1 /0/@diagram/@childNodes.3/@labels.0 /0/@diagram/@childNodes.4/@labels.0 /0/@diagram/@childNodes.5/@labels.0 /0/@diagram/@childNodes.32/@labels.0 /0/@diagram/@childNodes.33/@labels.0 /0/@diagram/@childNodes.34/@labels.0 /0/@diagram/@childNodes.35/@labels.0 /0/@diagram/@childNodes.52/@labels.3 /0/@diagram/@childNodes.94/@labels.1 /0/@diagram/@childNodes.102/@labels.1 /0/@diagram/@childNodes.110/@labels.1 /0/@diagram/@childNodes.115/@labels.1 /0/@diagram/@childNodes.119/@labels.1 /0/@diagram/@childNodes.124/@labels.1 /0/@diagram/@childNodes.128/@labels.1 /0/@diagram/@childNodes.132/@labels.1" + genView="/0/@diagram/@childNodes.67/@labels.1 /0/@diagram/@childNodes.87/@labels.1 /0/@diagram/@childNodes.90/@labels.1 /0/@diagram/@childNodes.16/@labels.1 /0/@diagram/@childNodes.6/@labels.1 /0/@diagram/@childNodes.37/@labels.1 /0/@diagram/@childNodes.54/@labels.1 /0/@diagram/@childNodes.70/@labels.1 /0/@diagram/@childNodes.73/@labels.1 /0/@diagram/@childNodes.76/@labels.1 /0/@diagram/@childNodes.79/@labels.1 /0/@diagram/@childNodes.83/@labels.1 /0/@diagram/@childNodes.85/@labels.1 /0/@diagram/@childNodes.11/@labels.1 /0/@diagram/@childNodes.92/@labels.2 /0/@diagram/@childNodes.36/@labels.2 /0/@diagram/@childNodes.44/@labels.1 /0/@diagram/@childNodes.3/@labels.0 /0/@diagram/@childNodes.4/@labels.0 /0/@diagram/@childNodes.5/@labels.0 /0/@diagram/@childNodes.32/@labels.0 /0/@diagram/@childNodes.33/@labels.0 /0/@diagram/@childNodes.34/@labels.0 /0/@diagram/@childNodes.35/@labels.0 /0/@diagram/@childNodes.52/@labels.3 /0/@diagram/@childNodes.94/@labels.1 /0/@diagram/@childNodes.102/@labels.1 /0/@diagram/@childNodes.110/@labels.1 /0/@diagram/@childNodes.115/@labels.1 /0/@diagram/@childNodes.119/@labels.1 /0/@diagram/@childNodes.124/@labels.1 /0/@diagram/@childNodes.128/@labels.1 /0/@diagram/@childNodes.132/@labels.1 /0/@diagram/@childNodes.134/@labels.1 /0/@diagram/@childNodes.138/@labels.1" name="FloatingLabelEditPart" superOwnedEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.FloatingLabelEditPart"/> <extensionNodes xsi:type="papyrusgmfgenextension:ExtendedGenView" comment="Elements that inherits RoundedCompartmentEditPart" - genView="/0/@diagram/@childNodes.87 /0/@diagram/@childNodes.67 /0/@diagram/@childNodes.90 /0/@diagram/@childNodes.68 /0/@diagram/@childNodes.57 /0/@diagram/@childNodes.56 /0/@diagram/@childNodes.60 /0/@diagram/@childNodes.64 /0/@diagram/@childNodes.65 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.16 /0/@diagram/@childNodes.79 /0/@diagram/@childNodes.73 /0/@diagram/@childNodes.83 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.70 /0/@diagram/@childNodes.76 /0/@diagram/@childNodes.85 /0/@diagram/@childNodes.37 /0/@diagram/@childNodes.54 /0/@diagram/@childNodes.92 /0/@diagram/@childNodes.36 /0/@diagram/@childNodes.44 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.3 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.32 /0/@diagram/@childNodes.33 /0/@diagram/@childNodes.34 /0/@diagram/@childNodes.35 /0/@diagram/@childNodes.52 /0/@diagram/@childNodes.72 /0/@diagram/@topLevelNodes.0 /0/@diagram/@childNodes.94 /0/@diagram/@childNodes.102 /0/@diagram/@childNodes.110 /0/@diagram/@childNodes.115 /0/@diagram/@childNodes.119 /0/@diagram/@childNodes.124 /0/@diagram/@childNodes.128 /0/@diagram/@childNodes.132" + genView="/0/@diagram/@childNodes.87 /0/@diagram/@childNodes.67 /0/@diagram/@childNodes.90 /0/@diagram/@childNodes.68 /0/@diagram/@childNodes.57 /0/@diagram/@childNodes.56 /0/@diagram/@childNodes.60 /0/@diagram/@childNodes.64 /0/@diagram/@childNodes.65 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.16 /0/@diagram/@childNodes.79 /0/@diagram/@childNodes.73 /0/@diagram/@childNodes.83 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.70 /0/@diagram/@childNodes.76 /0/@diagram/@childNodes.85 /0/@diagram/@childNodes.37 /0/@diagram/@childNodes.54 /0/@diagram/@childNodes.92 /0/@diagram/@childNodes.36 /0/@diagram/@childNodes.44 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.3 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.32 /0/@diagram/@childNodes.33 /0/@diagram/@childNodes.34 /0/@diagram/@childNodes.35 /0/@diagram/@childNodes.52 /0/@diagram/@childNodes.72 /0/@diagram/@topLevelNodes.0 /0/@diagram/@childNodes.94 /0/@diagram/@childNodes.102 /0/@diagram/@childNodes.110 /0/@diagram/@childNodes.115 /0/@diagram/@childNodes.119 /0/@diagram/@childNodes.124 /0/@diagram/@childNodes.128 /0/@diagram/@childNodes.132 /0/@diagram/@childNodes.134 /0/@diagram/@childNodes.138" name="Rounded Compartment EP inheritance" superOwnedEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.RoundedCompartmentEditPart"/> <extensionNodes @@ -22461,7 +23324,7 @@ xsi:type="papyrusgmfgenextension:SpecificLocator" comment="Affixed Pin locator for Actions" classpath="org.eclipse.papyrus.uml.diagram.activity.locator.PinPositionLocator" - genChildSideAffixedNode="/0/@diagram/@childNodes.38 /0/@diagram/@childNodes.39 /0/@diagram/@childNodes.40 /0/@diagram/@childNodes.41 /0/@diagram/@childNodes.42 /0/@diagram/@childNodes.43 /0/@diagram/@childNodes.45 /0/@diagram/@childNodes.46 /0/@diagram/@childNodes.47 /0/@diagram/@childNodes.7 /0/@diagram/@childNodes.8 /0/@diagram/@childNodes.9 /0/@diagram/@childNodes.10 /0/@diagram/@childNodes.12 /0/@diagram/@childNodes.13 /0/@diagram/@childNodes.14 /0/@diagram/@childNodes.15 /0/@diagram/@childNodes.17 /0/@diagram/@childNodes.18 /0/@diagram/@childNodes.19 /0/@diagram/@childNodes.20 /0/@diagram/@childNodes.21 /0/@diagram/@childNodes.22 /0/@diagram/@childNodes.23 /0/@diagram/@childNodes.48 /0/@diagram/@childNodes.49 /0/@diagram/@childNodes.50 /0/@diagram/@childNodes.53 /0/@diagram/@childNodes.55 /0/@diagram/@childNodes.71 /0/@diagram/@childNodes.74 /0/@diagram/@childNodes.77 /0/@diagram/@childNodes.78 /0/@diagram/@childNodes.80 /0/@diagram/@childNodes.81 /0/@diagram/@childNodes.82 /0/@diagram/@childNodes.84 /0/@diagram/@childNodes.86 /0/@diagram/@childNodes.88 /0/@diagram/@childNodes.89 /0/@diagram/@childNodes.91 /0/@diagram/@childNodes.66 /0/@diagram/@childNodes.95 /0/@diagram/@childNodes.96 /0/@diagram/@childNodes.97 /0/@diagram/@childNodes.98 /0/@diagram/@childNodes.99 /0/@diagram/@childNodes.100 /0/@diagram/@childNodes.101 /0/@diagram/@childNodes.103 /0/@diagram/@childNodes.104 /0/@diagram/@childNodes.105 /0/@diagram/@childNodes.106 /0/@diagram/@childNodes.107 /0/@diagram/@childNodes.108 /0/@diagram/@childNodes.109 /0/@diagram/@childNodes.111 /0/@diagram/@childNodes.112 /0/@diagram/@childNodes.113 /0/@diagram/@childNodes.114 /0/@diagram/@childNodes.116 /0/@diagram/@childNodes.117 /0/@diagram/@childNodes.118 /0/@diagram/@childNodes.120 /0/@diagram/@childNodes.121 /0/@diagram/@childNodes.122 /0/@diagram/@childNodes.123 /0/@diagram/@childNodes.125 /0/@diagram/@childNodes.126 /0/@diagram/@childNodes.127 /0/@diagram/@childNodes.129 /0/@diagram/@childNodes.130 /0/@diagram/@childNodes.131 /0/@diagram/@childNodes.133"/> + genChildSideAffixedNode="/0/@diagram/@childNodes.38 /0/@diagram/@childNodes.39 /0/@diagram/@childNodes.40 /0/@diagram/@childNodes.41 /0/@diagram/@childNodes.42 /0/@diagram/@childNodes.43 /0/@diagram/@childNodes.45 /0/@diagram/@childNodes.46 /0/@diagram/@childNodes.47 /0/@diagram/@childNodes.7 /0/@diagram/@childNodes.8 /0/@diagram/@childNodes.9 /0/@diagram/@childNodes.10 /0/@diagram/@childNodes.12 /0/@diagram/@childNodes.13 /0/@diagram/@childNodes.14 /0/@diagram/@childNodes.15 /0/@diagram/@childNodes.17 /0/@diagram/@childNodes.18 /0/@diagram/@childNodes.19 /0/@diagram/@childNodes.20 /0/@diagram/@childNodes.21 /0/@diagram/@childNodes.22 /0/@diagram/@childNodes.23 /0/@diagram/@childNodes.48 /0/@diagram/@childNodes.49 /0/@diagram/@childNodes.50 /0/@diagram/@childNodes.53 /0/@diagram/@childNodes.55 /0/@diagram/@childNodes.71 /0/@diagram/@childNodes.74 /0/@diagram/@childNodes.77 /0/@diagram/@childNodes.78 /0/@diagram/@childNodes.80 /0/@diagram/@childNodes.81 /0/@diagram/@childNodes.82 /0/@diagram/@childNodes.84 /0/@diagram/@childNodes.86 /0/@diagram/@childNodes.88 /0/@diagram/@childNodes.89 /0/@diagram/@childNodes.91 /0/@diagram/@childNodes.66 /0/@diagram/@childNodes.95 /0/@diagram/@childNodes.96 /0/@diagram/@childNodes.97 /0/@diagram/@childNodes.98 /0/@diagram/@childNodes.99 /0/@diagram/@childNodes.100 /0/@diagram/@childNodes.101 /0/@diagram/@childNodes.103 /0/@diagram/@childNodes.104 /0/@diagram/@childNodes.105 /0/@diagram/@childNodes.106 /0/@diagram/@childNodes.107 /0/@diagram/@childNodes.108 /0/@diagram/@childNodes.109 /0/@diagram/@childNodes.111 /0/@diagram/@childNodes.112 /0/@diagram/@childNodes.113 /0/@diagram/@childNodes.114 /0/@diagram/@childNodes.116 /0/@diagram/@childNodes.117 /0/@diagram/@childNodes.118 /0/@diagram/@childNodes.120 /0/@diagram/@childNodes.121 /0/@diagram/@childNodes.122 /0/@diagram/@childNodes.123 /0/@diagram/@childNodes.125 /0/@diagram/@childNodes.126 /0/@diagram/@childNodes.127 /0/@diagram/@childNodes.129 /0/@diagram/@childNodes.130 /0/@diagram/@childNodes.131 /0/@diagram/@childNodes.133 /0/@diagram/@childNodes.135 /0/@diagram/@childNodes.136 /0/@diagram/@childNodes.137 /0/@diagram/@childNodes.139 /0/@diagram/@childNodes.140 /0/@diagram/@childNodes.141 /0/@diagram/@childNodes.142"/> <extensionNodes xsi:type="papyrusgmfgenextension:SpecificLocator" comment="Affixed Activity Parameter Node locator for Activity" @@ -22553,24 +23416,24 @@ xsi:type="papyrusgmfgenextension:EditPartUsingDeleteService" comment="" name="Delete service elements" - genView="/0/@diagram/@childNodes.7 /0/@diagram/@childNodes.8 /0/@diagram/@childNodes.9 /0/@diagram/@childNodes.10 /0/@diagram/@childNodes.12 /0/@diagram/@childNodes.13 /0/@diagram/@childNodes.14 /0/@diagram/@childNodes.15 /0/@diagram/@childNodes.17 /0/@diagram/@childNodes.18 /0/@diagram/@childNodes.19 /0/@diagram/@childNodes.20 /0/@diagram/@childNodes.21 /0/@diagram/@childNodes.22 /0/@diagram/@childNodes.23 /0/@diagram/@childNodes.38 /0/@diagram/@childNodes.39 /0/@diagram/@childNodes.40 /0/@diagram/@childNodes.41 /0/@diagram/@childNodes.42 /0/@diagram/@childNodes.43 /0/@diagram/@childNodes.45 /0/@diagram/@childNodes.46 /0/@diagram/@childNodes.47 /0/@diagram/@childNodes.48 /0/@diagram/@childNodes.49 /0/@diagram/@childNodes.50 /0/@diagram/@childNodes.53 /0/@diagram/@childNodes.55 /0/@diagram/@childNodes.56 /0/@diagram/@childNodes.60 /0/@diagram/@childNodes.64 /0/@diagram/@childNodes.65 /0/@diagram/@childNodes.77 /0/@diagram/@childNodes.78 /0/@diagram/@childNodes.80 /0/@diagram/@childNodes.81 /0/@diagram/@childNodes.82 /0/@diagram/@childNodes.84 /0/@diagram/@childNodes.86 /0/@diagram/@childNodes.88 /0/@diagram/@childNodes.89 /0/@diagram/@childNodes.91 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.16 /0/@diagram/@childNodes.3 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.32 /0/@diagram/@childNodes.33 /0/@diagram/@childNodes.34 /0/@diagram/@childNodes.35 /0/@diagram/@childNodes.36 /0/@diagram/@childNodes.37 /0/@diagram/@childNodes.44 /0/@diagram/@childNodes.52 /0/@diagram/@childNodes.54 /0/@diagram/@childNodes.83 /0/@diagram/@childNodes.85 /0/@diagram/@childNodes.87 /0/@diagram/@childNodes.90 /0/@diagram/@childNodes.92 /0/@diagram/@childNodes.73 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.76 /0/@diagram/@childNodes.72 /0/@diagram/@childNodes.68 /0/@diagram/@childNodes.67 /0/@diagram/@topLevelNodes.0 /0/@diagram/@childNodes.51 /0/@diagram/@childNodes.79 /0/@diagram/@childNodes.69 /0/@diagram/@childNodes.31 /0/@diagram/@childNodes.30 /0/@diagram/@childNodes.2 /0/@diagram/@childNodes.1 /0/@diagram/@childNodes.93 /0/@diagram/@links.3 /0/@diagram/@childNodes.24 /0/@diagram/@childNodes.25 /0/@diagram/@childNodes.57 /0/@diagram/@childNodes.66 /0/@diagram/@childNodes.70 /0/@diagram/@childNodes.71 /0/@diagram/@childNodes.75 /0/@diagram/@links.4 /0/@diagram/@links.2 /0/@diagram/@childNodes.74 /0/@diagram/@childNodes.61 /0/@diagram/@childNodes.63/@labels.0 /0/@diagram/@childNodes.62 /0/@diagram/@childNodes.63 /0/@diagram/@childNodes.58 /0/@diagram/@childNodes.59 /0/@diagram/@childNodes.94 /0/@diagram/@childNodes.95 /0/@diagram/@childNodes.96 /0/@diagram/@childNodes.97 /0/@diagram/@childNodes.98 /0/@diagram/@childNodes.99 /0/@diagram/@childNodes.100 /0/@diagram/@childNodes.101 /0/@diagram/@childNodes.102 /0/@diagram/@childNodes.103 /0/@diagram/@childNodes.104 /0/@diagram/@childNodes.105 /0/@diagram/@childNodes.106 /0/@diagram/@childNodes.107 /0/@diagram/@childNodes.108 /0/@diagram/@childNodes.109 /0/@diagram/@childNodes.111 /0/@diagram/@childNodes.112 /0/@diagram/@childNodes.113 /0/@diagram/@childNodes.114 /0/@diagram/@childNodes.110 /0/@diagram/@childNodes.116 /0/@diagram/@childNodes.117 /0/@diagram/@childNodes.118 /0/@diagram/@childNodes.120 /0/@diagram/@childNodes.121 /0/@diagram/@childNodes.122 /0/@diagram/@childNodes.123 /0/@diagram/@childNodes.125 /0/@diagram/@childNodes.126 /0/@diagram/@childNodes.127 /0/@diagram/@childNodes.115 /0/@diagram/@childNodes.119 /0/@diagram/@childNodes.124 /0/@diagram/@childNodes.128 /0/@diagram/@childNodes.129 /0/@diagram/@childNodes.130 /0/@diagram/@childNodes.131 /0/@diagram/@childNodes.132 /0/@diagram/@childNodes.133"/> + genView="/0/@diagram/@childNodes.7 /0/@diagram/@childNodes.8 /0/@diagram/@childNodes.9 /0/@diagram/@childNodes.10 /0/@diagram/@childNodes.12 /0/@diagram/@childNodes.13 /0/@diagram/@childNodes.14 /0/@diagram/@childNodes.15 /0/@diagram/@childNodes.17 /0/@diagram/@childNodes.18 /0/@diagram/@childNodes.19 /0/@diagram/@childNodes.20 /0/@diagram/@childNodes.21 /0/@diagram/@childNodes.22 /0/@diagram/@childNodes.23 /0/@diagram/@childNodes.38 /0/@diagram/@childNodes.39 /0/@diagram/@childNodes.40 /0/@diagram/@childNodes.41 /0/@diagram/@childNodes.42 /0/@diagram/@childNodes.43 /0/@diagram/@childNodes.45 /0/@diagram/@childNodes.46 /0/@diagram/@childNodes.47 /0/@diagram/@childNodes.48 /0/@diagram/@childNodes.49 /0/@diagram/@childNodes.50 /0/@diagram/@childNodes.53 /0/@diagram/@childNodes.55 /0/@diagram/@childNodes.56 /0/@diagram/@childNodes.60 /0/@diagram/@childNodes.64 /0/@diagram/@childNodes.65 /0/@diagram/@childNodes.77 /0/@diagram/@childNodes.78 /0/@diagram/@childNodes.80 /0/@diagram/@childNodes.81 /0/@diagram/@childNodes.82 /0/@diagram/@childNodes.84 /0/@diagram/@childNodes.86 /0/@diagram/@childNodes.88 /0/@diagram/@childNodes.89 /0/@diagram/@childNodes.91 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.16 /0/@diagram/@childNodes.3 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.32 /0/@diagram/@childNodes.33 /0/@diagram/@childNodes.34 /0/@diagram/@childNodes.35 /0/@diagram/@childNodes.36 /0/@diagram/@childNodes.37 /0/@diagram/@childNodes.44 /0/@diagram/@childNodes.52 /0/@diagram/@childNodes.54 /0/@diagram/@childNodes.83 /0/@diagram/@childNodes.85 /0/@diagram/@childNodes.87 /0/@diagram/@childNodes.90 /0/@diagram/@childNodes.92 /0/@diagram/@childNodes.73 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.76 /0/@diagram/@childNodes.72 /0/@diagram/@childNodes.68 /0/@diagram/@childNodes.67 /0/@diagram/@topLevelNodes.0 /0/@diagram/@childNodes.51 /0/@diagram/@childNodes.79 /0/@diagram/@childNodes.69 /0/@diagram/@childNodes.31 /0/@diagram/@childNodes.30 /0/@diagram/@childNodes.2 /0/@diagram/@childNodes.1 /0/@diagram/@childNodes.93 /0/@diagram/@links.3 /0/@diagram/@childNodes.24 /0/@diagram/@childNodes.25 /0/@diagram/@childNodes.57 /0/@diagram/@childNodes.66 /0/@diagram/@childNodes.70 /0/@diagram/@childNodes.71 /0/@diagram/@childNodes.75 /0/@diagram/@links.4 /0/@diagram/@links.2 /0/@diagram/@childNodes.74 /0/@diagram/@childNodes.61 /0/@diagram/@childNodes.63/@labels.0 /0/@diagram/@childNodes.62 /0/@diagram/@childNodes.63 /0/@diagram/@childNodes.58 /0/@diagram/@childNodes.59 /0/@diagram/@childNodes.94 /0/@diagram/@childNodes.95 /0/@diagram/@childNodes.96 /0/@diagram/@childNodes.97 /0/@diagram/@childNodes.98 /0/@diagram/@childNodes.99 /0/@diagram/@childNodes.100 /0/@diagram/@childNodes.101 /0/@diagram/@childNodes.102 /0/@diagram/@childNodes.103 /0/@diagram/@childNodes.104 /0/@diagram/@childNodes.105 /0/@diagram/@childNodes.106 /0/@diagram/@childNodes.107 /0/@diagram/@childNodes.108 /0/@diagram/@childNodes.109 /0/@diagram/@childNodes.111 /0/@diagram/@childNodes.112 /0/@diagram/@childNodes.113 /0/@diagram/@childNodes.114 /0/@diagram/@childNodes.110 /0/@diagram/@childNodes.116 /0/@diagram/@childNodes.117 /0/@diagram/@childNodes.118 /0/@diagram/@childNodes.120 /0/@diagram/@childNodes.121 /0/@diagram/@childNodes.122 /0/@diagram/@childNodes.123 /0/@diagram/@childNodes.125 /0/@diagram/@childNodes.126 /0/@diagram/@childNodes.127 /0/@diagram/@childNodes.115 /0/@diagram/@childNodes.119 /0/@diagram/@childNodes.124 /0/@diagram/@childNodes.128 /0/@diagram/@childNodes.129 /0/@diagram/@childNodes.130 /0/@diagram/@childNodes.131 /0/@diagram/@childNodes.132 /0/@diagram/@childNodes.133 /0/@diagram/@childNodes.135 /0/@diagram/@childNodes.136 /0/@diagram/@childNodes.137 /0/@diagram/@childNodes.139 /0/@diagram/@childNodes.140 /0/@diagram/@childNodes.141 /0/@diagram/@childNodes.142 /0/@diagram/@childNodes.134 /0/@diagram/@childNodes.138"/> <extensionNodes xsi:type="papyrusgmfgenextension:ExtendedGenView" comment="set the super class as AbstractLabelEditPart" - genView="/0/@diagram/@childNodes.3/@labels.1 /0/@diagram/@childNodes.4/@labels.1 /0/@diagram/@childNodes.5/@labels.1 /0/@diagram/@childNodes.7/@labels.2 /0/@diagram/@childNodes.8/@labels.2 /0/@diagram/@childNodes.9/@labels.1 /0/@diagram/@childNodes.10/@labels.1 /0/@diagram/@childNodes.12/@labels.2 /0/@diagram/@childNodes.13/@labels.2 /0/@diagram/@childNodes.14/@labels.1 /0/@diagram/@childNodes.15/@labels.1 /0/@diagram/@childNodes.17/@labels.2 /0/@diagram/@childNodes.18/@labels.2 /0/@diagram/@childNodes.19/@labels.1 /0/@diagram/@childNodes.20/@labels.1 /0/@diagram/@childNodes.21/@labels.2 /0/@diagram/@childNodes.22/@labels.2 /0/@diagram/@childNodes.23/@labels.1 /0/@diagram/@childNodes.32/@labels.2 /0/@diagram/@childNodes.33/@labels.1 /0/@diagram/@childNodes.34/@labels.1 /0/@diagram/@childNodes.35/@labels.2 /0/@diagram/@childNodes.38/@labels.2 /0/@diagram/@childNodes.39/@labels.2 /0/@diagram/@childNodes.40/@labels.1 /0/@diagram/@childNodes.41/@labels.2 /0/@diagram/@childNodes.42/@labels.2 /0/@diagram/@childNodes.43/@labels.1 /0/@diagram/@childNodes.45/@labels.2 /0/@diagram/@childNodes.46/@labels.2 /0/@diagram/@childNodes.47/@labels.1 /0/@diagram/@childNodes.48/@labels.2 /0/@diagram/@childNodes.49/@labels.2 /0/@diagram/@childNodes.50/@labels.1 /0/@diagram/@childNodes.52/@labels.2 /0/@diagram/@childNodes.53/@labels.1 /0/@diagram/@childNodes.55/@labels.1 /0/@diagram/@childNodes.71/@labels.1 /0/@diagram/@childNodes.74/@labels.1 /0/@diagram/@childNodes.77/@labels.1 /0/@diagram/@childNodes.80/@labels.1 /0/@diagram/@childNodes.81/@labels.1 /0/@diagram/@childNodes.82/@labels.1 /0/@diagram/@childNodes.84/@labels.1 /0/@diagram/@childNodes.86/@labels.1 /0/@diagram/@childNodes.88/@labels.1 /0/@diagram/@childNodes.89/@labels.1 /0/@diagram/@childNodes.91/@labels.2 /0/@diagram/@childNodes.61/@labels.1 /0/@diagram/@childNodes.62/@labels.1 /0/@diagram/@childNodes.63/@labels.1 /0/@diagram/@childNodes.66/@labels.1 /0/@diagram/@childNodes.103/@labels.1 /0/@diagram/@childNodes.104/@labels.1 /0/@diagram/@childNodes.105/@labels.1 /0/@diagram/@childNodes.106/@labels.2 /0/@diagram/@childNodes.107/@labels.2 /0/@diagram/@childNodes.108/@labels.2 /0/@diagram/@childNodes.109/@labels.2 /0/@diagram/@childNodes.111/@labels.1 /0/@diagram/@childNodes.112/@labels.1 /0/@diagram/@childNodes.113/@labels.2 /0/@diagram/@childNodes.114/@labels.2 /0/@diagram/@childNodes.116/@labels.1 /0/@diagram/@childNodes.117/@labels.2 /0/@diagram/@childNodes.118/@labels.2 /0/@diagram/@childNodes.120/@labels.1 /0/@diagram/@childNodes.121/@labels.1 /0/@diagram/@childNodes.122/@labels.2 /0/@diagram/@childNodes.123/@labels.2 /0/@diagram/@childNodes.125/@labels.1 /0/@diagram/@childNodes.126/@labels.2 /0/@diagram/@childNodes.127/@labels.2 /0/@diagram/@childNodes.129/@labels.1 /0/@diagram/@childNodes.130/@labels.2 /0/@diagram/@childNodes.131/@labels.2 /0/@diagram/@childNodes.133/@labels.0 /0/@diagram/@childNodes.133/@labels.1" + genView="/0/@diagram/@childNodes.3/@labels.1 /0/@diagram/@childNodes.4/@labels.1 /0/@diagram/@childNodes.5/@labels.1 /0/@diagram/@childNodes.7/@labels.2 /0/@diagram/@childNodes.8/@labels.2 /0/@diagram/@childNodes.9/@labels.1 /0/@diagram/@childNodes.10/@labels.1 /0/@diagram/@childNodes.12/@labels.2 /0/@diagram/@childNodes.13/@labels.2 /0/@diagram/@childNodes.14/@labels.1 /0/@diagram/@childNodes.15/@labels.1 /0/@diagram/@childNodes.17/@labels.2 /0/@diagram/@childNodes.18/@labels.2 /0/@diagram/@childNodes.19/@labels.1 /0/@diagram/@childNodes.20/@labels.1 /0/@diagram/@childNodes.21/@labels.2 /0/@diagram/@childNodes.22/@labels.2 /0/@diagram/@childNodes.23/@labels.1 /0/@diagram/@childNodes.32/@labels.2 /0/@diagram/@childNodes.33/@labels.1 /0/@diagram/@childNodes.34/@labels.1 /0/@diagram/@childNodes.35/@labels.2 /0/@diagram/@childNodes.38/@labels.2 /0/@diagram/@childNodes.39/@labels.2 /0/@diagram/@childNodes.40/@labels.1 /0/@diagram/@childNodes.41/@labels.2 /0/@diagram/@childNodes.42/@labels.2 /0/@diagram/@childNodes.43/@labels.1 /0/@diagram/@childNodes.45/@labels.2 /0/@diagram/@childNodes.46/@labels.2 /0/@diagram/@childNodes.47/@labels.1 /0/@diagram/@childNodes.48/@labels.2 /0/@diagram/@childNodes.49/@labels.2 /0/@diagram/@childNodes.50/@labels.1 /0/@diagram/@childNodes.52/@labels.2 /0/@diagram/@childNodes.53/@labels.1 /0/@diagram/@childNodes.55/@labels.1 /0/@diagram/@childNodes.71/@labels.1 /0/@diagram/@childNodes.74/@labels.1 /0/@diagram/@childNodes.77/@labels.1 /0/@diagram/@childNodes.80/@labels.1 /0/@diagram/@childNodes.81/@labels.1 /0/@diagram/@childNodes.82/@labels.1 /0/@diagram/@childNodes.84/@labels.1 /0/@diagram/@childNodes.86/@labels.1 /0/@diagram/@childNodes.88/@labels.1 /0/@diagram/@childNodes.89/@labels.1 /0/@diagram/@childNodes.91/@labels.2 /0/@diagram/@childNodes.61/@labels.1 /0/@diagram/@childNodes.62/@labels.1 /0/@diagram/@childNodes.63/@labels.1 /0/@diagram/@childNodes.66/@labels.1 /0/@diagram/@childNodes.103/@labels.1 /0/@diagram/@childNodes.104/@labels.1 /0/@diagram/@childNodes.105/@labels.1 /0/@diagram/@childNodes.106/@labels.2 /0/@diagram/@childNodes.107/@labels.2 /0/@diagram/@childNodes.108/@labels.2 /0/@diagram/@childNodes.109/@labels.2 /0/@diagram/@childNodes.111/@labels.1 /0/@diagram/@childNodes.112/@labels.1 /0/@diagram/@childNodes.113/@labels.2 /0/@diagram/@childNodes.114/@labels.2 /0/@diagram/@childNodes.116/@labels.1 /0/@diagram/@childNodes.117/@labels.2 /0/@diagram/@childNodes.118/@labels.2 /0/@diagram/@childNodes.120/@labels.1 /0/@diagram/@childNodes.121/@labels.1 /0/@diagram/@childNodes.122/@labels.2 /0/@diagram/@childNodes.123/@labels.2 /0/@diagram/@childNodes.125/@labels.1 /0/@diagram/@childNodes.126/@labels.2 /0/@diagram/@childNodes.127/@labels.2 /0/@diagram/@childNodes.129/@labels.1 /0/@diagram/@childNodes.130/@labels.2 /0/@diagram/@childNodes.131/@labels.2 /0/@diagram/@childNodes.133/@labels.0 /0/@diagram/@childNodes.133/@labels.1 /0/@diagram/@childNodes.135/@labels.1 /0/@diagram/@childNodes.136/@labels.2 /0/@diagram/@childNodes.137/@labels.2 /0/@diagram/@childNodes.139/@labels.1 /0/@diagram/@childNodes.140/@labels.1 /0/@diagram/@childNodes.141/@labels.2 /0/@diagram/@childNodes.142/@labels.2" name="AbstractLabelEditPart" superOwnedEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.AbstractLabelEditPart"/> <extensionNodes xsi:type="papyrusgmfgenextension:ExtendedGenView" comment="contains methods to display arrows" - genView="/0/@diagram/@childNodes.13 /0/@diagram/@childNodes.22 /0/@diagram/@childNodes.17 /0/@diagram/@childNodes.8 /0/@diagram/@childNodes.39 /0/@diagram/@childNodes.42 /0/@diagram/@childNodes.49 /0/@diagram/@childNodes.45 /0/@diagram/@childNodes.80 /0/@diagram/@childNodes.81 /0/@diagram/@childNodes.88 /0/@diagram/@childNodes.89 /0/@diagram/@childNodes.91 /0/@diagram/@childNodes.14 /0/@diagram/@childNodes.23 /0/@diagram/@childNodes.19 /0/@diagram/@childNodes.84 /0/@diagram/@childNodes.9 /0/@diagram/@childNodes.77 /0/@diagram/@childNodes.40 /0/@diagram/@childNodes.43 /0/@diagram/@childNodes.50 /0/@diagram/@childNodes.47 /0/@diagram/@childNodes.53 /0/@diagram/@childNodes.82 /0/@diagram/@childNodes.15 /0/@diagram/@childNodes.20 /0/@diagram/@childNodes.74 /0/@diagram/@childNodes.10 /0/@diagram/@childNodes.78 /0/@diagram/@childNodes.86 /0/@diagram/@childNodes.55 /0/@diagram/@childNodes.12 /0/@diagram/@childNodes.21 /0/@diagram/@childNodes.18 /0/@diagram/@childNodes.7 /0/@diagram/@childNodes.38 /0/@diagram/@childNodes.41 /0/@diagram/@childNodes.48 /0/@diagram/@childNodes.46 /0/@diagram/@childNodes.71 /0/@diagram/@childNodes.95 /0/@diagram/@childNodes.96 /0/@diagram/@childNodes.97 /0/@diagram/@childNodes.98 /0/@diagram/@childNodes.99 /0/@diagram/@childNodes.100 /0/@diagram/@childNodes.101 /0/@diagram/@childNodes.103 /0/@diagram/@childNodes.104 /0/@diagram/@childNodes.105 /0/@diagram/@childNodes.106 /0/@diagram/@childNodes.107 /0/@diagram/@childNodes.108 /0/@diagram/@childNodes.109 /0/@diagram/@childNodes.111 /0/@diagram/@childNodes.112 /0/@diagram/@childNodes.113 /0/@diagram/@childNodes.114 /0/@diagram/@childNodes.116 /0/@diagram/@childNodes.117 /0/@diagram/@childNodes.118 /0/@diagram/@childNodes.120 /0/@diagram/@childNodes.121 /0/@diagram/@childNodes.122 /0/@diagram/@childNodes.123 /0/@diagram/@childNodes.125 /0/@diagram/@childNodes.126 /0/@diagram/@childNodes.127 /0/@diagram/@childNodes.129 /0/@diagram/@childNodes.130 /0/@diagram/@childNodes.131 /0/@diagram/@childNodes.133" + genView="/0/@diagram/@childNodes.13 /0/@diagram/@childNodes.22 /0/@diagram/@childNodes.17 /0/@diagram/@childNodes.8 /0/@diagram/@childNodes.39 /0/@diagram/@childNodes.42 /0/@diagram/@childNodes.49 /0/@diagram/@childNodes.45 /0/@diagram/@childNodes.80 /0/@diagram/@childNodes.81 /0/@diagram/@childNodes.88 /0/@diagram/@childNodes.89 /0/@diagram/@childNodes.91 /0/@diagram/@childNodes.14 /0/@diagram/@childNodes.23 /0/@diagram/@childNodes.19 /0/@diagram/@childNodes.84 /0/@diagram/@childNodes.9 /0/@diagram/@childNodes.77 /0/@diagram/@childNodes.40 /0/@diagram/@childNodes.43 /0/@diagram/@childNodes.50 /0/@diagram/@childNodes.47 /0/@diagram/@childNodes.53 /0/@diagram/@childNodes.82 /0/@diagram/@childNodes.15 /0/@diagram/@childNodes.20 /0/@diagram/@childNodes.74 /0/@diagram/@childNodes.10 /0/@diagram/@childNodes.78 /0/@diagram/@childNodes.86 /0/@diagram/@childNodes.55 /0/@diagram/@childNodes.12 /0/@diagram/@childNodes.21 /0/@diagram/@childNodes.18 /0/@diagram/@childNodes.7 /0/@diagram/@childNodes.38 /0/@diagram/@childNodes.41 /0/@diagram/@childNodes.48 /0/@diagram/@childNodes.46 /0/@diagram/@childNodes.71 /0/@diagram/@childNodes.95 /0/@diagram/@childNodes.96 /0/@diagram/@childNodes.97 /0/@diagram/@childNodes.98 /0/@diagram/@childNodes.99 /0/@diagram/@childNodes.100 /0/@diagram/@childNodes.101 /0/@diagram/@childNodes.103 /0/@diagram/@childNodes.104 /0/@diagram/@childNodes.105 /0/@diagram/@childNodes.106 /0/@diagram/@childNodes.107 /0/@diagram/@childNodes.108 /0/@diagram/@childNodes.109 /0/@diagram/@childNodes.111 /0/@diagram/@childNodes.112 /0/@diagram/@childNodes.113 /0/@diagram/@childNodes.114 /0/@diagram/@childNodes.116 /0/@diagram/@childNodes.117 /0/@diagram/@childNodes.118 /0/@diagram/@childNodes.120 /0/@diagram/@childNodes.121 /0/@diagram/@childNodes.122 /0/@diagram/@childNodes.123 /0/@diagram/@childNodes.125 /0/@diagram/@childNodes.126 /0/@diagram/@childNodes.127 /0/@diagram/@childNodes.129 /0/@diagram/@childNodes.130 /0/@diagram/@childNodes.131 /0/@diagram/@childNodes.133 /0/@diagram/@childNodes.135 /0/@diagram/@childNodes.136 /0/@diagram/@childNodes.137 /0/@diagram/@childNodes.139 /0/@diagram/@childNodes.140 /0/@diagram/@childNodes.141 /0/@diagram/@childNodes.142" name="AbstractPinEditPart" superOwnedEditPart="org.eclipse.papyrus.uml.diagram.activity.edit.part.AbstractPinEditPart"/> <extensionNodes xsi:type="papyrusgmfgenextension:SpecificLocatorExternalLabel" comment="locator for external label of pins" classpath="org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator" - genExternalNodeLabel="/0/@diagram/@childNodes.75/@labels.0 /0/@diagram/@childNodes.3/@labels.1 /0/@diagram/@childNodes.4/@labels.1 /0/@diagram/@childNodes.5/@labels.1 /0/@diagram/@childNodes.7/@labels.2 /0/@diagram/@childNodes.8/@labels.2 /0/@diagram/@childNodes.9/@labels.1 /0/@diagram/@childNodes.10/@labels.1 /0/@diagram/@childNodes.12/@labels.2 /0/@diagram/@childNodes.13/@labels.2 /0/@diagram/@childNodes.14/@labels.1 /0/@diagram/@childNodes.15/@labels.1 /0/@diagram/@childNodes.17/@labels.2 /0/@diagram/@childNodes.18/@labels.2 /0/@diagram/@childNodes.19/@labels.1 /0/@diagram/@childNodes.20/@labels.1 /0/@diagram/@childNodes.21/@labels.2 /0/@diagram/@childNodes.22/@labels.2 /0/@diagram/@childNodes.23/@labels.1 /0/@diagram/@childNodes.32/@labels.2 /0/@diagram/@childNodes.33/@labels.1 /0/@diagram/@childNodes.34/@labels.1 /0/@diagram/@childNodes.35/@labels.2 /0/@diagram/@childNodes.38/@labels.2 /0/@diagram/@childNodes.39/@labels.2 /0/@diagram/@childNodes.40/@labels.1 /0/@diagram/@childNodes.41/@labels.2 /0/@diagram/@childNodes.42/@labels.2 /0/@diagram/@childNodes.43/@labels.1 /0/@diagram/@childNodes.45/@labels.2 /0/@diagram/@childNodes.46/@labels.2 /0/@diagram/@childNodes.47/@labels.1 /0/@diagram/@childNodes.48/@labels.2 /0/@diagram/@childNodes.49/@labels.2 /0/@diagram/@childNodes.50/@labels.1 /0/@diagram/@childNodes.52/@labels.2 /0/@diagram/@childNodes.53/@labels.1 /0/@diagram/@childNodes.55/@labels.1 /0/@diagram/@childNodes.71/@labels.1 /0/@diagram/@childNodes.74/@labels.1 /0/@diagram/@childNodes.77/@labels.1 /0/@diagram/@childNodes.80/@labels.1 /0/@diagram/@childNodes.81/@labels.1 /0/@diagram/@childNodes.82/@labels.1 /0/@diagram/@childNodes.84/@labels.1 /0/@diagram/@childNodes.86/@labels.1 /0/@diagram/@childNodes.88/@labels.1 /0/@diagram/@childNodes.89/@labels.1 /0/@diagram/@childNodes.91/@labels.2 /0/@diagram/@childNodes.63/@labels.0 /0/@diagram/@childNodes.61/@labels.1 /0/@diagram/@childNodes.62/@labels.1 /0/@diagram/@childNodes.63/@labels.1 /0/@diagram/@childNodes.66/@labels.1 /0/@diagram/@childNodes.53/@labels.0 /0/@diagram/@childNodes.7/@labels.0 /0/@diagram/@childNodes.7/@labels.1 /0/@diagram/@childNodes.8/@labels.0 /0/@diagram/@childNodes.8/@labels.1 /0/@diagram/@childNodes.9/@labels.0 /0/@diagram/@childNodes.10/@labels.0 /0/@diagram/@childNodes.12/@labels.0 /0/@diagram/@childNodes.12/@labels.1 /0/@diagram/@childNodes.13/@labels.0 /0/@diagram/@childNodes.13/@labels.1 /0/@diagram/@childNodes.14/@labels.0 /0/@diagram/@childNodes.15/@labels.0 /0/@diagram/@childNodes.17/@labels.0 /0/@diagram/@childNodes.17/@labels.1 /0/@diagram/@childNodes.18/@labels.0 /0/@diagram/@childNodes.18/@labels.1 /0/@diagram/@childNodes.19/@labels.0 /0/@diagram/@childNodes.20/@labels.0 /0/@diagram/@childNodes.21/@labels.0 /0/@diagram/@childNodes.21/@labels.1 /0/@diagram/@childNodes.22/@labels.0 /0/@diagram/@childNodes.22/@labels.1 /0/@diagram/@childNodes.23/@labels.0 /0/@diagram/@childNodes.32/@labels.1 /0/@diagram/@childNodes.35/@labels.1 /0/@diagram/@childNodes.36/@labels.1 /0/@diagram/@childNodes.38/@labels.0 /0/@diagram/@childNodes.38/@labels.1 /0/@diagram/@childNodes.39/@labels.0 /0/@diagram/@childNodes.39/@labels.1 /0/@diagram/@childNodes.40/@labels.0 /0/@diagram/@childNodes.41/@labels.0 /0/@diagram/@childNodes.41/@labels.1 /0/@diagram/@childNodes.42/@labels.0 /0/@diagram/@childNodes.42/@labels.1 /0/@diagram/@childNodes.43/@labels.0 /0/@diagram/@childNodes.45/@labels.0 /0/@diagram/@childNodes.45/@labels.1 /0/@diagram/@childNodes.46/@labels.0 /0/@diagram/@childNodes.46/@labels.1 /0/@diagram/@childNodes.47/@labels.0 /0/@diagram/@childNodes.48/@labels.0 /0/@diagram/@childNodes.48/@labels.1 /0/@diagram/@childNodes.49/@labels.0 /0/@diagram/@childNodes.49/@labels.1 /0/@diagram/@childNodes.50/@labels.0 /0/@diagram/@childNodes.52/@labels.1 /0/@diagram/@childNodes.55/@labels.0 /0/@diagram/@childNodes.61/@labels.0 /0/@diagram/@childNodes.62/@labels.0 /0/@diagram/@childNodes.66/@labels.0 /0/@diagram/@childNodes.71/@labels.0 /0/@diagram/@childNodes.74/@labels.0 /0/@diagram/@childNodes.77/@labels.0 /0/@diagram/@childNodes.78/@labels.0 /0/@diagram/@childNodes.78/@labels.1 /0/@diagram/@childNodes.80/@labels.0 /0/@diagram/@childNodes.81/@labels.0 /0/@diagram/@childNodes.82/@labels.0 /0/@diagram/@childNodes.84/@labels.0 /0/@diagram/@childNodes.86/@labels.0 /0/@diagram/@childNodes.88/@labels.0 /0/@diagram/@childNodes.89/@labels.0 /0/@diagram/@childNodes.91/@labels.0 /0/@diagram/@childNodes.91/@labels.1 /0/@diagram/@childNodes.92/@labels.1 /0/@diagram/@childNodes.95/@labels.0 /0/@diagram/@childNodes.95/@labels.1 /0/@diagram/@childNodes.96/@labels.0 /0/@diagram/@childNodes.96/@labels.1 /0/@diagram/@childNodes.97/@labels.0 /0/@diagram/@childNodes.97/@labels.1 /0/@diagram/@childNodes.97/@labels.2 /0/@diagram/@childNodes.98/@labels.0 /0/@diagram/@childNodes.98/@labels.1 /0/@diagram/@childNodes.98/@labels.2 /0/@diagram/@childNodes.99/@labels.0 /0/@diagram/@childNodes.99/@labels.1 /0/@diagram/@childNodes.100/@labels.0 /0/@diagram/@childNodes.100/@labels.1 /0/@diagram/@childNodes.100/@labels.2 /0/@diagram/@childNodes.101/@labels.0 /0/@diagram/@childNodes.101/@labels.1 /0/@diagram/@childNodes.101/@labels.2 /0/@diagram/@childNodes.103/@labels.1 /0/@diagram/@childNodes.104/@labels.1 /0/@diagram/@childNodes.105/@labels.1 /0/@diagram/@childNodes.106/@labels.2 /0/@diagram/@childNodes.107/@labels.2 /0/@diagram/@childNodes.108/@labels.2 /0/@diagram/@childNodes.109/@labels.2 /0/@diagram/@childNodes.103/@labels.0 /0/@diagram/@childNodes.104/@labels.0 /0/@diagram/@childNodes.105/@labels.0 /0/@diagram/@childNodes.106/@labels.0 /0/@diagram/@childNodes.106/@labels.1 /0/@diagram/@childNodes.107/@labels.0 /0/@diagram/@childNodes.107/@labels.1 /0/@diagram/@childNodes.108/@labels.0 /0/@diagram/@childNodes.108/@labels.1 /0/@diagram/@childNodes.109/@labels.0 /0/@diagram/@childNodes.109/@labels.1 /0/@diagram/@childNodes.111/@labels.1 /0/@diagram/@childNodes.112/@labels.1 /0/@diagram/@childNodes.113/@labels.2 /0/@diagram/@childNodes.114/@labels.2 /0/@diagram/@childNodes.111/@labels.0 /0/@diagram/@childNodes.112/@labels.0 /0/@diagram/@childNodes.113/@labels.0 /0/@diagram/@childNodes.113/@labels.1 /0/@diagram/@childNodes.114/@labels.0 /0/@diagram/@childNodes.114/@labels.1 /0/@diagram/@childNodes.116/@labels.1 /0/@diagram/@childNodes.117/@labels.2 /0/@diagram/@childNodes.118/@labels.2 /0/@diagram/@childNodes.120/@labels.1 /0/@diagram/@childNodes.121/@labels.1 /0/@diagram/@childNodes.122/@labels.2 /0/@diagram/@childNodes.123/@labels.2 /0/@diagram/@childNodes.125/@labels.1 /0/@diagram/@childNodes.126/@labels.2 /0/@diagram/@childNodes.127/@labels.2 /0/@diagram/@childNodes.116/@labels.0 /0/@diagram/@childNodes.117/@labels.0 /0/@diagram/@childNodes.117/@labels.1 /0/@diagram/@childNodes.118/@labels.0 /0/@diagram/@childNodes.118/@labels.1 /0/@diagram/@childNodes.120/@labels.0 /0/@diagram/@childNodes.121/@labels.0 /0/@diagram/@childNodes.122/@labels.0 /0/@diagram/@childNodes.122/@labels.1 /0/@diagram/@childNodes.123/@labels.0 /0/@diagram/@childNodes.123/@labels.1 /0/@diagram/@childNodes.125/@labels.0 /0/@diagram/@childNodes.126/@labels.0 /0/@diagram/@childNodes.126/@labels.1 /0/@diagram/@childNodes.127/@labels.0 /0/@diagram/@childNodes.127/@labels.1 /0/@diagram/@childNodes.129/@labels.1 /0/@diagram/@childNodes.130/@labels.2 /0/@diagram/@childNodes.131/@labels.2 /0/@diagram/@childNodes.129/@labels.0 /0/@diagram/@childNodes.130/@labels.0 /0/@diagram/@childNodes.130/@labels.1 /0/@diagram/@childNodes.131/@labels.0 /0/@diagram/@childNodes.131/@labels.1 /0/@diagram/@childNodes.133/@labels.0 /0/@diagram/@childNodes.133/@labels.1"/> + genExternalNodeLabel="/0/@diagram/@childNodes.75/@labels.0 /0/@diagram/@childNodes.3/@labels.1 /0/@diagram/@childNodes.4/@labels.1 /0/@diagram/@childNodes.5/@labels.1 /0/@diagram/@childNodes.7/@labels.2 /0/@diagram/@childNodes.8/@labels.2 /0/@diagram/@childNodes.9/@labels.1 /0/@diagram/@childNodes.10/@labels.1 /0/@diagram/@childNodes.12/@labels.2 /0/@diagram/@childNodes.13/@labels.2 /0/@diagram/@childNodes.14/@labels.1 /0/@diagram/@childNodes.15/@labels.1 /0/@diagram/@childNodes.17/@labels.2 /0/@diagram/@childNodes.18/@labels.2 /0/@diagram/@childNodes.19/@labels.1 /0/@diagram/@childNodes.20/@labels.1 /0/@diagram/@childNodes.21/@labels.2 /0/@diagram/@childNodes.22/@labels.2 /0/@diagram/@childNodes.23/@labels.1 /0/@diagram/@childNodes.32/@labels.2 /0/@diagram/@childNodes.33/@labels.1 /0/@diagram/@childNodes.34/@labels.1 /0/@diagram/@childNodes.35/@labels.2 /0/@diagram/@childNodes.38/@labels.2 /0/@diagram/@childNodes.39/@labels.2 /0/@diagram/@childNodes.40/@labels.1 /0/@diagram/@childNodes.41/@labels.2 /0/@diagram/@childNodes.42/@labels.2 /0/@diagram/@childNodes.43/@labels.1 /0/@diagram/@childNodes.45/@labels.2 /0/@diagram/@childNodes.46/@labels.2 /0/@diagram/@childNodes.47/@labels.1 /0/@diagram/@childNodes.48/@labels.2 /0/@diagram/@childNodes.49/@labels.2 /0/@diagram/@childNodes.50/@labels.1 /0/@diagram/@childNodes.52/@labels.2 /0/@diagram/@childNodes.53/@labels.1 /0/@diagram/@childNodes.55/@labels.1 /0/@diagram/@childNodes.71/@labels.1 /0/@diagram/@childNodes.74/@labels.1 /0/@diagram/@childNodes.77/@labels.1 /0/@diagram/@childNodes.80/@labels.1 /0/@diagram/@childNodes.81/@labels.1 /0/@diagram/@childNodes.82/@labels.1 /0/@diagram/@childNodes.84/@labels.1 /0/@diagram/@childNodes.86/@labels.1 /0/@diagram/@childNodes.88/@labels.1 /0/@diagram/@childNodes.89/@labels.1 /0/@diagram/@childNodes.91/@labels.2 /0/@diagram/@childNodes.63/@labels.0 /0/@diagram/@childNodes.61/@labels.1 /0/@diagram/@childNodes.62/@labels.1 /0/@diagram/@childNodes.63/@labels.1 /0/@diagram/@childNodes.66/@labels.1 /0/@diagram/@childNodes.53/@labels.0 /0/@diagram/@childNodes.7/@labels.0 /0/@diagram/@childNodes.7/@labels.1 /0/@diagram/@childNodes.8/@labels.0 /0/@diagram/@childNodes.8/@labels.1 /0/@diagram/@childNodes.9/@labels.0 /0/@diagram/@childNodes.10/@labels.0 /0/@diagram/@childNodes.12/@labels.0 /0/@diagram/@childNodes.12/@labels.1 /0/@diagram/@childNodes.13/@labels.0 /0/@diagram/@childNodes.13/@labels.1 /0/@diagram/@childNodes.14/@labels.0 /0/@diagram/@childNodes.15/@labels.0 /0/@diagram/@childNodes.17/@labels.0 /0/@diagram/@childNodes.17/@labels.1 /0/@diagram/@childNodes.18/@labels.0 /0/@diagram/@childNodes.18/@labels.1 /0/@diagram/@childNodes.19/@labels.0 /0/@diagram/@childNodes.20/@labels.0 /0/@diagram/@childNodes.21/@labels.0 /0/@diagram/@childNodes.21/@labels.1 /0/@diagram/@childNodes.22/@labels.0 /0/@diagram/@childNodes.22/@labels.1 /0/@diagram/@childNodes.23/@labels.0 /0/@diagram/@childNodes.32/@labels.1 /0/@diagram/@childNodes.35/@labels.1 /0/@diagram/@childNodes.36/@labels.1 /0/@diagram/@childNodes.38/@labels.0 /0/@diagram/@childNodes.38/@labels.1 /0/@diagram/@childNodes.39/@labels.0 /0/@diagram/@childNodes.39/@labels.1 /0/@diagram/@childNodes.40/@labels.0 /0/@diagram/@childNodes.41/@labels.0 /0/@diagram/@childNodes.41/@labels.1 /0/@diagram/@childNodes.42/@labels.0 /0/@diagram/@childNodes.42/@labels.1 /0/@diagram/@childNodes.43/@labels.0 /0/@diagram/@childNodes.45/@labels.0 /0/@diagram/@childNodes.45/@labels.1 /0/@diagram/@childNodes.46/@labels.0 /0/@diagram/@childNodes.46/@labels.1 /0/@diagram/@childNodes.47/@labels.0 /0/@diagram/@childNodes.48/@labels.0 /0/@diagram/@childNodes.48/@labels.1 /0/@diagram/@childNodes.49/@labels.0 /0/@diagram/@childNodes.49/@labels.1 /0/@diagram/@childNodes.50/@labels.0 /0/@diagram/@childNodes.52/@labels.1 /0/@diagram/@childNodes.55/@labels.0 /0/@diagram/@childNodes.61/@labels.0 /0/@diagram/@childNodes.62/@labels.0 /0/@diagram/@childNodes.66/@labels.0 /0/@diagram/@childNodes.71/@labels.0 /0/@diagram/@childNodes.74/@labels.0 /0/@diagram/@childNodes.77/@labels.0 /0/@diagram/@childNodes.78/@labels.0 /0/@diagram/@childNodes.78/@labels.1 /0/@diagram/@childNodes.80/@labels.0 /0/@diagram/@childNodes.81/@labels.0 /0/@diagram/@childNodes.82/@labels.0 /0/@diagram/@childNodes.84/@labels.0 /0/@diagram/@childNodes.86/@labels.0 /0/@diagram/@childNodes.88/@labels.0 /0/@diagram/@childNodes.89/@labels.0 /0/@diagram/@childNodes.91/@labels.0 /0/@diagram/@childNodes.91/@labels.1 /0/@diagram/@childNodes.92/@labels.1 /0/@diagram/@childNodes.95/@labels.0 /0/@diagram/@childNodes.95/@labels.1 /0/@diagram/@childNodes.96/@labels.0 /0/@diagram/@childNodes.96/@labels.1 /0/@diagram/@childNodes.97/@labels.0 /0/@diagram/@childNodes.97/@labels.1 /0/@diagram/@childNodes.97/@labels.2 /0/@diagram/@childNodes.98/@labels.0 /0/@diagram/@childNodes.98/@labels.1 /0/@diagram/@childNodes.98/@labels.2 /0/@diagram/@childNodes.99/@labels.0 /0/@diagram/@childNodes.99/@labels.1 /0/@diagram/@childNodes.100/@labels.0 /0/@diagram/@childNodes.100/@labels.1 /0/@diagram/@childNodes.100/@labels.2 /0/@diagram/@childNodes.101/@labels.0 /0/@diagram/@childNodes.101/@labels.1 /0/@diagram/@childNodes.101/@labels.2 /0/@diagram/@childNodes.103/@labels.1 /0/@diagram/@childNodes.104/@labels.1 /0/@diagram/@childNodes.105/@labels.1 /0/@diagram/@childNodes.106/@labels.2 /0/@diagram/@childNodes.107/@labels.2 /0/@diagram/@childNodes.108/@labels.2 /0/@diagram/@childNodes.109/@labels.2 /0/@diagram/@childNodes.103/@labels.0 /0/@diagram/@childNodes.104/@labels.0 /0/@diagram/@childNodes.105/@labels.0 /0/@diagram/@childNodes.106/@labels.0 /0/@diagram/@childNodes.106/@labels.1 /0/@diagram/@childNodes.107/@labels.0 /0/@diagram/@childNodes.107/@labels.1 /0/@diagram/@childNodes.108/@labels.0 /0/@diagram/@childNodes.108/@labels.1 /0/@diagram/@childNodes.109/@labels.0 /0/@diagram/@childNodes.109/@labels.1 /0/@diagram/@childNodes.111/@labels.1 /0/@diagram/@childNodes.112/@labels.1 /0/@diagram/@childNodes.113/@labels.2 /0/@diagram/@childNodes.114/@labels.2 /0/@diagram/@childNodes.111/@labels.0 /0/@diagram/@childNodes.112/@labels.0 /0/@diagram/@childNodes.113/@labels.0 /0/@diagram/@childNodes.113/@labels.1 /0/@diagram/@childNodes.114/@labels.0 /0/@diagram/@childNodes.114/@labels.1 /0/@diagram/@childNodes.116/@labels.1 /0/@diagram/@childNodes.117/@labels.2 /0/@diagram/@childNodes.118/@labels.2 /0/@diagram/@childNodes.120/@labels.1 /0/@diagram/@childNodes.121/@labels.1 /0/@diagram/@childNodes.122/@labels.2 /0/@diagram/@childNodes.123/@labels.2 /0/@diagram/@childNodes.125/@labels.1 /0/@diagram/@childNodes.126/@labels.2 /0/@diagram/@childNodes.127/@labels.2 /0/@diagram/@childNodes.116/@labels.0 /0/@diagram/@childNodes.117/@labels.0 /0/@diagram/@childNodes.117/@labels.1 /0/@diagram/@childNodes.118/@labels.0 /0/@diagram/@childNodes.118/@labels.1 /0/@diagram/@childNodes.120/@labels.0 /0/@diagram/@childNodes.121/@labels.0 /0/@diagram/@childNodes.122/@labels.0 /0/@diagram/@childNodes.122/@labels.1 /0/@diagram/@childNodes.123/@labels.0 /0/@diagram/@childNodes.123/@labels.1 /0/@diagram/@childNodes.125/@labels.0 /0/@diagram/@childNodes.126/@labels.0 /0/@diagram/@childNodes.126/@labels.1 /0/@diagram/@childNodes.127/@labels.0 /0/@diagram/@childNodes.127/@labels.1 /0/@diagram/@childNodes.129/@labels.1 /0/@diagram/@childNodes.130/@labels.2 /0/@diagram/@childNodes.131/@labels.2 /0/@diagram/@childNodes.129/@labels.0 /0/@diagram/@childNodes.130/@labels.0 /0/@diagram/@childNodes.130/@labels.1 /0/@diagram/@childNodes.131/@labels.0 /0/@diagram/@childNodes.131/@labels.1 /0/@diagram/@childNodes.133/@labels.0 /0/@diagram/@childNodes.133/@labels.1 /0/@diagram/@childNodes.135/@labels.1 /0/@diagram/@childNodes.136/@labels.2 /0/@diagram/@childNodes.137/@labels.2 /0/@diagram/@childNodes.139/@labels.1 /0/@diagram/@childNodes.140/@labels.1 /0/@diagram/@childNodes.141/@labels.2 /0/@diagram/@childNodes.142/@labels.2 /0/@diagram/@childNodes.135/@labels.0 /0/@diagram/@childNodes.136/@labels.0 /0/@diagram/@childNodes.136/@labels.1 /0/@diagram/@childNodes.137/@labels.0 /0/@diagram/@childNodes.137/@labels.1 /0/@diagram/@childNodes.139/@labels.0 /0/@diagram/@childNodes.140/@labels.0 /0/@diagram/@childNodes.141/@labels.0 /0/@diagram/@childNodes.141/@labels.1 /0/@diagram/@childNodes.142/@labels.0 /0/@diagram/@childNodes.142/@labels.1"/> <extensionNodes xsi:type="papyrusgmfgenextension:GenerateUsingElementTypeCreationCommand"/> </papyrusgmfgenextension:PapyrusExtensionRootNode> diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/plugin.properties b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/plugin.properties index 445ff01e917..150134b5025 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/plugin.properties +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/plugin.properties @@ -194,3 +194,12 @@ metatype.name.ValuePin_3153=ValuePin metatype.name.ActionInputPin_3166=ActionInputPin metatype.name.ReadExtentAction_3120=ReadExtentAction metatype.name.OutputPin_3129=OutputPin +metatype.name.ReclassifyObjectAction_3121=ReclassifyObjectAction +metatype.name.InputPin_3141=InputPin +metatype.name.ValuePin_3154=ValuePin +metatype.name.ActionInputPin_3167=ActionInputPin +metatype.name.ReadIsClassifiedObjectAction_3122=ReadIsClassifiedObjectAction +metatype.name.OutputPin_3130=OutputPin +metatype.name.InputPin_3142=InputPin +metatype.name.ValuePin_3155=ValuePin +metatype.name.ActionInputPin_3168=ActionInputPin diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/plugin.xml index 0a4ffb1d0c4..c235e740be2 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/plugin.xml +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/plugin.xml @@ -166,7 +166,7 @@ <viewProvider class="org.eclipse.papyrus.uml.diagram.activity.providers.UMLViewProvider"> <Priority name="Lowest"/> <context viewClass="org.eclipse.gmf.runtime.notation.Diagram" semanticHints="PapyrusUMLActivityDiagram"/> - <context viewClass="org.eclipse.gmf.runtime.notation.Node" semanticHints="2001,3001,3002,3003,3004,3005,3006,3007,3015,3016,3013,3014,3008,3017,3018,3019,3020,3010,3021,3022,3023,3024,3025,3026,3027,3034,3035,3036,3037,3032,3033,3011,3012,3038,3039,3040,3041,3078,3042,3046,3047,3048,3049,3050,3051,3052,3053,3054,3055,3060,3061,3062,3059,3063,3064,3076,3077,3069,3070,3074,3075,3071,3109,3110,3111,3073,3065,3105,3067,3068,3080,3081,3084,3083,3086,3087,3085,3088,3089,3090,3091,3092,3093,3094,3095,3096,3097,3098,3099,3100,3101,3102,3103,3104,3112,3113,3125,3132,3145,3158,3133,3146,3159,3114,3126,3134,3135,3147,3148,3160,3161,3115,3127,3136,3149,3162,3117,3137,3151,3163,3116,3128,3138,3150,3164,3118,3139,3152,3165,3119,3140,3153,3166,3120,3129"/> + <context viewClass="org.eclipse.gmf.runtime.notation.Node" semanticHints="2001,3001,3002,3003,3004,3005,3006,3007,3015,3016,3013,3014,3008,3017,3018,3019,3020,3010,3021,3022,3023,3024,3025,3026,3027,3034,3035,3036,3037,3032,3033,3011,3012,3038,3039,3040,3041,3078,3042,3046,3047,3048,3049,3050,3051,3052,3053,3054,3055,3060,3061,3062,3059,3063,3064,3076,3077,3069,3070,3074,3075,3071,3109,3110,3111,3073,3065,3105,3067,3068,3080,3081,3084,3083,3086,3087,3085,3088,3089,3090,3091,3092,3093,3094,3095,3096,3097,3098,3099,3100,3101,3102,3103,3104,3112,3113,3125,3132,3145,3158,3133,3146,3159,3114,3126,3134,3135,3147,3148,3160,3161,3115,3127,3136,3149,3162,3117,3137,3151,3163,3116,3128,3138,3150,3164,3118,3139,3152,3165,3119,3140,3153,3166,3120,3129,3121,3141,3154,3167,3122,3130,3142,3155,3168"/> <context viewClass="org.eclipse.gmf.runtime.notation.Edge" semanticHints="4001,4002,4003,4004,4005,4006,4007"/> </viewProvider> </extension> @@ -179,13 +179,13 @@ <method name="getType()" value="PapyrusUMLActivityDiagram"/> </object> <object class="org.eclipse.gmf.runtime.notation.Node" id="generated-nodes"> - <method name="getType()" value="2001,3001,3002,3003,3004,3005,3006,3007,3015,3016,3013,3014,3008,3017,3018,3019,3020,3010,3021,3022,3023,3024,3025,3026,3027,3034,3035,3036,3037,3032,3033,3011,3012,3038,3039,3040,3041,3078,3042,3046,3047,3048,3049,3050,3051,3052,3053,3054,3055,3060,3061,3062,3059,3063,3064,3076,3077,3069,3070,3074,3075,3071,3109,3110,3111,3073,3065,3105,3067,3068,3080,3081,3084,3083,3086,3087,3085,3088,3089,3090,3091,3092,3093,3094,3095,3096,3097,3098,3099,3100,3101,3102,3103,3104,3112,3113,3125,3132,3145,3158,3133,3146,3159,3114,3126,3134,3135,3147,3148,3160,3161,3115,3127,3136,3149,3162,3117,3137,3151,3163,3116,3128,3138,3150,3164,3118,3139,3152,3165,3119,3140,3153,3166,3120,3129"/> + <method name="getType()" value="2001,3001,3002,3003,3004,3005,3006,3007,3015,3016,3013,3014,3008,3017,3018,3019,3020,3010,3021,3022,3023,3024,3025,3026,3027,3034,3035,3036,3037,3032,3033,3011,3012,3038,3039,3040,3041,3078,3042,3046,3047,3048,3049,3050,3051,3052,3053,3054,3055,3060,3061,3062,3059,3063,3064,3076,3077,3069,3070,3074,3075,3071,3109,3110,3111,3073,3065,3105,3067,3068,3080,3081,3084,3083,3086,3087,3085,3088,3089,3090,3091,3092,3093,3094,3095,3096,3097,3098,3099,3100,3101,3102,3103,3104,3112,3113,3125,3132,3145,3158,3133,3146,3159,3114,3126,3134,3135,3147,3148,3160,3161,3115,3127,3136,3149,3162,3117,3137,3151,3163,3116,3128,3138,3150,3164,3118,3139,3152,3165,3119,3140,3153,3166,3120,3129,3121,3141,3154,3167,3122,3130,3142,3155,3168"/> </object> <object class="org.eclipse.gmf.runtime.notation.Edge" id="generated-links"> <method name="getType()" value="4001,4002,4003,4004,4005,4006,4007"/> </object> <object class="org.eclipse.gmf.runtime.notation.Node" id="generated-labels"> - <method name="getType()" value="5001,5002,6034,5080,6033,5081,6035,5082,5003,6028,5011,5024,5083,5012,5025,5084,5009,5085,5010,5086,5004,6029,5013,5026,5087,5014,5027,5088,5015,5089,5016,5090,5006,6020,5017,5028,5091,5018,5029,5092,5019,5093,5020,5094,5021,5030,5095,5022,5031,5096,5023,5097,5038,5130,5039,5131,5040,5132,5041,5133,5036,5134,5037,5135,5007,5136,5008,5137,6036,5043,5098,6037,5099,6038,5100,6039,5042,5101,5127,5128,6031,5059,6027,5049,5050,5102,5051,5052,5103,5053,5104,5054,5055,5105,5056,5057,5106,5058,5107,5060,6032,5061,5062,5108,5063,5064,5109,5065,5110,5072,5073,5111,5074,5075,5112,5076,5113,5071,5078,5079,5115,6040,5077,5114,5126,6026,5124,5125,5119,5120,5121,5184,5185,5186,5183,5187,5188,5123,5117,5178,5179,5118,6016,5138,5139,6025,5144,5145,5142,5143,5148,6024,5146,5147,5129,5153,6023,5149,5150,5151,5152,5160,6019,5154,5155,5156,5157,5158,5159,5163,6022,5161,5162,5166,6021,5164,5165,5171,6018,5167,5168,5169,5170,5175,6017,5172,5173,5174,5176,5177,6030,5189,5190,5191,5394,5203,5204,5217,5218,5245,5246,5247,5263,5264,5265,5219,5220,5248,5249,5250,5266,5267,5268,5192,5395,5205,5206,5221,5222,5223,5224,5251,5252,5253,5254,5255,5256,5269,5270,5271,5272,5273,5274,5193,5396,5207,5208,5225,5226,5260,5261,5262,5275,5276,5277,5195,5397,5227,5228,5281,5282,5283,5278,5279,5280,5194,5398,5209,5210,5229,5230,5287,5288,5289,5284,5285,5286,5196,5399,5231,5232,5290,5291,5292,5293,5294,5295,5197,5400,5235,5236,5296,5297,5298,5299,5300,5301,5198,5401,5211,5212"/> + <method name="getType()" value="5001,5002,6034,5080,6033,5081,6035,5082,5003,6028,5011,5024,5083,5012,5025,5084,5009,5085,5010,5086,5004,6029,5013,5026,5087,5014,5027,5088,5015,5089,5016,5090,5006,6020,5017,5028,5091,5018,5029,5092,5019,5093,5020,5094,5021,5030,5095,5022,5031,5096,5023,5097,5038,5130,5039,5131,5040,5132,5041,5133,5036,5134,5037,5135,5007,5136,5008,5137,6036,5043,5098,6037,5099,6038,5100,6039,5042,5101,5127,5128,6031,5059,6027,5049,5050,5102,5051,5052,5103,5053,5104,5054,5055,5105,5056,5057,5106,5058,5107,5060,6032,5061,5062,5108,5063,5064,5109,5065,5110,5072,5073,5111,5074,5075,5112,5076,5113,5071,5078,5079,5115,6040,5077,5114,5126,6026,5124,5125,5119,5120,5121,5184,5185,5186,5183,5187,5188,5123,5117,5178,5179,5118,6016,5138,5139,6025,5144,5145,5142,5143,5148,6024,5146,5147,5129,5153,6023,5149,5150,5151,5152,5160,6019,5154,5155,5156,5157,5158,5159,5163,6022,5161,5162,5166,6021,5164,5165,5171,6018,5167,5168,5169,5170,5175,6017,5172,5173,5174,5176,5177,6030,5189,5190,5191,5394,5203,5204,5217,5218,5245,5246,5247,5263,5264,5265,5219,5220,5248,5249,5250,5266,5267,5268,5192,5395,5205,5206,5221,5222,5223,5224,5251,5252,5253,5254,5255,5256,5269,5270,5271,5272,5273,5274,5193,5396,5207,5208,5225,5226,5260,5261,5262,5275,5276,5277,5195,5397,5227,5228,5281,5282,5283,5278,5279,5280,5194,5398,5209,5210,5229,5230,5287,5288,5289,5284,5285,5286,5196,5399,5231,5232,5290,5291,5292,5293,5294,5295,5197,5400,5235,5236,5296,5297,5298,5299,5300,5301,5198,5402,5211,5212,5199,5401,5237,5238,5302,5303,5304,5305,5306,5307,5200,5403,5213,5214,5239,5240,5308,5309,5310,5311,5312,5313"/> </object> <object class="org.eclipse.gmf.runtime.notation.Node" id="generated-compartments"> <method name="getType()" value="7001,7002,7003,7004,7008,7009,7010,7012,7005,7006,7007,7014,7015,7016,7013"/> @@ -1426,6 +1426,87 @@ </metamodel> <metamodel nsURI="http://www.eclipse.org/uml2/5.0.0/UML"> <specializationType + id="org.eclipse.papyrus.uml.diagram.activity.ReclassifyObjectAction_3121" + name="%metatype.name.ReclassifyObjectAction_3121" + kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"> + <specializes id="org.eclipse.papyrus.uml.ReclassifyObjectAction"/> + <param name="semanticHint" value="3121"/> + </specializationType> + </metamodel> + <metamodel nsURI="http://www.eclipse.org/uml2/5.0.0/UML"> + <specializationType + id="org.eclipse.papyrus.uml.diagram.activity.InputPin_3141" + name="%metatype.name.InputPin_3141" + kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"> + <specializes id="org.eclipse.papyrus.uml.InputPin"/> + <param name="semanticHint" value="3141"/> + </specializationType> + </metamodel> + <metamodel nsURI="http://www.eclipse.org/uml2/5.0.0/UML"> + <specializationType + id="org.eclipse.papyrus.uml.diagram.activity.ValuePin_3154" + name="%metatype.name.ValuePin_3154" + kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"> + <specializes id="org.eclipse.papyrus.uml.ValuePin"/> + <param name="semanticHint" value="3154"/> + </specializationType> + </metamodel> + <metamodel nsURI="http://www.eclipse.org/uml2/5.0.0/UML"> + <specializationType + id="org.eclipse.papyrus.uml.diagram.activity.ActionInputPin_3167" + name="%metatype.name.ActionInputPin_3167" + kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"> + <specializes id="org.eclipse.papyrus.uml.ActionInputPin"/> + <param name="semanticHint" value="3167"/> + </specializationType> + </metamodel> + <metamodel nsURI="http://www.eclipse.org/uml2/5.0.0/UML"> + <specializationType + id="org.eclipse.papyrus.uml.diagram.activity.ReadIsClassifiedObjectAction_3122" + name="%metatype.name.ReadIsClassifiedObjectAction_3122" + kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"> + <specializes id="org.eclipse.papyrus.uml.ReadIsClassifiedObjectAction"/> + <param name="semanticHint" value="3122"/> + </specializationType> + </metamodel> + <metamodel nsURI="http://www.eclipse.org/uml2/5.0.0/UML"> + <specializationType + id="org.eclipse.papyrus.uml.diagram.activity.OutputPin_3130" + name="%metatype.name.OutputPin_3130" + kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"> + <specializes id="org.eclipse.papyrus.uml.OutputPin"/> + <param name="semanticHint" value="3130"/> + </specializationType> + </metamodel> + <metamodel nsURI="http://www.eclipse.org/uml2/5.0.0/UML"> + <specializationType + id="org.eclipse.papyrus.uml.diagram.activity.InputPin_3142" + name="%metatype.name.InputPin_3142" + kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"> + <specializes id="org.eclipse.papyrus.uml.InputPin"/> + <param name="semanticHint" value="3142"/> + </specializationType> + </metamodel> + <metamodel nsURI="http://www.eclipse.org/uml2/5.0.0/UML"> + <specializationType + id="org.eclipse.papyrus.uml.diagram.activity.ValuePin_3155" + name="%metatype.name.ValuePin_3155" + kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"> + <specializes id="org.eclipse.papyrus.uml.ValuePin"/> + <param name="semanticHint" value="3155"/> + </specializationType> + </metamodel> + <metamodel nsURI="http://www.eclipse.org/uml2/5.0.0/UML"> + <specializationType + id="org.eclipse.papyrus.uml.diagram.activity.ActionInputPin_3168" + name="%metatype.name.ActionInputPin_3168" + kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"> + <specializes id="org.eclipse.papyrus.uml.ActionInputPin"/> + <param name="semanticHint" value="3168"/> + </specializationType> + </metamodel> + <metamodel nsURI="http://www.eclipse.org/uml2/5.0.0/UML"> + <specializationType id="org.eclipse.papyrus.uml.diagram.activity.ActionLocalPrecondition_4001" name="%metatype.name.ActionLocalPrecondition_4001" kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"> @@ -1629,6 +1710,15 @@ <elementType ref="org.eclipse.papyrus.uml.diagram.activity.ActionInputPin_3166"/> <elementType ref="org.eclipse.papyrus.uml.diagram.activity.ReadExtentAction_3120"/> <elementType ref="org.eclipse.papyrus.uml.diagram.activity.OutputPin_3129"/> + <elementType ref="org.eclipse.papyrus.uml.diagram.activity.ReclassifyObjectAction_3121"/> + <elementType ref="org.eclipse.papyrus.uml.diagram.activity.InputPin_3141"/> + <elementType ref="org.eclipse.papyrus.uml.diagram.activity.ValuePin_3154"/> + <elementType ref="org.eclipse.papyrus.uml.diagram.activity.ActionInputPin_3167"/> + <elementType ref="org.eclipse.papyrus.uml.diagram.activity.ReadIsClassifiedObjectAction_3122"/> + <elementType ref="org.eclipse.papyrus.uml.diagram.activity.OutputPin_3130"/> + <elementType ref="org.eclipse.papyrus.uml.diagram.activity.InputPin_3142"/> + <elementType ref="org.eclipse.papyrus.uml.diagram.activity.ValuePin_3155"/> + <elementType ref="org.eclipse.papyrus.uml.diagram.activity.ActionInputPin_3168"/> <elementType ref="org.eclipse.papyrus.uml.diagram.activity.ActionLocalPrecondition_4001"/> <elementType ref="org.eclipse.papyrus.uml.diagram.activity.ActionLocalPostcondition_4002"/> <elementType ref="org.eclipse.papyrus.uml.diagram.activity.ObjectFlow_4003"/> @@ -3377,6 +3467,26 @@ self.structuralFeature.oclAsType(Property).opposite.type = self.object.type]]> </entry> <entry defineOnly="true" + description="Create a ReclassifyObjectAction" + id="createReclassifyObjectAction4CreationTool" + kind="tool" + label="Reclassify Object Action" + large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/ReclassifyObjectAction.gif" + path="" + small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/ReclassifyObjectAction.gif"> + </entry> + <entry + defineOnly="true" + description="Create a Read Is Classified Object Action" + id="createReadIsClassifiedObjectAction5CreationTool" + kind="tool" + label="Read Is Classified Object Action" + large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/ReadIsClassifiedObjectAction.gif" + path="" + small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/ReadIsClassifiedObjectAction.gif"> + </entry> + <entry + defineOnly="true" description="Create a Structured Activity Node" id="createStructuredActivityNode1CreationTool" kind="tool" @@ -4065,6 +4175,14 @@ self.structuralFeature.oclAsType(Property).opposite.type = self.object.type]]> id="createReadSelfAction3CreationTool" path="/createNodes1Group/createObjectActionsGroup"> </predefinedEntry> + <predefinedEntry + id="createReclassifyObjectAction4CreationTool" + path="/createNodes1Group/createObjectActionsGroup"> + </predefinedEntry> + <predefinedEntry + id="createReadIsClassifiedObjectAction5CreationTool" + path="/createNodes1Group/createObjectActionsGroup"> + </predefinedEntry> <entry description="StructuredActions" id="createStructuredActionsGroup" diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionPinInReadIsClassifiedObjectActionAsObjectCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionPinInReadIsClassifiedObjectActionAsObjectCreateCommand.java new file mode 100644 index 00000000000..2a094a4bf52 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionPinInReadIsClassifiedObjectActionAsObjectCreateCommand.java @@ -0,0 +1,105 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.commands; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers; +import org.eclipse.uml2.uml.ActionInputPin; +import org.eclipse.uml2.uml.ReadIsClassifiedObjectAction; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class ActionPinInReadIsClassifiedObjectActionAsObjectCreateCommand extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public ActionPinInReadIsClassifiedObjectActionAsObjectCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + public boolean canExecute() { + ReadIsClassifiedObjectAction container = (ReadIsClassifiedObjectAction) getElementToEdit(); + if (container.getObject() != null) { + return false; + } + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getActionInputPin()); + return data.isPermitted(); + } + + /** + * @generated + */ + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + ActionInputPin newElement = UMLFactory.eINSTANCE.createActionInputPin(); + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + ReadIsClassifiedObjectAction qualifiedTarget = (ReadIsClassifiedObjectAction) target; + qualifiedTarget.setObject(newElement); + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + ElementInitializers.getInstance().init_ActionInputPin_3168(newElement); + doConfigure(newElement, monitor, info); + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(ActionInputPin newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionPinInReclassifyObjectActionAsObjectCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionPinInReclassifyObjectActionAsObjectCreateCommand.java new file mode 100644 index 00000000000..a64f3a5aec1 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionPinInReclassifyObjectActionAsObjectCreateCommand.java @@ -0,0 +1,105 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.commands; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers; +import org.eclipse.uml2.uml.ActionInputPin; +import org.eclipse.uml2.uml.ReclassifyObjectAction; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class ActionPinInReclassifyObjectActionAsObjectCreateCommand extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public ActionPinInReclassifyObjectActionAsObjectCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + public boolean canExecute() { + ReclassifyObjectAction container = (ReclassifyObjectAction) getElementToEdit(); + if (container.getObject() != null) { + return false; + } + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getActionInputPin()); + return data.isPermitted(); + } + + /** + * @generated + */ + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + ActionInputPin newElement = UMLFactory.eINSTANCE.createActionInputPin(); + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + ReclassifyObjectAction qualifiedTarget = (ReclassifyObjectAction) target; + qualifiedTarget.setObject(newElement); + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + ElementInitializers.getInstance().init_ActionInputPin_3167(newElement); + doConfigure(newElement, monitor, info); + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(ActionInputPin newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInReadIsClassifiedObjectActionAsObjectCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInReadIsClassifiedObjectActionAsObjectCreateCommand.java new file mode 100644 index 00000000000..bae650a3ad1 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInReadIsClassifiedObjectActionAsObjectCreateCommand.java @@ -0,0 +1,105 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.commands; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers; +import org.eclipse.uml2.uml.InputPin; +import org.eclipse.uml2.uml.ReadIsClassifiedObjectAction; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class InputPinInReadIsClassifiedObjectActionAsObjectCreateCommand extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public InputPinInReadIsClassifiedObjectActionAsObjectCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + public boolean canExecute() { + ReadIsClassifiedObjectAction container = (ReadIsClassifiedObjectAction) getElementToEdit(); + if (container.getObject() != null) { + return false; + } + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInputPin()); + return data.isPermitted(); + } + + /** + * @generated + */ + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + InputPin newElement = UMLFactory.eINSTANCE.createInputPin(); + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + ReadIsClassifiedObjectAction qualifiedTarget = (ReadIsClassifiedObjectAction) target; + qualifiedTarget.setObject(newElement); + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + ElementInitializers.getInstance().init_InputPin_3142(newElement); + doConfigure(newElement, monitor, info); + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(InputPin newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInReclassifyObjectActionAsObjectCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInReclassifyObjectActionAsObjectCreateCommand.java new file mode 100644 index 00000000000..667d39e94e9 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInReclassifyObjectActionAsObjectCreateCommand.java @@ -0,0 +1,105 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.commands; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers; +import org.eclipse.uml2.uml.InputPin; +import org.eclipse.uml2.uml.ReclassifyObjectAction; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class InputPinInReclassifyObjectActionAsObjectCreateCommand extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public InputPinInReclassifyObjectActionAsObjectCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + public boolean canExecute() { + ReclassifyObjectAction container = (ReclassifyObjectAction) getElementToEdit(); + if (container.getObject() != null) { + return false; + } + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInputPin()); + return data.isPermitted(); + } + + /** + * @generated + */ + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + InputPin newElement = UMLFactory.eINSTANCE.createInputPin(); + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + ReclassifyObjectAction qualifiedTarget = (ReclassifyObjectAction) target; + qualifiedTarget.setObject(newElement); + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + ElementInitializers.getInstance().init_InputPin_3141(newElement); + doConfigure(newElement, monitor, info); + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(InputPin newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInReadIsClassifiedObjectActionCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInReadIsClassifiedObjectActionCreateCommand.java new file mode 100644 index 00000000000..1c935af3a84 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInReadIsClassifiedObjectActionCreateCommand.java @@ -0,0 +1,105 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.commands; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers; +import org.eclipse.uml2.uml.OutputPin; +import org.eclipse.uml2.uml.ReadIsClassifiedObjectAction; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class OutputPinInReadIsClassifiedObjectActionCreateCommand extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public OutputPinInReadIsClassifiedObjectActionCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + public boolean canExecute() { + ReadIsClassifiedObjectAction container = (ReadIsClassifiedObjectAction) getElementToEdit(); + if (container.getResult() != null) { + return false; + } + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getOutputPin()); + return data.isPermitted(); + } + + /** + * @generated + */ + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + OutputPin newElement = UMLFactory.eINSTANCE.createOutputPin(); + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + ReadIsClassifiedObjectAction qualifiedTarget = (ReadIsClassifiedObjectAction) target; + qualifiedTarget.setResult(newElement); + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + ElementInitializers.getInstance().init_OutputPin_3130(newElement); + doConfigure(newElement, monitor, info); + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(OutputPin newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ReadIsClassifiedObjectActionCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ReadIsClassifiedObjectActionCreateCommand.java new file mode 100644 index 00000000000..4527f70a90e --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ReadIsClassifiedObjectActionCreateCommand.java @@ -0,0 +1,101 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.commands; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers; +import org.eclipse.uml2.uml.Activity; +import org.eclipse.uml2.uml.ReadIsClassifiedObjectAction; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class ReadIsClassifiedObjectActionCreateCommand extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public ReadIsClassifiedObjectActionCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + public boolean canExecute() { + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getReadIsClassifiedObjectAction()); + return data.isPermitted(); + } + + /** + * @generated + */ + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + ReadIsClassifiedObjectAction newElement = UMLFactory.eINSTANCE.createReadIsClassifiedObjectAction(); + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + Activity qualifiedTarget = (Activity) target; + qualifiedTarget.getOwnedNodes().add(newElement); + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + ElementInitializers.getInstance().init_ReadIsClassifiedObjectAction_3122(newElement); + doConfigure(newElement, monitor, info); + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(ReadIsClassifiedObjectAction newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ReclassifyObjectActionCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ReclassifyObjectActionCreateCommand.java new file mode 100644 index 00000000000..056c6ca4e61 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ReclassifyObjectActionCreateCommand.java @@ -0,0 +1,101 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.commands; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers; +import org.eclipse.uml2.uml.Activity; +import org.eclipse.uml2.uml.ReclassifyObjectAction; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class ReclassifyObjectActionCreateCommand extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public ReclassifyObjectActionCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + public boolean canExecute() { + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getReclassifyObjectAction()); + return data.isPermitted(); + } + + /** + * @generated + */ + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + ReclassifyObjectAction newElement = UMLFactory.eINSTANCE.createReclassifyObjectAction(); + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + Activity qualifiedTarget = (Activity) target; + qualifiedTarget.getOwnedNodes().add(newElement); + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + ElementInitializers.getInstance().init_ReclassifyObjectAction_3121(newElement); + doConfigure(newElement, monitor, info); + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(ReclassifyObjectAction newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInReadIsClassifiedObjectActionAsObjectCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInReadIsClassifiedObjectActionAsObjectCreateCommand.java new file mode 100644 index 00000000000..430229587b9 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInReadIsClassifiedObjectActionAsObjectCreateCommand.java @@ -0,0 +1,105 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.commands; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers; +import org.eclipse.uml2.uml.ReadIsClassifiedObjectAction; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; +import org.eclipse.uml2.uml.ValuePin; + +/** + * @generated + */ +public class ValuePinInReadIsClassifiedObjectActionAsObjectCreateCommand extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public ValuePinInReadIsClassifiedObjectActionAsObjectCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + public boolean canExecute() { + ReadIsClassifiedObjectAction container = (ReadIsClassifiedObjectAction) getElementToEdit(); + if (container.getObject() != null) { + return false; + } + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getValuePin()); + return data.isPermitted(); + } + + /** + * @generated + */ + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + ValuePin newElement = UMLFactory.eINSTANCE.createValuePin(); + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + ReadIsClassifiedObjectAction qualifiedTarget = (ReadIsClassifiedObjectAction) target; + qualifiedTarget.setObject(newElement); + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + ElementInitializers.getInstance().init_ValuePin_3155(newElement); + doConfigure(newElement, monitor, info); + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(ValuePin newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInReclassifyObjectActionAsObjectCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInReclassifyObjectActionAsObjectCreateCommand.java new file mode 100644 index 00000000000..ce6e8059e48 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInReclassifyObjectActionAsObjectCreateCommand.java @@ -0,0 +1,105 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.commands; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers; +import org.eclipse.uml2.uml.ReclassifyObjectAction; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; +import org.eclipse.uml2.uml.ValuePin; + +/** + * @generated + */ +public class ValuePinInReclassifyObjectActionAsObjectCreateCommand extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public ValuePinInReclassifyObjectActionAsObjectCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + public boolean canExecute() { + ReclassifyObjectAction container = (ReclassifyObjectAction) getElementToEdit(); + if (container.getObject() != null) { + return false; + } + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getValuePin()); + return data.isPermitted(); + } + + /** + * @generated + */ + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + ValuePin newElement = UMLFactory.eINSTANCE.createValuePin(); + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + ReclassifyObjectAction qualifiedTarget = (ReclassifyObjectAction) target; + qualifiedTarget.setObject(newElement); + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + ElementInitializers.getInstance().init_ValuePin_3154(newElement); + doConfigure(newElement, monitor, info); + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(ValuePin newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart.java new file mode 100644 index 00000000000..9a4c9e82149 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart.java @@ -0,0 +1,789 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.parts; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.Label; +import org.eclipse.draw2d.geometry.Point; +import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.transaction.RecordingCommand; +import org.eclipse.emf.transaction.RunnableWithResult; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gef.AccessibleEditPart; +import org.eclipse.gef.EditPolicy; +import org.eclipse.gef.Request; +import org.eclipse.gef.requests.DirectEditRequest; +import org.eclipse.gef.tools.DirectEditManager; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; +import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; +import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; +import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; +import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; +import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; +import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; +import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; +import org.eclipse.gmf.runtime.notation.FontStyle; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.text.contentassist.IContentAssistProcessor; +import org.eclipse.jface.viewers.ICellEditorValidator; +import org.eclipse.jface.window.Window; +import org.eclipse.papyrus.extensionpoints.editors.Activator; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper; +import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil; +import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLParserProvider; +import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; +import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractLabelEditPart; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.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; +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.custom.BusyIndicator; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.PlatformUI; +import org.eclipse.uml2.uml.Feature; + +/** + * @generated + */ +public class ActionPinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart extends AbstractLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 5313; + + /** + * @generated + */ + private DirectEditManager manager; + + /** + * @generated + */ + private IParser parser; + + /** + * @generated + */ + private List<?> parserElements; + + /** + * @generated + */ + private String defaultText; + + /** + * direct edition mode (default, undefined, registered editor, etc.) + * + * @generated + */ + protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR; + + /** + * configuration from a registered edit dialog + * + * @generated + */ + protected IDirectEditorConfiguration configuration; + /** + * @generated + */ + static { + registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActionPinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public ActionPinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy()); + installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy()); + installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeExternalNodeEditPolicy()); + installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy()); + } + + /** + * @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 + */ + public void setParser(IParser parser) { + this.parser = parser; + } + + /** + * @generated + */ + protected EObject getParserElement() { + return resolveSemanticElement(); + } + + /** + * @generated + */ + protected Image getLabelIcon() { + return null; + } + + /** + * @generated + */ + protected String getLabelText() { + String text = null; + EObject parserElement = getParserElement(); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + } + if (text == null || text.length() == 0) { + text = defaultText; + } + return text; + } + + /** + * @generated + */ + public void setLabelText(String text) { + setLabelTextHelper(getFigure(), text); + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + /** + * @generated + */ + 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() { + + @Override + public String isValid(final Object value) { + if (value instanceof String) { + final EObject element = getParserElement(); + final IParser parser = getParser(); + try { + IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value)); + } + }); + return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); + } catch (InterruptedException ie) { + ie.printStackTrace(); + } + } + // shouldn't get here + return null; + } + }; + } + + /** + * @generated + */ + 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 = UMLParserProvider.getParser(UMLElementTypes.ActionInputPin_3168, getParserElement(), + UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActionPinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID)); + } + return parser; + } + + /** + * @generated + */ + protected DirectEditManager getManager() { + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + } + return manager; + } + + /** + * @generated + */ + protected void setManager(DirectEditManager manager) { + this.manager = manager; + } + + /** + * @generated + */ + protected void performDirectEdit() { + BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() { + + @Override + public void run() { + getManager().show(); + } + }); + } + + /** + * @generated + */ + protected void performDirectEdit(Point eventLocation) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); + } + } + + /** + * @generated + */ + private void performDirectEdit(char initialCharacter) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); + } else { + performDirectEdit(); + } + } + + /** + * @generated + */ + protected void performDirectEditRequest(Request request) { + final Request theRequest = request; + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + directEditionMode = getDirectEditionType(); + } + switch (directEditionMode) { + case IDirectEdition.NO_DIRECT_EDITION: + // no direct edition mode => does nothing + return; + case IDirectEdition.EXTENDED_DIRECT_EDITOR: + updateExtendedEditorConfiguration(); + if (configuration == null || configuration.getLanguage() == null) { + // Create default edit manager + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + performDefaultDirectEditorEdit(theRequest); + } else { + configuration.preEditAction(resolveSemanticElement()); + Dialog dialog = null; + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); + initializeDirectEditManager(theRequest); + return; + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this); + helper.showEditor(); + return; + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else { + return; + } + final Dialog finalDialog = dialog; + if (Window.OK == dialog.open()) { + TransactionalEditingDomain domain = getEditingDomain(); + RecordingCommand command = new RecordingCommand(domain, "Edit Label") { + + @Override + protected void doExecute() { + configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue()); + } + }; + domain.getCommandStack().execute(command); + } + } + break; + case IDirectEdition.DEFAULT_DIRECT_EDITOR: + initializeDirectEditManager(theRequest); + break; + default: + break; + } + } + + /** + * @generated + */ + protected void initializeDirectEditManager(final Request request) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + if (isActive() && isEditable()) { + if (request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * @generated + */ + protected void refreshVisuals() { + super.refreshVisuals(); + refreshLabel(); + refreshFont(); + refreshFontColor(); + refreshUnderline(); + refreshStrikeThrough(); + } + + /** + * @generated + */ + protected void refreshLabel() { + EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); + if (maskLabelPolicy == null) { + maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); + } + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { + setLabelTextHelper(getFigure(), getLabelText()); + setLabelIconHelper(getFigure(), getLabelIcon()); + } else { + setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$ + setLabelIconHelper(getFigure(), null); + } + } + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + /** + * @generated + */ + protected void refreshUnderline() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); + } + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); + } else { + ((WrappingLabel) getFigure()).setTextUnderline(false); + } + } + } + + /** + * @generated + */ + protected void refreshStrikeThrough() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + } + } + + /** + * @generated + */ + 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() { + + @Override + public void getName(AccessibleEvent e) { + e.result = getLabelTextHelper(getFigure()); + } + }; + } + return accessibleEP; + } + + /** + * @generated + */ + private View getFontStyleOwnerView() { + return getPrimaryView(); + } + + /** + * Returns the kind of associated editor for direct edition. + * + * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition + * @generated + */ + public int getDirectEditionType() { + if (checkExtendedEditor()) { + initExtendedEditorConfiguration(); + return IDirectEdition.EXTENDED_DIRECT_EDITOR; + } + if (checkDefaultEdition()) { + return IDirectEdition.DEFAULT_DIRECT_EDITOR; + } + // not a named element. no specific editor => do nothing + return IDirectEdition.NO_DIRECT_EDITION; + } + + /** + * Checks if an extended editor is present. + * + * @return <code>true</code> if an extended editor is present. + * @generated + */ + protected boolean checkExtendedEditor() { + if (resolveSemanticElement() != null) { + return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName()); + } + return false; + } + + /** + * Checks if a default direct edition is available + * + * @return <code>true</code> if a default direct edition is available + * @generated + */ + protected boolean checkDefaultEdition() { + return (getParser() != null); + } + + /** + * Initializes the extended editor configuration + * + * @generated + */ + protected void initExtendedEditorConfiguration() { + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); + } + } + } + + /** + * Updates the preference configuration + * + * @generated + */ + protected void updateExtendedEditorConfiguration() { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + configuration = null; + } + } + + /** + * Performs the direct edit usually used by GMF editors. + * + * @param theRequest + * the direct edit request that starts the direct edit system + * @generated + */ + protected void performDefaultDirectEditorEdit(final Request theRequest) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + if (isActive() && isEditable()) { + if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; + performDirectEdit(editRequest.getLocation()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * @generated + */ + 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 AppliedStereotypeWrappingLabelFigure(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInReadIsClassifiedObjectActionAsObjectEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInReadIsClassifiedObjectActionAsObjectEditPart.java new file mode 100644 index 00000000000..1023ca62c1e --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInReadIsClassifiedObjectActionAsObjectEditPart.java @@ -0,0 +1,255 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.parts; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.StackLayout; +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.RequestConstants; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.editpolicies.LayoutEditPolicy; +import org.eclipse.gef.editpolicies.NonResizableEditPolicy; +import org.eclipse.gef.handles.MoveHandle; +import org.eclipse.gef.requests.CreateRequest; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; +import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; +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.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure; +import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure; +import org.eclipse.papyrus.uml.diagram.activity.edit.part.AbstractPinEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.ActionPinInReadIsClassifiedObjectActionAsObjectItemSemanticEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.NoDeleteFromDiagramEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.OpenDiagramEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.PinLayoutEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.figures.PinFigure; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator; +import org.eclipse.swt.graphics.Color; + +/** + * @generated + */ +public class ActionPinInReadIsClassifiedObjectActionAsObjectEditPart extends AbstractPinEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 3168; + + /** + * @generated + */ + protected IFigure contentPane; + + /** + * @generated + */ + protected IFigure primaryShape; + + /** + * @generated + */ + public ActionPinInReadIsClassifiedObjectActionAsObjectEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, getPrimaryDragEditPolicy()); + installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ActionPinInReadIsClassifiedObjectActionAsObjectItemSemanticEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); + installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, new PinLayoutEditPolicy()); + installEditPolicy(RequestConstants.REQ_DELETE, new NoDeleteFromDiagramEditPolicy()); + // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies + // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE); + } + + /** + * @generated + */ + protected LayoutEditPolicy createLayoutEditPolicy() { + org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() { + + @Override + protected EditPolicy createChildEditPolicy(EditPart child) { + View childView = (View) child.getModel(); + switch (UMLVisualIDRegistry.getVisualID(childView)) { + case ActionPinInReadIsClassifiedObjectActionAsObjectLabelEditPart.VISUAL_ID: + case ActionPinInReadIsClassifiedObjectActionAsObjectValueEditPart.VISUAL_ID: + case ActionPinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID: + return new BorderItemSelectionEditPolicy() { + + @Override + protected List<?> createSelectionHandles() { + MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost()); + mh.setBorder(null); + return Collections.singletonList(mh); + } + }; + } + EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (result == null) { + result = new NonResizableEditPolicy(); + } + return result; + } + + @Override + protected Command getMoveChildrenCommand(Request request) { + return null; + } + + @Override + protected Command getCreateCommand(CreateRequest request) { + return null; + } + }; + return lep; + } + + /** + * Papyrus codeGen + * + * @generated + **/ + protected void handleNotificationEvent(Notification event) { + /* + * when a node have external node labels, the methods refreshChildren() remove the EditPart corresponding to the Label from the EditPart + * Registry. After that, we can't reset the visibility to true (using the Show/Hide Label Action)! + */ + if (NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) { + Object notifier = event.getNotifier(); + List<?> modelChildren = ((View) getModel()).getChildren(); + if (!(notifier instanceof Edge)) { + if (modelChildren.contains(event.getNotifier())) { + return; + } + } + } + super.handleNotificationEvent(event); + } + + /** + * @generated + */ + protected IFigure createNodeShape() { + return primaryShape = new PinFigure(); + } + + /** + * org.eclipse.papyrus.uml.diagram.activity.figures.PinFigure + * + * @generated + */ + public PinFigure getPrimaryShape() { + return (PinFigure) primaryShape; + } + + /** + * @generated + */ + protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) { + if (borderItemEditPart instanceof ActionPinInReadIsClassifiedObjectActionAsObjectLabelEditPart) { + IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure()); + borderItemContainer.add(borderItemEditPart.getFigure(), locator); + } else if (borderItemEditPart instanceof ActionPinInReadIsClassifiedObjectActionAsObjectValueEditPart) { + IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure()); + borderItemContainer.add(borderItemEditPart.getFigure(), locator); + } else if (borderItemEditPart instanceof ActionPinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart) { + IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure()); + borderItemContainer.add(borderItemEditPart.getFigure(), locator); + } else { + super.addBorderItem(borderItemContainer, borderItemEditPart); + } + } + + protected NodeFigure createNodePlate() { + RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(16, 16); + 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) { + super.setLineWidth(width); + } + + /** + * @generated + */ + protected void setLineType(int style) { + if (primaryShape instanceof IPapyrusNodeFigure) { + ((IPapyrusNodeFigure) primaryShape).setLineStyle(style); + } + } + + /** + * @generated + */ + public EditPart getPrimaryChildEditPart() { + return getChildBySemanticHint(UMLVisualIDRegistry.getType(ActionPinInReadIsClassifiedObjectActionAsObjectLabelEditPart.VISUAL_ID)); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInReadIsClassifiedObjectActionAsObjectLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInReadIsClassifiedObjectActionAsObjectLabelEditPart.java new file mode 100644 index 00000000000..4bc2f9fd22b --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInReadIsClassifiedObjectActionAsObjectLabelEditPart.java @@ -0,0 +1,785 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.parts; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.Label; +import org.eclipse.draw2d.geometry.Point; +import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.transaction.RecordingCommand; +import org.eclipse.emf.transaction.RunnableWithResult; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gef.AccessibleEditPart; +import org.eclipse.gef.EditPolicy; +import org.eclipse.gef.Request; +import org.eclipse.gef.requests.DirectEditRequest; +import org.eclipse.gef.tools.DirectEditManager; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; +import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; +import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; +import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; +import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; +import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; +import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; +import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; +import org.eclipse.gmf.runtime.notation.FontStyle; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.text.contentassist.IContentAssistProcessor; +import org.eclipse.jface.viewers.ICellEditorValidator; +import org.eclipse.jface.window.Window; +import org.eclipse.papyrus.extensionpoints.editors.Activator; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper; +import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil; +import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds; +import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.figures.SimpleLabel; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLParserProvider; +import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; +import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; +import org.eclipse.swt.SWT; +import org.eclipse.swt.accessibility.AccessibleEvent; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.PlatformUI; +import org.eclipse.uml2.uml.Feature; + +/** + * @generated + */ +public class ActionPinInReadIsClassifiedObjectActionAsObjectLabelEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 5311; + + /** + * @generated + */ + private DirectEditManager manager; + + /** + * @generated + */ + private IParser parser; + + /** + * @generated + */ + private List<?> parserElements; + + /** + * @generated + */ + private String defaultText; + + /** + * direct edition mode (default, undefined, registered editor, etc.) + * + * @generated + */ + protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR; + + /** + * configuration from a registered edit dialog + * + * @generated + */ + protected IDirectEditorConfiguration configuration; + /** + * @generated + */ + static { + registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActionPinInReadIsClassifiedObjectActionAsObjectLabelEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public ActionPinInReadIsClassifiedObjectActionAsObjectLabelEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy()); + installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy()); + installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy()); + } + + /** + * @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 + */ + public void setParser(IParser parser) { + this.parser = parser; + } + + /** + * @generated + */ + protected EObject getParserElement() { + return resolveSemanticElement(); + } + + /** + * @generated + */ + protected Image getLabelIcon() { + return null; + } + + /** + * @generated + */ + protected String getLabelText() { + String text = null; + EObject parserElement = getParserElement(); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + } + if (text == null || text.length() == 0) { + text = defaultText; + } + return text; + } + + /** + * @generated + */ + public void setLabelText(String text) { + setLabelTextHelper(getFigure(), text); + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + /** + * @generated + */ + 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() { + + @Override + public String isValid(final Object value) { + if (value instanceof String) { + final EObject element = getParserElement(); + final IParser parser = getParser(); + try { + IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value)); + } + }); + return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); + } catch (InterruptedException ie) { + ie.printStackTrace(); + } + } + // shouldn't get here + return null; + } + }; + } + + /** + * @generated + */ + 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 = UMLParserProvider.getParser(UMLElementTypes.ActionInputPin_3168, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActionPinInReadIsClassifiedObjectActionAsObjectLabelEditPart.VISUAL_ID)); + } + return parser; + } + + /** + * @generated + */ + protected DirectEditManager getManager() { + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + } + return manager; + } + + /** + * @generated + */ + protected void setManager(DirectEditManager manager) { + this.manager = manager; + } + + /** + * @generated + */ + protected void performDirectEdit() { + BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() { + + @Override + public void run() { + getManager().show(); + } + }); + } + + /** + * @generated + */ + protected void performDirectEdit(Point eventLocation) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); + } + } + + /** + * @generated + */ + private void performDirectEdit(char initialCharacter) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); + } else { + performDirectEdit(); + } + } + + /** + * @generated + */ + protected void performDirectEditRequest(Request request) { + final Request theRequest = request; + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + directEditionMode = getDirectEditionType(); + } + switch (directEditionMode) { + case IDirectEdition.NO_DIRECT_EDITION: + // no direct edition mode => does nothing + return; + case IDirectEdition.EXTENDED_DIRECT_EDITOR: + updateExtendedEditorConfiguration(); + if (configuration == null || configuration.getLanguage() == null) { + // Create default edit manager + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + performDefaultDirectEditorEdit(theRequest); + } else { + configuration.preEditAction(resolveSemanticElement()); + Dialog dialog = null; + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); + initializeDirectEditManager(theRequest); + return; + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this); + helper.showEditor(); + return; + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else { + return; + } + final Dialog finalDialog = dialog; + if (Window.OK == dialog.open()) { + TransactionalEditingDomain domain = getEditingDomain(); + RecordingCommand command = new RecordingCommand(domain, "Edit Label") { + + @Override + protected void doExecute() { + configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue()); + } + }; + domain.getCommandStack().execute(command); + } + } + break; + case IDirectEdition.DEFAULT_DIRECT_EDITOR: + initializeDirectEditManager(theRequest); + break; + default: + break; + } + } + + /** + * @generated + */ + protected void initializeDirectEditManager(final Request request) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + if (isActive() && isEditable()) { + if (request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * @generated + */ + protected void refreshVisuals() { + super.refreshVisuals(); + refreshLabel(); + refreshFont(); + refreshFontColor(); + refreshUnderline(); + refreshStrikeThrough(); + } + + /** + * @generated + */ + protected void refreshLabel() { + EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); + if (maskLabelPolicy == null) { + maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); + } + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { + setLabelTextHelper(getFigure(), getLabelText()); + setLabelIconHelper(getFigure(), getLabelIcon()); + } else { + setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$ + setLabelIconHelper(getFigure(), null); + } + } + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + /** + * @generated + */ + protected void refreshUnderline() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); + } + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); + } else { + ((WrappingLabel) getFigure()).setTextUnderline(false); + } + } + } + + /** + * @generated + */ + protected void refreshStrikeThrough() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + } + } + + /** + * @generated + */ + 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() { + + @Override + public void getName(AccessibleEvent e) { + e.result = getLabelTextHelper(getFigure()); + } + }; + } + return accessibleEP; + } + + /** + * @generated + */ + private View getFontStyleOwnerView() { + return getPrimaryView(); + } + + /** + * Returns the kind of associated editor for direct edition. + * + * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition + * @generated + */ + public int getDirectEditionType() { + if (checkExtendedEditor()) { + initExtendedEditorConfiguration(); + return IDirectEdition.EXTENDED_DIRECT_EDITOR; + } + if (checkDefaultEdition()) { + return IDirectEdition.DEFAULT_DIRECT_EDITOR; + } + // not a named element. no specific editor => do nothing + return IDirectEdition.NO_DIRECT_EDITION; + } + + /** + * Checks if an extended editor is present. + * + * @return <code>true</code> if an extended editor is present. + * @generated + */ + protected boolean checkExtendedEditor() { + if (resolveSemanticElement() != null) { + return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName()); + } + return false; + } + + /** + * Checks if a default direct edition is available + * + * @return <code>true</code> if a default direct edition is available + * @generated + */ + protected boolean checkDefaultEdition() { + return (getParser() != null); + } + + /** + * Initializes the extended editor configuration + * + * @generated + */ + protected void initExtendedEditorConfiguration() { + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); + } + } + } + + /** + * Updates the preference configuration + * + * @generated + */ + protected void updateExtendedEditorConfiguration() { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + configuration = null; + } + } + + /** + * Performs the direct edit usually used by GMF editors. + * + * @param theRequest + * the direct edit request that starts the direct edit system + * @generated + */ + protected void performDefaultDirectEditorEdit(final Request theRequest) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + if (isActive() && isEditable()) { + if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; + performDirectEdit(editRequest.getLocation()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * @generated + */ + 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 SimpleLabel(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInReadIsClassifiedObjectActionAsObjectValueEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInReadIsClassifiedObjectActionAsObjectValueEditPart.java new file mode 100644 index 00000000000..95adfc65ef2 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInReadIsClassifiedObjectActionAsObjectValueEditPart.java @@ -0,0 +1,785 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.parts; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.Label; +import org.eclipse.draw2d.geometry.Point; +import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.transaction.RecordingCommand; +import org.eclipse.emf.transaction.RunnableWithResult; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gef.AccessibleEditPart; +import org.eclipse.gef.EditPolicy; +import org.eclipse.gef.Request; +import org.eclipse.gef.requests.DirectEditRequest; +import org.eclipse.gef.tools.DirectEditManager; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; +import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; +import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; +import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; +import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; +import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; +import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; +import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; +import org.eclipse.gmf.runtime.notation.FontStyle; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.text.contentassist.IContentAssistProcessor; +import org.eclipse.jface.viewers.ICellEditorValidator; +import org.eclipse.jface.window.Window; +import org.eclipse.papyrus.extensionpoints.editors.Activator; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper; +import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil; +import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds; +import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.figures.SimpleLabel; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLParserProvider; +import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; +import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; +import org.eclipse.swt.SWT; +import org.eclipse.swt.accessibility.AccessibleEvent; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.PlatformUI; +import org.eclipse.uml2.uml.Feature; + +/** + * @generated + */ +public class ActionPinInReadIsClassifiedObjectActionAsObjectValueEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 5312; + + /** + * @generated + */ + private DirectEditManager manager; + + /** + * @generated + */ + private IParser parser; + + /** + * @generated + */ + private List<?> parserElements; + + /** + * @generated + */ + private String defaultText; + + /** + * direct edition mode (default, undefined, registered editor, etc.) + * + * @generated + */ + protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR; + + /** + * configuration from a registered edit dialog + * + * @generated + */ + protected IDirectEditorConfiguration configuration; + /** + * @generated + */ + static { + registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActionPinInReadIsClassifiedObjectActionAsObjectValueEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public ActionPinInReadIsClassifiedObjectActionAsObjectValueEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy()); + installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy()); + installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy()); + } + + /** + * @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 + */ + public void setParser(IParser parser) { + this.parser = parser; + } + + /** + * @generated + */ + protected EObject getParserElement() { + return resolveSemanticElement(); + } + + /** + * @generated + */ + protected Image getLabelIcon() { + return null; + } + + /** + * @generated + */ + protected String getLabelText() { + String text = null; + EObject parserElement = getParserElement(); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + } + if (text == null || text.length() == 0) { + text = defaultText; + } + return text; + } + + /** + * @generated + */ + public void setLabelText(String text) { + setLabelTextHelper(getFigure(), text); + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + /** + * @generated + */ + 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() { + + @Override + public String isValid(final Object value) { + if (value instanceof String) { + final EObject element = getParserElement(); + final IParser parser = getParser(); + try { + IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value)); + } + }); + return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); + } catch (InterruptedException ie) { + ie.printStackTrace(); + } + } + // shouldn't get here + return null; + } + }; + } + + /** + * @generated + */ + 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 = UMLParserProvider.getParser(UMLElementTypes.ActionInputPin_3168, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActionPinInReadIsClassifiedObjectActionAsObjectValueEditPart.VISUAL_ID)); + } + return parser; + } + + /** + * @generated + */ + protected DirectEditManager getManager() { + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + } + return manager; + } + + /** + * @generated + */ + protected void setManager(DirectEditManager manager) { + this.manager = manager; + } + + /** + * @generated + */ + protected void performDirectEdit() { + BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() { + + @Override + public void run() { + getManager().show(); + } + }); + } + + /** + * @generated + */ + protected void performDirectEdit(Point eventLocation) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); + } + } + + /** + * @generated + */ + private void performDirectEdit(char initialCharacter) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); + } else { + performDirectEdit(); + } + } + + /** + * @generated + */ + protected void performDirectEditRequest(Request request) { + final Request theRequest = request; + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + directEditionMode = getDirectEditionType(); + } + switch (directEditionMode) { + case IDirectEdition.NO_DIRECT_EDITION: + // no direct edition mode => does nothing + return; + case IDirectEdition.EXTENDED_DIRECT_EDITOR: + updateExtendedEditorConfiguration(); + if (configuration == null || configuration.getLanguage() == null) { + // Create default edit manager + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + performDefaultDirectEditorEdit(theRequest); + } else { + configuration.preEditAction(resolveSemanticElement()); + Dialog dialog = null; + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); + initializeDirectEditManager(theRequest); + return; + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this); + helper.showEditor(); + return; + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else { + return; + } + final Dialog finalDialog = dialog; + if (Window.OK == dialog.open()) { + TransactionalEditingDomain domain = getEditingDomain(); + RecordingCommand command = new RecordingCommand(domain, "Edit Label") { + + @Override + protected void doExecute() { + configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue()); + } + }; + domain.getCommandStack().execute(command); + } + } + break; + case IDirectEdition.DEFAULT_DIRECT_EDITOR: + initializeDirectEditManager(theRequest); + break; + default: + break; + } + } + + /** + * @generated + */ + protected void initializeDirectEditManager(final Request request) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + if (isActive() && isEditable()) { + if (request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * @generated + */ + protected void refreshVisuals() { + super.refreshVisuals(); + refreshLabel(); + refreshFont(); + refreshFontColor(); + refreshUnderline(); + refreshStrikeThrough(); + } + + /** + * @generated + */ + protected void refreshLabel() { + EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); + if (maskLabelPolicy == null) { + maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); + } + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { + setLabelTextHelper(getFigure(), getLabelText()); + setLabelIconHelper(getFigure(), getLabelIcon()); + } else { + setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$ + setLabelIconHelper(getFigure(), null); + } + } + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + /** + * @generated + */ + protected void refreshUnderline() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); + } + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); + } else { + ((WrappingLabel) getFigure()).setTextUnderline(false); + } + } + } + + /** + * @generated + */ + protected void refreshStrikeThrough() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + } + } + + /** + * @generated + */ + 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() { + + @Override + public void getName(AccessibleEvent e) { + e.result = getLabelTextHelper(getFigure()); + } + }; + } + return accessibleEP; + } + + /** + * @generated + */ + private View getFontStyleOwnerView() { + return getPrimaryView(); + } + + /** + * Returns the kind of associated editor for direct edition. + * + * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition + * @generated + */ + public int getDirectEditionType() { + if (checkExtendedEditor()) { + initExtendedEditorConfiguration(); + return IDirectEdition.EXTENDED_DIRECT_EDITOR; + } + if (checkDefaultEdition()) { + return IDirectEdition.DEFAULT_DIRECT_EDITOR; + } + // not a named element. no specific editor => do nothing + return IDirectEdition.NO_DIRECT_EDITION; + } + + /** + * Checks if an extended editor is present. + * + * @return <code>true</code> if an extended editor is present. + * @generated + */ + protected boolean checkExtendedEditor() { + if (resolveSemanticElement() != null) { + return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName()); + } + return false; + } + + /** + * Checks if a default direct edition is available + * + * @return <code>true</code> if a default direct edition is available + * @generated + */ + protected boolean checkDefaultEdition() { + return (getParser() != null); + } + + /** + * Initializes the extended editor configuration + * + * @generated + */ + protected void initExtendedEditorConfiguration() { + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); + } + } + } + + /** + * Updates the preference configuration + * + * @generated + */ + protected void updateExtendedEditorConfiguration() { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + configuration = null; + } + } + + /** + * Performs the direct edit usually used by GMF editors. + * + * @param theRequest + * the direct edit request that starts the direct edit system + * @generated + */ + protected void performDefaultDirectEditorEdit(final Request theRequest) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + if (isActive() && isEditable()) { + if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; + performDirectEdit(editRequest.getLocation()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * @generated + */ + 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 SimpleLabel(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInReclassifyObjectActionAsObjectAppliedStereotypeLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInReclassifyObjectActionAsObjectAppliedStereotypeLabelEditPart.java new file mode 100644 index 00000000000..c82a597d2d9 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInReclassifyObjectActionAsObjectAppliedStereotypeLabelEditPart.java @@ -0,0 +1,789 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.parts; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.Label; +import org.eclipse.draw2d.geometry.Point; +import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.transaction.RecordingCommand; +import org.eclipse.emf.transaction.RunnableWithResult; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gef.AccessibleEditPart; +import org.eclipse.gef.EditPolicy; +import org.eclipse.gef.Request; +import org.eclipse.gef.requests.DirectEditRequest; +import org.eclipse.gef.tools.DirectEditManager; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; +import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; +import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; +import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; +import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; +import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; +import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; +import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; +import org.eclipse.gmf.runtime.notation.FontStyle; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.text.contentassist.IContentAssistProcessor; +import org.eclipse.jface.viewers.ICellEditorValidator; +import org.eclipse.jface.window.Window; +import org.eclipse.papyrus.extensionpoints.editors.Activator; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper; +import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil; +import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLParserProvider; +import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; +import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractLabelEditPart; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.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; +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.custom.BusyIndicator; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.PlatformUI; +import org.eclipse.uml2.uml.Feature; + +/** + * @generated + */ +public class ActionPinInReclassifyObjectActionAsObjectAppliedStereotypeLabelEditPart extends AbstractLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 5307; + + /** + * @generated + */ + private DirectEditManager manager; + + /** + * @generated + */ + private IParser parser; + + /** + * @generated + */ + private List<?> parserElements; + + /** + * @generated + */ + private String defaultText; + + /** + * direct edition mode (default, undefined, registered editor, etc.) + * + * @generated + */ + protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR; + + /** + * configuration from a registered edit dialog + * + * @generated + */ + protected IDirectEditorConfiguration configuration; + /** + * @generated + */ + static { + registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActionPinInReclassifyObjectActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public ActionPinInReclassifyObjectActionAsObjectAppliedStereotypeLabelEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy()); + installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy()); + installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeExternalNodeEditPolicy()); + installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy()); + } + + /** + * @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 + */ + public void setParser(IParser parser) { + this.parser = parser; + } + + /** + * @generated + */ + protected EObject getParserElement() { + return resolveSemanticElement(); + } + + /** + * @generated + */ + protected Image getLabelIcon() { + return null; + } + + /** + * @generated + */ + protected String getLabelText() { + String text = null; + EObject parserElement = getParserElement(); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + } + if (text == null || text.length() == 0) { + text = defaultText; + } + return text; + } + + /** + * @generated + */ + public void setLabelText(String text) { + setLabelTextHelper(getFigure(), text); + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + /** + * @generated + */ + 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() { + + @Override + public String isValid(final Object value) { + if (value instanceof String) { + final EObject element = getParserElement(); + final IParser parser = getParser(); + try { + IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value)); + } + }); + return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); + } catch (InterruptedException ie) { + ie.printStackTrace(); + } + } + // shouldn't get here + return null; + } + }; + } + + /** + * @generated + */ + 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 = UMLParserProvider.getParser(UMLElementTypes.ActionInputPin_3167, getParserElement(), + UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActionPinInReclassifyObjectActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID)); + } + return parser; + } + + /** + * @generated + */ + protected DirectEditManager getManager() { + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + } + return manager; + } + + /** + * @generated + */ + protected void setManager(DirectEditManager manager) { + this.manager = manager; + } + + /** + * @generated + */ + protected void performDirectEdit() { + BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() { + + @Override + public void run() { + getManager().show(); + } + }); + } + + /** + * @generated + */ + protected void performDirectEdit(Point eventLocation) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); + } + } + + /** + * @generated + */ + private void performDirectEdit(char initialCharacter) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); + } else { + performDirectEdit(); + } + } + + /** + * @generated + */ + protected void performDirectEditRequest(Request request) { + final Request theRequest = request; + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + directEditionMode = getDirectEditionType(); + } + switch (directEditionMode) { + case IDirectEdition.NO_DIRECT_EDITION: + // no direct edition mode => does nothing + return; + case IDirectEdition.EXTENDED_DIRECT_EDITOR: + updateExtendedEditorConfiguration(); + if (configuration == null || configuration.getLanguage() == null) { + // Create default edit manager + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + performDefaultDirectEditorEdit(theRequest); + } else { + configuration.preEditAction(resolveSemanticElement()); + Dialog dialog = null; + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); + initializeDirectEditManager(theRequest); + return; + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this); + helper.showEditor(); + return; + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else { + return; + } + final Dialog finalDialog = dialog; + if (Window.OK == dialog.open()) { + TransactionalEditingDomain domain = getEditingDomain(); + RecordingCommand command = new RecordingCommand(domain, "Edit Label") { + + @Override + protected void doExecute() { + configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue()); + } + }; + domain.getCommandStack().execute(command); + } + } + break; + case IDirectEdition.DEFAULT_DIRECT_EDITOR: + initializeDirectEditManager(theRequest); + break; + default: + break; + } + } + + /** + * @generated + */ + protected void initializeDirectEditManager(final Request request) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + if (isActive() && isEditable()) { + if (request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * @generated + */ + protected void refreshVisuals() { + super.refreshVisuals(); + refreshLabel(); + refreshFont(); + refreshFontColor(); + refreshUnderline(); + refreshStrikeThrough(); + } + + /** + * @generated + */ + protected void refreshLabel() { + EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); + if (maskLabelPolicy == null) { + maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); + } + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { + setLabelTextHelper(getFigure(), getLabelText()); + setLabelIconHelper(getFigure(), getLabelIcon()); + } else { + setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$ + setLabelIconHelper(getFigure(), null); + } + } + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + /** + * @generated + */ + protected void refreshUnderline() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); + } + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); + } else { + ((WrappingLabel) getFigure()).setTextUnderline(false); + } + } + } + + /** + * @generated + */ + protected void refreshStrikeThrough() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + } + } + + /** + * @generated + */ + 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() { + + @Override + public void getName(AccessibleEvent e) { + e.result = getLabelTextHelper(getFigure()); + } + }; + } + return accessibleEP; + } + + /** + * @generated + */ + private View getFontStyleOwnerView() { + return getPrimaryView(); + } + + /** + * Returns the kind of associated editor for direct edition. + * + * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition + * @generated + */ + public int getDirectEditionType() { + if (checkExtendedEditor()) { + initExtendedEditorConfiguration(); + return IDirectEdition.EXTENDED_DIRECT_EDITOR; + } + if (checkDefaultEdition()) { + return IDirectEdition.DEFAULT_DIRECT_EDITOR; + } + // not a named element. no specific editor => do nothing + return IDirectEdition.NO_DIRECT_EDITION; + } + + /** + * Checks if an extended editor is present. + * + * @return <code>true</code> if an extended editor is present. + * @generated + */ + protected boolean checkExtendedEditor() { + if (resolveSemanticElement() != null) { + return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName()); + } + return false; + } + + /** + * Checks if a default direct edition is available + * + * @return <code>true</code> if a default direct edition is available + * @generated + */ + protected boolean checkDefaultEdition() { + return (getParser() != null); + } + + /** + * Initializes the extended editor configuration + * + * @generated + */ + protected void initExtendedEditorConfiguration() { + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); + } + } + } + + /** + * Updates the preference configuration + * + * @generated + */ + protected void updateExtendedEditorConfiguration() { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + configuration = null; + } + } + + /** + * Performs the direct edit usually used by GMF editors. + * + * @param theRequest + * the direct edit request that starts the direct edit system + * @generated + */ + protected void performDefaultDirectEditorEdit(final Request theRequest) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + if (isActive() && isEditable()) { + if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; + performDirectEdit(editRequest.getLocation()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * @generated + */ + 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 AppliedStereotypeWrappingLabelFigure(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInReclassifyObjectActionAsObjectEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInReclassifyObjectActionAsObjectEditPart.java new file mode 100644 index 00000000000..e6551ea6e5b --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInReclassifyObjectActionAsObjectEditPart.java @@ -0,0 +1,255 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.parts; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.StackLayout; +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.RequestConstants; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.editpolicies.LayoutEditPolicy; +import org.eclipse.gef.editpolicies.NonResizableEditPolicy; +import org.eclipse.gef.handles.MoveHandle; +import org.eclipse.gef.requests.CreateRequest; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; +import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; +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.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure; +import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure; +import org.eclipse.papyrus.uml.diagram.activity.edit.part.AbstractPinEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.ActionPinInReclassifyObjectActionAsObjectItemSemanticEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.NoDeleteFromDiagramEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.OpenDiagramEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.PinLayoutEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.figures.PinFigure; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator; +import org.eclipse.swt.graphics.Color; + +/** + * @generated + */ +public class ActionPinInReclassifyObjectActionAsObjectEditPart extends AbstractPinEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 3167; + + /** + * @generated + */ + protected IFigure contentPane; + + /** + * @generated + */ + protected IFigure primaryShape; + + /** + * @generated + */ + public ActionPinInReclassifyObjectActionAsObjectEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, getPrimaryDragEditPolicy()); + installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ActionPinInReclassifyObjectActionAsObjectItemSemanticEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); + installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, new PinLayoutEditPolicy()); + installEditPolicy(RequestConstants.REQ_DELETE, new NoDeleteFromDiagramEditPolicy()); + // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies + // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE); + } + + /** + * @generated + */ + protected LayoutEditPolicy createLayoutEditPolicy() { + org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() { + + @Override + protected EditPolicy createChildEditPolicy(EditPart child) { + View childView = (View) child.getModel(); + switch (UMLVisualIDRegistry.getVisualID(childView)) { + case ActionPinInReclassifyObjectActionAsObjectLabelEditPart.VISUAL_ID: + case ActionPinInReclassifyObjectActionAsObjectValueEditPart.VISUAL_ID: + case ActionPinInReclassifyObjectActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID: + return new BorderItemSelectionEditPolicy() { + + @Override + protected List<?> createSelectionHandles() { + MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost()); + mh.setBorder(null); + return Collections.singletonList(mh); + } + }; + } + EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (result == null) { + result = new NonResizableEditPolicy(); + } + return result; + } + + @Override + protected Command getMoveChildrenCommand(Request request) { + return null; + } + + @Override + protected Command getCreateCommand(CreateRequest request) { + return null; + } + }; + return lep; + } + + /** + * Papyrus codeGen + * + * @generated + **/ + protected void handleNotificationEvent(Notification event) { + /* + * when a node have external node labels, the methods refreshChildren() remove the EditPart corresponding to the Label from the EditPart + * Registry. After that, we can't reset the visibility to true (using the Show/Hide Label Action)! + */ + if (NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) { + Object notifier = event.getNotifier(); + List<?> modelChildren = ((View) getModel()).getChildren(); + if (!(notifier instanceof Edge)) { + if (modelChildren.contains(event.getNotifier())) { + return; + } + } + } + super.handleNotificationEvent(event); + } + + /** + * @generated + */ + protected IFigure createNodeShape() { + return primaryShape = new PinFigure(); + } + + /** + * org.eclipse.papyrus.uml.diagram.activity.figures.PinFigure + * + * @generated + */ + public PinFigure getPrimaryShape() { + return (PinFigure) primaryShape; + } + + /** + * @generated + */ + protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) { + if (borderItemEditPart instanceof ActionPinInReclassifyObjectActionAsObjectLabelEditPart) { + IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure()); + borderItemContainer.add(borderItemEditPart.getFigure(), locator); + } else if (borderItemEditPart instanceof ActionPinInReclassifyObjectActionAsObjectValueEditPart) { + IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure()); + borderItemContainer.add(borderItemEditPart.getFigure(), locator); + } else if (borderItemEditPart instanceof ActionPinInReclassifyObjectActionAsObjectAppliedStereotypeLabelEditPart) { + IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure()); + borderItemContainer.add(borderItemEditPart.getFigure(), locator); + } else { + super.addBorderItem(borderItemContainer, borderItemEditPart); + } + } + + protected NodeFigure createNodePlate() { + RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(16, 16); + 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) { + super.setLineWidth(width); + } + + /** + * @generated + */ + protected void setLineType(int style) { + if (primaryShape instanceof IPapyrusNodeFigure) { + ((IPapyrusNodeFigure) primaryShape).setLineStyle(style); + } + } + + /** + * @generated + */ + public EditPart getPrimaryChildEditPart() { + return getChildBySemanticHint(UMLVisualIDRegistry.getType(ActionPinInReclassifyObjectActionAsObjectLabelEditPart.VISUAL_ID)); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInReclassifyObjectActionAsObjectLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInReclassifyObjectActionAsObjectLabelEditPart.java new file mode 100644 index 00000000000..7d4a66e5706 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInReclassifyObjectActionAsObjectLabelEditPart.java @@ -0,0 +1,785 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.parts; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.Label; +import org.eclipse.draw2d.geometry.Point; +import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.transaction.RecordingCommand; +import org.eclipse.emf.transaction.RunnableWithResult; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gef.AccessibleEditPart; +import org.eclipse.gef.EditPolicy; +import org.eclipse.gef.Request; +import org.eclipse.gef.requests.DirectEditRequest; +import org.eclipse.gef.tools.DirectEditManager; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; +import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; +import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; +import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; +import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; +import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; +import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; +import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; +import org.eclipse.gmf.runtime.notation.FontStyle; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.text.contentassist.IContentAssistProcessor; +import org.eclipse.jface.viewers.ICellEditorValidator; +import org.eclipse.jface.window.Window; +import org.eclipse.papyrus.extensionpoints.editors.Activator; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper; +import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil; +import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds; +import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.figures.SimpleLabel; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLParserProvider; +import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; +import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; +import org.eclipse.swt.SWT; +import org.eclipse.swt.accessibility.AccessibleEvent; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.PlatformUI; +import org.eclipse.uml2.uml.Feature; + +/** + * @generated + */ +public class ActionPinInReclassifyObjectActionAsObjectLabelEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 5305; + + /** + * @generated + */ + private DirectEditManager manager; + + /** + * @generated + */ + private IParser parser; + + /** + * @generated + */ + private List<?> parserElements; + + /** + * @generated + */ + private String defaultText; + + /** + * direct edition mode (default, undefined, registered editor, etc.) + * + * @generated + */ + protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR; + + /** + * configuration from a registered edit dialog + * + * @generated + */ + protected IDirectEditorConfiguration configuration; + /** + * @generated + */ + static { + registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActionPinInReclassifyObjectActionAsObjectLabelEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public ActionPinInReclassifyObjectActionAsObjectLabelEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy()); + installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy()); + installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy()); + } + + /** + * @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 + */ + public void setParser(IParser parser) { + this.parser = parser; + } + + /** + * @generated + */ + protected EObject getParserElement() { + return resolveSemanticElement(); + } + + /** + * @generated + */ + protected Image getLabelIcon() { + return null; + } + + /** + * @generated + */ + protected String getLabelText() { + String text = null; + EObject parserElement = getParserElement(); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + } + if (text == null || text.length() == 0) { + text = defaultText; + } + return text; + } + + /** + * @generated + */ + public void setLabelText(String text) { + setLabelTextHelper(getFigure(), text); + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + /** + * @generated + */ + 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() { + + @Override + public String isValid(final Object value) { + if (value instanceof String) { + final EObject element = getParserElement(); + final IParser parser = getParser(); + try { + IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value)); + } + }); + return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); + } catch (InterruptedException ie) { + ie.printStackTrace(); + } + } + // shouldn't get here + return null; + } + }; + } + + /** + * @generated + */ + 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 = UMLParserProvider.getParser(UMLElementTypes.ActionInputPin_3167, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActionPinInReclassifyObjectActionAsObjectLabelEditPart.VISUAL_ID)); + } + return parser; + } + + /** + * @generated + */ + protected DirectEditManager getManager() { + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + } + return manager; + } + + /** + * @generated + */ + protected void setManager(DirectEditManager manager) { + this.manager = manager; + } + + /** + * @generated + */ + protected void performDirectEdit() { + BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() { + + @Override + public void run() { + getManager().show(); + } + }); + } + + /** + * @generated + */ + protected void performDirectEdit(Point eventLocation) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); + } + } + + /** + * @generated + */ + private void performDirectEdit(char initialCharacter) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); + } else { + performDirectEdit(); + } + } + + /** + * @generated + */ + protected void performDirectEditRequest(Request request) { + final Request theRequest = request; + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + directEditionMode = getDirectEditionType(); + } + switch (directEditionMode) { + case IDirectEdition.NO_DIRECT_EDITION: + // no direct edition mode => does nothing + return; + case IDirectEdition.EXTENDED_DIRECT_EDITOR: + updateExtendedEditorConfiguration(); + if (configuration == null || configuration.getLanguage() == null) { + // Create default edit manager + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + performDefaultDirectEditorEdit(theRequest); + } else { + configuration.preEditAction(resolveSemanticElement()); + Dialog dialog = null; + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); + initializeDirectEditManager(theRequest); + return; + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this); + helper.showEditor(); + return; + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else { + return; + } + final Dialog finalDialog = dialog; + if (Window.OK == dialog.open()) { + TransactionalEditingDomain domain = getEditingDomain(); + RecordingCommand command = new RecordingCommand(domain, "Edit Label") { + + @Override + protected void doExecute() { + configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue()); + } + }; + domain.getCommandStack().execute(command); + } + } + break; + case IDirectEdition.DEFAULT_DIRECT_EDITOR: + initializeDirectEditManager(theRequest); + break; + default: + break; + } + } + + /** + * @generated + */ + protected void initializeDirectEditManager(final Request request) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + if (isActive() && isEditable()) { + if (request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * @generated + */ + protected void refreshVisuals() { + super.refreshVisuals(); + refreshLabel(); + refreshFont(); + refreshFontColor(); + refreshUnderline(); + refreshStrikeThrough(); + } + + /** + * @generated + */ + protected void refreshLabel() { + EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); + if (maskLabelPolicy == null) { + maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); + } + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { + setLabelTextHelper(getFigure(), getLabelText()); + setLabelIconHelper(getFigure(), getLabelIcon()); + } else { + setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$ + setLabelIconHelper(getFigure(), null); + } + } + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + /** + * @generated + */ + protected void refreshUnderline() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); + } + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); + } else { + ((WrappingLabel) getFigure()).setTextUnderline(false); + } + } + } + + /** + * @generated + */ + protected void refreshStrikeThrough() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + } + } + + /** + * @generated + */ + 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() { + + @Override + public void getName(AccessibleEvent e) { + e.result = getLabelTextHelper(getFigure()); + } + }; + } + return accessibleEP; + } + + /** + * @generated + */ + private View getFontStyleOwnerView() { + return getPrimaryView(); + } + + /** + * Returns the kind of associated editor for direct edition. + * + * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition + * @generated + */ + public int getDirectEditionType() { + if (checkExtendedEditor()) { + initExtendedEditorConfiguration(); + return IDirectEdition.EXTENDED_DIRECT_EDITOR; + } + if (checkDefaultEdition()) { + return IDirectEdition.DEFAULT_DIRECT_EDITOR; + } + // not a named element. no specific editor => do nothing + return IDirectEdition.NO_DIRECT_EDITION; + } + + /** + * Checks if an extended editor is present. + * + * @return <code>true</code> if an extended editor is present. + * @generated + */ + protected boolean checkExtendedEditor() { + if (resolveSemanticElement() != null) { + return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName()); + } + return false; + } + + /** + * Checks if a default direct edition is available + * + * @return <code>true</code> if a default direct edition is available + * @generated + */ + protected boolean checkDefaultEdition() { + return (getParser() != null); + } + + /** + * Initializes the extended editor configuration + * + * @generated + */ + protected void initExtendedEditorConfiguration() { + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); + } + } + } + + /** + * Updates the preference configuration + * + * @generated + */ + protected void updateExtendedEditorConfiguration() { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + configuration = null; + } + } + + /** + * Performs the direct edit usually used by GMF editors. + * + * @param theRequest + * the direct edit request that starts the direct edit system + * @generated + */ + protected void performDefaultDirectEditorEdit(final Request theRequest) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + if (isActive() && isEditable()) { + if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; + performDirectEdit(editRequest.getLocation()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * @generated + */ + 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 SimpleLabel(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInReclassifyObjectActionAsObjectValueEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInReclassifyObjectActionAsObjectValueEditPart.java new file mode 100644 index 00000000000..7219acce36e --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInReclassifyObjectActionAsObjectValueEditPart.java @@ -0,0 +1,785 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.parts; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.Label; +import org.eclipse.draw2d.geometry.Point; +import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.transaction.RecordingCommand; +import org.eclipse.emf.transaction.RunnableWithResult; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gef.AccessibleEditPart; +import org.eclipse.gef.EditPolicy; +import org.eclipse.gef.Request; +import org.eclipse.gef.requests.DirectEditRequest; +import org.eclipse.gef.tools.DirectEditManager; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; +import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; +import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; +import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; +import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; +import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; +import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; +import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; +import org.eclipse.gmf.runtime.notation.FontStyle; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.text.contentassist.IContentAssistProcessor; +import org.eclipse.jface.viewers.ICellEditorValidator; +import org.eclipse.jface.window.Window; +import org.eclipse.papyrus.extensionpoints.editors.Activator; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper; +import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil; +import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds; +import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.figures.SimpleLabel; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLParserProvider; +import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; +import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; +import org.eclipse.swt.SWT; +import org.eclipse.swt.accessibility.AccessibleEvent; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.PlatformUI; +import org.eclipse.uml2.uml.Feature; + +/** + * @generated + */ +public class ActionPinInReclassifyObjectActionAsObjectValueEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 5306; + + /** + * @generated + */ + private DirectEditManager manager; + + /** + * @generated + */ + private IParser parser; + + /** + * @generated + */ + private List<?> parserElements; + + /** + * @generated + */ + private String defaultText; + + /** + * direct edition mode (default, undefined, registered editor, etc.) + * + * @generated + */ + protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR; + + /** + * configuration from a registered edit dialog + * + * @generated + */ + protected IDirectEditorConfiguration configuration; + /** + * @generated + */ + static { + registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActionPinInReclassifyObjectActionAsObjectValueEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public ActionPinInReclassifyObjectActionAsObjectValueEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy()); + installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy()); + installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy()); + } + + /** + * @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 + */ + public void setParser(IParser parser) { + this.parser = parser; + } + + /** + * @generated + */ + protected EObject getParserElement() { + return resolveSemanticElement(); + } + + /** + * @generated + */ + protected Image getLabelIcon() { + return null; + } + + /** + * @generated + */ + protected String getLabelText() { + String text = null; + EObject parserElement = getParserElement(); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + } + if (text == null || text.length() == 0) { + text = defaultText; + } + return text; + } + + /** + * @generated + */ + public void setLabelText(String text) { + setLabelTextHelper(getFigure(), text); + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + /** + * @generated + */ + 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() { + + @Override + public String isValid(final Object value) { + if (value instanceof String) { + final EObject element = getParserElement(); + final IParser parser = getParser(); + try { + IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value)); + } + }); + return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); + } catch (InterruptedException ie) { + ie.printStackTrace(); + } + } + // shouldn't get here + return null; + } + }; + } + + /** + * @generated + */ + 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 = UMLParserProvider.getParser(UMLElementTypes.ActionInputPin_3167, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActionPinInReclassifyObjectActionAsObjectValueEditPart.VISUAL_ID)); + } + return parser; + } + + /** + * @generated + */ + protected DirectEditManager getManager() { + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + } + return manager; + } + + /** + * @generated + */ + protected void setManager(DirectEditManager manager) { + this.manager = manager; + } + + /** + * @generated + */ + protected void performDirectEdit() { + BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() { + + @Override + public void run() { + getManager().show(); + } + }); + } + + /** + * @generated + */ + protected void performDirectEdit(Point eventLocation) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); + } + } + + /** + * @generated + */ + private void performDirectEdit(char initialCharacter) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); + } else { + performDirectEdit(); + } + } + + /** + * @generated + */ + protected void performDirectEditRequest(Request request) { + final Request theRequest = request; + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + directEditionMode = getDirectEditionType(); + } + switch (directEditionMode) { + case IDirectEdition.NO_DIRECT_EDITION: + // no direct edition mode => does nothing + return; + case IDirectEdition.EXTENDED_DIRECT_EDITOR: + updateExtendedEditorConfiguration(); + if (configuration == null || configuration.getLanguage() == null) { + // Create default edit manager + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + performDefaultDirectEditorEdit(theRequest); + } else { + configuration.preEditAction(resolveSemanticElement()); + Dialog dialog = null; + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); + initializeDirectEditManager(theRequest); + return; + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this); + helper.showEditor(); + return; + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else { + return; + } + final Dialog finalDialog = dialog; + if (Window.OK == dialog.open()) { + TransactionalEditingDomain domain = getEditingDomain(); + RecordingCommand command = new RecordingCommand(domain, "Edit Label") { + + @Override + protected void doExecute() { + configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue()); + } + }; + domain.getCommandStack().execute(command); + } + } + break; + case IDirectEdition.DEFAULT_DIRECT_EDITOR: + initializeDirectEditManager(theRequest); + break; + default: + break; + } + } + + /** + * @generated + */ + protected void initializeDirectEditManager(final Request request) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + if (isActive() && isEditable()) { + if (request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * @generated + */ + protected void refreshVisuals() { + super.refreshVisuals(); + refreshLabel(); + refreshFont(); + refreshFontColor(); + refreshUnderline(); + refreshStrikeThrough(); + } + + /** + * @generated + */ + protected void refreshLabel() { + EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); + if (maskLabelPolicy == null) { + maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); + } + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { + setLabelTextHelper(getFigure(), getLabelText()); + setLabelIconHelper(getFigure(), getLabelIcon()); + } else { + setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$ + setLabelIconHelper(getFigure(), null); + } + } + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + /** + * @generated + */ + protected void refreshUnderline() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); + } + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); + } else { + ((WrappingLabel) getFigure()).setTextUnderline(false); + } + } + } + + /** + * @generated + */ + protected void refreshStrikeThrough() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + } + } + + /** + * @generated + */ + 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() { + + @Override + public void getName(AccessibleEvent e) { + e.result = getLabelTextHelper(getFigure()); + } + }; + } + return accessibleEP; + } + + /** + * @generated + */ + private View getFontStyleOwnerView() { + return getPrimaryView(); + } + + /** + * Returns the kind of associated editor for direct edition. + * + * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition + * @generated + */ + public int getDirectEditionType() { + if (checkExtendedEditor()) { + initExtendedEditorConfiguration(); + return IDirectEdition.EXTENDED_DIRECT_EDITOR; + } + if (checkDefaultEdition()) { + return IDirectEdition.DEFAULT_DIRECT_EDITOR; + } + // not a named element. no specific editor => do nothing + return IDirectEdition.NO_DIRECT_EDITION; + } + + /** + * Checks if an extended editor is present. + * + * @return <code>true</code> if an extended editor is present. + * @generated + */ + protected boolean checkExtendedEditor() { + if (resolveSemanticElement() != null) { + return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName()); + } + return false; + } + + /** + * Checks if a default direct edition is available + * + * @return <code>true</code> if a default direct edition is available + * @generated + */ + protected boolean checkDefaultEdition() { + return (getParser() != null); + } + + /** + * Initializes the extended editor configuration + * + * @generated + */ + protected void initExtendedEditorConfiguration() { + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); + } + } + } + + /** + * Updates the preference configuration + * + * @generated + */ + protected void updateExtendedEditorConfiguration() { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + configuration = null; + } + } + + /** + * Performs the direct edit usually used by GMF editors. + * + * @param theRequest + * the direct edit request that starts the direct edit system + * @generated + */ + protected void performDefaultDirectEditorEdit(final Request theRequest) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + if (isActive() && isEditable()) { + if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; + performDirectEdit(editRequest.getLocation()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * @generated + */ + 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 SimpleLabel(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/InputPinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/InputPinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart.java new file mode 100644 index 00000000000..e0657036608 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/InputPinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart.java @@ -0,0 +1,789 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.parts; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.Label; +import org.eclipse.draw2d.geometry.Point; +import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.transaction.RecordingCommand; +import org.eclipse.emf.transaction.RunnableWithResult; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gef.AccessibleEditPart; +import org.eclipse.gef.EditPolicy; +import org.eclipse.gef.Request; +import org.eclipse.gef.requests.DirectEditRequest; +import org.eclipse.gef.tools.DirectEditManager; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; +import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; +import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; +import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; +import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; +import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; +import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; +import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; +import org.eclipse.gmf.runtime.notation.FontStyle; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.text.contentassist.IContentAssistProcessor; +import org.eclipse.jface.viewers.ICellEditorValidator; +import org.eclipse.jface.window.Window; +import org.eclipse.papyrus.extensionpoints.editors.Activator; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper; +import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil; +import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLParserProvider; +import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; +import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractLabelEditPart; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.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; +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.custom.BusyIndicator; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.PlatformUI; +import org.eclipse.uml2.uml.Feature; + +/** + * @generated + */ +public class InputPinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart extends AbstractLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 5240; + + /** + * @generated + */ + private DirectEditManager manager; + + /** + * @generated + */ + private IParser parser; + + /** + * @generated + */ + private List<?> parserElements; + + /** + * @generated + */ + private String defaultText; + + /** + * direct edition mode (default, undefined, registered editor, etc.) + * + * @generated + */ + protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR; + + /** + * configuration from a registered edit dialog + * + * @generated + */ + protected IDirectEditorConfiguration configuration; + /** + * @generated + */ + static { + registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.InputPinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public InputPinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy()); + installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy()); + installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeExternalNodeEditPolicy()); + installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy()); + } + + /** + * @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 + */ + public void setParser(IParser parser) { + this.parser = parser; + } + + /** + * @generated + */ + protected EObject getParserElement() { + return resolveSemanticElement(); + } + + /** + * @generated + */ + protected Image getLabelIcon() { + return null; + } + + /** + * @generated + */ + protected String getLabelText() { + String text = null; + EObject parserElement = getParserElement(); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + } + if (text == null || text.length() == 0) { + text = defaultText; + } + return text; + } + + /** + * @generated + */ + public void setLabelText(String text) { + setLabelTextHelper(getFigure(), text); + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + /** + * @generated + */ + 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() { + + @Override + public String isValid(final Object value) { + if (value instanceof String) { + final EObject element = getParserElement(); + final IParser parser = getParser(); + try { + IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value)); + } + }); + return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); + } catch (InterruptedException ie) { + ie.printStackTrace(); + } + } + // shouldn't get here + return null; + } + }; + } + + /** + * @generated + */ + 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 = UMLParserProvider.getParser(UMLElementTypes.InputPin_3142, getParserElement(), + UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.InputPinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID)); + } + return parser; + } + + /** + * @generated + */ + protected DirectEditManager getManager() { + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + } + return manager; + } + + /** + * @generated + */ + protected void setManager(DirectEditManager manager) { + this.manager = manager; + } + + /** + * @generated + */ + protected void performDirectEdit() { + BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() { + + @Override + public void run() { + getManager().show(); + } + }); + } + + /** + * @generated + */ + protected void performDirectEdit(Point eventLocation) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); + } + } + + /** + * @generated + */ + private void performDirectEdit(char initialCharacter) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); + } else { + performDirectEdit(); + } + } + + /** + * @generated + */ + protected void performDirectEditRequest(Request request) { + final Request theRequest = request; + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + directEditionMode = getDirectEditionType(); + } + switch (directEditionMode) { + case IDirectEdition.NO_DIRECT_EDITION: + // no direct edition mode => does nothing + return; + case IDirectEdition.EXTENDED_DIRECT_EDITOR: + updateExtendedEditorConfiguration(); + if (configuration == null || configuration.getLanguage() == null) { + // Create default edit manager + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + performDefaultDirectEditorEdit(theRequest); + } else { + configuration.preEditAction(resolveSemanticElement()); + Dialog dialog = null; + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); + initializeDirectEditManager(theRequest); + return; + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this); + helper.showEditor(); + return; + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else { + return; + } + final Dialog finalDialog = dialog; + if (Window.OK == dialog.open()) { + TransactionalEditingDomain domain = getEditingDomain(); + RecordingCommand command = new RecordingCommand(domain, "Edit Label") { + + @Override + protected void doExecute() { + configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue()); + } + }; + domain.getCommandStack().execute(command); + } + } + break; + case IDirectEdition.DEFAULT_DIRECT_EDITOR: + initializeDirectEditManager(theRequest); + break; + default: + break; + } + } + + /** + * @generated + */ + protected void initializeDirectEditManager(final Request request) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + if (isActive() && isEditable()) { + if (request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * @generated + */ + protected void refreshVisuals() { + super.refreshVisuals(); + refreshLabel(); + refreshFont(); + refreshFontColor(); + refreshUnderline(); + refreshStrikeThrough(); + } + + /** + * @generated + */ + protected void refreshLabel() { + EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); + if (maskLabelPolicy == null) { + maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); + } + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { + setLabelTextHelper(getFigure(), getLabelText()); + setLabelIconHelper(getFigure(), getLabelIcon()); + } else { + setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$ + setLabelIconHelper(getFigure(), null); + } + } + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + /** + * @generated + */ + protected void refreshUnderline() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); + } + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); + } else { + ((WrappingLabel) getFigure()).setTextUnderline(false); + } + } + } + + /** + * @generated + */ + protected void refreshStrikeThrough() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + } + } + + /** + * @generated + */ + 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() { + + @Override + public void getName(AccessibleEvent e) { + e.result = getLabelTextHelper(getFigure()); + } + }; + } + return accessibleEP; + } + + /** + * @generated + */ + private View getFontStyleOwnerView() { + return getPrimaryView(); + } + + /** + * Returns the kind of associated editor for direct edition. + * + * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition + * @generated + */ + public int getDirectEditionType() { + if (checkExtendedEditor()) { + initExtendedEditorConfiguration(); + return IDirectEdition.EXTENDED_DIRECT_EDITOR; + } + if (checkDefaultEdition()) { + return IDirectEdition.DEFAULT_DIRECT_EDITOR; + } + // not a named element. no specific editor => do nothing + return IDirectEdition.NO_DIRECT_EDITION; + } + + /** + * Checks if an extended editor is present. + * + * @return <code>true</code> if an extended editor is present. + * @generated + */ + protected boolean checkExtendedEditor() { + if (resolveSemanticElement() != null) { + return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName()); + } + return false; + } + + /** + * Checks if a default direct edition is available + * + * @return <code>true</code> if a default direct edition is available + * @generated + */ + protected boolean checkDefaultEdition() { + return (getParser() != null); + } + + /** + * Initializes the extended editor configuration + * + * @generated + */ + protected void initExtendedEditorConfiguration() { + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); + } + } + } + + /** + * Updates the preference configuration + * + * @generated + */ + protected void updateExtendedEditorConfiguration() { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + configuration = null; + } + } + + /** + * Performs the direct edit usually used by GMF editors. + * + * @param theRequest + * the direct edit request that starts the direct edit system + * @generated + */ + protected void performDefaultDirectEditorEdit(final Request theRequest) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + if (isActive() && isEditable()) { + if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; + performDirectEdit(editRequest.getLocation()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * @generated + */ + 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 AppliedStereotypeWrappingLabelFigure(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/InputPinInReadIsClassifiedObjectActionAsObjectEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/InputPinInReadIsClassifiedObjectActionAsObjectEditPart.java new file mode 100644 index 00000000000..9de0059bcae --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/InputPinInReadIsClassifiedObjectActionAsObjectEditPart.java @@ -0,0 +1,251 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.parts; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.StackLayout; +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.RequestConstants; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.editpolicies.LayoutEditPolicy; +import org.eclipse.gef.editpolicies.NonResizableEditPolicy; +import org.eclipse.gef.handles.MoveHandle; +import org.eclipse.gef.requests.CreateRequest; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; +import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; +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.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure; +import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure; +import org.eclipse.papyrus.uml.diagram.activity.edit.part.AbstractPinEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.InputPinInReadIsClassifiedObjectActionAsObjectItemSemanticEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.NoDeleteFromDiagramEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.OpenDiagramEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.PinLayoutEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.figures.InputPinFigure; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator; +import org.eclipse.swt.graphics.Color; + +/** + * @generated + */ +public class InputPinInReadIsClassifiedObjectActionAsObjectEditPart extends AbstractPinEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 3142; + + /** + * @generated + */ + protected IFigure contentPane; + + /** + * @generated + */ + protected IFigure primaryShape; + + /** + * @generated + */ + public InputPinInReadIsClassifiedObjectActionAsObjectEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, getPrimaryDragEditPolicy()); + installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new InputPinInReadIsClassifiedObjectActionAsObjectItemSemanticEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); + installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, new PinLayoutEditPolicy()); + installEditPolicy(RequestConstants.REQ_DELETE, new NoDeleteFromDiagramEditPolicy()); + // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies + // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE); + } + + /** + * @generated + */ + protected LayoutEditPolicy createLayoutEditPolicy() { + org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() { + + @Override + protected EditPolicy createChildEditPolicy(EditPart child) { + View childView = (View) child.getModel(); + switch (UMLVisualIDRegistry.getVisualID(childView)) { + case InputPinInReadIsClassifiedObjectActionAsObjectLabelEditPart.VISUAL_ID: + case InputPinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID: + return new BorderItemSelectionEditPolicy() { + + @Override + protected List<?> createSelectionHandles() { + MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost()); + mh.setBorder(null); + return Collections.singletonList(mh); + } + }; + } + EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (result == null) { + result = new NonResizableEditPolicy(); + } + return result; + } + + @Override + protected Command getMoveChildrenCommand(Request request) { + return null; + } + + @Override + protected Command getCreateCommand(CreateRequest request) { + return null; + } + }; + return lep; + } + + /** + * Papyrus codeGen + * + * @generated + **/ + protected void handleNotificationEvent(Notification event) { + /* + * when a node have external node labels, the methods refreshChildren() remove the EditPart corresponding to the Label from the EditPart + * Registry. After that, we can't reset the visibility to true (using the Show/Hide Label Action)! + */ + if (NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) { + Object notifier = event.getNotifier(); + List<?> modelChildren = ((View) getModel()).getChildren(); + if (!(notifier instanceof Edge)) { + if (modelChildren.contains(event.getNotifier())) { + return; + } + } + } + super.handleNotificationEvent(event); + } + + /** + * @generated + */ + protected IFigure createNodeShape() { + return primaryShape = new InputPinFigure(); + } + + /** + * org.eclipse.papyrus.uml.diagram.activity.figures.InputPinFigure + * + * @generated + */ + public InputPinFigure getPrimaryShape() { + return (InputPinFigure) primaryShape; + } + + /** + * @generated + */ + protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) { + if (borderItemEditPart instanceof InputPinInReadIsClassifiedObjectActionAsObjectLabelEditPart) { + IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure()); + borderItemContainer.add(borderItemEditPart.getFigure(), locator); + } else if (borderItemEditPart instanceof InputPinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart) { + IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure()); + borderItemContainer.add(borderItemEditPart.getFigure(), locator); + } else { + super.addBorderItem(borderItemContainer, borderItemEditPart); + } + } + + protected NodeFigure createNodePlate() { + RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(16, 16); + 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) { + super.setLineWidth(width); + } + + /** + * @generated + */ + protected void setLineType(int style) { + if (primaryShape instanceof IPapyrusNodeFigure) { + ((IPapyrusNodeFigure) primaryShape).setLineStyle(style); + } + } + + /** + * @generated + */ + public EditPart getPrimaryChildEditPart() { + return getChildBySemanticHint(UMLVisualIDRegistry.getType(InputPinInReadIsClassifiedObjectActionAsObjectLabelEditPart.VISUAL_ID)); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/InputPinInReadIsClassifiedObjectActionAsObjectLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/InputPinInReadIsClassifiedObjectActionAsObjectLabelEditPart.java new file mode 100644 index 00000000000..0289414757c --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/InputPinInReadIsClassifiedObjectActionAsObjectLabelEditPart.java @@ -0,0 +1,785 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.parts; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.Label; +import org.eclipse.draw2d.geometry.Point; +import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.transaction.RecordingCommand; +import org.eclipse.emf.transaction.RunnableWithResult; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gef.AccessibleEditPart; +import org.eclipse.gef.EditPolicy; +import org.eclipse.gef.Request; +import org.eclipse.gef.requests.DirectEditRequest; +import org.eclipse.gef.tools.DirectEditManager; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; +import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; +import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; +import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; +import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; +import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; +import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; +import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; +import org.eclipse.gmf.runtime.notation.FontStyle; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.text.contentassist.IContentAssistProcessor; +import org.eclipse.jface.viewers.ICellEditorValidator; +import org.eclipse.jface.window.Window; +import org.eclipse.papyrus.extensionpoints.editors.Activator; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper; +import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil; +import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds; +import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.figures.SimpleLabel; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLParserProvider; +import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; +import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; +import org.eclipse.swt.SWT; +import org.eclipse.swt.accessibility.AccessibleEvent; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.PlatformUI; +import org.eclipse.uml2.uml.Feature; + +/** + * @generated + */ +public class InputPinInReadIsClassifiedObjectActionAsObjectLabelEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 5239; + + /** + * @generated + */ + private DirectEditManager manager; + + /** + * @generated + */ + private IParser parser; + + /** + * @generated + */ + private List<?> parserElements; + + /** + * @generated + */ + private String defaultText; + + /** + * direct edition mode (default, undefined, registered editor, etc.) + * + * @generated + */ + protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR; + + /** + * configuration from a registered edit dialog + * + * @generated + */ + protected IDirectEditorConfiguration configuration; + /** + * @generated + */ + static { + registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.InputPinInReadIsClassifiedObjectActionAsObjectLabelEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public InputPinInReadIsClassifiedObjectActionAsObjectLabelEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy()); + installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy()); + installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy()); + } + + /** + * @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 + */ + public void setParser(IParser parser) { + this.parser = parser; + } + + /** + * @generated + */ + protected EObject getParserElement() { + return resolveSemanticElement(); + } + + /** + * @generated + */ + protected Image getLabelIcon() { + return null; + } + + /** + * @generated + */ + protected String getLabelText() { + String text = null; + EObject parserElement = getParserElement(); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + } + if (text == null || text.length() == 0) { + text = defaultText; + } + return text; + } + + /** + * @generated + */ + public void setLabelText(String text) { + setLabelTextHelper(getFigure(), text); + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + /** + * @generated + */ + 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() { + + @Override + public String isValid(final Object value) { + if (value instanceof String) { + final EObject element = getParserElement(); + final IParser parser = getParser(); + try { + IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value)); + } + }); + return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); + } catch (InterruptedException ie) { + ie.printStackTrace(); + } + } + // shouldn't get here + return null; + } + }; + } + + /** + * @generated + */ + 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 = UMLParserProvider.getParser(UMLElementTypes.InputPin_3142, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.InputPinInReadIsClassifiedObjectActionAsObjectLabelEditPart.VISUAL_ID)); + } + return parser; + } + + /** + * @generated + */ + protected DirectEditManager getManager() { + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + } + return manager; + } + + /** + * @generated + */ + protected void setManager(DirectEditManager manager) { + this.manager = manager; + } + + /** + * @generated + */ + protected void performDirectEdit() { + BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() { + + @Override + public void run() { + getManager().show(); + } + }); + } + + /** + * @generated + */ + protected void performDirectEdit(Point eventLocation) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); + } + } + + /** + * @generated + */ + private void performDirectEdit(char initialCharacter) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); + } else { + performDirectEdit(); + } + } + + /** + * @generated + */ + protected void performDirectEditRequest(Request request) { + final Request theRequest = request; + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + directEditionMode = getDirectEditionType(); + } + switch (directEditionMode) { + case IDirectEdition.NO_DIRECT_EDITION: + // no direct edition mode => does nothing + return; + case IDirectEdition.EXTENDED_DIRECT_EDITOR: + updateExtendedEditorConfiguration(); + if (configuration == null || configuration.getLanguage() == null) { + // Create default edit manager + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + performDefaultDirectEditorEdit(theRequest); + } else { + configuration.preEditAction(resolveSemanticElement()); + Dialog dialog = null; + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); + initializeDirectEditManager(theRequest); + return; + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this); + helper.showEditor(); + return; + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else { + return; + } + final Dialog finalDialog = dialog; + if (Window.OK == dialog.open()) { + TransactionalEditingDomain domain = getEditingDomain(); + RecordingCommand command = new RecordingCommand(domain, "Edit Label") { + + @Override + protected void doExecute() { + configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue()); + } + }; + domain.getCommandStack().execute(command); + } + } + break; + case IDirectEdition.DEFAULT_DIRECT_EDITOR: + initializeDirectEditManager(theRequest); + break; + default: + break; + } + } + + /** + * @generated + */ + protected void initializeDirectEditManager(final Request request) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + if (isActive() && isEditable()) { + if (request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * @generated + */ + protected void refreshVisuals() { + super.refreshVisuals(); + refreshLabel(); + refreshFont(); + refreshFontColor(); + refreshUnderline(); + refreshStrikeThrough(); + } + + /** + * @generated + */ + protected void refreshLabel() { + EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); + if (maskLabelPolicy == null) { + maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); + } + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { + setLabelTextHelper(getFigure(), getLabelText()); + setLabelIconHelper(getFigure(), getLabelIcon()); + } else { + setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$ + setLabelIconHelper(getFigure(), null); + } + } + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + /** + * @generated + */ + protected void refreshUnderline() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); + } + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); + } else { + ((WrappingLabel) getFigure()).setTextUnderline(false); + } + } + } + + /** + * @generated + */ + protected void refreshStrikeThrough() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + } + } + + /** + * @generated + */ + 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() { + + @Override + public void getName(AccessibleEvent e) { + e.result = getLabelTextHelper(getFigure()); + } + }; + } + return accessibleEP; + } + + /** + * @generated + */ + private View getFontStyleOwnerView() { + return getPrimaryView(); + } + + /** + * Returns the kind of associated editor for direct edition. + * + * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition + * @generated + */ + public int getDirectEditionType() { + if (checkExtendedEditor()) { + initExtendedEditorConfiguration(); + return IDirectEdition.EXTENDED_DIRECT_EDITOR; + } + if (checkDefaultEdition()) { + return IDirectEdition.DEFAULT_DIRECT_EDITOR; + } + // not a named element. no specific editor => do nothing + return IDirectEdition.NO_DIRECT_EDITION; + } + + /** + * Checks if an extended editor is present. + * + * @return <code>true</code> if an extended editor is present. + * @generated + */ + protected boolean checkExtendedEditor() { + if (resolveSemanticElement() != null) { + return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName()); + } + return false; + } + + /** + * Checks if a default direct edition is available + * + * @return <code>true</code> if a default direct edition is available + * @generated + */ + protected boolean checkDefaultEdition() { + return (getParser() != null); + } + + /** + * Initializes the extended editor configuration + * + * @generated + */ + protected void initExtendedEditorConfiguration() { + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); + } + } + } + + /** + * Updates the preference configuration + * + * @generated + */ + protected void updateExtendedEditorConfiguration() { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + configuration = null; + } + } + + /** + * Performs the direct edit usually used by GMF editors. + * + * @param theRequest + * the direct edit request that starts the direct edit system + * @generated + */ + protected void performDefaultDirectEditorEdit(final Request theRequest) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + if (isActive() && isEditable()) { + if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; + performDirectEdit(editRequest.getLocation()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * @generated + */ + 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 SimpleLabel(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/InputPinInReclassifyObjectActionAsObjectAppliedStereotypeLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/InputPinInReclassifyObjectActionAsObjectAppliedStereotypeLabelEditPart.java new file mode 100644 index 00000000000..5163300d058 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/InputPinInReclassifyObjectActionAsObjectAppliedStereotypeLabelEditPart.java @@ -0,0 +1,789 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.parts; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.Label; +import org.eclipse.draw2d.geometry.Point; +import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.transaction.RecordingCommand; +import org.eclipse.emf.transaction.RunnableWithResult; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gef.AccessibleEditPart; +import org.eclipse.gef.EditPolicy; +import org.eclipse.gef.Request; +import org.eclipse.gef.requests.DirectEditRequest; +import org.eclipse.gef.tools.DirectEditManager; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; +import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; +import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; +import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; +import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; +import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; +import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; +import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; +import org.eclipse.gmf.runtime.notation.FontStyle; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.text.contentassist.IContentAssistProcessor; +import org.eclipse.jface.viewers.ICellEditorValidator; +import org.eclipse.jface.window.Window; +import org.eclipse.papyrus.extensionpoints.editors.Activator; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper; +import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil; +import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLParserProvider; +import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; +import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractLabelEditPart; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.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; +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.custom.BusyIndicator; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.PlatformUI; +import org.eclipse.uml2.uml.Feature; + +/** + * @generated + */ +public class InputPinInReclassifyObjectActionAsObjectAppliedStereotypeLabelEditPart extends AbstractLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 5238; + + /** + * @generated + */ + private DirectEditManager manager; + + /** + * @generated + */ + private IParser parser; + + /** + * @generated + */ + private List<?> parserElements; + + /** + * @generated + */ + private String defaultText; + + /** + * direct edition mode (default, undefined, registered editor, etc.) + * + * @generated + */ + protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR; + + /** + * configuration from a registered edit dialog + * + * @generated + */ + protected IDirectEditorConfiguration configuration; + /** + * @generated + */ + static { + registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.InputPinInReclassifyObjectActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public InputPinInReclassifyObjectActionAsObjectAppliedStereotypeLabelEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy()); + installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy()); + installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeExternalNodeEditPolicy()); + installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy()); + } + + /** + * @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 + */ + public void setParser(IParser parser) { + this.parser = parser; + } + + /** + * @generated + */ + protected EObject getParserElement() { + return resolveSemanticElement(); + } + + /** + * @generated + */ + protected Image getLabelIcon() { + return null; + } + + /** + * @generated + */ + protected String getLabelText() { + String text = null; + EObject parserElement = getParserElement(); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + } + if (text == null || text.length() == 0) { + text = defaultText; + } + return text; + } + + /** + * @generated + */ + public void setLabelText(String text) { + setLabelTextHelper(getFigure(), text); + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + /** + * @generated + */ + 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() { + + @Override + public String isValid(final Object value) { + if (value instanceof String) { + final EObject element = getParserElement(); + final IParser parser = getParser(); + try { + IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value)); + } + }); + return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); + } catch (InterruptedException ie) { + ie.printStackTrace(); + } + } + // shouldn't get here + return null; + } + }; + } + + /** + * @generated + */ + 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 = UMLParserProvider.getParser(UMLElementTypes.InputPin_3141, getParserElement(), + UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.InputPinInReclassifyObjectActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID)); + } + return parser; + } + + /** + * @generated + */ + protected DirectEditManager getManager() { + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + } + return manager; + } + + /** + * @generated + */ + protected void setManager(DirectEditManager manager) { + this.manager = manager; + } + + /** + * @generated + */ + protected void performDirectEdit() { + BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() { + + @Override + public void run() { + getManager().show(); + } + }); + } + + /** + * @generated + */ + protected void performDirectEdit(Point eventLocation) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); + } + } + + /** + * @generated + */ + private void performDirectEdit(char initialCharacter) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); + } else { + performDirectEdit(); + } + } + + /** + * @generated + */ + protected void performDirectEditRequest(Request request) { + final Request theRequest = request; + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + directEditionMode = getDirectEditionType(); + } + switch (directEditionMode) { + case IDirectEdition.NO_DIRECT_EDITION: + // no direct edition mode => does nothing + return; + case IDirectEdition.EXTENDED_DIRECT_EDITOR: + updateExtendedEditorConfiguration(); + if (configuration == null || configuration.getLanguage() == null) { + // Create default edit manager + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + performDefaultDirectEditorEdit(theRequest); + } else { + configuration.preEditAction(resolveSemanticElement()); + Dialog dialog = null; + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); + initializeDirectEditManager(theRequest); + return; + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this); + helper.showEditor(); + return; + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else { + return; + } + final Dialog finalDialog = dialog; + if (Window.OK == dialog.open()) { + TransactionalEditingDomain domain = getEditingDomain(); + RecordingCommand command = new RecordingCommand(domain, "Edit Label") { + + @Override + protected void doExecute() { + configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue()); + } + }; + domain.getCommandStack().execute(command); + } + } + break; + case IDirectEdition.DEFAULT_DIRECT_EDITOR: + initializeDirectEditManager(theRequest); + break; + default: + break; + } + } + + /** + * @generated + */ + protected void initializeDirectEditManager(final Request request) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + if (isActive() && isEditable()) { + if (request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * @generated + */ + protected void refreshVisuals() { + super.refreshVisuals(); + refreshLabel(); + refreshFont(); + refreshFontColor(); + refreshUnderline(); + refreshStrikeThrough(); + } + + /** + * @generated + */ + protected void refreshLabel() { + EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); + if (maskLabelPolicy == null) { + maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); + } + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { + setLabelTextHelper(getFigure(), getLabelText()); + setLabelIconHelper(getFigure(), getLabelIcon()); + } else { + setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$ + setLabelIconHelper(getFigure(), null); + } + } + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + /** + * @generated + */ + protected void refreshUnderline() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); + } + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); + } else { + ((WrappingLabel) getFigure()).setTextUnderline(false); + } + } + } + + /** + * @generated + */ + protected void refreshStrikeThrough() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + } + } + + /** + * @generated + */ + 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() { + + @Override + public void getName(AccessibleEvent e) { + e.result = getLabelTextHelper(getFigure()); + } + }; + } + return accessibleEP; + } + + /** + * @generated + */ + private View getFontStyleOwnerView() { + return getPrimaryView(); + } + + /** + * Returns the kind of associated editor for direct edition. + * + * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition + * @generated + */ + public int getDirectEditionType() { + if (checkExtendedEditor()) { + initExtendedEditorConfiguration(); + return IDirectEdition.EXTENDED_DIRECT_EDITOR; + } + if (checkDefaultEdition()) { + return IDirectEdition.DEFAULT_DIRECT_EDITOR; + } + // not a named element. no specific editor => do nothing + return IDirectEdition.NO_DIRECT_EDITION; + } + + /** + * Checks if an extended editor is present. + * + * @return <code>true</code> if an extended editor is present. + * @generated + */ + protected boolean checkExtendedEditor() { + if (resolveSemanticElement() != null) { + return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName()); + } + return false; + } + + /** + * Checks if a default direct edition is available + * + * @return <code>true</code> if a default direct edition is available + * @generated + */ + protected boolean checkDefaultEdition() { + return (getParser() != null); + } + + /** + * Initializes the extended editor configuration + * + * @generated + */ + protected void initExtendedEditorConfiguration() { + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); + } + } + } + + /** + * Updates the preference configuration + * + * @generated + */ + protected void updateExtendedEditorConfiguration() { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + configuration = null; + } + } + + /** + * Performs the direct edit usually used by GMF editors. + * + * @param theRequest + * the direct edit request that starts the direct edit system + * @generated + */ + protected void performDefaultDirectEditorEdit(final Request theRequest) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + if (isActive() && isEditable()) { + if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; + performDirectEdit(editRequest.getLocation()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * @generated + */ + 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 AppliedStereotypeWrappingLabelFigure(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/InputPinInReclassifyObjectActionAsObjectEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/InputPinInReclassifyObjectActionAsObjectEditPart.java new file mode 100644 index 00000000000..740ad01a0e3 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/InputPinInReclassifyObjectActionAsObjectEditPart.java @@ -0,0 +1,251 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.parts; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.StackLayout; +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.RequestConstants; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.editpolicies.LayoutEditPolicy; +import org.eclipse.gef.editpolicies.NonResizableEditPolicy; +import org.eclipse.gef.handles.MoveHandle; +import org.eclipse.gef.requests.CreateRequest; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; +import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; +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.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure; +import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure; +import org.eclipse.papyrus.uml.diagram.activity.edit.part.AbstractPinEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.InputPinInReclassifyObjectActionAsObjectItemSemanticEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.NoDeleteFromDiagramEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.OpenDiagramEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.PinLayoutEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.figures.InputPinFigure; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator; +import org.eclipse.swt.graphics.Color; + +/** + * @generated + */ +public class InputPinInReclassifyObjectActionAsObjectEditPart extends AbstractPinEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 3141; + + /** + * @generated + */ + protected IFigure contentPane; + + /** + * @generated + */ + protected IFigure primaryShape; + + /** + * @generated + */ + public InputPinInReclassifyObjectActionAsObjectEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, getPrimaryDragEditPolicy()); + installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new InputPinInReclassifyObjectActionAsObjectItemSemanticEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); + installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, new PinLayoutEditPolicy()); + installEditPolicy(RequestConstants.REQ_DELETE, new NoDeleteFromDiagramEditPolicy()); + // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies + // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE); + } + + /** + * @generated + */ + protected LayoutEditPolicy createLayoutEditPolicy() { + org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() { + + @Override + protected EditPolicy createChildEditPolicy(EditPart child) { + View childView = (View) child.getModel(); + switch (UMLVisualIDRegistry.getVisualID(childView)) { + case InputPinInReclassifyObjectActionAsObjectLabelEditPart.VISUAL_ID: + case InputPinInReclassifyObjectActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID: + return new BorderItemSelectionEditPolicy() { + + @Override + protected List<?> createSelectionHandles() { + MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost()); + mh.setBorder(null); + return Collections.singletonList(mh); + } + }; + } + EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (result == null) { + result = new NonResizableEditPolicy(); + } + return result; + } + + @Override + protected Command getMoveChildrenCommand(Request request) { + return null; + } + + @Override + protected Command getCreateCommand(CreateRequest request) { + return null; + } + }; + return lep; + } + + /** + * Papyrus codeGen + * + * @generated + **/ + protected void handleNotificationEvent(Notification event) { + /* + * when a node have external node labels, the methods refreshChildren() remove the EditPart corresponding to the Label from the EditPart + * Registry. After that, we can't reset the visibility to true (using the Show/Hide Label Action)! + */ + if (NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) { + Object notifier = event.getNotifier(); + List<?> modelChildren = ((View) getModel()).getChildren(); + if (!(notifier instanceof Edge)) { + if (modelChildren.contains(event.getNotifier())) { + return; + } + } + } + super.handleNotificationEvent(event); + } + + /** + * @generated + */ + protected IFigure createNodeShape() { + return primaryShape = new InputPinFigure(); + } + + /** + * org.eclipse.papyrus.uml.diagram.activity.figures.InputPinFigure + * + * @generated + */ + public InputPinFigure getPrimaryShape() { + return (InputPinFigure) primaryShape; + } + + /** + * @generated + */ + protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) { + if (borderItemEditPart instanceof InputPinInReclassifyObjectActionAsObjectLabelEditPart) { + IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure()); + borderItemContainer.add(borderItemEditPart.getFigure(), locator); + } else if (borderItemEditPart instanceof InputPinInReclassifyObjectActionAsObjectAppliedStereotypeLabelEditPart) { + IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure()); + borderItemContainer.add(borderItemEditPart.getFigure(), locator); + } else { + super.addBorderItem(borderItemContainer, borderItemEditPart); + } + } + + protected NodeFigure createNodePlate() { + RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(16, 16); + 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) { + super.setLineWidth(width); + } + + /** + * @generated + */ + protected void setLineType(int style) { + if (primaryShape instanceof IPapyrusNodeFigure) { + ((IPapyrusNodeFigure) primaryShape).setLineStyle(style); + } + } + + /** + * @generated + */ + public EditPart getPrimaryChildEditPart() { + return getChildBySemanticHint(UMLVisualIDRegistry.getType(InputPinInReclassifyObjectActionAsObjectLabelEditPart.VISUAL_ID)); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/InputPinInReclassifyObjectActionAsObjectLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/InputPinInReclassifyObjectActionAsObjectLabelEditPart.java new file mode 100644 index 00000000000..633bfa0e5ed --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/InputPinInReclassifyObjectActionAsObjectLabelEditPart.java @@ -0,0 +1,785 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.parts; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.Label; +import org.eclipse.draw2d.geometry.Point; +import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.transaction.RecordingCommand; +import org.eclipse.emf.transaction.RunnableWithResult; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gef.AccessibleEditPart; +import org.eclipse.gef.EditPolicy; +import org.eclipse.gef.Request; +import org.eclipse.gef.requests.DirectEditRequest; +import org.eclipse.gef.tools.DirectEditManager; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; +import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; +import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; +import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; +import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; +import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; +import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; +import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; +import org.eclipse.gmf.runtime.notation.FontStyle; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.text.contentassist.IContentAssistProcessor; +import org.eclipse.jface.viewers.ICellEditorValidator; +import org.eclipse.jface.window.Window; +import org.eclipse.papyrus.extensionpoints.editors.Activator; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper; +import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil; +import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds; +import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.figures.SimpleLabel; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLParserProvider; +import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; +import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; +import org.eclipse.swt.SWT; +import org.eclipse.swt.accessibility.AccessibleEvent; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.PlatformUI; +import org.eclipse.uml2.uml.Feature; + +/** + * @generated + */ +public class InputPinInReclassifyObjectActionAsObjectLabelEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 5237; + + /** + * @generated + */ + private DirectEditManager manager; + + /** + * @generated + */ + private IParser parser; + + /** + * @generated + */ + private List<?> parserElements; + + /** + * @generated + */ + private String defaultText; + + /** + * direct edition mode (default, undefined, registered editor, etc.) + * + * @generated + */ + protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR; + + /** + * configuration from a registered edit dialog + * + * @generated + */ + protected IDirectEditorConfiguration configuration; + /** + * @generated + */ + static { + registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.InputPinInReclassifyObjectActionAsObjectLabelEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public InputPinInReclassifyObjectActionAsObjectLabelEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy()); + installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy()); + installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy()); + } + + /** + * @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 + */ + public void setParser(IParser parser) { + this.parser = parser; + } + + /** + * @generated + */ + protected EObject getParserElement() { + return resolveSemanticElement(); + } + + /** + * @generated + */ + protected Image getLabelIcon() { + return null; + } + + /** + * @generated + */ + protected String getLabelText() { + String text = null; + EObject parserElement = getParserElement(); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + } + if (text == null || text.length() == 0) { + text = defaultText; + } + return text; + } + + /** + * @generated + */ + public void setLabelText(String text) { + setLabelTextHelper(getFigure(), text); + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + /** + * @generated + */ + 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() { + + @Override + public String isValid(final Object value) { + if (value instanceof String) { + final EObject element = getParserElement(); + final IParser parser = getParser(); + try { + IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value)); + } + }); + return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); + } catch (InterruptedException ie) { + ie.printStackTrace(); + } + } + // shouldn't get here + return null; + } + }; + } + + /** + * @generated + */ + 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 = UMLParserProvider.getParser(UMLElementTypes.InputPin_3141, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.InputPinInReclassifyObjectActionAsObjectLabelEditPart.VISUAL_ID)); + } + return parser; + } + + /** + * @generated + */ + protected DirectEditManager getManager() { + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + } + return manager; + } + + /** + * @generated + */ + protected void setManager(DirectEditManager manager) { + this.manager = manager; + } + + /** + * @generated + */ + protected void performDirectEdit() { + BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() { + + @Override + public void run() { + getManager().show(); + } + }); + } + + /** + * @generated + */ + protected void performDirectEdit(Point eventLocation) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); + } + } + + /** + * @generated + */ + private void performDirectEdit(char initialCharacter) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); + } else { + performDirectEdit(); + } + } + + /** + * @generated + */ + protected void performDirectEditRequest(Request request) { + final Request theRequest = request; + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + directEditionMode = getDirectEditionType(); + } + switch (directEditionMode) { + case IDirectEdition.NO_DIRECT_EDITION: + // no direct edition mode => does nothing + return; + case IDirectEdition.EXTENDED_DIRECT_EDITOR: + updateExtendedEditorConfiguration(); + if (configuration == null || configuration.getLanguage() == null) { + // Create default edit manager + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + performDefaultDirectEditorEdit(theRequest); + } else { + configuration.preEditAction(resolveSemanticElement()); + Dialog dialog = null; + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); + initializeDirectEditManager(theRequest); + return; + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this); + helper.showEditor(); + return; + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else { + return; + } + final Dialog finalDialog = dialog; + if (Window.OK == dialog.open()) { + TransactionalEditingDomain domain = getEditingDomain(); + RecordingCommand command = new RecordingCommand(domain, "Edit Label") { + + @Override + protected void doExecute() { + configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue()); + } + }; + domain.getCommandStack().execute(command); + } + } + break; + case IDirectEdition.DEFAULT_DIRECT_EDITOR: + initializeDirectEditManager(theRequest); + break; + default: + break; + } + } + + /** + * @generated + */ + protected void initializeDirectEditManager(final Request request) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + if (isActive() && isEditable()) { + if (request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * @generated + */ + protected void refreshVisuals() { + super.refreshVisuals(); + refreshLabel(); + refreshFont(); + refreshFontColor(); + refreshUnderline(); + refreshStrikeThrough(); + } + + /** + * @generated + */ + protected void refreshLabel() { + EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); + if (maskLabelPolicy == null) { + maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); + } + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { + setLabelTextHelper(getFigure(), getLabelText()); + setLabelIconHelper(getFigure(), getLabelIcon()); + } else { + setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$ + setLabelIconHelper(getFigure(), null); + } + } + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + /** + * @generated + */ + protected void refreshUnderline() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); + } + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); + } else { + ((WrappingLabel) getFigure()).setTextUnderline(false); + } + } + } + + /** + * @generated + */ + protected void refreshStrikeThrough() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + } + } + + /** + * @generated + */ + 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() { + + @Override + public void getName(AccessibleEvent e) { + e.result = getLabelTextHelper(getFigure()); + } + }; + } + return accessibleEP; + } + + /** + * @generated + */ + private View getFontStyleOwnerView() { + return getPrimaryView(); + } + + /** + * Returns the kind of associated editor for direct edition. + * + * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition + * @generated + */ + public int getDirectEditionType() { + if (checkExtendedEditor()) { + initExtendedEditorConfiguration(); + return IDirectEdition.EXTENDED_DIRECT_EDITOR; + } + if (checkDefaultEdition()) { + return IDirectEdition.DEFAULT_DIRECT_EDITOR; + } + // not a named element. no specific editor => do nothing + return IDirectEdition.NO_DIRECT_EDITION; + } + + /** + * Checks if an extended editor is present. + * + * @return <code>true</code> if an extended editor is present. + * @generated + */ + protected boolean checkExtendedEditor() { + if (resolveSemanticElement() != null) { + return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName()); + } + return false; + } + + /** + * Checks if a default direct edition is available + * + * @return <code>true</code> if a default direct edition is available + * @generated + */ + protected boolean checkDefaultEdition() { + return (getParser() != null); + } + + /** + * Initializes the extended editor configuration + * + * @generated + */ + protected void initExtendedEditorConfiguration() { + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); + } + } + } + + /** + * Updates the preference configuration + * + * @generated + */ + protected void updateExtendedEditorConfiguration() { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + configuration = null; + } + } + + /** + * Performs the direct edit usually used by GMF editors. + * + * @param theRequest + * the direct edit request that starts the direct edit system + * @generated + */ + protected void performDefaultDirectEditorEdit(final Request theRequest) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + if (isActive() && isEditable()) { + if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; + performDirectEdit(editRequest.getLocation()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * @generated + */ + 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 SimpleLabel(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/OutputPinInReadIsClassifiedObjectActionAppliedStereotypeLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/OutputPinInReadIsClassifiedObjectActionAppliedStereotypeLabelEditPart.java new file mode 100644 index 00000000000..a66c72545d7 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/OutputPinInReadIsClassifiedObjectActionAppliedStereotypeLabelEditPart.java @@ -0,0 +1,789 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.parts; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.Label; +import org.eclipse.draw2d.geometry.Point; +import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.transaction.RecordingCommand; +import org.eclipse.emf.transaction.RunnableWithResult; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gef.AccessibleEditPart; +import org.eclipse.gef.EditPolicy; +import org.eclipse.gef.Request; +import org.eclipse.gef.requests.DirectEditRequest; +import org.eclipse.gef.tools.DirectEditManager; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; +import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; +import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; +import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; +import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; +import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; +import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; +import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; +import org.eclipse.gmf.runtime.notation.FontStyle; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.text.contentassist.IContentAssistProcessor; +import org.eclipse.jface.viewers.ICellEditorValidator; +import org.eclipse.jface.window.Window; +import org.eclipse.papyrus.extensionpoints.editors.Activator; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper; +import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil; +import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLParserProvider; +import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; +import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractLabelEditPart; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.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; +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.custom.BusyIndicator; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.PlatformUI; +import org.eclipse.uml2.uml.Feature; + +/** + * @generated + */ +public class OutputPinInReadIsClassifiedObjectActionAppliedStereotypeLabelEditPart extends AbstractLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 5214; + + /** + * @generated + */ + private DirectEditManager manager; + + /** + * @generated + */ + private IParser parser; + + /** + * @generated + */ + private List<?> parserElements; + + /** + * @generated + */ + private String defaultText; + + /** + * direct edition mode (default, undefined, registered editor, etc.) + * + * @generated + */ + protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR; + + /** + * configuration from a registered edit dialog + * + * @generated + */ + protected IDirectEditorConfiguration configuration; + /** + * @generated + */ + static { + registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.OutputPinInReadIsClassifiedObjectActionAppliedStereotypeLabelEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public OutputPinInReadIsClassifiedObjectActionAppliedStereotypeLabelEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy()); + installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy()); + installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeExternalNodeEditPolicy()); + installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy()); + } + + /** + * @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 + */ + public void setParser(IParser parser) { + this.parser = parser; + } + + /** + * @generated + */ + protected EObject getParserElement() { + return resolveSemanticElement(); + } + + /** + * @generated + */ + protected Image getLabelIcon() { + return null; + } + + /** + * @generated + */ + protected String getLabelText() { + String text = null; + EObject parserElement = getParserElement(); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + } + if (text == null || text.length() == 0) { + text = defaultText; + } + return text; + } + + /** + * @generated + */ + public void setLabelText(String text) { + setLabelTextHelper(getFigure(), text); + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + /** + * @generated + */ + 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() { + + @Override + public String isValid(final Object value) { + if (value instanceof String) { + final EObject element = getParserElement(); + final IParser parser = getParser(); + try { + IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value)); + } + }); + return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); + } catch (InterruptedException ie) { + ie.printStackTrace(); + } + } + // shouldn't get here + return null; + } + }; + } + + /** + * @generated + */ + 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 = UMLParserProvider.getParser(UMLElementTypes.OutputPin_3130, getParserElement(), + UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.OutputPinInReadIsClassifiedObjectActionAppliedStereotypeLabelEditPart.VISUAL_ID)); + } + return parser; + } + + /** + * @generated + */ + protected DirectEditManager getManager() { + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + } + return manager; + } + + /** + * @generated + */ + protected void setManager(DirectEditManager manager) { + this.manager = manager; + } + + /** + * @generated + */ + protected void performDirectEdit() { + BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() { + + @Override + public void run() { + getManager().show(); + } + }); + } + + /** + * @generated + */ + protected void performDirectEdit(Point eventLocation) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); + } + } + + /** + * @generated + */ + private void performDirectEdit(char initialCharacter) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); + } else { + performDirectEdit(); + } + } + + /** + * @generated + */ + protected void performDirectEditRequest(Request request) { + final Request theRequest = request; + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + directEditionMode = getDirectEditionType(); + } + switch (directEditionMode) { + case IDirectEdition.NO_DIRECT_EDITION: + // no direct edition mode => does nothing + return; + case IDirectEdition.EXTENDED_DIRECT_EDITOR: + updateExtendedEditorConfiguration(); + if (configuration == null || configuration.getLanguage() == null) { + // Create default edit manager + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + performDefaultDirectEditorEdit(theRequest); + } else { + configuration.preEditAction(resolveSemanticElement()); + Dialog dialog = null; + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); + initializeDirectEditManager(theRequest); + return; + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this); + helper.showEditor(); + return; + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else { + return; + } + final Dialog finalDialog = dialog; + if (Window.OK == dialog.open()) { + TransactionalEditingDomain domain = getEditingDomain(); + RecordingCommand command = new RecordingCommand(domain, "Edit Label") { + + @Override + protected void doExecute() { + configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue()); + } + }; + domain.getCommandStack().execute(command); + } + } + break; + case IDirectEdition.DEFAULT_DIRECT_EDITOR: + initializeDirectEditManager(theRequest); + break; + default: + break; + } + } + + /** + * @generated + */ + protected void initializeDirectEditManager(final Request request) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + if (isActive() && isEditable()) { + if (request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * @generated + */ + protected void refreshVisuals() { + super.refreshVisuals(); + refreshLabel(); + refreshFont(); + refreshFontColor(); + refreshUnderline(); + refreshStrikeThrough(); + } + + /** + * @generated + */ + protected void refreshLabel() { + EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); + if (maskLabelPolicy == null) { + maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); + } + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { + setLabelTextHelper(getFigure(), getLabelText()); + setLabelIconHelper(getFigure(), getLabelIcon()); + } else { + setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$ + setLabelIconHelper(getFigure(), null); + } + } + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + /** + * @generated + */ + protected void refreshUnderline() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); + } + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); + } else { + ((WrappingLabel) getFigure()).setTextUnderline(false); + } + } + } + + /** + * @generated + */ + protected void refreshStrikeThrough() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + } + } + + /** + * @generated + */ + 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() { + + @Override + public void getName(AccessibleEvent e) { + e.result = getLabelTextHelper(getFigure()); + } + }; + } + return accessibleEP; + } + + /** + * @generated + */ + private View getFontStyleOwnerView() { + return getPrimaryView(); + } + + /** + * Returns the kind of associated editor for direct edition. + * + * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition + * @generated + */ + public int getDirectEditionType() { + if (checkExtendedEditor()) { + initExtendedEditorConfiguration(); + return IDirectEdition.EXTENDED_DIRECT_EDITOR; + } + if (checkDefaultEdition()) { + return IDirectEdition.DEFAULT_DIRECT_EDITOR; + } + // not a named element. no specific editor => do nothing + return IDirectEdition.NO_DIRECT_EDITION; + } + + /** + * Checks if an extended editor is present. + * + * @return <code>true</code> if an extended editor is present. + * @generated + */ + protected boolean checkExtendedEditor() { + if (resolveSemanticElement() != null) { + return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName()); + } + return false; + } + + /** + * Checks if a default direct edition is available + * + * @return <code>true</code> if a default direct edition is available + * @generated + */ + protected boolean checkDefaultEdition() { + return (getParser() != null); + } + + /** + * Initializes the extended editor configuration + * + * @generated + */ + protected void initExtendedEditorConfiguration() { + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); + } + } + } + + /** + * Updates the preference configuration + * + * @generated + */ + protected void updateExtendedEditorConfiguration() { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + configuration = null; + } + } + + /** + * Performs the direct edit usually used by GMF editors. + * + * @param theRequest + * the direct edit request that starts the direct edit system + * @generated + */ + protected void performDefaultDirectEditorEdit(final Request theRequest) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + if (isActive() && isEditable()) { + if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; + performDirectEdit(editRequest.getLocation()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * @generated + */ + 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 AppliedStereotypeWrappingLabelFigure(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/OutputPinInReadIsClassifiedObjectActionEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/OutputPinInReadIsClassifiedObjectActionEditPart.java new file mode 100644 index 00000000000..76f8151bec9 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/OutputPinInReadIsClassifiedObjectActionEditPart.java @@ -0,0 +1,251 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.parts; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.StackLayout; +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.RequestConstants; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.editpolicies.LayoutEditPolicy; +import org.eclipse.gef.editpolicies.NonResizableEditPolicy; +import org.eclipse.gef.handles.MoveHandle; +import org.eclipse.gef.requests.CreateRequest; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; +import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; +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.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure; +import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure; +import org.eclipse.papyrus.uml.diagram.activity.edit.part.AbstractPinEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.NoDeleteFromDiagramEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.OpenDiagramEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.OutputPinInReadIsClassifiedObjectActionItemSemanticEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.PinLayoutEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.figures.OutputPinFigure; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator; +import org.eclipse.swt.graphics.Color; + +/** + * @generated + */ +public class OutputPinInReadIsClassifiedObjectActionEditPart extends AbstractPinEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 3130; + + /** + * @generated + */ + protected IFigure contentPane; + + /** + * @generated + */ + protected IFigure primaryShape; + + /** + * @generated + */ + public OutputPinInReadIsClassifiedObjectActionEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, getPrimaryDragEditPolicy()); + installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new OutputPinInReadIsClassifiedObjectActionItemSemanticEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); + installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, new PinLayoutEditPolicy()); + installEditPolicy(RequestConstants.REQ_DELETE, new NoDeleteFromDiagramEditPolicy()); + // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies + // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE); + } + + /** + * @generated + */ + protected LayoutEditPolicy createLayoutEditPolicy() { + org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() { + + @Override + protected EditPolicy createChildEditPolicy(EditPart child) { + View childView = (View) child.getModel(); + switch (UMLVisualIDRegistry.getVisualID(childView)) { + case OutputPinInReadIsClassifiedObjectActionLabelEditPart.VISUAL_ID: + case OutputPinInReadIsClassifiedObjectActionAppliedStereotypeLabelEditPart.VISUAL_ID: + return new BorderItemSelectionEditPolicy() { + + @Override + protected List<?> createSelectionHandles() { + MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost()); + mh.setBorder(null); + return Collections.singletonList(mh); + } + }; + } + EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (result == null) { + result = new NonResizableEditPolicy(); + } + return result; + } + + @Override + protected Command getMoveChildrenCommand(Request request) { + return null; + } + + @Override + protected Command getCreateCommand(CreateRequest request) { + return null; + } + }; + return lep; + } + + /** + * Papyrus codeGen + * + * @generated + **/ + protected void handleNotificationEvent(Notification event) { + /* + * when a node have external node labels, the methods refreshChildren() remove the EditPart corresponding to the Label from the EditPart + * Registry. After that, we can't reset the visibility to true (using the Show/Hide Label Action)! + */ + if (NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) { + Object notifier = event.getNotifier(); + List<?> modelChildren = ((View) getModel()).getChildren(); + if (!(notifier instanceof Edge)) { + if (modelChildren.contains(event.getNotifier())) { + return; + } + } + } + super.handleNotificationEvent(event); + } + + /** + * @generated + */ + protected IFigure createNodeShape() { + return primaryShape = new OutputPinFigure(); + } + + /** + * org.eclipse.papyrus.uml.diagram.activity.figures.OutputPinFigure + * + * @generated + */ + public OutputPinFigure getPrimaryShape() { + return (OutputPinFigure) primaryShape; + } + + /** + * @generated + */ + protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) { + if (borderItemEditPart instanceof OutputPinInReadIsClassifiedObjectActionLabelEditPart) { + IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure()); + borderItemContainer.add(borderItemEditPart.getFigure(), locator); + } else if (borderItemEditPart instanceof OutputPinInReadIsClassifiedObjectActionAppliedStereotypeLabelEditPart) { + IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure()); + borderItemContainer.add(borderItemEditPart.getFigure(), locator); + } else { + super.addBorderItem(borderItemContainer, borderItemEditPart); + } + } + + protected NodeFigure createNodePlate() { + RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(16, 16); + 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) { + super.setLineWidth(width); + } + + /** + * @generated + */ + protected void setLineType(int style) { + if (primaryShape instanceof IPapyrusNodeFigure) { + ((IPapyrusNodeFigure) primaryShape).setLineStyle(style); + } + } + + /** + * @generated + */ + public EditPart getPrimaryChildEditPart() { + return getChildBySemanticHint(UMLVisualIDRegistry.getType(OutputPinInReadIsClassifiedObjectActionLabelEditPart.VISUAL_ID)); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/OutputPinInReadIsClassifiedObjectActionLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/OutputPinInReadIsClassifiedObjectActionLabelEditPart.java new file mode 100644 index 00000000000..5560fd26403 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/OutputPinInReadIsClassifiedObjectActionLabelEditPart.java @@ -0,0 +1,785 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.parts; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.Label; +import org.eclipse.draw2d.geometry.Point; +import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.transaction.RecordingCommand; +import org.eclipse.emf.transaction.RunnableWithResult; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gef.AccessibleEditPart; +import org.eclipse.gef.EditPolicy; +import org.eclipse.gef.Request; +import org.eclipse.gef.requests.DirectEditRequest; +import org.eclipse.gef.tools.DirectEditManager; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; +import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; +import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; +import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; +import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; +import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; +import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; +import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; +import org.eclipse.gmf.runtime.notation.FontStyle; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.text.contentassist.IContentAssistProcessor; +import org.eclipse.jface.viewers.ICellEditorValidator; +import org.eclipse.jface.window.Window; +import org.eclipse.papyrus.extensionpoints.editors.Activator; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper; +import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil; +import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds; +import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.figures.SimpleLabel; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLParserProvider; +import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; +import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; +import org.eclipse.swt.SWT; +import org.eclipse.swt.accessibility.AccessibleEvent; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.PlatformUI; +import org.eclipse.uml2.uml.Feature; + +/** + * @generated + */ +public class OutputPinInReadIsClassifiedObjectActionLabelEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 5213; + + /** + * @generated + */ + private DirectEditManager manager; + + /** + * @generated + */ + private IParser parser; + + /** + * @generated + */ + private List<?> parserElements; + + /** + * @generated + */ + private String defaultText; + + /** + * direct edition mode (default, undefined, registered editor, etc.) + * + * @generated + */ + protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR; + + /** + * configuration from a registered edit dialog + * + * @generated + */ + protected IDirectEditorConfiguration configuration; + /** + * @generated + */ + static { + registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.OutputPinInReadIsClassifiedObjectActionLabelEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public OutputPinInReadIsClassifiedObjectActionLabelEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy()); + installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy()); + installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy()); + } + + /** + * @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 + */ + public void setParser(IParser parser) { + this.parser = parser; + } + + /** + * @generated + */ + protected EObject getParserElement() { + return resolveSemanticElement(); + } + + /** + * @generated + */ + protected Image getLabelIcon() { + return null; + } + + /** + * @generated + */ + protected String getLabelText() { + String text = null; + EObject parserElement = getParserElement(); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + } + if (text == null || text.length() == 0) { + text = defaultText; + } + return text; + } + + /** + * @generated + */ + public void setLabelText(String text) { + setLabelTextHelper(getFigure(), text); + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + /** + * @generated + */ + 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() { + + @Override + public String isValid(final Object value) { + if (value instanceof String) { + final EObject element = getParserElement(); + final IParser parser = getParser(); + try { + IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value)); + } + }); + return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); + } catch (InterruptedException ie) { + ie.printStackTrace(); + } + } + // shouldn't get here + return null; + } + }; + } + + /** + * @generated + */ + 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 = UMLParserProvider.getParser(UMLElementTypes.OutputPin_3130, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.OutputPinInReadIsClassifiedObjectActionLabelEditPart.VISUAL_ID)); + } + return parser; + } + + /** + * @generated + */ + protected DirectEditManager getManager() { + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + } + return manager; + } + + /** + * @generated + */ + protected void setManager(DirectEditManager manager) { + this.manager = manager; + } + + /** + * @generated + */ + protected void performDirectEdit() { + BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() { + + @Override + public void run() { + getManager().show(); + } + }); + } + + /** + * @generated + */ + protected void performDirectEdit(Point eventLocation) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); + } + } + + /** + * @generated + */ + private void performDirectEdit(char initialCharacter) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); + } else { + performDirectEdit(); + } + } + + /** + * @generated + */ + protected void performDirectEditRequest(Request request) { + final Request theRequest = request; + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + directEditionMode = getDirectEditionType(); + } + switch (directEditionMode) { + case IDirectEdition.NO_DIRECT_EDITION: + // no direct edition mode => does nothing + return; + case IDirectEdition.EXTENDED_DIRECT_EDITOR: + updateExtendedEditorConfiguration(); + if (configuration == null || configuration.getLanguage() == null) { + // Create default edit manager + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + performDefaultDirectEditorEdit(theRequest); + } else { + configuration.preEditAction(resolveSemanticElement()); + Dialog dialog = null; + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); + initializeDirectEditManager(theRequest); + return; + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this); + helper.showEditor(); + return; + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else { + return; + } + final Dialog finalDialog = dialog; + if (Window.OK == dialog.open()) { + TransactionalEditingDomain domain = getEditingDomain(); + RecordingCommand command = new RecordingCommand(domain, "Edit Label") { + + @Override + protected void doExecute() { + configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue()); + } + }; + domain.getCommandStack().execute(command); + } + } + break; + case IDirectEdition.DEFAULT_DIRECT_EDITOR: + initializeDirectEditManager(theRequest); + break; + default: + break; + } + } + + /** + * @generated + */ + protected void initializeDirectEditManager(final Request request) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + if (isActive() && isEditable()) { + if (request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * @generated + */ + protected void refreshVisuals() { + super.refreshVisuals(); + refreshLabel(); + refreshFont(); + refreshFontColor(); + refreshUnderline(); + refreshStrikeThrough(); + } + + /** + * @generated + */ + protected void refreshLabel() { + EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); + if (maskLabelPolicy == null) { + maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); + } + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { + setLabelTextHelper(getFigure(), getLabelText()); + setLabelIconHelper(getFigure(), getLabelIcon()); + } else { + setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$ + setLabelIconHelper(getFigure(), null); + } + } + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + /** + * @generated + */ + protected void refreshUnderline() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); + } + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); + } else { + ((WrappingLabel) getFigure()).setTextUnderline(false); + } + } + } + + /** + * @generated + */ + protected void refreshStrikeThrough() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + } + } + + /** + * @generated + */ + 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() { + + @Override + public void getName(AccessibleEvent e) { + e.result = getLabelTextHelper(getFigure()); + } + }; + } + return accessibleEP; + } + + /** + * @generated + */ + private View getFontStyleOwnerView() { + return getPrimaryView(); + } + + /** + * Returns the kind of associated editor for direct edition. + * + * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition + * @generated + */ + public int getDirectEditionType() { + if (checkExtendedEditor()) { + initExtendedEditorConfiguration(); + return IDirectEdition.EXTENDED_DIRECT_EDITOR; + } + if (checkDefaultEdition()) { + return IDirectEdition.DEFAULT_DIRECT_EDITOR; + } + // not a named element. no specific editor => do nothing + return IDirectEdition.NO_DIRECT_EDITION; + } + + /** + * Checks if an extended editor is present. + * + * @return <code>true</code> if an extended editor is present. + * @generated + */ + protected boolean checkExtendedEditor() { + if (resolveSemanticElement() != null) { + return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName()); + } + return false; + } + + /** + * Checks if a default direct edition is available + * + * @return <code>true</code> if a default direct edition is available + * @generated + */ + protected boolean checkDefaultEdition() { + return (getParser() != null); + } + + /** + * Initializes the extended editor configuration + * + * @generated + */ + protected void initExtendedEditorConfiguration() { + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); + } + } + } + + /** + * Updates the preference configuration + * + * @generated + */ + protected void updateExtendedEditorConfiguration() { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + configuration = null; + } + } + + /** + * Performs the direct edit usually used by GMF editors. + * + * @param theRequest + * the direct edit request that starts the direct edit system + * @generated + */ + protected void performDefaultDirectEditorEdit(final Request theRequest) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + if (isActive() && isEditable()) { + if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; + performDirectEdit(editRequest.getLocation()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * @generated + */ + 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 SimpleLabel(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ReadExtentActionFloatingNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ReadExtentActionFloatingNameEditPart.java index fb084c6ab01..69293fa1864 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ReadExtentActionFloatingNameEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ReadExtentActionFloatingNameEditPart.java @@ -78,7 +78,7 @@ public class ReadExtentActionFloatingNameEditPart extends FloatingLabelEditPart /** * @generated */ - public static final int VISUAL_ID = 5401; + public static final int VISUAL_ID = 5402; /** * @generated diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ReadIsClassifiedObjectActionEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ReadIsClassifiedObjectActionEditPart.java new file mode 100644 index 00000000000..1357c11ea97 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ReadIsClassifiedObjectActionEditPart.java @@ -0,0 +1,365 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.parts; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.PositionConstants; +import org.eclipse.draw2d.geometry.Dimension; +import org.eclipse.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.RequestConstants; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.editpolicies.LayoutEditPolicy; +import org.eclipse.gef.editpolicies.NonResizableEditPolicy; +import org.eclipse.gef.handles.MoveHandle; +import org.eclipse.gef.requests.CreateRequest; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; +import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator; +import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; +import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout; +import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure; +import org.eclipse.gmf.runtime.notation.Edge; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure; +import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure; +import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.ActivityDiagramChangeStereotypedShapeEditpolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.CreateActionLocalConditionEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.CustomDiagramDragDropEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.DeleteActionViewEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.ObjectFlowWithPinsCreationEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.OpenDiagramEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.ReadIsClassifiedObjectActionItemSemanticEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.locator.PinPositionLocator; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.common.editparts.RoundedCompartmentEditPart; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.BorderItemResizableEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.ChangeStereotypedShapeEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusRoundedNodeFigure; +import org.eclipse.swt.graphics.Color; + +/** + * @generated + */ +public class ReadIsClassifiedObjectActionEditPart extends RoundedCompartmentEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 3122; + + /** + * @generated + */ + protected IFigure contentPane; + + /** + * @generated + */ + protected IFigure primaryShape; + + /** + * @generated + */ + public ReadIsClassifiedObjectActionEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy()); + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ReadIsClassifiedObjectActionItemSemanticEditPolicy()); + installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy()); + // in Papyrus diagrams are not strongly synchronised + // installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.activity.edit.policies.ReadIsClassifiedObjectActionCanonicalEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); + installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy()); + installEditPolicy(RequestConstants.REQ_CREATE, new CreateActionLocalConditionEditPolicy()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new ObjectFlowWithPinsCreationEditPolicy()); + installEditPolicy(RequestConstants.REQ_DELETE, new DeleteActionViewEditPolicy()); + installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); + installEditPolicy(ChangeStereotypedShapeEditPolicy.CHANGE_SHAPE_POLICY, new ActivityDiagramChangeStereotypedShapeEditpolicy()); + installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); + // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies + // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE); + } + + /** + * @generated + */ + protected LayoutEditPolicy createLayoutEditPolicy() { + org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() { + + @Override + protected EditPolicy createChildEditPolicy(EditPart child) { + View childView = (View) child.getModel(); + switch (UMLVisualIDRegistry.getVisualID(childView)) { + case ReadIsClassifiedObjectActionFloatingNameEditPart.VISUAL_ID: + return new BorderItemSelectionEditPolicy() { + + @Override + protected List<?> createSelectionHandles() { + MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost()); + mh.setBorder(null); + return Collections.singletonList(mh); + } + }; + case OutputPinInReadIsClassifiedObjectActionEditPart.VISUAL_ID: + case InputPinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID: + case ValuePinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID: + case ActionPinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID: + 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; + } + + /** + * Papyrus codeGen + * + * @generated + **/ + protected void handleNotificationEvent(Notification event) { + /* + * when a node have external node labels, the methods refreshChildren() remove the EditPart corresponding to the Label from the EditPart + * Registry. After that, we can't reset the visibility to true (using the Show/Hide Label Action)! + */ + if (NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) { + Object notifier = event.getNotifier(); + List<?> modelChildren = ((View) getModel()).getChildren(); + if (!(notifier instanceof Edge)) { + if (modelChildren.contains(event.getNotifier())) { + return; + } + } + } + super.handleNotificationEvent(event); + } + + /** + * @generated + */ + protected IFigure createNodeShape() { + return primaryShape = new PapyrusRoundedNodeFigure(); + } + + /** + * org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusRoundedNodeFigure + * + * @generated + */ + public PapyrusRoundedNodeFigure getPrimaryShape() { + return (PapyrusRoundedNodeFigure) primaryShape; + } + + /** + * @generated + */ + protected boolean addFixedChild(EditPart childEditPart) { + if (childEditPart instanceof ReadIsClassifiedObjectActionNameEditPart) { + ((ReadIsClassifiedObjectActionNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); + return true; + } + // Papyrus Gencode :Affixed Pin locator for Actions + if (childEditPart instanceof OutputPinInReadIsClassifiedObjectActionEditPart) { + IBorderItemLocator locator = new PinPositionLocator(getMainFigure(), PositionConstants.EAST); + getBorderedFigure().getBorderItemContainer().add(((OutputPinInReadIsClassifiedObjectActionEditPart) childEditPart).getFigure(), locator); + return true; + } + // Papyrus Gencode :Affixed Pin locator for Actions + if (childEditPart instanceof InputPinInReadIsClassifiedObjectActionAsObjectEditPart) { + IBorderItemLocator locator = new PinPositionLocator(getMainFigure(), PositionConstants.NONE); + getBorderedFigure().getBorderItemContainer().add(((InputPinInReadIsClassifiedObjectActionAsObjectEditPart) childEditPart).getFigure(), locator); + return true; + } + // Papyrus Gencode :Affixed Pin locator for Actions + if (childEditPart instanceof ValuePinInReadIsClassifiedObjectActionAsObjectEditPart) { + IBorderItemLocator locator = new PinPositionLocator(getMainFigure(), PositionConstants.NONE); + getBorderedFigure().getBorderItemContainer().add(((ValuePinInReadIsClassifiedObjectActionAsObjectEditPart) childEditPart).getFigure(), locator); + return true; + } + // Papyrus Gencode :Affixed Pin locator for Actions + if (childEditPart instanceof ActionPinInReadIsClassifiedObjectActionAsObjectEditPart) { + IBorderItemLocator locator = new PinPositionLocator(getMainFigure(), PositionConstants.NONE); + getBorderedFigure().getBorderItemContainer().add(((ActionPinInReadIsClassifiedObjectActionAsObjectEditPart) childEditPart).getFigure(), locator); + return true; + } + return false; + } + + /** + * @generated + */ + protected boolean removeFixedChild(EditPart childEditPart) { + if (childEditPart instanceof ReadIsClassifiedObjectActionNameEditPart) { + return true; + } + if (childEditPart instanceof OutputPinInReadIsClassifiedObjectActionEditPart) { + getBorderedFigure().getBorderItemContainer().remove(((OutputPinInReadIsClassifiedObjectActionEditPart) childEditPart).getFigure()); + return true; + } + if (childEditPart instanceof InputPinInReadIsClassifiedObjectActionAsObjectEditPart) { + getBorderedFigure().getBorderItemContainer().remove(((InputPinInReadIsClassifiedObjectActionAsObjectEditPart) childEditPart).getFigure()); + return true; + } + if (childEditPart instanceof ValuePinInReadIsClassifiedObjectActionAsObjectEditPart) { + getBorderedFigure().getBorderItemContainer().remove(((ValuePinInReadIsClassifiedObjectActionAsObjectEditPart) childEditPart).getFigure()); + return true; + } + if (childEditPart instanceof ActionPinInReadIsClassifiedObjectActionAsObjectEditPart) { + getBorderedFigure().getBorderItemContainer().remove(((ActionPinInReadIsClassifiedObjectActionAsObjectEditPart) 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 void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) { + if (borderItemEditPart instanceof ReadIsClassifiedObjectActionFloatingNameEditPart) { + BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.SOUTH); + locator.setBorderItemOffset(new Dimension(-20, -20)); + borderItemContainer.add(borderItemEditPart.getFigure(), locator); + } else { + super.addBorderItem(borderItemContainer, borderItemEditPart); + } + } + + protected NodeFigure createNodePlate() { + RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(40, 40); + return result; + } + + /** + * Creates figure for this edit part. + * + * Body of this method does not depend on settings in generation model + * so you may safely remove <i>generated</i> tag and modify it. + * + * @generated + */ + protected NodeFigure createMainFigure() { + return new SelectableBorderedNodeFigure(createMainFigureWithSVG()); + } + + /** + * Default implementation treats passed figure as content pane. + * Respects layout one may have set for generated figure. + * + * @param nodeShape + * instance of generated figure class + * @generated + */ + 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) { + super.setLineWidth(width); + } + + /** + * @generated + */ + protected void setLineType(int style) { + if (primaryShape instanceof IPapyrusNodeFigure) { + ((IPapyrusNodeFigure) primaryShape).setLineStyle(style); + } + } + + /** + * @generated + */ + public EditPart getPrimaryChildEditPart() { + return getChildBySemanticHint(UMLVisualIDRegistry.getType(ReadIsClassifiedObjectActionNameEditPart.VISUAL_ID)); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ReadIsClassifiedObjectActionFloatingNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ReadIsClassifiedObjectActionFloatingNameEditPart.java new file mode 100644 index 00000000000..cf3b293610b --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ReadIsClassifiedObjectActionFloatingNameEditPart.java @@ -0,0 +1,787 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.parts; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.Label; +import org.eclipse.draw2d.geometry.Point; +import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.transaction.RecordingCommand; +import org.eclipse.emf.transaction.RunnableWithResult; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gef.AccessibleEditPart; +import org.eclipse.gef.EditPolicy; +import org.eclipse.gef.Request; +import org.eclipse.gef.requests.DirectEditRequest; +import org.eclipse.gef.tools.DirectEditManager; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; +import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; +import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; +import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; +import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; +import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; +import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; +import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; +import org.eclipse.gmf.runtime.notation.FontStyle; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.text.contentassist.IContentAssistProcessor; +import org.eclipse.jface.viewers.ICellEditorValidator; +import org.eclipse.jface.window.Window; +import org.eclipse.papyrus.extensionpoints.editors.Activator; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper; +import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil; +import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLParserProvider; +import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; +import org.eclipse.papyrus.uml.diagram.common.editparts.FloatingLabelEditPart; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; +import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; +import org.eclipse.swt.SWT; +import org.eclipse.swt.accessibility.AccessibleEvent; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.PlatformUI; +import org.eclipse.uml2.uml.Feature; + +/** + * @generated + */ +public class ReadIsClassifiedObjectActionFloatingNameEditPart extends FloatingLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 5403; + + /** + * @generated + */ + private DirectEditManager manager; + + /** + * @generated + */ + private IParser parser; + + /** + * @generated + */ + private List<?> parserElements; + + /** + * @generated + */ + private String defaultText; + + /** + * direct edition mode (default, undefined, registered editor, etc.) + * + * @generated + */ + protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR; + + /** + * configuration from a registered edit dialog + * + * @generated + */ + protected IDirectEditorConfiguration configuration; + /** + * @generated + */ + static { + registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadIsClassifiedObjectActionFloatingNameEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public ReadIsClassifiedObjectActionFloatingNameEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy()); + installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy()); + installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy()); + installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy()); + } + + /** + * @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 + */ + public void setParser(IParser parser) { + this.parser = parser; + } + + /** + * @generated + */ + protected EObject getParserElement() { + return resolveSemanticElement(); + } + + /** + * @generated + */ + protected Image getLabelIcon() { + return null; + } + + /** + * @generated + */ + protected String getLabelText() { + String text = null; + EObject parserElement = getParserElement(); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + } + if (text == null || text.length() == 0) { + text = defaultText; + } + return text; + } + + /** + * @generated + */ + public void setLabelText(String text) { + setLabelTextHelper(getFigure(), text); + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + /** + * @generated + */ + 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() { + + @Override + public String isValid(final Object value) { + if (value instanceof String) { + final EObject element = getParserElement(); + final IParser parser = getParser(); + try { + IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value)); + } + }); + return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); + } catch (InterruptedException ie) { + ie.printStackTrace(); + } + } + // shouldn't get here + return null; + } + }; + } + + /** + * @generated + */ + 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 = UMLParserProvider + .getParser(UMLElementTypes.ReadIsClassifiedObjectAction_3122, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadIsClassifiedObjectActionFloatingNameEditPart.VISUAL_ID)); + } + return parser; + } + + /** + * @generated + */ + protected DirectEditManager getManager() { + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + } + return manager; + } + + /** + * @generated + */ + protected void setManager(DirectEditManager manager) { + this.manager = manager; + } + + /** + * @generated + */ + protected void performDirectEdit() { + BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() { + + @Override + public void run() { + getManager().show(); + } + }); + } + + /** + * @generated + */ + protected void performDirectEdit(Point eventLocation) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); + } + } + + /** + * @generated + */ + private void performDirectEdit(char initialCharacter) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); + } else { + performDirectEdit(); + } + } + + /** + * @generated + */ + protected void performDirectEditRequest(Request request) { + final Request theRequest = request; + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + directEditionMode = getDirectEditionType(); + } + switch (directEditionMode) { + case IDirectEdition.NO_DIRECT_EDITION: + // no direct edition mode => does nothing + return; + case IDirectEdition.EXTENDED_DIRECT_EDITOR: + updateExtendedEditorConfiguration(); + if (configuration == null || configuration.getLanguage() == null) { + // Create default edit manager + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + performDefaultDirectEditorEdit(theRequest); + } else { + configuration.preEditAction(resolveSemanticElement()); + Dialog dialog = null; + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); + initializeDirectEditManager(theRequest); + return; + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this); + helper.showEditor(); + return; + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else { + return; + } + final Dialog finalDialog = dialog; + if (Window.OK == dialog.open()) { + TransactionalEditingDomain domain = getEditingDomain(); + RecordingCommand command = new RecordingCommand(domain, "Edit Label") { + + @Override + protected void doExecute() { + configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue()); + } + }; + domain.getCommandStack().execute(command); + } + } + break; + case IDirectEdition.DEFAULT_DIRECT_EDITOR: + initializeDirectEditManager(theRequest); + break; + default: + break; + } + } + + /** + * @generated + */ + protected void initializeDirectEditManager(final Request request) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + if (isActive() && isEditable()) { + if (request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * @generated + */ + protected void refreshVisuals() { + super.refreshVisuals(); + refreshLabel(); + refreshFont(); + refreshFontColor(); + refreshUnderline(); + refreshStrikeThrough(); + } + + /** + * @generated + */ + protected void refreshLabel() { + EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); + if (maskLabelPolicy == null) { + maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); + } + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { + setLabelTextHelper(getFigure(), getLabelText()); + setLabelIconHelper(getFigure(), getLabelIcon()); + } else { + setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$ + setLabelIconHelper(getFigure(), null); + } + } + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + /** + * @generated + */ + protected void refreshUnderline() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); + } + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); + } else { + ((WrappingLabel) getFigure()).setTextUnderline(false); + } + } + } + + /** + * @generated + */ + protected void refreshStrikeThrough() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + } + } + + /** + * @generated + */ + 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() { + + @Override + public void getName(AccessibleEvent e) { + e.result = getLabelTextHelper(getFigure()); + } + }; + } + return accessibleEP; + } + + /** + * @generated + */ + private View getFontStyleOwnerView() { + return getPrimaryView(); + } + + /** + * Returns the kind of associated editor for direct edition. + * + * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition + * @generated + */ + public int getDirectEditionType() { + if (checkExtendedEditor()) { + initExtendedEditorConfiguration(); + return IDirectEdition.EXTENDED_DIRECT_EDITOR; + } + if (checkDefaultEdition()) { + return IDirectEdition.DEFAULT_DIRECT_EDITOR; + } + // not a named element. no specific editor => do nothing + return IDirectEdition.NO_DIRECT_EDITION; + } + + /** + * Checks if an extended editor is present. + * + * @return <code>true</code> if an extended editor is present. + * @generated + */ + protected boolean checkExtendedEditor() { + if (resolveSemanticElement() != null) { + return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName()); + } + return false; + } + + /** + * Checks if a default direct edition is available + * + * @return <code>true</code> if a default direct edition is available + * @generated + */ + protected boolean checkDefaultEdition() { + return (getParser() != null); + } + + /** + * Initializes the extended editor configuration + * + * @generated + */ + protected void initExtendedEditorConfiguration() { + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); + } + } + } + + /** + * Updates the preference configuration + * + * @generated + */ + protected void updateExtendedEditorConfiguration() { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + configuration = null; + } + } + + /** + * Performs the direct edit usually used by GMF editors. + * + * @param theRequest + * the direct edit request that starts the direct edit system + * @generated + */ + protected void performDefaultDirectEditorEdit(final Request theRequest) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + if (isActive() && isEditable()) { + if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; + performDirectEdit(editRequest.getLocation()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * @generated + */ + 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 PapyrusWrappingLabel(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ReadIsClassifiedObjectActionNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ReadIsClassifiedObjectActionNameEditPart.java new file mode 100644 index 00000000000..395ebcfbf29 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ReadIsClassifiedObjectActionNameEditPart.java @@ -0,0 +1,797 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.parts; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.Label; +import org.eclipse.draw2d.geometry.Point; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.transaction.RecordingCommand; +import org.eclipse.emf.transaction.RunnableWithResult; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gef.AccessibleEditPart; +import org.eclipse.gef.EditPolicy; +import org.eclipse.gef.Request; +import org.eclipse.gef.requests.DirectEditRequest; +import org.eclipse.gef.tools.DirectEditManager; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; +import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; +import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; +import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; +import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; +import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; +import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; +import org.eclipse.gmf.runtime.notation.FontStyle; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.text.contentassist.IContentAssistProcessor; +import org.eclipse.jface.viewers.ICellEditorValidator; +import org.eclipse.jface.window.Window; +import org.eclipse.papyrus.extensionpoints.editors.Activator; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper; +import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil; +import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds; +import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit; +import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLParserProvider; +import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; +import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; +import org.eclipse.swt.SWT; +import org.eclipse.swt.accessibility.AccessibleEvent; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.PlatformUI; +import org.eclipse.uml2.uml.Feature; + +/** + * @generated + */ +public class ReadIsClassifiedObjectActionNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit { + + /** + * @generated + */ + public static final int VISUAL_ID = 5200; + + /** + * @generated + */ + private DirectEditManager manager; + + /** + * @generated + */ + private IParser parser; + + /** + * @generated + */ + private List<?> parserElements; + + /** + * @generated + */ + private String defaultText; + + /** + * direct edition mode (default, undefined, registered editor, etc.) + * + * @generated + */ + protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR; + + /** + * configuration from a registered edit dialog + * + * @generated + */ + protected IDirectEditorConfiguration configuration; + + /** + * @generated + */ + public ReadIsClassifiedObjectActionNameEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy()); + installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy()); + installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy()); + } + + /** + * @generated + */ + protected String getLabelTextHelper(IFigure figure) { + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); + } else { + return ((Label) figure).getText(); + } + } + + /** + * @generated + */ + protected void setLabelTextHelper(IFigure figure, String text) { + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); + } else { + ((Label) figure).setText(text); + } + } + + /** + * @generated + */ + protected Image getLabelIconHelper(IFigure figure) { + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); + } else { + return ((Label) figure).getIcon(); + } + } + + /** + * @generated + */ + protected void setLabelIconHelper(IFigure figure, Image icon) { + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); + } else { + ((Label) figure).setIcon(icon); + } + } + + /** + * @generated + */ + public void setLabel(IFigure figure) { + unregisterVisuals(); + setFigure(figure); + defaultText = getLabelTextHelper(figure); + registerVisuals(); + refreshVisuals(); + } + + /** + * @generated + */ + protected List<?> getModelChildren() { + return Collections.EMPTY_LIST; + } + + /** + * @generated + */ + public IGraphicalEditPart getChildBySemanticHint(String semanticHint) { + return null; + } + + /** + * @generated + */ + public void setParser(IParser parser) { + this.parser = parser; + } + + /** + * @generated + */ + protected EObject getParserElement() { + return resolveSemanticElement(); + } + + /** + * @generated + */ + protected Image getLabelIcon() { + return null; + } + + /** + * @generated + */ + protected String getLabelText() { + String text = null; + EObject parserElement = getParserElement(); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + } + if (text == null || text.length() == 0) { + text = defaultText; + } + return text; + } + + /** + * @generated + */ + public void setLabelText(String text) { + setLabelTextHelper(getFigure(), text); + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + /** + * @generated + */ + 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() { + + @Override + public String isValid(final Object value) { + if (value instanceof String) { + final EObject element = getParserElement(); + final IParser parser = getParser(); + try { + IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value)); + } + }); + return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); + } catch (InterruptedException ie) { + ie.printStackTrace(); + } + } + // shouldn't get here + return null; + } + }; + } + + /** + * @generated + */ + 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 = UMLParserProvider.getParser(UMLElementTypes.ReadIsClassifiedObjectAction_3122, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadIsClassifiedObjectActionNameEditPart.VISUAL_ID)); + } + return parser; + } + + /** + * @generated + */ + protected DirectEditManager getManager() { + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + } + return manager; + } + + /** + * @generated + */ + protected void setManager(DirectEditManager manager) { + this.manager = manager; + } + + /** + * @generated + */ + protected void performDirectEdit() { + BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() { + + @Override + public void run() { + getManager().show(); + } + }); + } + + /** + * @generated + */ + protected void performDirectEdit(Point eventLocation) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); + } + } + + /** + * @generated + */ + private void performDirectEdit(char initialCharacter) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); + } else { + performDirectEdit(); + } + } + + /** + * @generated + */ + protected void performDirectEditRequest(Request request) { + final Request theRequest = request; + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + directEditionMode = getDirectEditionType(); + } + switch (directEditionMode) { + case IDirectEdition.NO_DIRECT_EDITION: + // no direct edition mode => does nothing + return; + case IDirectEdition.EXTENDED_DIRECT_EDITOR: + updateExtendedEditorConfiguration(); + if (configuration == null || configuration.getLanguage() == null) { + // Create default edit manager + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + performDefaultDirectEditorEdit(theRequest); + } else { + configuration.preEditAction(resolveSemanticElement()); + Dialog dialog = null; + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); + initializeDirectEditManager(theRequest); + return; + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this); + helper.showEditor(); + return; + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else { + return; + } + final Dialog finalDialog = dialog; + if (Window.OK == dialog.open()) { + TransactionalEditingDomain domain = getEditingDomain(); + RecordingCommand command = new RecordingCommand(domain, "Edit Label") { + + @Override + protected void doExecute() { + configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue()); + } + }; + domain.getCommandStack().execute(command); + } + } + break; + case IDirectEdition.DEFAULT_DIRECT_EDITOR: + initializeDirectEditManager(theRequest); + break; + default: + break; + } + } + + /** + * @generated + */ + protected void initializeDirectEditManager(final Request request) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + if (isActive() && isEditable()) { + if (request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * @generated + */ + protected void refreshVisuals() { + super.refreshVisuals(); + refreshLabel(); + refreshFont(); + refreshFontColor(); + refreshUnderline(); + refreshStrikeThrough(); + } + + /** + * @generated + */ + protected void refreshLabel() { + EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); + if (maskLabelPolicy == null) { + maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); + } + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { + setLabelTextHelper(getFigure(), getLabelText()); + setLabelIconHelper(getFigure(), getLabelIcon()); + } else { + setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$ + setLabelIconHelper(getFigure(), null); + } + } + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + /** + * @generated + */ + protected void refreshUnderline() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); + } + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); + } else { + ((WrappingLabel) getFigure()).setTextUnderline(false); + } + } + } + + /** + * @generated + */ + protected void refreshStrikeThrough() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + } + } + + /** + * @generated + */ + 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() { + + @Override + public void getName(AccessibleEvent e) { + e.result = getLabelTextHelper(getFigure()); + } + }; + } + return accessibleEP; + } + + /** + * @generated + */ + private View getFontStyleOwnerView() { + return getPrimaryView(); + } + + /** + * Returns the kind of associated editor for direct edition. + * + * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition + * @generated + */ + public int getDirectEditionType() { + if (checkExtendedEditor()) { + initExtendedEditorConfiguration(); + return IDirectEdition.EXTENDED_DIRECT_EDITOR; + } + if (checkDefaultEdition()) { + return IDirectEdition.DEFAULT_DIRECT_EDITOR; + } + // not a named element. no specific editor => do nothing + return IDirectEdition.NO_DIRECT_EDITION; + } + + /** + * Checks if an extended editor is present. + * + * @return <code>true</code> if an extended editor is present. + * @generated + */ + protected boolean checkExtendedEditor() { + if (resolveSemanticElement() != null) { + return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName()); + } + return false; + } + + /** + * Checks if a default direct edition is available + * + * @return <code>true</code> if a default direct edition is available + * @generated + */ + protected boolean checkDefaultEdition() { + return (getParser() != null); + } + + /** + * Initializes the extended editor configuration + * + * @generated + */ + protected void initExtendedEditorConfiguration() { + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); + } + } + } + + /** + * Updates the preference configuration + * + * @generated + */ + protected void updateExtendedEditorConfiguration() { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + configuration = null; + } + } + + /** + * Performs the direct edit usually used by GMF editors. + * + * @param theRequest + * the direct edit request that starts the direct edit system + * @generated + */ + protected void performDefaultDirectEditorEdit(final Request theRequest) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + if (isActive() && isEditable()) { + if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; + performDirectEdit(editRequest.getLocation()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * @generated + */ + 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(); + } + } + } + super.handleNotificationEvent(event); + } + + /** + * @generated + */ + protected IFigure createFigure() { + // Parent should assign one using setLabel() method + return null; + } + + /** + * @generated + */ + 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())); + } + + /** + * @generated + */ + public void deactivate() { + removeOwnerElementListeners(); + super.deactivate(); + } + + /** + * @generated + */ + protected void removeOwnerElementListeners() { + removeListenerFilter(ADD_PARENT_MODEL); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ReclassifyObjectActionEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ReclassifyObjectActionEditPart.java new file mode 100644 index 00000000000..80495c52bd8 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ReclassifyObjectActionEditPart.java @@ -0,0 +1,354 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.parts; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.PositionConstants; +import org.eclipse.draw2d.geometry.Dimension; +import org.eclipse.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.RequestConstants; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.editpolicies.LayoutEditPolicy; +import org.eclipse.gef.editpolicies.NonResizableEditPolicy; +import org.eclipse.gef.handles.MoveHandle; +import org.eclipse.gef.requests.CreateRequest; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; +import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator; +import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; +import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout; +import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure; +import org.eclipse.gmf.runtime.notation.Edge; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure; +import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure; +import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.ActivityDiagramChangeStereotypedShapeEditpolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.CreateActionLocalConditionEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.CustomDiagramDragDropEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.DeleteActionViewEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.ObjectFlowWithPinsCreationEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.OpenDiagramEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.ReclassifyObjectActionItemSemanticEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.locator.PinPositionLocator; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.common.editparts.RoundedCompartmentEditPart; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.BorderItemResizableEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.ChangeStereotypedShapeEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusRoundedNodeFigure; +import org.eclipse.swt.graphics.Color; + +/** + * @generated + */ +public class ReclassifyObjectActionEditPart extends RoundedCompartmentEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 3121; + + /** + * @generated + */ + protected IFigure contentPane; + + /** + * @generated + */ + protected IFigure primaryShape; + + /** + * @generated + */ + public ReclassifyObjectActionEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy()); + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ReclassifyObjectActionItemSemanticEditPolicy()); + installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy()); + // in Papyrus diagrams are not strongly synchronised + // installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.activity.edit.policies.ReclassifyObjectActionCanonicalEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); + installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy()); + installEditPolicy(RequestConstants.REQ_CREATE, new CreateActionLocalConditionEditPolicy()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new ObjectFlowWithPinsCreationEditPolicy()); + installEditPolicy(RequestConstants.REQ_DELETE, new DeleteActionViewEditPolicy()); + installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); + installEditPolicy(ChangeStereotypedShapeEditPolicy.CHANGE_SHAPE_POLICY, new ActivityDiagramChangeStereotypedShapeEditpolicy()); + installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); + // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies + // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE); + } + + /** + * @generated + */ + protected LayoutEditPolicy createLayoutEditPolicy() { + org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() { + + @Override + protected EditPolicy createChildEditPolicy(EditPart child) { + View childView = (View) child.getModel(); + switch (UMLVisualIDRegistry.getVisualID(childView)) { + case ReclassifyObjectActionFloatingNameEditPart.VISUAL_ID: + return new BorderItemSelectionEditPolicy() { + + @Override + protected List<?> createSelectionHandles() { + MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost()); + mh.setBorder(null); + return Collections.singletonList(mh); + } + }; + case InputPinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID: + case ValuePinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID: + case ActionPinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID: + 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; + } + + /** + * Papyrus codeGen + * + * @generated + **/ + protected void handleNotificationEvent(Notification event) { + /* + * when a node have external node labels, the methods refreshChildren() remove the EditPart corresponding to the Label from the EditPart + * Registry. After that, we can't reset the visibility to true (using the Show/Hide Label Action)! + */ + if (NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) { + Object notifier = event.getNotifier(); + List<?> modelChildren = ((View) getModel()).getChildren(); + if (!(notifier instanceof Edge)) { + if (modelChildren.contains(event.getNotifier())) { + return; + } + } + } + super.handleNotificationEvent(event); + } + + /** + * @generated + */ + protected IFigure createNodeShape() { + return primaryShape = new PapyrusRoundedNodeFigure(); + } + + /** + * org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusRoundedNodeFigure + * + * @generated + */ + public PapyrusRoundedNodeFigure getPrimaryShape() { + return (PapyrusRoundedNodeFigure) primaryShape; + } + + /** + * @generated + */ + protected boolean addFixedChild(EditPart childEditPart) { + if (childEditPart instanceof ReclassifyObjectActionNameEditPart) { + ((ReclassifyObjectActionNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); + return true; + } + // Papyrus Gencode :Affixed Pin locator for Actions + if (childEditPart instanceof InputPinInReclassifyObjectActionAsObjectEditPart) { + IBorderItemLocator locator = new PinPositionLocator(getMainFigure(), PositionConstants.NONE); + getBorderedFigure().getBorderItemContainer().add(((InputPinInReclassifyObjectActionAsObjectEditPart) childEditPart).getFigure(), locator); + return true; + } + // Papyrus Gencode :Affixed Pin locator for Actions + if (childEditPart instanceof ValuePinInReclassifyObjectActionAsObjectEditPart) { + IBorderItemLocator locator = new PinPositionLocator(getMainFigure(), PositionConstants.NONE); + getBorderedFigure().getBorderItemContainer().add(((ValuePinInReclassifyObjectActionAsObjectEditPart) childEditPart).getFigure(), locator); + return true; + } + // Papyrus Gencode :Affixed Pin locator for Actions + if (childEditPart instanceof ActionPinInReclassifyObjectActionAsObjectEditPart) { + IBorderItemLocator locator = new PinPositionLocator(getMainFigure(), PositionConstants.NONE); + getBorderedFigure().getBorderItemContainer().add(((ActionPinInReclassifyObjectActionAsObjectEditPart) childEditPart).getFigure(), locator); + return true; + } + return false; + } + + /** + * @generated + */ + protected boolean removeFixedChild(EditPart childEditPart) { + if (childEditPart instanceof ReclassifyObjectActionNameEditPart) { + return true; + } + if (childEditPart instanceof InputPinInReclassifyObjectActionAsObjectEditPart) { + getBorderedFigure().getBorderItemContainer().remove(((InputPinInReclassifyObjectActionAsObjectEditPart) childEditPart).getFigure()); + return true; + } + if (childEditPart instanceof ValuePinInReclassifyObjectActionAsObjectEditPart) { + getBorderedFigure().getBorderItemContainer().remove(((ValuePinInReclassifyObjectActionAsObjectEditPart) childEditPart).getFigure()); + return true; + } + if (childEditPart instanceof ActionPinInReclassifyObjectActionAsObjectEditPart) { + getBorderedFigure().getBorderItemContainer().remove(((ActionPinInReclassifyObjectActionAsObjectEditPart) 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 void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) { + if (borderItemEditPart instanceof ReclassifyObjectActionFloatingNameEditPart) { + BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.SOUTH); + locator.setBorderItemOffset(new Dimension(-20, -20)); + borderItemContainer.add(borderItemEditPart.getFigure(), locator); + } else { + super.addBorderItem(borderItemContainer, borderItemEditPart); + } + } + + protected NodeFigure createNodePlate() { + RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(40, 40); + return result; + } + + /** + * Creates figure for this edit part. + * + * Body of this method does not depend on settings in generation model + * so you may safely remove <i>generated</i> tag and modify it. + * + * @generated + */ + protected NodeFigure createMainFigure() { + return new SelectableBorderedNodeFigure(createMainFigureWithSVG()); + } + + /** + * Default implementation treats passed figure as content pane. + * Respects layout one may have set for generated figure. + * + * @param nodeShape + * instance of generated figure class + * @generated + */ + 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) { + super.setLineWidth(width); + } + + /** + * @generated + */ + protected void setLineType(int style) { + if (primaryShape instanceof IPapyrusNodeFigure) { + ((IPapyrusNodeFigure) primaryShape).setLineStyle(style); + } + } + + /** + * @generated + */ + public EditPart getPrimaryChildEditPart() { + return getChildBySemanticHint(UMLVisualIDRegistry.getType(ReclassifyObjectActionNameEditPart.VISUAL_ID)); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ReclassifyObjectActionFloatingNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ReclassifyObjectActionFloatingNameEditPart.java new file mode 100644 index 00000000000..3289b760b23 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ReclassifyObjectActionFloatingNameEditPart.java @@ -0,0 +1,786 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.parts; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.Label; +import org.eclipse.draw2d.geometry.Point; +import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.transaction.RecordingCommand; +import org.eclipse.emf.transaction.RunnableWithResult; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gef.AccessibleEditPart; +import org.eclipse.gef.EditPolicy; +import org.eclipse.gef.Request; +import org.eclipse.gef.requests.DirectEditRequest; +import org.eclipse.gef.tools.DirectEditManager; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; +import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; +import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; +import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; +import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; +import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; +import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; +import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; +import org.eclipse.gmf.runtime.notation.FontStyle; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.text.contentassist.IContentAssistProcessor; +import org.eclipse.jface.viewers.ICellEditorValidator; +import org.eclipse.jface.window.Window; +import org.eclipse.papyrus.extensionpoints.editors.Activator; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper; +import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil; +import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLParserProvider; +import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; +import org.eclipse.papyrus.uml.diagram.common.editparts.FloatingLabelEditPart; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; +import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; +import org.eclipse.swt.SWT; +import org.eclipse.swt.accessibility.AccessibleEvent; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.PlatformUI; +import org.eclipse.uml2.uml.Feature; + +/** + * @generated + */ +public class ReclassifyObjectActionFloatingNameEditPart extends FloatingLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 5401; + + /** + * @generated + */ + private DirectEditManager manager; + + /** + * @generated + */ + private IParser parser; + + /** + * @generated + */ + private List<?> parserElements; + + /** + * @generated + */ + private String defaultText; + + /** + * direct edition mode (default, undefined, registered editor, etc.) + * + * @generated + */ + protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR; + + /** + * configuration from a registered edit dialog + * + * @generated + */ + protected IDirectEditorConfiguration configuration; + /** + * @generated + */ + static { + registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReclassifyObjectActionFloatingNameEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public ReclassifyObjectActionFloatingNameEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy()); + installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy()); + installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy()); + installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy()); + } + + /** + * @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 + */ + public void setParser(IParser parser) { + this.parser = parser; + } + + /** + * @generated + */ + protected EObject getParserElement() { + return resolveSemanticElement(); + } + + /** + * @generated + */ + protected Image getLabelIcon() { + return null; + } + + /** + * @generated + */ + protected String getLabelText() { + String text = null; + EObject parserElement = getParserElement(); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + } + if (text == null || text.length() == 0) { + text = defaultText; + } + return text; + } + + /** + * @generated + */ + public void setLabelText(String text) { + setLabelTextHelper(getFigure(), text); + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + /** + * @generated + */ + 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() { + + @Override + public String isValid(final Object value) { + if (value instanceof String) { + final EObject element = getParserElement(); + final IParser parser = getParser(); + try { + IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value)); + } + }); + return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); + } catch (InterruptedException ie) { + ie.printStackTrace(); + } + } + // shouldn't get here + return null; + } + }; + } + + /** + * @generated + */ + 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 = UMLParserProvider.getParser(UMLElementTypes.ReclassifyObjectAction_3121, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReclassifyObjectActionFloatingNameEditPart.VISUAL_ID)); + } + return parser; + } + + /** + * @generated + */ + protected DirectEditManager getManager() { + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + } + return manager; + } + + /** + * @generated + */ + protected void setManager(DirectEditManager manager) { + this.manager = manager; + } + + /** + * @generated + */ + protected void performDirectEdit() { + BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() { + + @Override + public void run() { + getManager().show(); + } + }); + } + + /** + * @generated + */ + protected void performDirectEdit(Point eventLocation) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); + } + } + + /** + * @generated + */ + private void performDirectEdit(char initialCharacter) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); + } else { + performDirectEdit(); + } + } + + /** + * @generated + */ + protected void performDirectEditRequest(Request request) { + final Request theRequest = request; + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + directEditionMode = getDirectEditionType(); + } + switch (directEditionMode) { + case IDirectEdition.NO_DIRECT_EDITION: + // no direct edition mode => does nothing + return; + case IDirectEdition.EXTENDED_DIRECT_EDITOR: + updateExtendedEditorConfiguration(); + if (configuration == null || configuration.getLanguage() == null) { + // Create default edit manager + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + performDefaultDirectEditorEdit(theRequest); + } else { + configuration.preEditAction(resolveSemanticElement()); + Dialog dialog = null; + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); + initializeDirectEditManager(theRequest); + return; + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this); + helper.showEditor(); + return; + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else { + return; + } + final Dialog finalDialog = dialog; + if (Window.OK == dialog.open()) { + TransactionalEditingDomain domain = getEditingDomain(); + RecordingCommand command = new RecordingCommand(domain, "Edit Label") { + + @Override + protected void doExecute() { + configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue()); + } + }; + domain.getCommandStack().execute(command); + } + } + break; + case IDirectEdition.DEFAULT_DIRECT_EDITOR: + initializeDirectEditManager(theRequest); + break; + default: + break; + } + } + + /** + * @generated + */ + protected void initializeDirectEditManager(final Request request) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + if (isActive() && isEditable()) { + if (request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * @generated + */ + protected void refreshVisuals() { + super.refreshVisuals(); + refreshLabel(); + refreshFont(); + refreshFontColor(); + refreshUnderline(); + refreshStrikeThrough(); + } + + /** + * @generated + */ + protected void refreshLabel() { + EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); + if (maskLabelPolicy == null) { + maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); + } + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { + setLabelTextHelper(getFigure(), getLabelText()); + setLabelIconHelper(getFigure(), getLabelIcon()); + } else { + setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$ + setLabelIconHelper(getFigure(), null); + } + } + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + /** + * @generated + */ + protected void refreshUnderline() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); + } + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); + } else { + ((WrappingLabel) getFigure()).setTextUnderline(false); + } + } + } + + /** + * @generated + */ + protected void refreshStrikeThrough() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + } + } + + /** + * @generated + */ + 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() { + + @Override + public void getName(AccessibleEvent e) { + e.result = getLabelTextHelper(getFigure()); + } + }; + } + return accessibleEP; + } + + /** + * @generated + */ + private View getFontStyleOwnerView() { + return getPrimaryView(); + } + + /** + * Returns the kind of associated editor for direct edition. + * + * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition + * @generated + */ + public int getDirectEditionType() { + if (checkExtendedEditor()) { + initExtendedEditorConfiguration(); + return IDirectEdition.EXTENDED_DIRECT_EDITOR; + } + if (checkDefaultEdition()) { + return IDirectEdition.DEFAULT_DIRECT_EDITOR; + } + // not a named element. no specific editor => do nothing + return IDirectEdition.NO_DIRECT_EDITION; + } + + /** + * Checks if an extended editor is present. + * + * @return <code>true</code> if an extended editor is present. + * @generated + */ + protected boolean checkExtendedEditor() { + if (resolveSemanticElement() != null) { + return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName()); + } + return false; + } + + /** + * Checks if a default direct edition is available + * + * @return <code>true</code> if a default direct edition is available + * @generated + */ + protected boolean checkDefaultEdition() { + return (getParser() != null); + } + + /** + * Initializes the extended editor configuration + * + * @generated + */ + protected void initExtendedEditorConfiguration() { + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); + } + } + } + + /** + * Updates the preference configuration + * + * @generated + */ + protected void updateExtendedEditorConfiguration() { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + configuration = null; + } + } + + /** + * Performs the direct edit usually used by GMF editors. + * + * @param theRequest + * the direct edit request that starts the direct edit system + * @generated + */ + protected void performDefaultDirectEditorEdit(final Request theRequest) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + if (isActive() && isEditable()) { + if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; + performDirectEdit(editRequest.getLocation()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * @generated + */ + 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 PapyrusWrappingLabel(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ReclassifyObjectActionNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ReclassifyObjectActionNameEditPart.java new file mode 100644 index 00000000000..1bb01b8bcf4 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ReclassifyObjectActionNameEditPart.java @@ -0,0 +1,797 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.parts; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.Label; +import org.eclipse.draw2d.geometry.Point; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.transaction.RecordingCommand; +import org.eclipse.emf.transaction.RunnableWithResult; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gef.AccessibleEditPart; +import org.eclipse.gef.EditPolicy; +import org.eclipse.gef.Request; +import org.eclipse.gef.requests.DirectEditRequest; +import org.eclipse.gef.tools.DirectEditManager; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; +import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; +import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; +import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; +import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; +import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; +import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; +import org.eclipse.gmf.runtime.notation.FontStyle; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.text.contentassist.IContentAssistProcessor; +import org.eclipse.jface.viewers.ICellEditorValidator; +import org.eclipse.jface.window.Window; +import org.eclipse.papyrus.extensionpoints.editors.Activator; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper; +import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil; +import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds; +import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit; +import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLParserProvider; +import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; +import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; +import org.eclipse.swt.SWT; +import org.eclipse.swt.accessibility.AccessibleEvent; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.PlatformUI; +import org.eclipse.uml2.uml.Feature; + +/** + * @generated + */ +public class ReclassifyObjectActionNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit { + + /** + * @generated + */ + public static final int VISUAL_ID = 5199; + + /** + * @generated + */ + private DirectEditManager manager; + + /** + * @generated + */ + private IParser parser; + + /** + * @generated + */ + private List<?> parserElements; + + /** + * @generated + */ + private String defaultText; + + /** + * direct edition mode (default, undefined, registered editor, etc.) + * + * @generated + */ + protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR; + + /** + * configuration from a registered edit dialog + * + * @generated + */ + protected IDirectEditorConfiguration configuration; + + /** + * @generated + */ + public ReclassifyObjectActionNameEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy()); + installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy()); + installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy()); + } + + /** + * @generated + */ + protected String getLabelTextHelper(IFigure figure) { + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); + } else { + return ((Label) figure).getText(); + } + } + + /** + * @generated + */ + protected void setLabelTextHelper(IFigure figure, String text) { + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); + } else { + ((Label) figure).setText(text); + } + } + + /** + * @generated + */ + protected Image getLabelIconHelper(IFigure figure) { + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); + } else { + return ((Label) figure).getIcon(); + } + } + + /** + * @generated + */ + protected void setLabelIconHelper(IFigure figure, Image icon) { + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); + } else { + ((Label) figure).setIcon(icon); + } + } + + /** + * @generated + */ + public void setLabel(IFigure figure) { + unregisterVisuals(); + setFigure(figure); + defaultText = getLabelTextHelper(figure); + registerVisuals(); + refreshVisuals(); + } + + /** + * @generated + */ + protected List<?> getModelChildren() { + return Collections.EMPTY_LIST; + } + + /** + * @generated + */ + public IGraphicalEditPart getChildBySemanticHint(String semanticHint) { + return null; + } + + /** + * @generated + */ + public void setParser(IParser parser) { + this.parser = parser; + } + + /** + * @generated + */ + protected EObject getParserElement() { + return resolveSemanticElement(); + } + + /** + * @generated + */ + protected Image getLabelIcon() { + return null; + } + + /** + * @generated + */ + protected String getLabelText() { + String text = null; + EObject parserElement = getParserElement(); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + } + if (text == null || text.length() == 0) { + text = defaultText; + } + return text; + } + + /** + * @generated + */ + public void setLabelText(String text) { + setLabelTextHelper(getFigure(), text); + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + /** + * @generated + */ + 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() { + + @Override + public String isValid(final Object value) { + if (value instanceof String) { + final EObject element = getParserElement(); + final IParser parser = getParser(); + try { + IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value)); + } + }); + return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); + } catch (InterruptedException ie) { + ie.printStackTrace(); + } + } + // shouldn't get here + return null; + } + }; + } + + /** + * @generated + */ + 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 = UMLParserProvider.getParser(UMLElementTypes.ReclassifyObjectAction_3121, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReclassifyObjectActionNameEditPart.VISUAL_ID)); + } + return parser; + } + + /** + * @generated + */ + protected DirectEditManager getManager() { + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + } + return manager; + } + + /** + * @generated + */ + protected void setManager(DirectEditManager manager) { + this.manager = manager; + } + + /** + * @generated + */ + protected void performDirectEdit() { + BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() { + + @Override + public void run() { + getManager().show(); + } + }); + } + + /** + * @generated + */ + protected void performDirectEdit(Point eventLocation) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); + } + } + + /** + * @generated + */ + private void performDirectEdit(char initialCharacter) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); + } else { + performDirectEdit(); + } + } + + /** + * @generated + */ + protected void performDirectEditRequest(Request request) { + final Request theRequest = request; + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + directEditionMode = getDirectEditionType(); + } + switch (directEditionMode) { + case IDirectEdition.NO_DIRECT_EDITION: + // no direct edition mode => does nothing + return; + case IDirectEdition.EXTENDED_DIRECT_EDITOR: + updateExtendedEditorConfiguration(); + if (configuration == null || configuration.getLanguage() == null) { + // Create default edit manager + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + performDefaultDirectEditorEdit(theRequest); + } else { + configuration.preEditAction(resolveSemanticElement()); + Dialog dialog = null; + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); + initializeDirectEditManager(theRequest); + return; + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this); + helper.showEditor(); + return; + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else { + return; + } + final Dialog finalDialog = dialog; + if (Window.OK == dialog.open()) { + TransactionalEditingDomain domain = getEditingDomain(); + RecordingCommand command = new RecordingCommand(domain, "Edit Label") { + + @Override + protected void doExecute() { + configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue()); + } + }; + domain.getCommandStack().execute(command); + } + } + break; + case IDirectEdition.DEFAULT_DIRECT_EDITOR: + initializeDirectEditManager(theRequest); + break; + default: + break; + } + } + + /** + * @generated + */ + protected void initializeDirectEditManager(final Request request) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + if (isActive() && isEditable()) { + if (request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * @generated + */ + protected void refreshVisuals() { + super.refreshVisuals(); + refreshLabel(); + refreshFont(); + refreshFontColor(); + refreshUnderline(); + refreshStrikeThrough(); + } + + /** + * @generated + */ + protected void refreshLabel() { + EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); + if (maskLabelPolicy == null) { + maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); + } + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { + setLabelTextHelper(getFigure(), getLabelText()); + setLabelIconHelper(getFigure(), getLabelIcon()); + } else { + setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$ + setLabelIconHelper(getFigure(), null); + } + } + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + /** + * @generated + */ + protected void refreshUnderline() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); + } + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); + } else { + ((WrappingLabel) getFigure()).setTextUnderline(false); + } + } + } + + /** + * @generated + */ + protected void refreshStrikeThrough() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + } + } + + /** + * @generated + */ + 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() { + + @Override + public void getName(AccessibleEvent e) { + e.result = getLabelTextHelper(getFigure()); + } + }; + } + return accessibleEP; + } + + /** + * @generated + */ + private View getFontStyleOwnerView() { + return getPrimaryView(); + } + + /** + * Returns the kind of associated editor for direct edition. + * + * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition + * @generated + */ + public int getDirectEditionType() { + if (checkExtendedEditor()) { + initExtendedEditorConfiguration(); + return IDirectEdition.EXTENDED_DIRECT_EDITOR; + } + if (checkDefaultEdition()) { + return IDirectEdition.DEFAULT_DIRECT_EDITOR; + } + // not a named element. no specific editor => do nothing + return IDirectEdition.NO_DIRECT_EDITION; + } + + /** + * Checks if an extended editor is present. + * + * @return <code>true</code> if an extended editor is present. + * @generated + */ + protected boolean checkExtendedEditor() { + if (resolveSemanticElement() != null) { + return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName()); + } + return false; + } + + /** + * Checks if a default direct edition is available + * + * @return <code>true</code> if a default direct edition is available + * @generated + */ + protected boolean checkDefaultEdition() { + return (getParser() != null); + } + + /** + * Initializes the extended editor configuration + * + * @generated + */ + protected void initExtendedEditorConfiguration() { + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); + } + } + } + + /** + * Updates the preference configuration + * + * @generated + */ + protected void updateExtendedEditorConfiguration() { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + configuration = null; + } + } + + /** + * Performs the direct edit usually used by GMF editors. + * + * @param theRequest + * the direct edit request that starts the direct edit system + * @generated + */ + protected void performDefaultDirectEditorEdit(final Request theRequest) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + if (isActive() && isEditable()) { + if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; + performDirectEdit(editRequest.getLocation()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * @generated + */ + 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(); + } + } + } + super.handleNotificationEvent(event); + } + + /** + * @generated + */ + protected IFigure createFigure() { + // Parent should assign one using setLabel() method + return null; + } + + /** + * @generated + */ + 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())); + } + + /** + * @generated + */ + public void deactivate() { + removeOwnerElementListeners(); + super.deactivate(); + } + + /** + * @generated + */ + protected void removeOwnerElementListeners() { + removeListenerFilter(ADD_PARENT_MODEL); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/UMLEditPartFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/UMLEditPartFactory.java index aebf2d4bd2d..2b5917f76f9 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/UMLEditPartFactory.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/UMLEditPartFactory.java @@ -897,6 +897,68 @@ public class UMLEditPartFactory implements EditPartFactory { return new OutputPinInReadExtentActionLabelEditPart(view); case OutputPinInReadExtentActionAppliedStereotypeLabelEditPart.VISUAL_ID: return new OutputPinInReadExtentActionAppliedStereotypeLabelEditPart(view); + case ReclassifyObjectActionEditPart.VISUAL_ID: + return new ReclassifyObjectActionEditPart(view); + case ReclassifyObjectActionNameEditPart.VISUAL_ID: + return new ReclassifyObjectActionNameEditPart(view); + case ReclassifyObjectActionFloatingNameEditPart.VISUAL_ID: + return new ReclassifyObjectActionFloatingNameEditPart(view); + case InputPinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID: + return new InputPinInReclassifyObjectActionAsObjectEditPart(view); + case InputPinInReclassifyObjectActionAsObjectLabelEditPart.VISUAL_ID: + return new InputPinInReclassifyObjectActionAsObjectLabelEditPart(view); + case InputPinInReclassifyObjectActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID: + return new InputPinInReclassifyObjectActionAsObjectAppliedStereotypeLabelEditPart(view); + case ValuePinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID: + return new ValuePinInReclassifyObjectActionAsObjectEditPart(view); + case ValuePinInReclassifyObjectActionAsObjectLabelEditPart.VISUAL_ID: + return new ValuePinInReclassifyObjectActionAsObjectLabelEditPart(view); + case ValuePinInReclassifyObjectActionAsObjectValueEditPart.VISUAL_ID: + return new ValuePinInReclassifyObjectActionAsObjectValueEditPart(view); + case ValuePinInReclassifyObjectActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID: + return new ValuePinInReclassifyObjectActionAsObjectAppliedStereotypeLabelEditPart(view); + case ActionPinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID: + return new ActionPinInReclassifyObjectActionAsObjectEditPart(view); + case ActionPinInReclassifyObjectActionAsObjectLabelEditPart.VISUAL_ID: + return new ActionPinInReclassifyObjectActionAsObjectLabelEditPart(view); + case ActionPinInReclassifyObjectActionAsObjectValueEditPart.VISUAL_ID: + return new ActionPinInReclassifyObjectActionAsObjectValueEditPart(view); + case ActionPinInReclassifyObjectActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID: + return new ActionPinInReclassifyObjectActionAsObjectAppliedStereotypeLabelEditPart(view); + case ReadIsClassifiedObjectActionEditPart.VISUAL_ID: + return new ReadIsClassifiedObjectActionEditPart(view); + case ReadIsClassifiedObjectActionNameEditPart.VISUAL_ID: + return new ReadIsClassifiedObjectActionNameEditPart(view); + case ReadIsClassifiedObjectActionFloatingNameEditPart.VISUAL_ID: + return new ReadIsClassifiedObjectActionFloatingNameEditPart(view); + case OutputPinInReadIsClassifiedObjectActionEditPart.VISUAL_ID: + return new OutputPinInReadIsClassifiedObjectActionEditPart(view); + case OutputPinInReadIsClassifiedObjectActionLabelEditPart.VISUAL_ID: + return new OutputPinInReadIsClassifiedObjectActionLabelEditPart(view); + case OutputPinInReadIsClassifiedObjectActionAppliedStereotypeLabelEditPart.VISUAL_ID: + return new OutputPinInReadIsClassifiedObjectActionAppliedStereotypeLabelEditPart(view); + case InputPinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID: + return new InputPinInReadIsClassifiedObjectActionAsObjectEditPart(view); + case InputPinInReadIsClassifiedObjectActionAsObjectLabelEditPart.VISUAL_ID: + return new InputPinInReadIsClassifiedObjectActionAsObjectLabelEditPart(view); + case InputPinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID: + return new InputPinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart(view); + case ValuePinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID: + return new ValuePinInReadIsClassifiedObjectActionAsObjectEditPart(view); + case ValuePinInReadIsClassifiedObjectActionAsObjectLabelEditPart.VISUAL_ID: + return new ValuePinInReadIsClassifiedObjectActionAsObjectLabelEditPart(view); + case ValuePinInReadIsClassifiedObjectActionAsObjectValueEditPart.VISUAL_ID: + return new ValuePinInReadIsClassifiedObjectActionAsObjectValueEditPart(view); + case ValuePinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID: + return new ValuePinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart(view); + case ActionPinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID: + return new ActionPinInReadIsClassifiedObjectActionAsObjectEditPart(view); + case ActionPinInReadIsClassifiedObjectActionAsObjectLabelEditPart.VISUAL_ID: + return new ActionPinInReadIsClassifiedObjectActionAsObjectLabelEditPart(view); + case ActionPinInReadIsClassifiedObjectActionAsObjectValueEditPart.VISUAL_ID: + return new ActionPinInReadIsClassifiedObjectActionAsObjectValueEditPart(view); + case ActionPinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID: + return new ActionPinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart(view); case ActivityActivityParametersCompartmentEditPart.VISUAL_ID: return new ActivityActivityParametersCompartmentEditPart(view); case ActivityActivityPreConditionsCompartmentEditPart.VISUAL_ID: diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart.java new file mode 100644 index 00000000000..35cb00187f3 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart.java @@ -0,0 +1,789 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.parts; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.Label; +import org.eclipse.draw2d.geometry.Point; +import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.transaction.RecordingCommand; +import org.eclipse.emf.transaction.RunnableWithResult; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gef.AccessibleEditPart; +import org.eclipse.gef.EditPolicy; +import org.eclipse.gef.Request; +import org.eclipse.gef.requests.DirectEditRequest; +import org.eclipse.gef.tools.DirectEditManager; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; +import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; +import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; +import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; +import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; +import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; +import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; +import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; +import org.eclipse.gmf.runtime.notation.FontStyle; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.text.contentassist.IContentAssistProcessor; +import org.eclipse.jface.viewers.ICellEditorValidator; +import org.eclipse.jface.window.Window; +import org.eclipse.papyrus.extensionpoints.editors.Activator; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper; +import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil; +import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLParserProvider; +import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; +import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractLabelEditPart; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.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; +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.custom.BusyIndicator; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.PlatformUI; +import org.eclipse.uml2.uml.Feature; + +/** + * @generated + */ +public class ValuePinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart extends AbstractLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 5310; + + /** + * @generated + */ + private DirectEditManager manager; + + /** + * @generated + */ + private IParser parser; + + /** + * @generated + */ + private List<?> parserElements; + + /** + * @generated + */ + private String defaultText; + + /** + * direct edition mode (default, undefined, registered editor, etc.) + * + * @generated + */ + protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR; + + /** + * configuration from a registered edit dialog + * + * @generated + */ + protected IDirectEditorConfiguration configuration; + /** + * @generated + */ + static { + registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.ValuePinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public ValuePinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy()); + installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy()); + installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeExternalNodeEditPolicy()); + installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy()); + } + + /** + * @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 + */ + public void setParser(IParser parser) { + this.parser = parser; + } + + /** + * @generated + */ + protected EObject getParserElement() { + return resolveSemanticElement(); + } + + /** + * @generated + */ + protected Image getLabelIcon() { + return null; + } + + /** + * @generated + */ + protected String getLabelText() { + String text = null; + EObject parserElement = getParserElement(); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + } + if (text == null || text.length() == 0) { + text = defaultText; + } + return text; + } + + /** + * @generated + */ + public void setLabelText(String text) { + setLabelTextHelper(getFigure(), text); + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + /** + * @generated + */ + 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() { + + @Override + public String isValid(final Object value) { + if (value instanceof String) { + final EObject element = getParserElement(); + final IParser parser = getParser(); + try { + IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value)); + } + }); + return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); + } catch (InterruptedException ie) { + ie.printStackTrace(); + } + } + // shouldn't get here + return null; + } + }; + } + + /** + * @generated + */ + 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 = UMLParserProvider.getParser(UMLElementTypes.ValuePin_3155, getParserElement(), + UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.ValuePinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID)); + } + return parser; + } + + /** + * @generated + */ + protected DirectEditManager getManager() { + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + } + return manager; + } + + /** + * @generated + */ + protected void setManager(DirectEditManager manager) { + this.manager = manager; + } + + /** + * @generated + */ + protected void performDirectEdit() { + BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() { + + @Override + public void run() { + getManager().show(); + } + }); + } + + /** + * @generated + */ + protected void performDirectEdit(Point eventLocation) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); + } + } + + /** + * @generated + */ + private void performDirectEdit(char initialCharacter) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); + } else { + performDirectEdit(); + } + } + + /** + * @generated + */ + protected void performDirectEditRequest(Request request) { + final Request theRequest = request; + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + directEditionMode = getDirectEditionType(); + } + switch (directEditionMode) { + case IDirectEdition.NO_DIRECT_EDITION: + // no direct edition mode => does nothing + return; + case IDirectEdition.EXTENDED_DIRECT_EDITOR: + updateExtendedEditorConfiguration(); + if (configuration == null || configuration.getLanguage() == null) { + // Create default edit manager + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + performDefaultDirectEditorEdit(theRequest); + } else { + configuration.preEditAction(resolveSemanticElement()); + Dialog dialog = null; + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); + initializeDirectEditManager(theRequest); + return; + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this); + helper.showEditor(); + return; + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else { + return; + } + final Dialog finalDialog = dialog; + if (Window.OK == dialog.open()) { + TransactionalEditingDomain domain = getEditingDomain(); + RecordingCommand command = new RecordingCommand(domain, "Edit Label") { + + @Override + protected void doExecute() { + configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue()); + } + }; + domain.getCommandStack().execute(command); + } + } + break; + case IDirectEdition.DEFAULT_DIRECT_EDITOR: + initializeDirectEditManager(theRequest); + break; + default: + break; + } + } + + /** + * @generated + */ + protected void initializeDirectEditManager(final Request request) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + if (isActive() && isEditable()) { + if (request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * @generated + */ + protected void refreshVisuals() { + super.refreshVisuals(); + refreshLabel(); + refreshFont(); + refreshFontColor(); + refreshUnderline(); + refreshStrikeThrough(); + } + + /** + * @generated + */ + protected void refreshLabel() { + EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); + if (maskLabelPolicy == null) { + maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); + } + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { + setLabelTextHelper(getFigure(), getLabelText()); + setLabelIconHelper(getFigure(), getLabelIcon()); + } else { + setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$ + setLabelIconHelper(getFigure(), null); + } + } + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + /** + * @generated + */ + protected void refreshUnderline() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); + } + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); + } else { + ((WrappingLabel) getFigure()).setTextUnderline(false); + } + } + } + + /** + * @generated + */ + protected void refreshStrikeThrough() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + } + } + + /** + * @generated + */ + 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() { + + @Override + public void getName(AccessibleEvent e) { + e.result = getLabelTextHelper(getFigure()); + } + }; + } + return accessibleEP; + } + + /** + * @generated + */ + private View getFontStyleOwnerView() { + return getPrimaryView(); + } + + /** + * Returns the kind of associated editor for direct edition. + * + * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition + * @generated + */ + public int getDirectEditionType() { + if (checkExtendedEditor()) { + initExtendedEditorConfiguration(); + return IDirectEdition.EXTENDED_DIRECT_EDITOR; + } + if (checkDefaultEdition()) { + return IDirectEdition.DEFAULT_DIRECT_EDITOR; + } + // not a named element. no specific editor => do nothing + return IDirectEdition.NO_DIRECT_EDITION; + } + + /** + * Checks if an extended editor is present. + * + * @return <code>true</code> if an extended editor is present. + * @generated + */ + protected boolean checkExtendedEditor() { + if (resolveSemanticElement() != null) { + return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName()); + } + return false; + } + + /** + * Checks if a default direct edition is available + * + * @return <code>true</code> if a default direct edition is available + * @generated + */ + protected boolean checkDefaultEdition() { + return (getParser() != null); + } + + /** + * Initializes the extended editor configuration + * + * @generated + */ + protected void initExtendedEditorConfiguration() { + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); + } + } + } + + /** + * Updates the preference configuration + * + * @generated + */ + protected void updateExtendedEditorConfiguration() { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + configuration = null; + } + } + + /** + * Performs the direct edit usually used by GMF editors. + * + * @param theRequest + * the direct edit request that starts the direct edit system + * @generated + */ + protected void performDefaultDirectEditorEdit(final Request theRequest) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + if (isActive() && isEditable()) { + if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; + performDirectEdit(editRequest.getLocation()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * @generated + */ + 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 AppliedStereotypeWrappingLabelFigure(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInReadIsClassifiedObjectActionAsObjectEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInReadIsClassifiedObjectActionAsObjectEditPart.java new file mode 100644 index 00000000000..7e01536108d --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInReadIsClassifiedObjectActionAsObjectEditPart.java @@ -0,0 +1,255 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.parts; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.StackLayout; +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.RequestConstants; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.editpolicies.LayoutEditPolicy; +import org.eclipse.gef.editpolicies.NonResizableEditPolicy; +import org.eclipse.gef.handles.MoveHandle; +import org.eclipse.gef.requests.CreateRequest; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; +import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; +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.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure; +import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure; +import org.eclipse.papyrus.uml.diagram.activity.edit.part.AbstractPinEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.NoDeleteFromDiagramEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.OpenDiagramEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.PinLayoutEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.ValuePinInReadIsClassifiedObjectActionAsObjectItemSemanticEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.figures.PinFigure; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator; +import org.eclipse.swt.graphics.Color; + +/** + * @generated + */ +public class ValuePinInReadIsClassifiedObjectActionAsObjectEditPart extends AbstractPinEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 3155; + + /** + * @generated + */ + protected IFigure contentPane; + + /** + * @generated + */ + protected IFigure primaryShape; + + /** + * @generated + */ + public ValuePinInReadIsClassifiedObjectActionAsObjectEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, getPrimaryDragEditPolicy()); + installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ValuePinInReadIsClassifiedObjectActionAsObjectItemSemanticEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); + installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, new PinLayoutEditPolicy()); + installEditPolicy(RequestConstants.REQ_DELETE, new NoDeleteFromDiagramEditPolicy()); + // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies + // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE); + } + + /** + * @generated + */ + protected LayoutEditPolicy createLayoutEditPolicy() { + org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() { + + @Override + protected EditPolicy createChildEditPolicy(EditPart child) { + View childView = (View) child.getModel(); + switch (UMLVisualIDRegistry.getVisualID(childView)) { + case ValuePinInReadIsClassifiedObjectActionAsObjectLabelEditPart.VISUAL_ID: + case ValuePinInReadIsClassifiedObjectActionAsObjectValueEditPart.VISUAL_ID: + case ValuePinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID: + return new BorderItemSelectionEditPolicy() { + + @Override + protected List<?> createSelectionHandles() { + MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost()); + mh.setBorder(null); + return Collections.singletonList(mh); + } + }; + } + EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (result == null) { + result = new NonResizableEditPolicy(); + } + return result; + } + + @Override + protected Command getMoveChildrenCommand(Request request) { + return null; + } + + @Override + protected Command getCreateCommand(CreateRequest request) { + return null; + } + }; + return lep; + } + + /** + * Papyrus codeGen + * + * @generated + **/ + protected void handleNotificationEvent(Notification event) { + /* + * when a node have external node labels, the methods refreshChildren() remove the EditPart corresponding to the Label from the EditPart + * Registry. After that, we can't reset the visibility to true (using the Show/Hide Label Action)! + */ + if (NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) { + Object notifier = event.getNotifier(); + List<?> modelChildren = ((View) getModel()).getChildren(); + if (!(notifier instanceof Edge)) { + if (modelChildren.contains(event.getNotifier())) { + return; + } + } + } + super.handleNotificationEvent(event); + } + + /** + * @generated + */ + protected IFigure createNodeShape() { + return primaryShape = new PinFigure(); + } + + /** + * org.eclipse.papyrus.uml.diagram.activity.figures.PinFigure + * + * @generated + */ + public PinFigure getPrimaryShape() { + return (PinFigure) primaryShape; + } + + /** + * @generated + */ + protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) { + if (borderItemEditPart instanceof ValuePinInReadIsClassifiedObjectActionAsObjectLabelEditPart) { + IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure()); + borderItemContainer.add(borderItemEditPart.getFigure(), locator); + } else if (borderItemEditPart instanceof ValuePinInReadIsClassifiedObjectActionAsObjectValueEditPart) { + IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure()); + borderItemContainer.add(borderItemEditPart.getFigure(), locator); + } else if (borderItemEditPart instanceof ValuePinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart) { + IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure()); + borderItemContainer.add(borderItemEditPart.getFigure(), locator); + } else { + super.addBorderItem(borderItemContainer, borderItemEditPart); + } + } + + protected NodeFigure createNodePlate() { + RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(16, 16); + 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) { + super.setLineWidth(width); + } + + /** + * @generated + */ + protected void setLineType(int style) { + if (primaryShape instanceof IPapyrusNodeFigure) { + ((IPapyrusNodeFigure) primaryShape).setLineStyle(style); + } + } + + /** + * @generated + */ + public EditPart getPrimaryChildEditPart() { + return getChildBySemanticHint(UMLVisualIDRegistry.getType(ValuePinInReadIsClassifiedObjectActionAsObjectLabelEditPart.VISUAL_ID)); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInReadIsClassifiedObjectActionAsObjectLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInReadIsClassifiedObjectActionAsObjectLabelEditPart.java new file mode 100644 index 00000000000..d937c531ed7 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInReadIsClassifiedObjectActionAsObjectLabelEditPart.java @@ -0,0 +1,785 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.parts; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.Label; +import org.eclipse.draw2d.geometry.Point; +import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.transaction.RecordingCommand; +import org.eclipse.emf.transaction.RunnableWithResult; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gef.AccessibleEditPart; +import org.eclipse.gef.EditPolicy; +import org.eclipse.gef.Request; +import org.eclipse.gef.requests.DirectEditRequest; +import org.eclipse.gef.tools.DirectEditManager; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; +import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; +import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; +import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; +import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; +import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; +import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; +import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; +import org.eclipse.gmf.runtime.notation.FontStyle; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.text.contentassist.IContentAssistProcessor; +import org.eclipse.jface.viewers.ICellEditorValidator; +import org.eclipse.jface.window.Window; +import org.eclipse.papyrus.extensionpoints.editors.Activator; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper; +import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil; +import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds; +import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.figures.SimpleLabel; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLParserProvider; +import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; +import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; +import org.eclipse.swt.SWT; +import org.eclipse.swt.accessibility.AccessibleEvent; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.PlatformUI; +import org.eclipse.uml2.uml.Feature; + +/** + * @generated + */ +public class ValuePinInReadIsClassifiedObjectActionAsObjectLabelEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 5308; + + /** + * @generated + */ + private DirectEditManager manager; + + /** + * @generated + */ + private IParser parser; + + /** + * @generated + */ + private List<?> parserElements; + + /** + * @generated + */ + private String defaultText; + + /** + * direct edition mode (default, undefined, registered editor, etc.) + * + * @generated + */ + protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR; + + /** + * configuration from a registered edit dialog + * + * @generated + */ + protected IDirectEditorConfiguration configuration; + /** + * @generated + */ + static { + registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.ValuePinInReadIsClassifiedObjectActionAsObjectLabelEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public ValuePinInReadIsClassifiedObjectActionAsObjectLabelEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy()); + installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy()); + installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy()); + } + + /** + * @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 + */ + public void setParser(IParser parser) { + this.parser = parser; + } + + /** + * @generated + */ + protected EObject getParserElement() { + return resolveSemanticElement(); + } + + /** + * @generated + */ + protected Image getLabelIcon() { + return null; + } + + /** + * @generated + */ + protected String getLabelText() { + String text = null; + EObject parserElement = getParserElement(); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + } + if (text == null || text.length() == 0) { + text = defaultText; + } + return text; + } + + /** + * @generated + */ + public void setLabelText(String text) { + setLabelTextHelper(getFigure(), text); + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + /** + * @generated + */ + 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() { + + @Override + public String isValid(final Object value) { + if (value instanceof String) { + final EObject element = getParserElement(); + final IParser parser = getParser(); + try { + IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value)); + } + }); + return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); + } catch (InterruptedException ie) { + ie.printStackTrace(); + } + } + // shouldn't get here + return null; + } + }; + } + + /** + * @generated + */ + 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 = UMLParserProvider.getParser(UMLElementTypes.ValuePin_3155, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.ValuePinInReadIsClassifiedObjectActionAsObjectLabelEditPart.VISUAL_ID)); + } + return parser; + } + + /** + * @generated + */ + protected DirectEditManager getManager() { + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + } + return manager; + } + + /** + * @generated + */ + protected void setManager(DirectEditManager manager) { + this.manager = manager; + } + + /** + * @generated + */ + protected void performDirectEdit() { + BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() { + + @Override + public void run() { + getManager().show(); + } + }); + } + + /** + * @generated + */ + protected void performDirectEdit(Point eventLocation) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); + } + } + + /** + * @generated + */ + private void performDirectEdit(char initialCharacter) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); + } else { + performDirectEdit(); + } + } + + /** + * @generated + */ + protected void performDirectEditRequest(Request request) { + final Request theRequest = request; + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + directEditionMode = getDirectEditionType(); + } + switch (directEditionMode) { + case IDirectEdition.NO_DIRECT_EDITION: + // no direct edition mode => does nothing + return; + case IDirectEdition.EXTENDED_DIRECT_EDITOR: + updateExtendedEditorConfiguration(); + if (configuration == null || configuration.getLanguage() == null) { + // Create default edit manager + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + performDefaultDirectEditorEdit(theRequest); + } else { + configuration.preEditAction(resolveSemanticElement()); + Dialog dialog = null; + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); + initializeDirectEditManager(theRequest); + return; + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this); + helper.showEditor(); + return; + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else { + return; + } + final Dialog finalDialog = dialog; + if (Window.OK == dialog.open()) { + TransactionalEditingDomain domain = getEditingDomain(); + RecordingCommand command = new RecordingCommand(domain, "Edit Label") { + + @Override + protected void doExecute() { + configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue()); + } + }; + domain.getCommandStack().execute(command); + } + } + break; + case IDirectEdition.DEFAULT_DIRECT_EDITOR: + initializeDirectEditManager(theRequest); + break; + default: + break; + } + } + + /** + * @generated + */ + protected void initializeDirectEditManager(final Request request) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + if (isActive() && isEditable()) { + if (request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * @generated + */ + protected void refreshVisuals() { + super.refreshVisuals(); + refreshLabel(); + refreshFont(); + refreshFontColor(); + refreshUnderline(); + refreshStrikeThrough(); + } + + /** + * @generated + */ + protected void refreshLabel() { + EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); + if (maskLabelPolicy == null) { + maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); + } + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { + setLabelTextHelper(getFigure(), getLabelText()); + setLabelIconHelper(getFigure(), getLabelIcon()); + } else { + setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$ + setLabelIconHelper(getFigure(), null); + } + } + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + /** + * @generated + */ + protected void refreshUnderline() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); + } + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); + } else { + ((WrappingLabel) getFigure()).setTextUnderline(false); + } + } + } + + /** + * @generated + */ + protected void refreshStrikeThrough() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + } + } + + /** + * @generated + */ + 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() { + + @Override + public void getName(AccessibleEvent e) { + e.result = getLabelTextHelper(getFigure()); + } + }; + } + return accessibleEP; + } + + /** + * @generated + */ + private View getFontStyleOwnerView() { + return getPrimaryView(); + } + + /** + * Returns the kind of associated editor for direct edition. + * + * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition + * @generated + */ + public int getDirectEditionType() { + if (checkExtendedEditor()) { + initExtendedEditorConfiguration(); + return IDirectEdition.EXTENDED_DIRECT_EDITOR; + } + if (checkDefaultEdition()) { + return IDirectEdition.DEFAULT_DIRECT_EDITOR; + } + // not a named element. no specific editor => do nothing + return IDirectEdition.NO_DIRECT_EDITION; + } + + /** + * Checks if an extended editor is present. + * + * @return <code>true</code> if an extended editor is present. + * @generated + */ + protected boolean checkExtendedEditor() { + if (resolveSemanticElement() != null) { + return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName()); + } + return false; + } + + /** + * Checks if a default direct edition is available + * + * @return <code>true</code> if a default direct edition is available + * @generated + */ + protected boolean checkDefaultEdition() { + return (getParser() != null); + } + + /** + * Initializes the extended editor configuration + * + * @generated + */ + protected void initExtendedEditorConfiguration() { + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); + } + } + } + + /** + * Updates the preference configuration + * + * @generated + */ + protected void updateExtendedEditorConfiguration() { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + configuration = null; + } + } + + /** + * Performs the direct edit usually used by GMF editors. + * + * @param theRequest + * the direct edit request that starts the direct edit system + * @generated + */ + protected void performDefaultDirectEditorEdit(final Request theRequest) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + if (isActive() && isEditable()) { + if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; + performDirectEdit(editRequest.getLocation()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * @generated + */ + 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 SimpleLabel(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInReadIsClassifiedObjectActionAsObjectValueEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInReadIsClassifiedObjectActionAsObjectValueEditPart.java new file mode 100644 index 00000000000..a7fa4fa895a --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInReadIsClassifiedObjectActionAsObjectValueEditPart.java @@ -0,0 +1,785 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.parts; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.Label; +import org.eclipse.draw2d.geometry.Point; +import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.transaction.RecordingCommand; +import org.eclipse.emf.transaction.RunnableWithResult; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gef.AccessibleEditPart; +import org.eclipse.gef.EditPolicy; +import org.eclipse.gef.Request; +import org.eclipse.gef.requests.DirectEditRequest; +import org.eclipse.gef.tools.DirectEditManager; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; +import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; +import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; +import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; +import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; +import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; +import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; +import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; +import org.eclipse.gmf.runtime.notation.FontStyle; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.text.contentassist.IContentAssistProcessor; +import org.eclipse.jface.viewers.ICellEditorValidator; +import org.eclipse.jface.window.Window; +import org.eclipse.papyrus.extensionpoints.editors.Activator; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper; +import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil; +import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds; +import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.figures.SimpleLabel; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLParserProvider; +import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; +import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; +import org.eclipse.swt.SWT; +import org.eclipse.swt.accessibility.AccessibleEvent; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.PlatformUI; +import org.eclipse.uml2.uml.Feature; + +/** + * @generated + */ +public class ValuePinInReadIsClassifiedObjectActionAsObjectValueEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 5309; + + /** + * @generated + */ + private DirectEditManager manager; + + /** + * @generated + */ + private IParser parser; + + /** + * @generated + */ + private List<?> parserElements; + + /** + * @generated + */ + private String defaultText; + + /** + * direct edition mode (default, undefined, registered editor, etc.) + * + * @generated + */ + protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR; + + /** + * configuration from a registered edit dialog + * + * @generated + */ + protected IDirectEditorConfiguration configuration; + /** + * @generated + */ + static { + registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.ValuePinInReadIsClassifiedObjectActionAsObjectValueEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public ValuePinInReadIsClassifiedObjectActionAsObjectValueEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy()); + installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy()); + installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy()); + } + + /** + * @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 + */ + public void setParser(IParser parser) { + this.parser = parser; + } + + /** + * @generated + */ + protected EObject getParserElement() { + return resolveSemanticElement(); + } + + /** + * @generated + */ + protected Image getLabelIcon() { + return null; + } + + /** + * @generated + */ + protected String getLabelText() { + String text = null; + EObject parserElement = getParserElement(); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + } + if (text == null || text.length() == 0) { + text = defaultText; + } + return text; + } + + /** + * @generated + */ + public void setLabelText(String text) { + setLabelTextHelper(getFigure(), text); + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + /** + * @generated + */ + 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() { + + @Override + public String isValid(final Object value) { + if (value instanceof String) { + final EObject element = getParserElement(); + final IParser parser = getParser(); + try { + IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value)); + } + }); + return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); + } catch (InterruptedException ie) { + ie.printStackTrace(); + } + } + // shouldn't get here + return null; + } + }; + } + + /** + * @generated + */ + 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 = UMLParserProvider.getParser(UMLElementTypes.ValuePin_3155, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.ValuePinInReadIsClassifiedObjectActionAsObjectValueEditPart.VISUAL_ID)); + } + return parser; + } + + /** + * @generated + */ + protected DirectEditManager getManager() { + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + } + return manager; + } + + /** + * @generated + */ + protected void setManager(DirectEditManager manager) { + this.manager = manager; + } + + /** + * @generated + */ + protected void performDirectEdit() { + BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() { + + @Override + public void run() { + getManager().show(); + } + }); + } + + /** + * @generated + */ + protected void performDirectEdit(Point eventLocation) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); + } + } + + /** + * @generated + */ + private void performDirectEdit(char initialCharacter) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); + } else { + performDirectEdit(); + } + } + + /** + * @generated + */ + protected void performDirectEditRequest(Request request) { + final Request theRequest = request; + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + directEditionMode = getDirectEditionType(); + } + switch (directEditionMode) { + case IDirectEdition.NO_DIRECT_EDITION: + // no direct edition mode => does nothing + return; + case IDirectEdition.EXTENDED_DIRECT_EDITOR: + updateExtendedEditorConfiguration(); + if (configuration == null || configuration.getLanguage() == null) { + // Create default edit manager + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + performDefaultDirectEditorEdit(theRequest); + } else { + configuration.preEditAction(resolveSemanticElement()); + Dialog dialog = null; + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); + initializeDirectEditManager(theRequest); + return; + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this); + helper.showEditor(); + return; + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else { + return; + } + final Dialog finalDialog = dialog; + if (Window.OK == dialog.open()) { + TransactionalEditingDomain domain = getEditingDomain(); + RecordingCommand command = new RecordingCommand(domain, "Edit Label") { + + @Override + protected void doExecute() { + configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue()); + } + }; + domain.getCommandStack().execute(command); + } + } + break; + case IDirectEdition.DEFAULT_DIRECT_EDITOR: + initializeDirectEditManager(theRequest); + break; + default: + break; + } + } + + /** + * @generated + */ + protected void initializeDirectEditManager(final Request request) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + if (isActive() && isEditable()) { + if (request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * @generated + */ + protected void refreshVisuals() { + super.refreshVisuals(); + refreshLabel(); + refreshFont(); + refreshFontColor(); + refreshUnderline(); + refreshStrikeThrough(); + } + + /** + * @generated + */ + protected void refreshLabel() { + EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); + if (maskLabelPolicy == null) { + maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); + } + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { + setLabelTextHelper(getFigure(), getLabelText()); + setLabelIconHelper(getFigure(), getLabelIcon()); + } else { + setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$ + setLabelIconHelper(getFigure(), null); + } + } + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + /** + * @generated + */ + protected void refreshUnderline() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); + } + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); + } else { + ((WrappingLabel) getFigure()).setTextUnderline(false); + } + } + } + + /** + * @generated + */ + protected void refreshStrikeThrough() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + } + } + + /** + * @generated + */ + 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() { + + @Override + public void getName(AccessibleEvent e) { + e.result = getLabelTextHelper(getFigure()); + } + }; + } + return accessibleEP; + } + + /** + * @generated + */ + private View getFontStyleOwnerView() { + return getPrimaryView(); + } + + /** + * Returns the kind of associated editor for direct edition. + * + * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition + * @generated + */ + public int getDirectEditionType() { + if (checkExtendedEditor()) { + initExtendedEditorConfiguration(); + return IDirectEdition.EXTENDED_DIRECT_EDITOR; + } + if (checkDefaultEdition()) { + return IDirectEdition.DEFAULT_DIRECT_EDITOR; + } + // not a named element. no specific editor => do nothing + return IDirectEdition.NO_DIRECT_EDITION; + } + + /** + * Checks if an extended editor is present. + * + * @return <code>true</code> if an extended editor is present. + * @generated + */ + protected boolean checkExtendedEditor() { + if (resolveSemanticElement() != null) { + return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName()); + } + return false; + } + + /** + * Checks if a default direct edition is available + * + * @return <code>true</code> if a default direct edition is available + * @generated + */ + protected boolean checkDefaultEdition() { + return (getParser() != null); + } + + /** + * Initializes the extended editor configuration + * + * @generated + */ + protected void initExtendedEditorConfiguration() { + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); + } + } + } + + /** + * Updates the preference configuration + * + * @generated + */ + protected void updateExtendedEditorConfiguration() { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + configuration = null; + } + } + + /** + * Performs the direct edit usually used by GMF editors. + * + * @param theRequest + * the direct edit request that starts the direct edit system + * @generated + */ + protected void performDefaultDirectEditorEdit(final Request theRequest) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + if (isActive() && isEditable()) { + if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; + performDirectEdit(editRequest.getLocation()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * @generated + */ + 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 SimpleLabel(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInReclassifyObjectActionAsObjectAppliedStereotypeLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInReclassifyObjectActionAsObjectAppliedStereotypeLabelEditPart.java new file mode 100644 index 00000000000..2ec0147fe19 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInReclassifyObjectActionAsObjectAppliedStereotypeLabelEditPart.java @@ -0,0 +1,789 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.parts; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.Label; +import org.eclipse.draw2d.geometry.Point; +import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.transaction.RecordingCommand; +import org.eclipse.emf.transaction.RunnableWithResult; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gef.AccessibleEditPart; +import org.eclipse.gef.EditPolicy; +import org.eclipse.gef.Request; +import org.eclipse.gef.requests.DirectEditRequest; +import org.eclipse.gef.tools.DirectEditManager; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; +import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; +import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; +import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; +import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; +import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; +import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; +import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; +import org.eclipse.gmf.runtime.notation.FontStyle; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.text.contentassist.IContentAssistProcessor; +import org.eclipse.jface.viewers.ICellEditorValidator; +import org.eclipse.jface.window.Window; +import org.eclipse.papyrus.extensionpoints.editors.Activator; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper; +import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil; +import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLParserProvider; +import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; +import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractLabelEditPart; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.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; +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.custom.BusyIndicator; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.PlatformUI; +import org.eclipse.uml2.uml.Feature; + +/** + * @generated + */ +public class ValuePinInReclassifyObjectActionAsObjectAppliedStereotypeLabelEditPart extends AbstractLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 5304; + + /** + * @generated + */ + private DirectEditManager manager; + + /** + * @generated + */ + private IParser parser; + + /** + * @generated + */ + private List<?> parserElements; + + /** + * @generated + */ + private String defaultText; + + /** + * direct edition mode (default, undefined, registered editor, etc.) + * + * @generated + */ + protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR; + + /** + * configuration from a registered edit dialog + * + * @generated + */ + protected IDirectEditorConfiguration configuration; + /** + * @generated + */ + static { + registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.ValuePinInReclassifyObjectActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public ValuePinInReclassifyObjectActionAsObjectAppliedStereotypeLabelEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy()); + installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy()); + installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeExternalNodeEditPolicy()); + installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy()); + } + + /** + * @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 + */ + public void setParser(IParser parser) { + this.parser = parser; + } + + /** + * @generated + */ + protected EObject getParserElement() { + return resolveSemanticElement(); + } + + /** + * @generated + */ + protected Image getLabelIcon() { + return null; + } + + /** + * @generated + */ + protected String getLabelText() { + String text = null; + EObject parserElement = getParserElement(); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + } + if (text == null || text.length() == 0) { + text = defaultText; + } + return text; + } + + /** + * @generated + */ + public void setLabelText(String text) { + setLabelTextHelper(getFigure(), text); + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + /** + * @generated + */ + 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() { + + @Override + public String isValid(final Object value) { + if (value instanceof String) { + final EObject element = getParserElement(); + final IParser parser = getParser(); + try { + IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value)); + } + }); + return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); + } catch (InterruptedException ie) { + ie.printStackTrace(); + } + } + // shouldn't get here + return null; + } + }; + } + + /** + * @generated + */ + 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 = UMLParserProvider.getParser(UMLElementTypes.ValuePin_3154, getParserElement(), + UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.ValuePinInReclassifyObjectActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID)); + } + return parser; + } + + /** + * @generated + */ + protected DirectEditManager getManager() { + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + } + return manager; + } + + /** + * @generated + */ + protected void setManager(DirectEditManager manager) { + this.manager = manager; + } + + /** + * @generated + */ + protected void performDirectEdit() { + BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() { + + @Override + public void run() { + getManager().show(); + } + }); + } + + /** + * @generated + */ + protected void performDirectEdit(Point eventLocation) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); + } + } + + /** + * @generated + */ + private void performDirectEdit(char initialCharacter) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); + } else { + performDirectEdit(); + } + } + + /** + * @generated + */ + protected void performDirectEditRequest(Request request) { + final Request theRequest = request; + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + directEditionMode = getDirectEditionType(); + } + switch (directEditionMode) { + case IDirectEdition.NO_DIRECT_EDITION: + // no direct edition mode => does nothing + return; + case IDirectEdition.EXTENDED_DIRECT_EDITOR: + updateExtendedEditorConfiguration(); + if (configuration == null || configuration.getLanguage() == null) { + // Create default edit manager + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + performDefaultDirectEditorEdit(theRequest); + } else { + configuration.preEditAction(resolveSemanticElement()); + Dialog dialog = null; + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); + initializeDirectEditManager(theRequest); + return; + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this); + helper.showEditor(); + return; + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else { + return; + } + final Dialog finalDialog = dialog; + if (Window.OK == dialog.open()) { + TransactionalEditingDomain domain = getEditingDomain(); + RecordingCommand command = new RecordingCommand(domain, "Edit Label") { + + @Override + protected void doExecute() { + configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue()); + } + }; + domain.getCommandStack().execute(command); + } + } + break; + case IDirectEdition.DEFAULT_DIRECT_EDITOR: + initializeDirectEditManager(theRequest); + break; + default: + break; + } + } + + /** + * @generated + */ + protected void initializeDirectEditManager(final Request request) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + if (isActive() && isEditable()) { + if (request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * @generated + */ + protected void refreshVisuals() { + super.refreshVisuals(); + refreshLabel(); + refreshFont(); + refreshFontColor(); + refreshUnderline(); + refreshStrikeThrough(); + } + + /** + * @generated + */ + protected void refreshLabel() { + EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); + if (maskLabelPolicy == null) { + maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); + } + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { + setLabelTextHelper(getFigure(), getLabelText()); + setLabelIconHelper(getFigure(), getLabelIcon()); + } else { + setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$ + setLabelIconHelper(getFigure(), null); + } + } + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + /** + * @generated + */ + protected void refreshUnderline() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); + } + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); + } else { + ((WrappingLabel) getFigure()).setTextUnderline(false); + } + } + } + + /** + * @generated + */ + protected void refreshStrikeThrough() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + } + } + + /** + * @generated + */ + 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() { + + @Override + public void getName(AccessibleEvent e) { + e.result = getLabelTextHelper(getFigure()); + } + }; + } + return accessibleEP; + } + + /** + * @generated + */ + private View getFontStyleOwnerView() { + return getPrimaryView(); + } + + /** + * Returns the kind of associated editor for direct edition. + * + * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition + * @generated + */ + public int getDirectEditionType() { + if (checkExtendedEditor()) { + initExtendedEditorConfiguration(); + return IDirectEdition.EXTENDED_DIRECT_EDITOR; + } + if (checkDefaultEdition()) { + return IDirectEdition.DEFAULT_DIRECT_EDITOR; + } + // not a named element. no specific editor => do nothing + return IDirectEdition.NO_DIRECT_EDITION; + } + + /** + * Checks if an extended editor is present. + * + * @return <code>true</code> if an extended editor is present. + * @generated + */ + protected boolean checkExtendedEditor() { + if (resolveSemanticElement() != null) { + return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName()); + } + return false; + } + + /** + * Checks if a default direct edition is available + * + * @return <code>true</code> if a default direct edition is available + * @generated + */ + protected boolean checkDefaultEdition() { + return (getParser() != null); + } + + /** + * Initializes the extended editor configuration + * + * @generated + */ + protected void initExtendedEditorConfiguration() { + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); + } + } + } + + /** + * Updates the preference configuration + * + * @generated + */ + protected void updateExtendedEditorConfiguration() { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + configuration = null; + } + } + + /** + * Performs the direct edit usually used by GMF editors. + * + * @param theRequest + * the direct edit request that starts the direct edit system + * @generated + */ + protected void performDefaultDirectEditorEdit(final Request theRequest) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + if (isActive() && isEditable()) { + if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; + performDirectEdit(editRequest.getLocation()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * @generated + */ + 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 AppliedStereotypeWrappingLabelFigure(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInReclassifyObjectActionAsObjectEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInReclassifyObjectActionAsObjectEditPart.java new file mode 100644 index 00000000000..ca4a7afeb38 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInReclassifyObjectActionAsObjectEditPart.java @@ -0,0 +1,255 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.parts; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.StackLayout; +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.RequestConstants; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.editpolicies.LayoutEditPolicy; +import org.eclipse.gef.editpolicies.NonResizableEditPolicy; +import org.eclipse.gef.handles.MoveHandle; +import org.eclipse.gef.requests.CreateRequest; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; +import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; +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.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure; +import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure; +import org.eclipse.papyrus.uml.diagram.activity.edit.part.AbstractPinEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.NoDeleteFromDiagramEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.OpenDiagramEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.PinLayoutEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.ValuePinInReclassifyObjectActionAsObjectItemSemanticEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.figures.PinFigure; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator; +import org.eclipse.swt.graphics.Color; + +/** + * @generated + */ +public class ValuePinInReclassifyObjectActionAsObjectEditPart extends AbstractPinEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 3154; + + /** + * @generated + */ + protected IFigure contentPane; + + /** + * @generated + */ + protected IFigure primaryShape; + + /** + * @generated + */ + public ValuePinInReclassifyObjectActionAsObjectEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, getPrimaryDragEditPolicy()); + installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ValuePinInReclassifyObjectActionAsObjectItemSemanticEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); + installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, new PinLayoutEditPolicy()); + installEditPolicy(RequestConstants.REQ_DELETE, new NoDeleteFromDiagramEditPolicy()); + // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies + // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE); + } + + /** + * @generated + */ + protected LayoutEditPolicy createLayoutEditPolicy() { + org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() { + + @Override + protected EditPolicy createChildEditPolicy(EditPart child) { + View childView = (View) child.getModel(); + switch (UMLVisualIDRegistry.getVisualID(childView)) { + case ValuePinInReclassifyObjectActionAsObjectLabelEditPart.VISUAL_ID: + case ValuePinInReclassifyObjectActionAsObjectValueEditPart.VISUAL_ID: + case ValuePinInReclassifyObjectActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID: + return new BorderItemSelectionEditPolicy() { + + @Override + protected List<?> createSelectionHandles() { + MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost()); + mh.setBorder(null); + return Collections.singletonList(mh); + } + }; + } + EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (result == null) { + result = new NonResizableEditPolicy(); + } + return result; + } + + @Override + protected Command getMoveChildrenCommand(Request request) { + return null; + } + + @Override + protected Command getCreateCommand(CreateRequest request) { + return null; + } + }; + return lep; + } + + /** + * Papyrus codeGen + * + * @generated + **/ + protected void handleNotificationEvent(Notification event) { + /* + * when a node have external node labels, the methods refreshChildren() remove the EditPart corresponding to the Label from the EditPart + * Registry. After that, we can't reset the visibility to true (using the Show/Hide Label Action)! + */ + if (NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) { + Object notifier = event.getNotifier(); + List<?> modelChildren = ((View) getModel()).getChildren(); + if (!(notifier instanceof Edge)) { + if (modelChildren.contains(event.getNotifier())) { + return; + } + } + } + super.handleNotificationEvent(event); + } + + /** + * @generated + */ + protected IFigure createNodeShape() { + return primaryShape = new PinFigure(); + } + + /** + * org.eclipse.papyrus.uml.diagram.activity.figures.PinFigure + * + * @generated + */ + public PinFigure getPrimaryShape() { + return (PinFigure) primaryShape; + } + + /** + * @generated + */ + protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) { + if (borderItemEditPart instanceof ValuePinInReclassifyObjectActionAsObjectLabelEditPart) { + IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure()); + borderItemContainer.add(borderItemEditPart.getFigure(), locator); + } else if (borderItemEditPart instanceof ValuePinInReclassifyObjectActionAsObjectValueEditPart) { + IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure()); + borderItemContainer.add(borderItemEditPart.getFigure(), locator); + } else if (borderItemEditPart instanceof ValuePinInReclassifyObjectActionAsObjectAppliedStereotypeLabelEditPart) { + IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure()); + borderItemContainer.add(borderItemEditPart.getFigure(), locator); + } else { + super.addBorderItem(borderItemContainer, borderItemEditPart); + } + } + + protected NodeFigure createNodePlate() { + RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(16, 16); + 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) { + super.setLineWidth(width); + } + + /** + * @generated + */ + protected void setLineType(int style) { + if (primaryShape instanceof IPapyrusNodeFigure) { + ((IPapyrusNodeFigure) primaryShape).setLineStyle(style); + } + } + + /** + * @generated + */ + public EditPart getPrimaryChildEditPart() { + return getChildBySemanticHint(UMLVisualIDRegistry.getType(ValuePinInReclassifyObjectActionAsObjectLabelEditPart.VISUAL_ID)); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInReclassifyObjectActionAsObjectLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInReclassifyObjectActionAsObjectLabelEditPart.java new file mode 100644 index 00000000000..dc89d56cbcd --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInReclassifyObjectActionAsObjectLabelEditPart.java @@ -0,0 +1,785 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.parts; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.Label; +import org.eclipse.draw2d.geometry.Point; +import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.transaction.RecordingCommand; +import org.eclipse.emf.transaction.RunnableWithResult; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gef.AccessibleEditPart; +import org.eclipse.gef.EditPolicy; +import org.eclipse.gef.Request; +import org.eclipse.gef.requests.DirectEditRequest; +import org.eclipse.gef.tools.DirectEditManager; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; +import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; +import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; +import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; +import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; +import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; +import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; +import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; +import org.eclipse.gmf.runtime.notation.FontStyle; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.text.contentassist.IContentAssistProcessor; +import org.eclipse.jface.viewers.ICellEditorValidator; +import org.eclipse.jface.window.Window; +import org.eclipse.papyrus.extensionpoints.editors.Activator; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper; +import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil; +import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds; +import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.figures.SimpleLabel; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLParserProvider; +import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; +import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; +import org.eclipse.swt.SWT; +import org.eclipse.swt.accessibility.AccessibleEvent; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.PlatformUI; +import org.eclipse.uml2.uml.Feature; + +/** + * @generated + */ +public class ValuePinInReclassifyObjectActionAsObjectLabelEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 5302; + + /** + * @generated + */ + private DirectEditManager manager; + + /** + * @generated + */ + private IParser parser; + + /** + * @generated + */ + private List<?> parserElements; + + /** + * @generated + */ + private String defaultText; + + /** + * direct edition mode (default, undefined, registered editor, etc.) + * + * @generated + */ + protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR; + + /** + * configuration from a registered edit dialog + * + * @generated + */ + protected IDirectEditorConfiguration configuration; + /** + * @generated + */ + static { + registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.ValuePinInReclassifyObjectActionAsObjectLabelEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public ValuePinInReclassifyObjectActionAsObjectLabelEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy()); + installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy()); + installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy()); + } + + /** + * @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 + */ + public void setParser(IParser parser) { + this.parser = parser; + } + + /** + * @generated + */ + protected EObject getParserElement() { + return resolveSemanticElement(); + } + + /** + * @generated + */ + protected Image getLabelIcon() { + return null; + } + + /** + * @generated + */ + protected String getLabelText() { + String text = null; + EObject parserElement = getParserElement(); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + } + if (text == null || text.length() == 0) { + text = defaultText; + } + return text; + } + + /** + * @generated + */ + public void setLabelText(String text) { + setLabelTextHelper(getFigure(), text); + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + /** + * @generated + */ + 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() { + + @Override + public String isValid(final Object value) { + if (value instanceof String) { + final EObject element = getParserElement(); + final IParser parser = getParser(); + try { + IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value)); + } + }); + return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); + } catch (InterruptedException ie) { + ie.printStackTrace(); + } + } + // shouldn't get here + return null; + } + }; + } + + /** + * @generated + */ + 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 = UMLParserProvider.getParser(UMLElementTypes.ValuePin_3154, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.ValuePinInReclassifyObjectActionAsObjectLabelEditPart.VISUAL_ID)); + } + return parser; + } + + /** + * @generated + */ + protected DirectEditManager getManager() { + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + } + return manager; + } + + /** + * @generated + */ + protected void setManager(DirectEditManager manager) { + this.manager = manager; + } + + /** + * @generated + */ + protected void performDirectEdit() { + BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() { + + @Override + public void run() { + getManager().show(); + } + }); + } + + /** + * @generated + */ + protected void performDirectEdit(Point eventLocation) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); + } + } + + /** + * @generated + */ + private void performDirectEdit(char initialCharacter) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); + } else { + performDirectEdit(); + } + } + + /** + * @generated + */ + protected void performDirectEditRequest(Request request) { + final Request theRequest = request; + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + directEditionMode = getDirectEditionType(); + } + switch (directEditionMode) { + case IDirectEdition.NO_DIRECT_EDITION: + // no direct edition mode => does nothing + return; + case IDirectEdition.EXTENDED_DIRECT_EDITOR: + updateExtendedEditorConfiguration(); + if (configuration == null || configuration.getLanguage() == null) { + // Create default edit manager + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + performDefaultDirectEditorEdit(theRequest); + } else { + configuration.preEditAction(resolveSemanticElement()); + Dialog dialog = null; + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); + initializeDirectEditManager(theRequest); + return; + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this); + helper.showEditor(); + return; + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else { + return; + } + final Dialog finalDialog = dialog; + if (Window.OK == dialog.open()) { + TransactionalEditingDomain domain = getEditingDomain(); + RecordingCommand command = new RecordingCommand(domain, "Edit Label") { + + @Override + protected void doExecute() { + configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue()); + } + }; + domain.getCommandStack().execute(command); + } + } + break; + case IDirectEdition.DEFAULT_DIRECT_EDITOR: + initializeDirectEditManager(theRequest); + break; + default: + break; + } + } + + /** + * @generated + */ + protected void initializeDirectEditManager(final Request request) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + if (isActive() && isEditable()) { + if (request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * @generated + */ + protected void refreshVisuals() { + super.refreshVisuals(); + refreshLabel(); + refreshFont(); + refreshFontColor(); + refreshUnderline(); + refreshStrikeThrough(); + } + + /** + * @generated + */ + protected void refreshLabel() { + EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); + if (maskLabelPolicy == null) { + maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); + } + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { + setLabelTextHelper(getFigure(), getLabelText()); + setLabelIconHelper(getFigure(), getLabelIcon()); + } else { + setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$ + setLabelIconHelper(getFigure(), null); + } + } + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + /** + * @generated + */ + protected void refreshUnderline() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); + } + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); + } else { + ((WrappingLabel) getFigure()).setTextUnderline(false); + } + } + } + + /** + * @generated + */ + protected void refreshStrikeThrough() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + } + } + + /** + * @generated + */ + 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() { + + @Override + public void getName(AccessibleEvent e) { + e.result = getLabelTextHelper(getFigure()); + } + }; + } + return accessibleEP; + } + + /** + * @generated + */ + private View getFontStyleOwnerView() { + return getPrimaryView(); + } + + /** + * Returns the kind of associated editor for direct edition. + * + * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition + * @generated + */ + public int getDirectEditionType() { + if (checkExtendedEditor()) { + initExtendedEditorConfiguration(); + return IDirectEdition.EXTENDED_DIRECT_EDITOR; + } + if (checkDefaultEdition()) { + return IDirectEdition.DEFAULT_DIRECT_EDITOR; + } + // not a named element. no specific editor => do nothing + return IDirectEdition.NO_DIRECT_EDITION; + } + + /** + * Checks if an extended editor is present. + * + * @return <code>true</code> if an extended editor is present. + * @generated + */ + protected boolean checkExtendedEditor() { + if (resolveSemanticElement() != null) { + return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName()); + } + return false; + } + + /** + * Checks if a default direct edition is available + * + * @return <code>true</code> if a default direct edition is available + * @generated + */ + protected boolean checkDefaultEdition() { + return (getParser() != null); + } + + /** + * Initializes the extended editor configuration + * + * @generated + */ + protected void initExtendedEditorConfiguration() { + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); + } + } + } + + /** + * Updates the preference configuration + * + * @generated + */ + protected void updateExtendedEditorConfiguration() { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + configuration = null; + } + } + + /** + * Performs the direct edit usually used by GMF editors. + * + * @param theRequest + * the direct edit request that starts the direct edit system + * @generated + */ + protected void performDefaultDirectEditorEdit(final Request theRequest) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + if (isActive() && isEditable()) { + if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; + performDirectEdit(editRequest.getLocation()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * @generated + */ + 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 SimpleLabel(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInReclassifyObjectActionAsObjectValueEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInReclassifyObjectActionAsObjectValueEditPart.java new file mode 100644 index 00000000000..0459554e6ec --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInReclassifyObjectActionAsObjectValueEditPart.java @@ -0,0 +1,785 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.parts; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.Label; +import org.eclipse.draw2d.geometry.Point; +import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.transaction.RecordingCommand; +import org.eclipse.emf.transaction.RunnableWithResult; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gef.AccessibleEditPart; +import org.eclipse.gef.EditPolicy; +import org.eclipse.gef.Request; +import org.eclipse.gef.requests.DirectEditRequest; +import org.eclipse.gef.tools.DirectEditManager; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; +import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; +import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; +import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; +import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; +import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; +import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; +import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; +import org.eclipse.gmf.runtime.notation.FontStyle; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.text.contentassist.IContentAssistProcessor; +import org.eclipse.jface.viewers.ICellEditorValidator; +import org.eclipse.jface.window.Window; +import org.eclipse.papyrus.extensionpoints.editors.Activator; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper; +import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil; +import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds; +import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.figures.SimpleLabel; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLParserProvider; +import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; +import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; +import org.eclipse.swt.SWT; +import org.eclipse.swt.accessibility.AccessibleEvent; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.PlatformUI; +import org.eclipse.uml2.uml.Feature; + +/** + * @generated + */ +public class ValuePinInReclassifyObjectActionAsObjectValueEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 5303; + + /** + * @generated + */ + private DirectEditManager manager; + + /** + * @generated + */ + private IParser parser; + + /** + * @generated + */ + private List<?> parserElements; + + /** + * @generated + */ + private String defaultText; + + /** + * direct edition mode (default, undefined, registered editor, etc.) + * + * @generated + */ + protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR; + + /** + * configuration from a registered edit dialog + * + * @generated + */ + protected IDirectEditorConfiguration configuration; + /** + * @generated + */ + static { + registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.ValuePinInReclassifyObjectActionAsObjectValueEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public ValuePinInReclassifyObjectActionAsObjectValueEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy()); + installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy()); + installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy()); + } + + /** + * @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 + */ + public void setParser(IParser parser) { + this.parser = parser; + } + + /** + * @generated + */ + protected EObject getParserElement() { + return resolveSemanticElement(); + } + + /** + * @generated + */ + protected Image getLabelIcon() { + return null; + } + + /** + * @generated + */ + protected String getLabelText() { + String text = null; + EObject parserElement = getParserElement(); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue()); + } + if (text == null || text.length() == 0) { + text = defaultText; + } + return text; + } + + /** + * @generated + */ + public void setLabelText(String text) { + setLabelTextHelper(getFigure(), text); + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + /** + * @generated + */ + 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() { + + @Override + public String isValid(final Object value) { + if (value instanceof String) { + final EObject element = getParserElement(); + final IParser parser = getParser(); + try { + IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value)); + } + }); + return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); + } catch (InterruptedException ie) { + ie.printStackTrace(); + } + } + // shouldn't get here + return null; + } + }; + } + + /** + * @generated + */ + 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 = UMLParserProvider.getParser(UMLElementTypes.ValuePin_3154, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.ValuePinInReclassifyObjectActionAsObjectValueEditPart.VISUAL_ID)); + } + return parser; + } + + /** + * @generated + */ + protected DirectEditManager getManager() { + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + } + return manager; + } + + /** + * @generated + */ + protected void setManager(DirectEditManager manager) { + this.manager = manager; + } + + /** + * @generated + */ + protected void performDirectEdit() { + BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() { + + @Override + public void run() { + getManager().show(); + } + }); + } + + /** + * @generated + */ + protected void performDirectEdit(Point eventLocation) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); + } + } + + /** + * @generated + */ + private void performDirectEdit(char initialCharacter) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); + } else { + performDirectEdit(); + } + } + + /** + * @generated + */ + protected void performDirectEditRequest(Request request) { + final Request theRequest = request; + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + directEditionMode = getDirectEditionType(); + } + switch (directEditionMode) { + case IDirectEdition.NO_DIRECT_EDITION: + // no direct edition mode => does nothing + return; + case IDirectEdition.EXTENDED_DIRECT_EDITOR: + updateExtendedEditorConfiguration(); + if (configuration == null || configuration.getLanguage() == null) { + // Create default edit manager + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); + performDefaultDirectEditorEdit(theRequest); + } else { + configuration.preEditAction(resolveSemanticElement()); + Dialog dialog = null; + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); + initializeDirectEditManager(theRequest); + return; + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this); + helper.showEditor(); + return; + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else { + return; + } + final Dialog finalDialog = dialog; + if (Window.OK == dialog.open()) { + TransactionalEditingDomain domain = getEditingDomain(); + RecordingCommand command = new RecordingCommand(domain, "Edit Label") { + + @Override + protected void doExecute() { + configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue()); + } + }; + domain.getCommandStack().execute(command); + } + } + break; + case IDirectEdition.DEFAULT_DIRECT_EDITOR: + initializeDirectEditManager(theRequest); + break; + default: + break; + } + } + + /** + * @generated + */ + protected void initializeDirectEditManager(final Request request) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + if (isActive() && isEditable()) { + if (request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * @generated + */ + protected void refreshVisuals() { + super.refreshVisuals(); + refreshLabel(); + refreshFont(); + refreshFontColor(); + refreshUnderline(); + refreshStrikeThrough(); + } + + /** + * @generated + */ + protected void refreshLabel() { + EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); + if (maskLabelPolicy == null) { + maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); + } + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { + setLabelTextHelper(getFigure(), getLabelText()); + setLabelIconHelper(getFigure(), getLabelIcon()); + } else { + setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$ + setLabelIconHelper(getFigure(), null); + } + } + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + /** + * @generated + */ + protected void refreshUnderline() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); + } + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); + } else { + ((WrappingLabel) getFigure()).setTextUnderline(false); + } + } + } + + /** + * @generated + */ + protected void refreshStrikeThrough() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + } + } + + /** + * @generated + */ + 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() { + + @Override + public void getName(AccessibleEvent e) { + e.result = getLabelTextHelper(getFigure()); + } + }; + } + return accessibleEP; + } + + /** + * @generated + */ + private View getFontStyleOwnerView() { + return getPrimaryView(); + } + + /** + * Returns the kind of associated editor for direct edition. + * + * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition + * @generated + */ + public int getDirectEditionType() { + if (checkExtendedEditor()) { + initExtendedEditorConfiguration(); + return IDirectEdition.EXTENDED_DIRECT_EDITOR; + } + if (checkDefaultEdition()) { + return IDirectEdition.DEFAULT_DIRECT_EDITOR; + } + // not a named element. no specific editor => do nothing + return IDirectEdition.NO_DIRECT_EDITION; + } + + /** + * Checks if an extended editor is present. + * + * @return <code>true</code> if an extended editor is present. + * @generated + */ + protected boolean checkExtendedEditor() { + if (resolveSemanticElement() != null) { + return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName()); + } + return false; + } + + /** + * Checks if a default direct edition is available + * + * @return <code>true</code> if a default direct edition is available + * @generated + */ + protected boolean checkDefaultEdition() { + return (getParser() != null); + } + + /** + * Initializes the extended editor configuration + * + * @generated + */ + protected void initExtendedEditorConfiguration() { + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); + } + } + } + + /** + * Updates the preference configuration + * + * @generated + */ + protected void updateExtendedEditorConfiguration() { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + configuration = null; + } + } + + /** + * Performs the direct edit usually used by GMF editors. + * + * @param theRequest + * the direct edit request that starts the direct edit system + * @generated + */ + protected void performDefaultDirectEditorEdit(final Request theRequest) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + if (isActive() && isEditable()) { + if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; + performDirectEdit(editRequest.getLocation()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * @generated + */ + 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 SimpleLabel(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActionPinInReadIsClassifiedObjectActionAsObjectItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActionPinInReadIsClassifiedObjectActionAsObjectItemSemanticEditPolicy.java new file mode 100644 index 00000000000..5c0d85a2bce --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActionPinInReadIsClassifiedObjectActionAsObjectItemSemanticEditPolicy.java @@ -0,0 +1,192 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.policies; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.commands.UnexecutableCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; +import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType; +import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils; +import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; +import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.CommentLinkCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.CommentLinkReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ConstraintConstrainedElementCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ConstraintConstrainedElementReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ControlFlowCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ControlFlowReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ExceptionHandlerCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ExceptionHandlerReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ObjectFlowCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ObjectFlowReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.CommentLinkEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ConstraintConstrainedElementEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ControlFlowEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ExceptionHandlerEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ObjectFlowEditPart; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; + +/** + * @generated + */ +public class ActionPinInReadIsClassifiedObjectActionAsObjectItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { + + /** + * @generated + */ + public ActionPinInReadIsClassifiedObjectActionAsObjectItemSemanticEditPolicy() { + super(UMLElementTypes.ActionInputPin_3168); + } + + /** + * @generated + */ + protected Command getDestroyElementCommand(DestroyElementRequest req) { + EObject selectedEObject = req.getElementToDestroy(); + IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject); + if (provider != null) { + // Retrieve delete command from the Element Edit service + ICommand deleteCommand = provider.getEditCommand(req); + if (deleteCommand != null) { + return new ICommandProxy(deleteCommand); + } + } + return UnexecutableCommand.INSTANCE; + } + + /** + * @generated + */ + protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) { + IElementType requestElementType = req.getElementType(); + if (requestElementType == null) { + return null; + } + IElementType baseElementType = requestElementType; + boolean isExtendedType = false; + if (requestElementType instanceof IExtendedHintedElementType) { + baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType); + if (baseElementType != null) { + isExtendedType = true; + } else { + // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs. + baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType); + isExtendedType = true; + } + } + if (UMLElementTypes.ObjectFlow_4003 == baseElementType) { + if (isExtendedType) { + return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ObjectFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ControlFlow_4004 == baseElementType) { + if (isExtendedType) { + return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ControlFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ExceptionHandler_4005 == baseElementType) { + return null; + } + if (UMLElementTypes.CommentAnnotatedElement_4006 == baseElementType) { + return null; + } + if (UMLElementTypes.ConstraintConstrainedElement_4007 == baseElementType) { + return null; + } + return null; + } + + /** + * @generated + */ + protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) { + IElementType requestElementType = req.getElementType(); + if (requestElementType == null) { + return null; + } + IElementType baseElementType = requestElementType; + boolean isExtendedType = false; + if (requestElementType instanceof IExtendedHintedElementType) { + baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType); + if (baseElementType != null) { + isExtendedType = true; + } else { + // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs. + baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType); + isExtendedType = true; + } + } + if (UMLElementTypes.ObjectFlow_4003 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ObjectFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ControlFlow_4004 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ControlFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ExceptionHandler_4005 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ExceptionHandlerCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.CommentAnnotatedElement_4006 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new CommentLinkCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ConstraintConstrainedElement_4007 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(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 ObjectFlowEditPart.VISUAL_ID: + return getGEFWrapper(new ObjectFlowReorientCommand(req)); + case ControlFlowEditPart.VISUAL_ID: + return getGEFWrapper(new ControlFlowReorientCommand(req)); + case ExceptionHandlerEditPart.VISUAL_ID: + return getGEFWrapper(new ExceptionHandlerReorientCommand(req)); + } + return super.getReorientRelationshipCommand(req); + } + + /** + * Returns command to reorient EReference based link. New link target or source + * should be the domain model element associated with this node. + * + * @generated + */ + protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) { + switch (getVisualID(req)) { + case CommentLinkEditPart.VISUAL_ID: + return getGEFWrapper(new CommentLinkReorientCommand(req)); + case ConstraintConstrainedElementEditPart.VISUAL_ID: + return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req)); + } + return super.getReorientReferenceRelationshipCommand(req); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActionPinInReclassifyObjectActionAsObjectItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActionPinInReclassifyObjectActionAsObjectItemSemanticEditPolicy.java new file mode 100644 index 00000000000..e9e867ab542 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActionPinInReclassifyObjectActionAsObjectItemSemanticEditPolicy.java @@ -0,0 +1,192 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.policies; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.commands.UnexecutableCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; +import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType; +import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils; +import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; +import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.CommentLinkCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.CommentLinkReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ConstraintConstrainedElementCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ConstraintConstrainedElementReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ControlFlowCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ControlFlowReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ExceptionHandlerCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ExceptionHandlerReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ObjectFlowCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ObjectFlowReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.CommentLinkEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ConstraintConstrainedElementEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ControlFlowEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ExceptionHandlerEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ObjectFlowEditPart; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; + +/** + * @generated + */ +public class ActionPinInReclassifyObjectActionAsObjectItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { + + /** + * @generated + */ + public ActionPinInReclassifyObjectActionAsObjectItemSemanticEditPolicy() { + super(UMLElementTypes.ActionInputPin_3167); + } + + /** + * @generated + */ + protected Command getDestroyElementCommand(DestroyElementRequest req) { + EObject selectedEObject = req.getElementToDestroy(); + IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject); + if (provider != null) { + // Retrieve delete command from the Element Edit service + ICommand deleteCommand = provider.getEditCommand(req); + if (deleteCommand != null) { + return new ICommandProxy(deleteCommand); + } + } + return UnexecutableCommand.INSTANCE; + } + + /** + * @generated + */ + protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) { + IElementType requestElementType = req.getElementType(); + if (requestElementType == null) { + return null; + } + IElementType baseElementType = requestElementType; + boolean isExtendedType = false; + if (requestElementType instanceof IExtendedHintedElementType) { + baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType); + if (baseElementType != null) { + isExtendedType = true; + } else { + // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs. + baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType); + isExtendedType = true; + } + } + if (UMLElementTypes.ObjectFlow_4003 == baseElementType) { + if (isExtendedType) { + return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ObjectFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ControlFlow_4004 == baseElementType) { + if (isExtendedType) { + return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ControlFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ExceptionHandler_4005 == baseElementType) { + return null; + } + if (UMLElementTypes.CommentAnnotatedElement_4006 == baseElementType) { + return null; + } + if (UMLElementTypes.ConstraintConstrainedElement_4007 == baseElementType) { + return null; + } + return null; + } + + /** + * @generated + */ + protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) { + IElementType requestElementType = req.getElementType(); + if (requestElementType == null) { + return null; + } + IElementType baseElementType = requestElementType; + boolean isExtendedType = false; + if (requestElementType instanceof IExtendedHintedElementType) { + baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType); + if (baseElementType != null) { + isExtendedType = true; + } else { + // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs. + baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType); + isExtendedType = true; + } + } + if (UMLElementTypes.ObjectFlow_4003 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ObjectFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ControlFlow_4004 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ControlFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ExceptionHandler_4005 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ExceptionHandlerCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.CommentAnnotatedElement_4006 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new CommentLinkCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ConstraintConstrainedElement_4007 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(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 ObjectFlowEditPart.VISUAL_ID: + return getGEFWrapper(new ObjectFlowReorientCommand(req)); + case ControlFlowEditPart.VISUAL_ID: + return getGEFWrapper(new ControlFlowReorientCommand(req)); + case ExceptionHandlerEditPart.VISUAL_ID: + return getGEFWrapper(new ExceptionHandlerReorientCommand(req)); + } + return super.getReorientRelationshipCommand(req); + } + + /** + * Returns command to reorient EReference based link. New link target or source + * should be the domain model element associated with this node. + * + * @generated + */ + protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) { + switch (getVisualID(req)) { + case CommentLinkEditPart.VISUAL_ID: + return getGEFWrapper(new CommentLinkReorientCommand(req)); + case ConstraintConstrainedElementEditPart.VISUAL_ID: + return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req)); + } + return super.getReorientReferenceRelationshipCommand(req); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityActivityContentCompartmentCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityActivityContentCompartmentCanonicalEditPolicy.java index a30b5b05845..aedfc598783 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityActivityContentCompartmentCanonicalEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityActivityContentCompartmentCanonicalEditPolicy.java @@ -82,10 +82,12 @@ import org.eclipse.papyrus.uml.diagram.activity.edit.parts.LoopNodeEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.MergeNodeEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.OpaqueActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadExtentActionEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadIsClassifiedObjectActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadLinkActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadSelfActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadStructuralFeatureActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadVariableActionEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReclassifyObjectActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SendObjectActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SendSignalActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SequenceNodeEditPart; @@ -202,6 +204,8 @@ public class ActivityActivityContentCompartmentCanonicalEditPolicy extends Canon case DestroyLinkActionEditPart.VISUAL_ID: case ClearAssociationActionEditPart.VISUAL_ID: case ReadExtentActionEditPart.VISUAL_ID: + case ReclassifyObjectActionEditPart.VISUAL_ID: + case ReadIsClassifiedObjectActionEditPart.VISUAL_ID: return true; } return false; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityActivityContentCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityActivityContentCompartmentItemSemanticEditPolicy.java index 853de375a86..5d62656d781 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityActivityContentCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityActivityContentCompartmentItemSemanticEditPolicy.java @@ -341,6 +341,18 @@ public class ActivityActivityContentCompartmentItemSemanticEditPolicy extends UM req.setContainmentFeature(containmentFeature); return getGEFWrapper(getSemanticCreationCommand(req)); } + if (UMLElementTypes.ReclassifyObjectAction_3121 == requestElementType) { + // adjust the containment feature + EReference containmentFeature = UMLPackage.eINSTANCE.getActivity_OwnedNode(); + req.setContainmentFeature(containmentFeature); + return getGEFWrapper(getSemanticCreationCommand(req)); + } + if (UMLElementTypes.ReadIsClassifiedObjectAction_3122 == requestElementType) { + // adjust the containment feature + EReference containmentFeature = UMLPackage.eINSTANCE.getActivity_OwnedNode(); + req.setContainmentFeature(containmentFeature); + return getGEFWrapper(getSemanticCreationCommand(req)); + } return super.getCreateCommand(req); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityCNContentCompartmentCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityCNContentCompartmentCanonicalEditPolicy.java index 6c135b3ae22..0e3e46e8f37 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityCNContentCompartmentCanonicalEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityCNContentCompartmentCanonicalEditPolicy.java @@ -69,10 +69,12 @@ import org.eclipse.papyrus.uml.diagram.activity.edit.parts.LoopNodeEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.MergeNodeEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.OpaqueActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadExtentActionEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadIsClassifiedObjectActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadLinkActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadSelfActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadStructuralFeatureActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadVariableActionEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReclassifyObjectActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SendObjectActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SendSignalActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SequenceNodeEditPart; @@ -206,6 +208,8 @@ public class ActivityCNContentCompartmentCanonicalEditPolicy extends CanonicalEd case DestroyLinkActionEditPart.VISUAL_ID: case ClearAssociationActionEditPart.VISUAL_ID: case ReadExtentActionEditPart.VISUAL_ID: + case ReclassifyObjectActionEditPart.VISUAL_ID: + case ReadIsClassifiedObjectActionEditPart.VISUAL_ID: return true; } return false; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityCNContentCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityCNContentCompartmentItemSemanticEditPolicy.java index fc0dd192402..f7fd5a5295b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityCNContentCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityCNContentCompartmentItemSemanticEditPolicy.java @@ -328,6 +328,18 @@ public class ActivityCNContentCompartmentItemSemanticEditPolicy extends UMLBaseI req.setContainmentFeature(containmentFeature); return getGEFWrapper(getSemanticCreationCommand(req)); } + if (UMLElementTypes.ReclassifyObjectAction_3121 == requestElementType) { + // adjust the containment feature + EReference containmentFeature = UMLPackage.eINSTANCE.getActivity_OwnedNode(); + req.setContainmentFeature(containmentFeature); + return getGEFWrapper(getSemanticCreationCommand(req)); + } + if (UMLElementTypes.ReadIsClassifiedObjectAction_3122 == requestElementType) { + // adjust the containment feature + EReference containmentFeature = UMLPackage.eINSTANCE.getActivity_OwnedNode(); + req.setContainmentFeature(containmentFeature); + return getGEFWrapper(getSemanticCreationCommand(req)); + } return super.getCreateCommand(req); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityDiagramCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityDiagramCanonicalEditPolicy.java index 28cc054ec7d..5256f041ba5 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityDiagramCanonicalEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityDiagramCanonicalEditPolicy.java @@ -1223,6 +1223,69 @@ public class ActivityDiagramCanonicalEditPolicy extends CanonicalEditPolicy { domain2NotationMap.putView(view.getElement(), view); break; } + case ReclassifyObjectActionEditPart.VISUAL_ID: { + if (!domain2NotationMap.containsKey(view.getElement())) { + result.addAll(UMLDiagramUpdater.INSTANCE.getReclassifyObjectAction_3121ContainedLinks(view)); + } + domain2NotationMap.putView(view.getElement(), view); + break; + } + case InputPinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID: { + if (!domain2NotationMap.containsKey(view.getElement())) { + result.addAll(UMLDiagramUpdater.INSTANCE.getInputPin_3141ContainedLinks(view)); + } + domain2NotationMap.putView(view.getElement(), view); + break; + } + case ValuePinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID: { + if (!domain2NotationMap.containsKey(view.getElement())) { + result.addAll(UMLDiagramUpdater.INSTANCE.getValuePin_3154ContainedLinks(view)); + } + domain2NotationMap.putView(view.getElement(), view); + break; + } + case ActionPinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID: { + if (!domain2NotationMap.containsKey(view.getElement())) { + result.addAll(UMLDiagramUpdater.INSTANCE.getActionInputPin_3167ContainedLinks(view)); + } + domain2NotationMap.putView(view.getElement(), view); + break; + } + case ReadIsClassifiedObjectActionEditPart.VISUAL_ID: { + if (!domain2NotationMap.containsKey(view.getElement())) { + result.addAll(UMLDiagramUpdater.INSTANCE.getReadIsClassifiedObjectAction_3122ContainedLinks(view)); + } + domain2NotationMap.putView(view.getElement(), view); + break; + } + case OutputPinInReadIsClassifiedObjectActionEditPart.VISUAL_ID: { + if (!domain2NotationMap.containsKey(view.getElement())) { + result.addAll(UMLDiagramUpdater.INSTANCE.getOutputPin_3130ContainedLinks(view)); + } + domain2NotationMap.putView(view.getElement(), view); + break; + } + case InputPinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID: { + if (!domain2NotationMap.containsKey(view.getElement())) { + result.addAll(UMLDiagramUpdater.INSTANCE.getInputPin_3142ContainedLinks(view)); + } + domain2NotationMap.putView(view.getElement(), view); + break; + } + case ValuePinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID: { + if (!domain2NotationMap.containsKey(view.getElement())) { + result.addAll(UMLDiagramUpdater.INSTANCE.getValuePin_3155ContainedLinks(view)); + } + domain2NotationMap.putView(view.getElement(), view); + break; + } + case ActionPinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID: { + if (!domain2NotationMap.containsKey(view.getElement())) { + result.addAll(UMLDiagramUpdater.INSTANCE.getActionInputPin_3168ContainedLinks(view)); + } + domain2NotationMap.putView(view.getElement(), view); + break; + } case ObjectFlowEditPart.VISUAL_ID: { if (!domain2NotationMap.containsKey(view.getElement())) { result.addAll(UMLDiagramUpdater.INSTANCE.getObjectFlow_4003ContainedLinks(view)); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityPartitionActivityPartitionContentCompartmentCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityPartitionActivityPartitionContentCompartmentCanonicalEditPolicy.java index 6445779f290..45116c1838a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityPartitionActivityPartitionContentCompartmentCanonicalEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityPartitionActivityPartitionContentCompartmentCanonicalEditPolicy.java @@ -80,10 +80,12 @@ import org.eclipse.papyrus.uml.diagram.activity.edit.parts.LoopNodeEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.MergeNodeEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.OpaqueActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadExtentActionEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadIsClassifiedObjectActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadLinkActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadSelfActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadStructuralFeatureActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadVariableActionEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReclassifyObjectActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SendObjectActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SendSignalActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SequenceNodeEditPart; @@ -215,6 +217,8 @@ public class ActivityPartitionActivityPartitionContentCompartmentCanonicalEditPo case DestroyLinkActionEditPart.VISUAL_ID: case ClearAssociationActionEditPart.VISUAL_ID: case ReadExtentActionEditPart.VISUAL_ID: + case ReclassifyObjectActionEditPart.VISUAL_ID: + case ReadIsClassifiedObjectActionEditPart.VISUAL_ID: return true; } return false; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ExpansionRegionStructuredActivityNodeContentCompartmentCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ExpansionRegionStructuredActivityNodeContentCompartmentCanonicalEditPolicy.java index 297572f9e93..7a80a475655 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ExpansionRegionStructuredActivityNodeContentCompartmentCanonicalEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ExpansionRegionStructuredActivityNodeContentCompartmentCanonicalEditPolicy.java @@ -79,10 +79,12 @@ import org.eclipse.papyrus.uml.diagram.activity.edit.parts.LoopNodeEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.MergeNodeEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.OpaqueActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadExtentActionEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadIsClassifiedObjectActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadLinkActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadSelfActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadStructuralFeatureActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadVariableActionEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReclassifyObjectActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SendObjectActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SendSignalActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SequenceNodeEditPart; @@ -213,6 +215,8 @@ public class ExpansionRegionStructuredActivityNodeContentCompartmentCanonicalEdi case DestroyLinkActionEditPart.VISUAL_ID: case ClearAssociationActionEditPart.VISUAL_ID: case ReadExtentActionEditPart.VISUAL_ID: + case ReclassifyObjectActionEditPart.VISUAL_ID: + case ReadIsClassifiedObjectActionEditPart.VISUAL_ID: return true; } return false; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/InputPinInReadIsClassifiedObjectActionAsObjectItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/InputPinInReadIsClassifiedObjectActionAsObjectItemSemanticEditPolicy.java new file mode 100644 index 00000000000..8b2265534b7 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/InputPinInReadIsClassifiedObjectActionAsObjectItemSemanticEditPolicy.java @@ -0,0 +1,192 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.policies; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.commands.UnexecutableCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; +import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType; +import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils; +import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; +import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.CommentLinkCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.CommentLinkReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ConstraintConstrainedElementCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ConstraintConstrainedElementReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ControlFlowCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ControlFlowReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ExceptionHandlerCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ExceptionHandlerReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ObjectFlowCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ObjectFlowReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.CommentLinkEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ConstraintConstrainedElementEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ControlFlowEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ExceptionHandlerEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ObjectFlowEditPart; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; + +/** + * @generated + */ +public class InputPinInReadIsClassifiedObjectActionAsObjectItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { + + /** + * @generated + */ + public InputPinInReadIsClassifiedObjectActionAsObjectItemSemanticEditPolicy() { + super(UMLElementTypes.InputPin_3142); + } + + /** + * @generated + */ + protected Command getDestroyElementCommand(DestroyElementRequest req) { + EObject selectedEObject = req.getElementToDestroy(); + IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject); + if (provider != null) { + // Retrieve delete command from the Element Edit service + ICommand deleteCommand = provider.getEditCommand(req); + if (deleteCommand != null) { + return new ICommandProxy(deleteCommand); + } + } + return UnexecutableCommand.INSTANCE; + } + + /** + * @generated + */ + protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) { + IElementType requestElementType = req.getElementType(); + if (requestElementType == null) { + return null; + } + IElementType baseElementType = requestElementType; + boolean isExtendedType = false; + if (requestElementType instanceof IExtendedHintedElementType) { + baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType); + if (baseElementType != null) { + isExtendedType = true; + } else { + // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs. + baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType); + isExtendedType = true; + } + } + if (UMLElementTypes.ObjectFlow_4003 == baseElementType) { + if (isExtendedType) { + return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ObjectFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ControlFlow_4004 == baseElementType) { + if (isExtendedType) { + return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ControlFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ExceptionHandler_4005 == baseElementType) { + return null; + } + if (UMLElementTypes.CommentAnnotatedElement_4006 == baseElementType) { + return null; + } + if (UMLElementTypes.ConstraintConstrainedElement_4007 == baseElementType) { + return null; + } + return null; + } + + /** + * @generated + */ + protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) { + IElementType requestElementType = req.getElementType(); + if (requestElementType == null) { + return null; + } + IElementType baseElementType = requestElementType; + boolean isExtendedType = false; + if (requestElementType instanceof IExtendedHintedElementType) { + baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType); + if (baseElementType != null) { + isExtendedType = true; + } else { + // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs. + baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType); + isExtendedType = true; + } + } + if (UMLElementTypes.ObjectFlow_4003 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ObjectFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ControlFlow_4004 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ControlFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ExceptionHandler_4005 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ExceptionHandlerCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.CommentAnnotatedElement_4006 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new CommentLinkCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ConstraintConstrainedElement_4007 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(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 ObjectFlowEditPart.VISUAL_ID: + return getGEFWrapper(new ObjectFlowReorientCommand(req)); + case ControlFlowEditPart.VISUAL_ID: + return getGEFWrapper(new ControlFlowReorientCommand(req)); + case ExceptionHandlerEditPart.VISUAL_ID: + return getGEFWrapper(new ExceptionHandlerReorientCommand(req)); + } + return super.getReorientRelationshipCommand(req); + } + + /** + * Returns command to reorient EReference based link. New link target or source + * should be the domain model element associated with this node. + * + * @generated + */ + protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) { + switch (getVisualID(req)) { + case CommentLinkEditPart.VISUAL_ID: + return getGEFWrapper(new CommentLinkReorientCommand(req)); + case ConstraintConstrainedElementEditPart.VISUAL_ID: + return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req)); + } + return super.getReorientReferenceRelationshipCommand(req); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/InputPinInReclassifyObjectActionAsObjectItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/InputPinInReclassifyObjectActionAsObjectItemSemanticEditPolicy.java new file mode 100644 index 00000000000..30beb599158 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/InputPinInReclassifyObjectActionAsObjectItemSemanticEditPolicy.java @@ -0,0 +1,192 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.policies; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.commands.UnexecutableCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; +import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType; +import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils; +import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; +import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.CommentLinkCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.CommentLinkReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ConstraintConstrainedElementCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ConstraintConstrainedElementReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ControlFlowCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ControlFlowReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ExceptionHandlerCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ExceptionHandlerReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ObjectFlowCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ObjectFlowReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.CommentLinkEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ConstraintConstrainedElementEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ControlFlowEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ExceptionHandlerEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ObjectFlowEditPart; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; + +/** + * @generated + */ +public class InputPinInReclassifyObjectActionAsObjectItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { + + /** + * @generated + */ + public InputPinInReclassifyObjectActionAsObjectItemSemanticEditPolicy() { + super(UMLElementTypes.InputPin_3141); + } + + /** + * @generated + */ + protected Command getDestroyElementCommand(DestroyElementRequest req) { + EObject selectedEObject = req.getElementToDestroy(); + IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject); + if (provider != null) { + // Retrieve delete command from the Element Edit service + ICommand deleteCommand = provider.getEditCommand(req); + if (deleteCommand != null) { + return new ICommandProxy(deleteCommand); + } + } + return UnexecutableCommand.INSTANCE; + } + + /** + * @generated + */ + protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) { + IElementType requestElementType = req.getElementType(); + if (requestElementType == null) { + return null; + } + IElementType baseElementType = requestElementType; + boolean isExtendedType = false; + if (requestElementType instanceof IExtendedHintedElementType) { + baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType); + if (baseElementType != null) { + isExtendedType = true; + } else { + // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs. + baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType); + isExtendedType = true; + } + } + if (UMLElementTypes.ObjectFlow_4003 == baseElementType) { + if (isExtendedType) { + return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ObjectFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ControlFlow_4004 == baseElementType) { + if (isExtendedType) { + return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ControlFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ExceptionHandler_4005 == baseElementType) { + return null; + } + if (UMLElementTypes.CommentAnnotatedElement_4006 == baseElementType) { + return null; + } + if (UMLElementTypes.ConstraintConstrainedElement_4007 == baseElementType) { + return null; + } + return null; + } + + /** + * @generated + */ + protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) { + IElementType requestElementType = req.getElementType(); + if (requestElementType == null) { + return null; + } + IElementType baseElementType = requestElementType; + boolean isExtendedType = false; + if (requestElementType instanceof IExtendedHintedElementType) { + baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType); + if (baseElementType != null) { + isExtendedType = true; + } else { + // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs. + baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType); + isExtendedType = true; + } + } + if (UMLElementTypes.ObjectFlow_4003 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ObjectFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ControlFlow_4004 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ControlFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ExceptionHandler_4005 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ExceptionHandlerCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.CommentAnnotatedElement_4006 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new CommentLinkCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ConstraintConstrainedElement_4007 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(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 ObjectFlowEditPart.VISUAL_ID: + return getGEFWrapper(new ObjectFlowReorientCommand(req)); + case ControlFlowEditPart.VISUAL_ID: + return getGEFWrapper(new ControlFlowReorientCommand(req)); + case ExceptionHandlerEditPart.VISUAL_ID: + return getGEFWrapper(new ExceptionHandlerReorientCommand(req)); + } + return super.getReorientRelationshipCommand(req); + } + + /** + * Returns command to reorient EReference based link. New link target or source + * should be the domain model element associated with this node. + * + * @generated + */ + protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) { + switch (getVisualID(req)) { + case CommentLinkEditPart.VISUAL_ID: + return getGEFWrapper(new CommentLinkReorientCommand(req)); + case ConstraintConstrainedElementEditPart.VISUAL_ID: + return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req)); + } + return super.getReorientReferenceRelationshipCommand(req); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/InterruptibleActivityRegionInterruptibleActivityRegionContentCompartmentCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/InterruptibleActivityRegionInterruptibleActivityRegionContentCompartmentCanonicalEditPolicy.java index df9cfb487d1..00af8a239a6 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/InterruptibleActivityRegionInterruptibleActivityRegionContentCompartmentCanonicalEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/InterruptibleActivityRegionInterruptibleActivityRegionContentCompartmentCanonicalEditPolicy.java @@ -79,10 +79,12 @@ import org.eclipse.papyrus.uml.diagram.activity.edit.parts.LoopNodeEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.MergeNodeEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.OpaqueActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadExtentActionEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadIsClassifiedObjectActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadLinkActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadSelfActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadStructuralFeatureActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadVariableActionEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReclassifyObjectActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SendObjectActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SendSignalActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SequenceNodeEditPart; @@ -213,6 +215,8 @@ public class InterruptibleActivityRegionInterruptibleActivityRegionContentCompar case DestroyLinkActionEditPart.VISUAL_ID: case ClearAssociationActionEditPart.VISUAL_ID: case ReadExtentActionEditPart.VISUAL_ID: + case ReclassifyObjectActionEditPart.VISUAL_ID: + case ReadIsClassifiedObjectActionEditPart.VISUAL_ID: return true; } return false; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/InterruptibleActivityRegionInterruptibleActivityRegionContentCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/InterruptibleActivityRegionInterruptibleActivityRegionContentCompartmentItemSemanticEditPolicy.java index 4a0dc409efb..eea35845651 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/InterruptibleActivityRegionInterruptibleActivityRegionContentCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/InterruptibleActivityRegionInterruptibleActivityRegionContentCompartmentItemSemanticEditPolicy.java @@ -323,6 +323,18 @@ public class InterruptibleActivityRegionInterruptibleActivityRegionContentCompar req.setContainmentFeature(containmentFeature); return getGEFWrapper(getSemanticCreationCommand(req)); } + if (UMLElementTypes.ReclassifyObjectAction_3121 == requestElementType) { + // adjust the containment feature + EReference containmentFeature = UMLPackage.eINSTANCE.getActivity_OwnedNode(); + req.setContainmentFeature(containmentFeature); + return getGEFWrapper(getSemanticCreationCommand(req)); + } + if (UMLElementTypes.ReadIsClassifiedObjectAction_3122 == requestElementType) { + // adjust the containment feature + EReference containmentFeature = UMLPackage.eINSTANCE.getActivity_OwnedNode(); + req.setContainmentFeature(containmentFeature); + return getGEFWrapper(getSemanticCreationCommand(req)); + } return super.getCreateCommand(req); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/LoopNodeStructuredActivityNodeContentCompartmentCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/LoopNodeStructuredActivityNodeContentCompartmentCanonicalEditPolicy.java index 96086356e03..da302874dfe 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/LoopNodeStructuredActivityNodeContentCompartmentCanonicalEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/LoopNodeStructuredActivityNodeContentCompartmentCanonicalEditPolicy.java @@ -79,10 +79,12 @@ import org.eclipse.papyrus.uml.diagram.activity.edit.parts.LoopNodeEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.MergeNodeEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.OpaqueActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadExtentActionEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadIsClassifiedObjectActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadLinkActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadSelfActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadStructuralFeatureActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadVariableActionEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReclassifyObjectActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SendObjectActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SendSignalActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SequenceNodeEditPart; @@ -213,6 +215,8 @@ public class LoopNodeStructuredActivityNodeContentCompartmentCanonicalEditPolicy case DestroyLinkActionEditPart.VISUAL_ID: case ClearAssociationActionEditPart.VISUAL_ID: case ReadExtentActionEditPart.VISUAL_ID: + case ReclassifyObjectActionEditPart.VISUAL_ID: + case ReadIsClassifiedObjectActionEditPart.VISUAL_ID: return true; } return false; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/OutputPinInReadIsClassifiedObjectActionItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/OutputPinInReadIsClassifiedObjectActionItemSemanticEditPolicy.java new file mode 100644 index 00000000000..d8ae680d7e9 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/OutputPinInReadIsClassifiedObjectActionItemSemanticEditPolicy.java @@ -0,0 +1,192 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.policies; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.commands.UnexecutableCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; +import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType; +import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils; +import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; +import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.CommentLinkCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.CommentLinkReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ConstraintConstrainedElementCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ConstraintConstrainedElementReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ControlFlowCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ControlFlowReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ExceptionHandlerCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ExceptionHandlerReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ObjectFlowCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ObjectFlowReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.CommentLinkEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ConstraintConstrainedElementEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ControlFlowEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ExceptionHandlerEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ObjectFlowEditPart; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; + +/** + * @generated + */ +public class OutputPinInReadIsClassifiedObjectActionItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { + + /** + * @generated + */ + public OutputPinInReadIsClassifiedObjectActionItemSemanticEditPolicy() { + super(UMLElementTypes.OutputPin_3130); + } + + /** + * @generated + */ + protected Command getDestroyElementCommand(DestroyElementRequest req) { + EObject selectedEObject = req.getElementToDestroy(); + IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject); + if (provider != null) { + // Retrieve delete command from the Element Edit service + ICommand deleteCommand = provider.getEditCommand(req); + if (deleteCommand != null) { + return new ICommandProxy(deleteCommand); + } + } + return UnexecutableCommand.INSTANCE; + } + + /** + * @generated + */ + protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) { + IElementType requestElementType = req.getElementType(); + if (requestElementType == null) { + return null; + } + IElementType baseElementType = requestElementType; + boolean isExtendedType = false; + if (requestElementType instanceof IExtendedHintedElementType) { + baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType); + if (baseElementType != null) { + isExtendedType = true; + } else { + // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs. + baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType); + isExtendedType = true; + } + } + if (UMLElementTypes.ObjectFlow_4003 == baseElementType) { + if (isExtendedType) { + return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ObjectFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ControlFlow_4004 == baseElementType) { + if (isExtendedType) { + return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ControlFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ExceptionHandler_4005 == baseElementType) { + return null; + } + if (UMLElementTypes.CommentAnnotatedElement_4006 == baseElementType) { + return null; + } + if (UMLElementTypes.ConstraintConstrainedElement_4007 == baseElementType) { + return null; + } + return null; + } + + /** + * @generated + */ + protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) { + IElementType requestElementType = req.getElementType(); + if (requestElementType == null) { + return null; + } + IElementType baseElementType = requestElementType; + boolean isExtendedType = false; + if (requestElementType instanceof IExtendedHintedElementType) { + baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType); + if (baseElementType != null) { + isExtendedType = true; + } else { + // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs. + baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType); + isExtendedType = true; + } + } + if (UMLElementTypes.ObjectFlow_4003 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ObjectFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ControlFlow_4004 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ControlFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ExceptionHandler_4005 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ExceptionHandlerCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.CommentAnnotatedElement_4006 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new CommentLinkCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ConstraintConstrainedElement_4007 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(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 ObjectFlowEditPart.VISUAL_ID: + return getGEFWrapper(new ObjectFlowReorientCommand(req)); + case ControlFlowEditPart.VISUAL_ID: + return getGEFWrapper(new ControlFlowReorientCommand(req)); + case ExceptionHandlerEditPart.VISUAL_ID: + return getGEFWrapper(new ExceptionHandlerReorientCommand(req)); + } + return super.getReorientRelationshipCommand(req); + } + + /** + * Returns command to reorient EReference based link. New link target or source + * should be the domain model element associated with this node. + * + * @generated + */ + protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) { + switch (getVisualID(req)) { + case CommentLinkEditPart.VISUAL_ID: + return getGEFWrapper(new CommentLinkReorientCommand(req)); + case ConstraintConstrainedElementEditPart.VISUAL_ID: + return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req)); + } + return super.getReorientReferenceRelationshipCommand(req); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ReadIsClassifiedObjectActionCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ReadIsClassifiedObjectActionCanonicalEditPolicy.java new file mode 100644 index 00000000000..fb0152a7090 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ReadIsClassifiedObjectActionCanonicalEditPolicy.java @@ -0,0 +1,178 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.policies; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Set; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gef.EditPart; +import org.eclipse.gef.commands.Command; +import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; +import org.eclipse.gmf.runtime.diagram.ui.commands.DeferredLayoutCommand; +import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; +import org.eclipse.gmf.runtime.diagram.ui.commands.SetViewMutabilityCommand; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest; +import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; +import org.eclipse.gmf.runtime.notation.Node; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActionPinInReadIsClassifiedObjectActionAsObjectEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.InputPinInReadIsClassifiedObjectActionAsObjectEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.OutputPinInReadIsClassifiedObjectActionEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ValuePinInReadIsClassifiedObjectActionAsObjectEditPart; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLDiagramUpdater; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLNodeDescriptor; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class ReadIsClassifiedObjectActionCanonicalEditPolicy extends CanonicalEditPolicy { + + /** + * @generated + */ + private Set<EStructuralFeature> myFeaturesToSynchronize; + + /** + * @generated + */ + protected void refreshOnActivate() { + // Need to activate editpart children before invoking the canonical refresh for EditParts to add event listeners + List<?> c = getHost().getChildren(); + for (int i = 0; i < c.size(); i++) { + ((EditPart) c.get(i)).activate(); + } + super.refreshOnActivate(); + } + + /** + * @generated + */ + protected Set<EStructuralFeature> getFeaturesToSynchronize() { + if (myFeaturesToSynchronize == null) { + myFeaturesToSynchronize = new HashSet<EStructuralFeature>(); + myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getReadIsClassifiedObjectAction_Result()); + myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getReadIsClassifiedObjectAction_Object()); + } + return myFeaturesToSynchronize; + } + + /** + * @generated + */ + protected List<EObject> getSemanticChildrenList() { + View viewObject = (View) getHost().getModel(); + LinkedList<EObject> result = new LinkedList<EObject>(); + List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE.getReadIsClassifiedObjectAction_3122SemanticChildren(viewObject); + for (UMLNodeDescriptor 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 = UMLVisualIDRegistry.getVisualID(view); + switch (visualID) { + case OutputPinInReadIsClassifiedObjectActionEditPart.VISUAL_ID: + case InputPinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID: + case ValuePinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID: + case ActionPinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID: + return true; + } + return false; + } + + /** + * @generated + */ + protected void refreshSemantic() { + if (resolveSemanticElement() == null) { + return; + } + LinkedList<IAdaptable> createdViews = new LinkedList<IAdaptable>(); + List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE.getReadIsClassifiedObjectAction_3122SemanticChildren((View) getHost().getModel()); + LinkedList<View> orphaned = new LinkedList<View>(); + // we care to check only views we recognize as ours + LinkedList<View> knownViewChildren = new LinkedList<View>(); + for (View v : getViewChildren()) { + if (isMyDiagramElement(v)) { + knownViewChildren.add(v); + } + } + // alternative to #cleanCanonicalSemanticChildren(getViewChildren(), semanticChildren) + // + // iteration happens over list of desired semantic elements, trying to find best matching View, while original CEP + // iterates views, potentially losing view (size/bounds) information - i.e. if there are few views to reference same EObject, only last one + // to answer isOrphaned == true will be used for the domain element representation, see #cleanCanonicalSemanticChildren() + for (Iterator<UMLNodeDescriptor> descriptorsIterator = childDescriptors.iterator(); descriptorsIterator.hasNext();) { + UMLNodeDescriptor next = descriptorsIterator.next(); + String hint = UMLVisualIDRegistry.getType(next.getVisualID()); + LinkedList<View> perfectMatch = new LinkedList<View>(); // both semanticElement and hint match that of NodeDescriptor + for (View childView : getViewChildren()) { + EObject semanticElement = childView.getElement(); + if (next.getModelElement().equals(semanticElement)) { + if (hint.equals(childView.getType())) { + perfectMatch.add(childView); + // actually, can stop iteration over view children here, but + // may want to use not the first view but last one as a 'real' match (the way original CEP does + // with its trick with viewToSemanticMap inside #cleanCanonicalSemanticChildren + } + } + } + if (perfectMatch.size() > 0) { + descriptorsIterator.remove(); // precise match found no need to create anything for the NodeDescriptor + // use only one view (first or last?), keep rest as orphaned for further consideration + knownViewChildren.remove(perfectMatch.getFirst()); + } + } + // those left in knownViewChildren are subject to removal - they are our diagram elements we didn't find match to, + // or those we have potential matches to, and thus need to be recreated, preserving size/location information. + orphaned.addAll(knownViewChildren); + // + ArrayList<CreateViewRequest.ViewDescriptor> viewDescriptors = new ArrayList<CreateViewRequest.ViewDescriptor>(childDescriptors.size()); + for (UMLNodeDescriptor next : childDescriptors) { + String hint = UMLVisualIDRegistry.getType(next.getVisualID()); + IAdaptable elementAdapter = new CanonicalElementAdapter(next.getModelElement(), hint); + CreateViewRequest.ViewDescriptor descriptor = new CreateViewRequest.ViewDescriptor(elementAdapter, Node.class, hint, ViewUtil.APPEND, false, host().getDiagramPreferencesHint()); + viewDescriptors.add(descriptor); + } + boolean changed = deleteViews(orphaned.iterator()); + // + CreateViewRequest request = getCreateViewRequest(viewDescriptors); + Command cmd = getCreateViewCommand(request); + if (cmd != null && cmd.canExecute()) { + SetViewMutabilityCommand.makeMutable(new EObjectAdapter(host().getNotationView())).execute(); + executeCommand(cmd); + @SuppressWarnings("unchecked") + List<IAdaptable> nl = (List<IAdaptable>) request.getNewObject(); + createdViews.addAll(nl); + } + if (changed || createdViews.size() > 0) { + postProcessRefreshSemantic(createdViews); + } + if (createdViews.size() > 1) { + // perform a layout of the container + DeferredLayoutCommand layoutCmd = new DeferredLayoutCommand(host().getEditingDomain(), createdViews, host()); + executeCommand(new ICommandProxy(layoutCmd)); + } + makeViewsImmutable(createdViews); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ReadIsClassifiedObjectActionItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ReadIsClassifiedObjectActionItemSemanticEditPolicy.java new file mode 100644 index 00000000000..edc2c83c331 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ReadIsClassifiedObjectActionItemSemanticEditPolicy.java @@ -0,0 +1,258 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.policies; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.commands.UnexecutableCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; +import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType; +import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils; +import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; +import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ActionLocalPostconditionCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ActionLocalPostconditionReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ActionLocalPreconditionCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ActionLocalPreconditionReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.CommentLinkCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.CommentLinkReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ConstraintConstrainedElementCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ConstraintConstrainedElementReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ControlFlowCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ControlFlowReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ExceptionHandlerCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ExceptionHandlerReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ObjectFlowCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ObjectFlowReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActionLocalPostconditionEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActionLocalPreconditionEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.CommentLinkEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ConstraintConstrainedElementEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ControlFlowEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ExceptionHandlerEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ObjectFlowEditPart; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class ReadIsClassifiedObjectActionItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { + + /** + * @generated + */ + public ReadIsClassifiedObjectActionItemSemanticEditPolicy() { + super(UMLElementTypes.ReadIsClassifiedObjectAction_3122); + } + + /** + * @generated + */ + protected Command getCreateCommand(CreateElementRequest req) { + IElementType requestElementType = req.getElementType(); + if (requestElementType == null) { + return super.getCreateCommand(req); + } + if (UMLElementTypes.OutputPin_3130 == requestElementType) { + // adjust the containment feature + EReference containmentFeature = UMLPackage.eINSTANCE.getReadIsClassifiedObjectAction_Result(); + req.setContainmentFeature(containmentFeature); + return getGEFWrapper(getSemanticCreationCommand(req)); + } + if (UMLElementTypes.InputPin_3142 == requestElementType) { + // adjust the containment feature + EReference containmentFeature = UMLPackage.eINSTANCE.getReadIsClassifiedObjectAction_Object(); + req.setContainmentFeature(containmentFeature); + return getGEFWrapper(getSemanticCreationCommand(req)); + } + if (UMLElementTypes.ValuePin_3155 == requestElementType) { + // adjust the containment feature + EReference containmentFeature = UMLPackage.eINSTANCE.getReadIsClassifiedObjectAction_Object(); + req.setContainmentFeature(containmentFeature); + return getGEFWrapper(getSemanticCreationCommand(req)); + } + if (UMLElementTypes.ActionInputPin_3168 == requestElementType) { + // adjust the containment feature + EReference containmentFeature = UMLPackage.eINSTANCE.getReadIsClassifiedObjectAction_Object(); + req.setContainmentFeature(containmentFeature); + return getGEFWrapper(getSemanticCreationCommand(req)); + } + return super.getCreateCommand(req); + } + + /** + * @generated + */ + protected Command getDestroyElementCommand(DestroyElementRequest req) { + EObject selectedEObject = req.getElementToDestroy(); + IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject); + if (provider != null) { + // Retrieve delete command from the Element Edit service + ICommand deleteCommand = provider.getEditCommand(req); + if (deleteCommand != null) { + return new ICommandProxy(deleteCommand); + } + } + return UnexecutableCommand.INSTANCE; + } + + /** + * @generated + */ + protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) { + IElementType requestElementType = req.getElementType(); + if (requestElementType == null) { + return null; + } + IElementType baseElementType = requestElementType; + boolean isExtendedType = false; + if (requestElementType instanceof IExtendedHintedElementType) { + baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType); + if (baseElementType != null) { + isExtendedType = true; + } else { + // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs. + baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType); + isExtendedType = true; + } + } + if (UMLElementTypes.ActionLocalPrecondition_4001 == baseElementType) { + if (isExtendedType) { + return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ActionLocalPreconditionCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ActionLocalPostcondition_4002 == baseElementType) { + if (isExtendedType) { + return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ActionLocalPostconditionCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ObjectFlow_4003 == baseElementType) { + if (isExtendedType) { + return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ObjectFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ControlFlow_4004 == baseElementType) { + if (isExtendedType) { + return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ControlFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ExceptionHandler_4005 == baseElementType) { + if (isExtendedType) { + return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ExceptionHandlerCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.CommentAnnotatedElement_4006 == baseElementType) { + return null; + } + if (UMLElementTypes.ConstraintConstrainedElement_4007 == baseElementType) { + return null; + } + return null; + } + + /** + * @generated + */ + protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) { + IElementType requestElementType = req.getElementType(); + if (requestElementType == null) { + return null; + } + IElementType baseElementType = requestElementType; + boolean isExtendedType = false; + if (requestElementType instanceof IExtendedHintedElementType) { + baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType); + if (baseElementType != null) { + isExtendedType = true; + } else { + // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs. + baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType); + isExtendedType = true; + } + } + if (UMLElementTypes.ActionLocalPrecondition_4001 == baseElementType) { + return null; + } + if (UMLElementTypes.ActionLocalPostcondition_4002 == baseElementType) { + return null; + } + if (UMLElementTypes.ObjectFlow_4003 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ObjectFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ControlFlow_4004 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ControlFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ExceptionHandler_4005 == baseElementType) { + return null; + } + if (UMLElementTypes.CommentAnnotatedElement_4006 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new CommentLinkCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ConstraintConstrainedElement_4007 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(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 ObjectFlowEditPart.VISUAL_ID: + return getGEFWrapper(new ObjectFlowReorientCommand(req)); + case ControlFlowEditPart.VISUAL_ID: + return getGEFWrapper(new ControlFlowReorientCommand(req)); + case ExceptionHandlerEditPart.VISUAL_ID: + return getGEFWrapper(new ExceptionHandlerReorientCommand(req)); + } + return super.getReorientRelationshipCommand(req); + } + + /** + * Returns command to reorient EReference based link. New link target or source + * should be the domain model element associated with this node. + * + * @generated + */ + protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) { + switch (getVisualID(req)) { + case ActionLocalPreconditionEditPart.VISUAL_ID: + return getGEFWrapper(new ActionLocalPreconditionReorientCommand(req)); + case ActionLocalPostconditionEditPart.VISUAL_ID: + return getGEFWrapper(new ActionLocalPostconditionReorientCommand(req)); + case CommentLinkEditPart.VISUAL_ID: + return getGEFWrapper(new CommentLinkReorientCommand(req)); + case ConstraintConstrainedElementEditPart.VISUAL_ID: + return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req)); + } + return super.getReorientReferenceRelationshipCommand(req); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ReclassifyObjectActionCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ReclassifyObjectActionCanonicalEditPolicy.java new file mode 100644 index 00000000000..9074de1ce9c --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ReclassifyObjectActionCanonicalEditPolicy.java @@ -0,0 +1,158 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.policies; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gef.EditPart; +import org.eclipse.gef.commands.Command; +import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; +import org.eclipse.gmf.runtime.diagram.ui.commands.DeferredLayoutCommand; +import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; +import org.eclipse.gmf.runtime.diagram.ui.commands.SetViewMutabilityCommand; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest; +import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; +import org.eclipse.gmf.runtime.notation.Node; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActionPinInReclassifyObjectActionAsObjectEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.InputPinInReclassifyObjectActionAsObjectEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ValuePinInReclassifyObjectActionAsObjectEditPart; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLDiagramUpdater; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLNodeDescriptor; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class ReclassifyObjectActionCanonicalEditPolicy 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.getReclassifyObjectAction_Object(); + } + + /** + * @generated + */ + protected List<EObject> getSemanticChildrenList() { + View viewObject = (View) getHost().getModel(); + LinkedList<EObject> result = new LinkedList<EObject>(); + List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE.getReclassifyObjectAction_3121SemanticChildren(viewObject); + for (UMLNodeDescriptor 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 = UMLVisualIDRegistry.getVisualID(view); + return visualID == InputPinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID || visualID == ValuePinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID || visualID == ActionPinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID; + } + + /** + * @generated + */ + protected void refreshSemantic() { + if (resolveSemanticElement() == null) { + return; + } + LinkedList<IAdaptable> createdViews = new LinkedList<IAdaptable>(); + List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE.getReclassifyObjectAction_3121SemanticChildren((View) getHost().getModel()); + LinkedList<View> orphaned = new LinkedList<View>(); + // we care to check only views we recognize as ours + LinkedList<View> knownViewChildren = new LinkedList<View>(); + for (View v : getViewChildren()) { + if (isMyDiagramElement(v)) { + knownViewChildren.add(v); + } + } + // alternative to #cleanCanonicalSemanticChildren(getViewChildren(), semanticChildren) + // + // iteration happens over list of desired semantic elements, trying to find best matching View, while original CEP + // iterates views, potentially losing view (size/bounds) information - i.e. if there are few views to reference same EObject, only last one + // to answer isOrphaned == true will be used for the domain element representation, see #cleanCanonicalSemanticChildren() + for (Iterator<UMLNodeDescriptor> descriptorsIterator = childDescriptors.iterator(); descriptorsIterator.hasNext();) { + UMLNodeDescriptor next = descriptorsIterator.next(); + String hint = UMLVisualIDRegistry.getType(next.getVisualID()); + LinkedList<View> perfectMatch = new LinkedList<View>(); // both semanticElement and hint match that of NodeDescriptor + for (View childView : getViewChildren()) { + EObject semanticElement = childView.getElement(); + if (next.getModelElement().equals(semanticElement)) { + if (hint.equals(childView.getType())) { + perfectMatch.add(childView); + // actually, can stop iteration over view children here, but + // may want to use not the first view but last one as a 'real' match (the way original CEP does + // with its trick with viewToSemanticMap inside #cleanCanonicalSemanticChildren + } + } + } + if (perfectMatch.size() > 0) { + descriptorsIterator.remove(); // precise match found no need to create anything for the NodeDescriptor + // use only one view (first or last?), keep rest as orphaned for further consideration + knownViewChildren.remove(perfectMatch.getFirst()); + } + } + // those left in knownViewChildren are subject to removal - they are our diagram elements we didn't find match to, + // or those we have potential matches to, and thus need to be recreated, preserving size/location information. + orphaned.addAll(knownViewChildren); + // + ArrayList<CreateViewRequest.ViewDescriptor> viewDescriptors = new ArrayList<CreateViewRequest.ViewDescriptor>(childDescriptors.size()); + for (UMLNodeDescriptor next : childDescriptors) { + String hint = UMLVisualIDRegistry.getType(next.getVisualID()); + IAdaptable elementAdapter = new CanonicalElementAdapter(next.getModelElement(), hint); + CreateViewRequest.ViewDescriptor descriptor = new CreateViewRequest.ViewDescriptor(elementAdapter, Node.class, hint, ViewUtil.APPEND, false, host().getDiagramPreferencesHint()); + viewDescriptors.add(descriptor); + } + boolean changed = deleteViews(orphaned.iterator()); + // + CreateViewRequest request = getCreateViewRequest(viewDescriptors); + Command cmd = getCreateViewCommand(request); + if (cmd != null && cmd.canExecute()) { + SetViewMutabilityCommand.makeMutable(new EObjectAdapter(host().getNotationView())).execute(); + executeCommand(cmd); + @SuppressWarnings("unchecked") + List<IAdaptable> nl = (List<IAdaptable>) request.getNewObject(); + createdViews.addAll(nl); + } + if (changed || createdViews.size() > 0) { + postProcessRefreshSemantic(createdViews); + } + if (createdViews.size() > 1) { + // perform a layout of the container + DeferredLayoutCommand layoutCmd = new DeferredLayoutCommand(host().getEditingDomain(), createdViews, host()); + executeCommand(new ICommandProxy(layoutCmd)); + } + makeViewsImmutable(createdViews); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ReclassifyObjectActionItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ReclassifyObjectActionItemSemanticEditPolicy.java new file mode 100644 index 00000000000..68db52ee8f5 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ReclassifyObjectActionItemSemanticEditPolicy.java @@ -0,0 +1,252 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.policies; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.commands.UnexecutableCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; +import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType; +import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils; +import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; +import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ActionLocalPostconditionCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ActionLocalPostconditionReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ActionLocalPreconditionCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ActionLocalPreconditionReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.CommentLinkCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.CommentLinkReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ConstraintConstrainedElementCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ConstraintConstrainedElementReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ControlFlowCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ControlFlowReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ExceptionHandlerCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ExceptionHandlerReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ObjectFlowCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ObjectFlowReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActionLocalPostconditionEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActionLocalPreconditionEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.CommentLinkEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ConstraintConstrainedElementEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ControlFlowEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ExceptionHandlerEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ObjectFlowEditPart; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class ReclassifyObjectActionItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { + + /** + * @generated + */ + public ReclassifyObjectActionItemSemanticEditPolicy() { + super(UMLElementTypes.ReclassifyObjectAction_3121); + } + + /** + * @generated + */ + protected Command getCreateCommand(CreateElementRequest req) { + IElementType requestElementType = req.getElementType(); + if (requestElementType == null) { + return super.getCreateCommand(req); + } + if (UMLElementTypes.InputPin_3141 == requestElementType) { + // adjust the containment feature + EReference containmentFeature = UMLPackage.eINSTANCE.getReclassifyObjectAction_Object(); + req.setContainmentFeature(containmentFeature); + return getGEFWrapper(getSemanticCreationCommand(req)); + } + if (UMLElementTypes.ValuePin_3154 == requestElementType) { + // adjust the containment feature + EReference containmentFeature = UMLPackage.eINSTANCE.getReclassifyObjectAction_Object(); + req.setContainmentFeature(containmentFeature); + return getGEFWrapper(getSemanticCreationCommand(req)); + } + if (UMLElementTypes.ActionInputPin_3167 == requestElementType) { + // adjust the containment feature + EReference containmentFeature = UMLPackage.eINSTANCE.getReclassifyObjectAction_Object(); + req.setContainmentFeature(containmentFeature); + return getGEFWrapper(getSemanticCreationCommand(req)); + } + return super.getCreateCommand(req); + } + + /** + * @generated + */ + protected Command getDestroyElementCommand(DestroyElementRequest req) { + EObject selectedEObject = req.getElementToDestroy(); + IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject); + if (provider != null) { + // Retrieve delete command from the Element Edit service + ICommand deleteCommand = provider.getEditCommand(req); + if (deleteCommand != null) { + return new ICommandProxy(deleteCommand); + } + } + return UnexecutableCommand.INSTANCE; + } + + /** + * @generated + */ + protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) { + IElementType requestElementType = req.getElementType(); + if (requestElementType == null) { + return null; + } + IElementType baseElementType = requestElementType; + boolean isExtendedType = false; + if (requestElementType instanceof IExtendedHintedElementType) { + baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType); + if (baseElementType != null) { + isExtendedType = true; + } else { + // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs. + baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType); + isExtendedType = true; + } + } + if (UMLElementTypes.ActionLocalPrecondition_4001 == baseElementType) { + if (isExtendedType) { + return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ActionLocalPreconditionCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ActionLocalPostcondition_4002 == baseElementType) { + if (isExtendedType) { + return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ActionLocalPostconditionCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ObjectFlow_4003 == baseElementType) { + if (isExtendedType) { + return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ObjectFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ControlFlow_4004 == baseElementType) { + if (isExtendedType) { + return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ControlFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ExceptionHandler_4005 == baseElementType) { + if (isExtendedType) { + return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ExceptionHandlerCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.CommentAnnotatedElement_4006 == baseElementType) { + return null; + } + if (UMLElementTypes.ConstraintConstrainedElement_4007 == baseElementType) { + return null; + } + return null; + } + + /** + * @generated + */ + protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) { + IElementType requestElementType = req.getElementType(); + if (requestElementType == null) { + return null; + } + IElementType baseElementType = requestElementType; + boolean isExtendedType = false; + if (requestElementType instanceof IExtendedHintedElementType) { + baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType); + if (baseElementType != null) { + isExtendedType = true; + } else { + // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs. + baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType); + isExtendedType = true; + } + } + if (UMLElementTypes.ActionLocalPrecondition_4001 == baseElementType) { + return null; + } + if (UMLElementTypes.ActionLocalPostcondition_4002 == baseElementType) { + return null; + } + if (UMLElementTypes.ObjectFlow_4003 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ObjectFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ControlFlow_4004 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ControlFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ExceptionHandler_4005 == baseElementType) { + return null; + } + if (UMLElementTypes.CommentAnnotatedElement_4006 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new CommentLinkCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ConstraintConstrainedElement_4007 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(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 ObjectFlowEditPart.VISUAL_ID: + return getGEFWrapper(new ObjectFlowReorientCommand(req)); + case ControlFlowEditPart.VISUAL_ID: + return getGEFWrapper(new ControlFlowReorientCommand(req)); + case ExceptionHandlerEditPart.VISUAL_ID: + return getGEFWrapper(new ExceptionHandlerReorientCommand(req)); + } + return super.getReorientRelationshipCommand(req); + } + + /** + * Returns command to reorient EReference based link. New link target or source + * should be the domain model element associated with this node. + * + * @generated + */ + protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) { + switch (getVisualID(req)) { + case ActionLocalPreconditionEditPart.VISUAL_ID: + return getGEFWrapper(new ActionLocalPreconditionReorientCommand(req)); + case ActionLocalPostconditionEditPart.VISUAL_ID: + return getGEFWrapper(new ActionLocalPostconditionReorientCommand(req)); + case CommentLinkEditPart.VISUAL_ID: + return getGEFWrapper(new CommentLinkReorientCommand(req)); + case ConstraintConstrainedElementEditPart.VISUAL_ID: + return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req)); + } + return super.getReorientReferenceRelationshipCommand(req); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/SequenceNodeStructuredActivityNodeContentCompartmentCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/SequenceNodeStructuredActivityNodeContentCompartmentCanonicalEditPolicy.java index 55b828767db..b4c9d58fb3f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/SequenceNodeStructuredActivityNodeContentCompartmentCanonicalEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/SequenceNodeStructuredActivityNodeContentCompartmentCanonicalEditPolicy.java @@ -79,10 +79,12 @@ import org.eclipse.papyrus.uml.diagram.activity.edit.parts.LoopNodeEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.MergeNodeEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.OpaqueActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadExtentActionEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadIsClassifiedObjectActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadLinkActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadSelfActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadStructuralFeatureActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadVariableActionEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReclassifyObjectActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SendObjectActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SendSignalActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SequenceNodeEditPart; @@ -213,6 +215,8 @@ public class SequenceNodeStructuredActivityNodeContentCompartmentCanonicalEditPo case DestroyLinkActionEditPart.VISUAL_ID: case ClearAssociationActionEditPart.VISUAL_ID: case ReadExtentActionEditPart.VISUAL_ID: + case ReclassifyObjectActionEditPart.VISUAL_ID: + case ReadIsClassifiedObjectActionEditPart.VISUAL_ID: return true; } return false; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/StructuredActivityNodeStructuredActivityNodeContentCompartmentCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/StructuredActivityNodeStructuredActivityNodeContentCompartmentCanonicalEditPolicy.java index 9fc992842d9..05cf3fa8b49 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/StructuredActivityNodeStructuredActivityNodeContentCompartmentCanonicalEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/StructuredActivityNodeStructuredActivityNodeContentCompartmentCanonicalEditPolicy.java @@ -79,10 +79,12 @@ import org.eclipse.papyrus.uml.diagram.activity.edit.parts.LoopNodeEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.MergeNodeEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.OpaqueActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadExtentActionEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadIsClassifiedObjectActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadLinkActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadSelfActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadStructuralFeatureActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadVariableActionEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReclassifyObjectActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SendObjectActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SendSignalActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SequenceNodeEditPart; @@ -213,6 +215,8 @@ public class StructuredActivityNodeStructuredActivityNodeContentCompartmentCanon case DestroyLinkActionEditPart.VISUAL_ID: case ClearAssociationActionEditPart.VISUAL_ID: case ReadExtentActionEditPart.VISUAL_ID: + case ReclassifyObjectActionEditPart.VISUAL_ID: + case ReadIsClassifiedObjectActionEditPart.VISUAL_ID: return true; } return false; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ValuePinInReadIsClassifiedObjectActionAsObjectItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ValuePinInReadIsClassifiedObjectActionAsObjectItemSemanticEditPolicy.java new file mode 100644 index 00000000000..01e322252b4 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ValuePinInReadIsClassifiedObjectActionAsObjectItemSemanticEditPolicy.java @@ -0,0 +1,192 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.policies; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.commands.UnexecutableCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; +import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType; +import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils; +import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; +import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.CommentLinkCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.CommentLinkReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ConstraintConstrainedElementCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ConstraintConstrainedElementReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ControlFlowCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ControlFlowReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ExceptionHandlerCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ExceptionHandlerReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ObjectFlowCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ObjectFlowReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.CommentLinkEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ConstraintConstrainedElementEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ControlFlowEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ExceptionHandlerEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ObjectFlowEditPart; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; + +/** + * @generated + */ +public class ValuePinInReadIsClassifiedObjectActionAsObjectItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { + + /** + * @generated + */ + public ValuePinInReadIsClassifiedObjectActionAsObjectItemSemanticEditPolicy() { + super(UMLElementTypes.ValuePin_3155); + } + + /** + * @generated + */ + protected Command getDestroyElementCommand(DestroyElementRequest req) { + EObject selectedEObject = req.getElementToDestroy(); + IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject); + if (provider != null) { + // Retrieve delete command from the Element Edit service + ICommand deleteCommand = provider.getEditCommand(req); + if (deleteCommand != null) { + return new ICommandProxy(deleteCommand); + } + } + return UnexecutableCommand.INSTANCE; + } + + /** + * @generated + */ + protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) { + IElementType requestElementType = req.getElementType(); + if (requestElementType == null) { + return null; + } + IElementType baseElementType = requestElementType; + boolean isExtendedType = false; + if (requestElementType instanceof IExtendedHintedElementType) { + baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType); + if (baseElementType != null) { + isExtendedType = true; + } else { + // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs. + baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType); + isExtendedType = true; + } + } + if (UMLElementTypes.ObjectFlow_4003 == baseElementType) { + if (isExtendedType) { + return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ObjectFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ControlFlow_4004 == baseElementType) { + if (isExtendedType) { + return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ControlFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ExceptionHandler_4005 == baseElementType) { + return null; + } + if (UMLElementTypes.CommentAnnotatedElement_4006 == baseElementType) { + return null; + } + if (UMLElementTypes.ConstraintConstrainedElement_4007 == baseElementType) { + return null; + } + return null; + } + + /** + * @generated + */ + protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) { + IElementType requestElementType = req.getElementType(); + if (requestElementType == null) { + return null; + } + IElementType baseElementType = requestElementType; + boolean isExtendedType = false; + if (requestElementType instanceof IExtendedHintedElementType) { + baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType); + if (baseElementType != null) { + isExtendedType = true; + } else { + // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs. + baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType); + isExtendedType = true; + } + } + if (UMLElementTypes.ObjectFlow_4003 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ObjectFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ControlFlow_4004 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ControlFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ExceptionHandler_4005 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ExceptionHandlerCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.CommentAnnotatedElement_4006 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new CommentLinkCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ConstraintConstrainedElement_4007 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(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 ObjectFlowEditPart.VISUAL_ID: + return getGEFWrapper(new ObjectFlowReorientCommand(req)); + case ControlFlowEditPart.VISUAL_ID: + return getGEFWrapper(new ControlFlowReorientCommand(req)); + case ExceptionHandlerEditPart.VISUAL_ID: + return getGEFWrapper(new ExceptionHandlerReorientCommand(req)); + } + return super.getReorientRelationshipCommand(req); + } + + /** + * Returns command to reorient EReference based link. New link target or source + * should be the domain model element associated with this node. + * + * @generated + */ + protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) { + switch (getVisualID(req)) { + case CommentLinkEditPart.VISUAL_ID: + return getGEFWrapper(new CommentLinkReorientCommand(req)); + case ConstraintConstrainedElementEditPart.VISUAL_ID: + return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req)); + } + return super.getReorientReferenceRelationshipCommand(req); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ValuePinInReclassifyObjectActionAsObjectItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ValuePinInReclassifyObjectActionAsObjectItemSemanticEditPolicy.java new file mode 100644 index 00000000000..e0b5950674f --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ValuePinInReclassifyObjectActionAsObjectItemSemanticEditPolicy.java @@ -0,0 +1,192 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.policies; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.commands.UnexecutableCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; +import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType; +import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils; +import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; +import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.CommentLinkCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.CommentLinkReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ConstraintConstrainedElementCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ConstraintConstrainedElementReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ControlFlowCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ControlFlowReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ExceptionHandlerCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ExceptionHandlerReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ObjectFlowCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ObjectFlowReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.CommentLinkEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ConstraintConstrainedElementEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ControlFlowEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ExceptionHandlerEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ObjectFlowEditPart; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; + +/** + * @generated + */ +public class ValuePinInReclassifyObjectActionAsObjectItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { + + /** + * @generated + */ + public ValuePinInReclassifyObjectActionAsObjectItemSemanticEditPolicy() { + super(UMLElementTypes.ValuePin_3154); + } + + /** + * @generated + */ + protected Command getDestroyElementCommand(DestroyElementRequest req) { + EObject selectedEObject = req.getElementToDestroy(); + IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject); + if (provider != null) { + // Retrieve delete command from the Element Edit service + ICommand deleteCommand = provider.getEditCommand(req); + if (deleteCommand != null) { + return new ICommandProxy(deleteCommand); + } + } + return UnexecutableCommand.INSTANCE; + } + + /** + * @generated + */ + protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) { + IElementType requestElementType = req.getElementType(); + if (requestElementType == null) { + return null; + } + IElementType baseElementType = requestElementType; + boolean isExtendedType = false; + if (requestElementType instanceof IExtendedHintedElementType) { + baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType); + if (baseElementType != null) { + isExtendedType = true; + } else { + // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs. + baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType); + isExtendedType = true; + } + } + if (UMLElementTypes.ObjectFlow_4003 == baseElementType) { + if (isExtendedType) { + return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ObjectFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ControlFlow_4004 == baseElementType) { + if (isExtendedType) { + return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ControlFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ExceptionHandler_4005 == baseElementType) { + return null; + } + if (UMLElementTypes.CommentAnnotatedElement_4006 == baseElementType) { + return null; + } + if (UMLElementTypes.ConstraintConstrainedElement_4007 == baseElementType) { + return null; + } + return null; + } + + /** + * @generated + */ + protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) { + IElementType requestElementType = req.getElementType(); + if (requestElementType == null) { + return null; + } + IElementType baseElementType = requestElementType; + boolean isExtendedType = false; + if (requestElementType instanceof IExtendedHintedElementType) { + baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType); + if (baseElementType != null) { + isExtendedType = true; + } else { + // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs. + baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType); + isExtendedType = true; + } + } + if (UMLElementTypes.ObjectFlow_4003 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ObjectFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ControlFlow_4004 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ControlFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ExceptionHandler_4005 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ExceptionHandlerCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.CommentAnnotatedElement_4006 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new CommentLinkCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ConstraintConstrainedElement_4007 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(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 ObjectFlowEditPart.VISUAL_ID: + return getGEFWrapper(new ObjectFlowReorientCommand(req)); + case ControlFlowEditPart.VISUAL_ID: + return getGEFWrapper(new ControlFlowReorientCommand(req)); + case ExceptionHandlerEditPart.VISUAL_ID: + return getGEFWrapper(new ExceptionHandlerReorientCommand(req)); + } + return super.getReorientRelationshipCommand(req); + } + + /** + * Returns command to reorient EReference based link. New link target or source + * should be the domain model element associated with this node. + * + * @generated + */ + protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) { + switch (getVisualID(req)) { + case CommentLinkEditPart.VISUAL_ID: + return getGEFWrapper(new CommentLinkReorientCommand(req)); + case ConstraintConstrainedElementEditPart.VISUAL_ID: + return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req)); + } + return super.getReorientReferenceRelationshipCommand(req); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/expressions/UMLOCLFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/expressions/UMLOCLFactory.java index 48cf2f18d71..15816dbbbec 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/expressions/UMLOCLFactory.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/expressions/UMLOCLFactory.java @@ -49,7 +49,7 @@ public class UMLOCLFactory { * @generated */ protected UMLOCLFactory() { - this.expressions = new UMLAbstractExpression[114]; + this.expressions = new UMLAbstractExpression[120]; this.expressionBodies = new String[] { "if self.owner.oclIsKindOf(CallOperationAction)\r\nthen self.owner.oclAsType(CallOperationAction).argument->includes(self)\r\nelse false endif", //$NON-NLS-1$ "if self.owner.oclIsKindOf(CallOperationAction)\r\nthen self.owner.oclAsType(CallOperationAction).argument->includes(self)\r\nelse false endif", //$NON-NLS-1$ @@ -165,6 +165,12 @@ public class UMLOCLFactory { "if self.owner.oclIsKindOf(ClearAssociationAction) and self.oclIsTypeOf(InputPin)\r\nthen self.owner.oclAsType(ClearAssociationAction).object = self\r\nelse false endif", //$NON-NLS-1$ "if self.owner.oclIsKindOf(ClearAssociationAction) and self.oclIsTypeOf(ValuePin)\r\nthen self.owner.oclAsType(ClearAssociationAction).object = self\r\nelse false endif", //$NON-NLS-1$ "if self.owner.oclIsKindOf(ClearAssociationAction) and self.oclIsTypeOf(ActionInputPin)\r\nthen self.owner.oclAsType(ClearAssociationAction).object = self\r\nelse false endif", //$NON-NLS-1$ + "if self.owner.oclIsKindOf(ReclassifyObjectAction) and self.oclIsTypeOf(ActionInputPin)\r\nthen self.owner.oclAsType(ReclassifyObjectAction).object = self\r\nelse false endif", //$NON-NLS-1$ + "if self.owner.oclIsKindOf(ReclassifyObjectAction) and self.oclIsTypeOf(InputPin)\r\nthen self.owner.oclAsType(ReclassifyObjectAction).object = self\r\nelse false endif", //$NON-NLS-1$ + "if self.owner.oclIsKindOf(ReclassifyObjectAction) and self.oclIsTypeOf(ValuePin)\r\nthen self.owner.oclAsType(ReclassifyObjectAction).object = self\r\nelse false endif", //$NON-NLS-1$ + "if self.owner.oclIsKindOf(ReadIsClassifiedObjectAction) and self.oclIsTypeOf(ValuePin)\r\nthen self.owner.oclAsType(ReadIsClassifiedObjectAction).object = self\r\nelse false endif", //$NON-NLS-1$ + "if self.owner.oclIsKindOf(ReadIsClassifiedObjectAction) and self.oclIsTypeOf(ActionInputPin)\r\nthen self.owner.oclAsType(ReadIsClassifiedObjectAction).object = self\r\nelse false endif", //$NON-NLS-1$ + "if self.owner.oclIsKindOf(ReadIsClassifiedObjectAction) and self.oclIsTypeOf(InputPin)\r\nthen self.owner.oclAsType(ReadIsClassifiedObjectAction).object = self\r\nelse false endif", //$NON-NLS-1$ }; } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/part/Messages.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/part/Messages.java index f2029a6c4d7..516e40ae9de 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/part/Messages.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/part/Messages.java @@ -836,6 +836,26 @@ public class Messages extends NLS { /** * @generated */ + public static String ReclassifyObjectAction4CreationTool_title; + + /** + * @generated + */ + public static String ReclassifyObjectAction4CreationTool_desc; + + /** + * @generated + */ + public static String ReadIsClassifiedObjectAction5CreationTool_title; + + /** + * @generated + */ + public static String ReadIsClassifiedObjectAction5CreationTool_desc; + + /** + * @generated + */ public static String StructuredActivityNode1CreationTool_title; /** diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/part/UMLDiagramUpdater.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/part/UMLDiagramUpdater.java index f52364eddf0..917615db785 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/part/UMLDiagramUpdater.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/part/UMLDiagramUpdater.java @@ -79,10 +79,12 @@ import org.eclipse.uml2.uml.Package; import org.eclipse.uml2.uml.PackageableElement; import org.eclipse.uml2.uml.Parameter; import org.eclipse.uml2.uml.ReadExtentAction; +import org.eclipse.uml2.uml.ReadIsClassifiedObjectAction; import org.eclipse.uml2.uml.ReadLinkAction; import org.eclipse.uml2.uml.ReadSelfAction; import org.eclipse.uml2.uml.ReadStructuralFeatureAction; import org.eclipse.uml2.uml.ReadVariableAction; +import org.eclipse.uml2.uml.ReclassifyObjectAction; import org.eclipse.uml2.uml.SendObjectAction; import org.eclipse.uml2.uml.SendSignalAction; import org.eclipse.uml2.uml.SequenceNode; @@ -172,6 +174,10 @@ public class UMLDiagramUpdater implements DiagramUpdater { return getClearAssociationAction_3119SemanticChildren(view); case ReadExtentActionEditPart.VISUAL_ID: return getReadExtentAction_3120SemanticChildren(view); + case ReclassifyObjectActionEditPart.VISUAL_ID: + return getReclassifyObjectAction_3121SemanticChildren(view); + case ReadIsClassifiedObjectActionEditPart.VISUAL_ID: + return getReadIsClassifiedObjectAction_3122SemanticChildren(view); case ActivityActivityParametersCompartmentEditPart.VISUAL_ID: return getActivityActivityFigureParameterCompartment_7001SemanticChildren(view); case ActivityActivityPreConditionsCompartmentEditPart.VISUAL_ID: @@ -1006,6 +1012,63 @@ public class UMLDiagramUpdater implements DiagramUpdater { /** * @generated */ + public List<UMLNodeDescriptor> getReclassifyObjectAction_3121SemanticChildren(View view) { + if (!view.isSetElement()) { + return Collections.emptyList(); + } + ReclassifyObjectAction modelElement = (ReclassifyObjectAction) view.getElement(); + LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>(); + { + InputPin childElement = modelElement.getObject(); + int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement); + if (visualID == InputPinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID) { + result.add(new UMLNodeDescriptor(childElement, visualID)); + } + if (visualID == ValuePinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID) { + result.add(new UMLNodeDescriptor(childElement, visualID)); + } + if (visualID == ActionPinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID) { + result.add(new UMLNodeDescriptor(childElement, visualID)); + } + } + return result; + } + + /** + * @generated + */ + public List<UMLNodeDescriptor> getReadIsClassifiedObjectAction_3122SemanticChildren(View view) { + if (!view.isSetElement()) { + return Collections.emptyList(); + } + ReadIsClassifiedObjectAction modelElement = (ReadIsClassifiedObjectAction) view.getElement(); + LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>(); + { + OutputPin childElement = modelElement.getResult(); + int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement); + if (visualID == OutputPinInReadIsClassifiedObjectActionEditPart.VISUAL_ID) { + result.add(new UMLNodeDescriptor(childElement, visualID)); + } + } + { + InputPin childElement = modelElement.getObject(); + int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement); + if (visualID == InputPinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID) { + result.add(new UMLNodeDescriptor(childElement, visualID)); + } + if (visualID == ValuePinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID) { + result.add(new UMLNodeDescriptor(childElement, visualID)); + } + if (visualID == ActionPinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID) { + result.add(new UMLNodeDescriptor(childElement, visualID)); + } + } + return result; + } + + /** + * @generated + */ public List<UMLNodeDescriptor> getActivityActivityFigureParameterCompartment_7001SemanticChildren(View view) { if (false == view.eContainer() instanceof View) { return Collections.emptyList(); @@ -3101,6 +3164,24 @@ public class UMLDiagramUpdater implements DiagramUpdater { return getReadExtentAction_3120ContainedLinks(view); case OutputPinInReadExtentActionEditPart.VISUAL_ID: return getOutputPin_3129ContainedLinks(view); + case ReclassifyObjectActionEditPart.VISUAL_ID: + return getReclassifyObjectAction_3121ContainedLinks(view); + case InputPinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID: + return getInputPin_3141ContainedLinks(view); + case ValuePinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID: + return getValuePin_3154ContainedLinks(view); + case ActionPinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID: + return getActionInputPin_3167ContainedLinks(view); + case ReadIsClassifiedObjectActionEditPart.VISUAL_ID: + return getReadIsClassifiedObjectAction_3122ContainedLinks(view); + case OutputPinInReadIsClassifiedObjectActionEditPart.VISUAL_ID: + return getOutputPin_3130ContainedLinks(view); + case InputPinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID: + return getInputPin_3142ContainedLinks(view); + case ValuePinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID: + return getValuePin_3155ContainedLinks(view); + case ActionPinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID: + return getActionInputPin_3168ContainedLinks(view); case ObjectFlowEditPart.VISUAL_ID: return getObjectFlow_4003ContainedLinks(view); case ControlFlowEditPart.VISUAL_ID: @@ -3386,6 +3467,24 @@ public class UMLDiagramUpdater implements DiagramUpdater { return getReadExtentAction_3120IncomingLinks(view); case OutputPinInReadExtentActionEditPart.VISUAL_ID: return getOutputPin_3129IncomingLinks(view); + case ReclassifyObjectActionEditPart.VISUAL_ID: + return getReclassifyObjectAction_3121IncomingLinks(view); + case InputPinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID: + return getInputPin_3141IncomingLinks(view); + case ValuePinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID: + return getValuePin_3154IncomingLinks(view); + case ActionPinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID: + return getActionInputPin_3167IncomingLinks(view); + case ReadIsClassifiedObjectActionEditPart.VISUAL_ID: + return getReadIsClassifiedObjectAction_3122IncomingLinks(view); + case OutputPinInReadIsClassifiedObjectActionEditPart.VISUAL_ID: + return getOutputPin_3130IncomingLinks(view); + case InputPinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID: + return getInputPin_3142IncomingLinks(view); + case ValuePinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID: + return getValuePin_3155IncomingLinks(view); + case ActionPinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID: + return getActionInputPin_3168IncomingLinks(view); case ObjectFlowEditPart.VISUAL_ID: return getObjectFlow_4003IncomingLinks(view); case ControlFlowEditPart.VISUAL_ID: @@ -3671,6 +3770,24 @@ public class UMLDiagramUpdater implements DiagramUpdater { return getReadExtentAction_3120OutgoingLinks(view); case OutputPinInReadExtentActionEditPart.VISUAL_ID: return getOutputPin_3129OutgoingLinks(view); + case ReclassifyObjectActionEditPart.VISUAL_ID: + return getReclassifyObjectAction_3121OutgoingLinks(view); + case InputPinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID: + return getInputPin_3141OutgoingLinks(view); + case ValuePinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID: + return getValuePin_3154OutgoingLinks(view); + case ActionPinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID: + return getActionInputPin_3167OutgoingLinks(view); + case ReadIsClassifiedObjectActionEditPart.VISUAL_ID: + return getReadIsClassifiedObjectAction_3122OutgoingLinks(view); + case OutputPinInReadIsClassifiedObjectActionEditPart.VISUAL_ID: + return getOutputPin_3130OutgoingLinks(view); + case InputPinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID: + return getInputPin_3142OutgoingLinks(view); + case ValuePinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID: + return getValuePin_3155OutgoingLinks(view); + case ActionPinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID: + return getActionInputPin_3168OutgoingLinks(view); case ObjectFlowEditPart.VISUAL_ID: return getObjectFlow_4003OutgoingLinks(view); case ControlFlowEditPart.VISUAL_ID: @@ -4651,6 +4768,79 @@ public class UMLDiagramUpdater implements DiagramUpdater { /** * @generated */ + public List<UMLLinkDescriptor> getReclassifyObjectAction_3121ContainedLinks(View view) { + ReclassifyObjectAction modelElement = (ReclassifyObjectAction) view.getElement(); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getOutgoingFeatureModelFacetLinks_Action_LocalPrecondition_4001(modelElement)); + result.addAll(getOutgoingFeatureModelFacetLinks_Action_LocalPostcondition_4002(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_ExceptionHandler_4005(modelElement)); + return result; + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getInputPin_3141ContainedLinks(View view) { + return Collections.emptyList(); + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getValuePin_3154ContainedLinks(View view) { + return Collections.emptyList(); + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getActionInputPin_3167ContainedLinks(View view) { + return Collections.emptyList(); + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getReadIsClassifiedObjectAction_3122ContainedLinks(View view) { + ReadIsClassifiedObjectAction modelElement = (ReadIsClassifiedObjectAction) view.getElement(); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getOutgoingFeatureModelFacetLinks_Action_LocalPrecondition_4001(modelElement)); + result.addAll(getOutgoingFeatureModelFacetLinks_Action_LocalPostcondition_4002(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_ExceptionHandler_4005(modelElement)); + return result; + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getOutputPin_3130ContainedLinks(View view) { + return Collections.emptyList(); + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getInputPin_3142ContainedLinks(View view) { + return Collections.emptyList(); + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getValuePin_3155ContainedLinks(View view) { + return Collections.emptyList(); + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getActionInputPin_3168ContainedLinks(View view) { + return Collections.emptyList(); + } + + /** + * @generated + */ public List<UMLLinkDescriptor> getValueSpecificationAction_3076ContainedLinks(View view) { ValueSpecificationAction modelElement = (ValueSpecificationAction) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); @@ -6521,6 +6711,139 @@ public class UMLDiagramUpdater implements DiagramUpdater { /** * @generated */ + public List<UMLLinkDescriptor> getReclassifyObjectAction_3121IncomingLinks(View view) { + ReclassifyObjectAction modelElement = (ReclassifyObjectAction) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getIncomingTypeModelFacetLinks_ObjectFlow_4003(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_ControlFlow_4004(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4006(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4007(modelElement, crossReferencer)); + return result; + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getInputPin_3141IncomingLinks(View view) { + InputPin modelElement = (InputPin) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getIncomingTypeModelFacetLinks_ObjectFlow_4003(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_ControlFlow_4004(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_ExceptionHandler_4005(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4006(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4007(modelElement, crossReferencer)); + return result; + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getValuePin_3154IncomingLinks(View view) { + ValuePin modelElement = (ValuePin) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getIncomingTypeModelFacetLinks_ObjectFlow_4003(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_ControlFlow_4004(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_ExceptionHandler_4005(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4006(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4007(modelElement, crossReferencer)); + return result; + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getActionInputPin_3167IncomingLinks(View view) { + ActionInputPin modelElement = (ActionInputPin) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getIncomingTypeModelFacetLinks_ObjectFlow_4003(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_ControlFlow_4004(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_ExceptionHandler_4005(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4006(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4007(modelElement, crossReferencer)); + return result; + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getReadIsClassifiedObjectAction_3122IncomingLinks(View view) { + ReadIsClassifiedObjectAction modelElement = (ReadIsClassifiedObjectAction) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getIncomingTypeModelFacetLinks_ObjectFlow_4003(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_ControlFlow_4004(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4006(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4007(modelElement, crossReferencer)); + return result; + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getOutputPin_3130IncomingLinks(View view) { + OutputPin modelElement = (OutputPin) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getIncomingTypeModelFacetLinks_ObjectFlow_4003(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_ControlFlow_4004(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_ExceptionHandler_4005(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4006(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4007(modelElement, crossReferencer)); + return result; + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getInputPin_3142IncomingLinks(View view) { + InputPin modelElement = (InputPin) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getIncomingTypeModelFacetLinks_ObjectFlow_4003(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_ControlFlow_4004(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_ExceptionHandler_4005(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4006(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4007(modelElement, crossReferencer)); + return result; + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getValuePin_3155IncomingLinks(View view) { + ValuePin modelElement = (ValuePin) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getIncomingTypeModelFacetLinks_ObjectFlow_4003(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_ControlFlow_4004(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_ExceptionHandler_4005(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4006(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4007(modelElement, crossReferencer)); + return result; + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getActionInputPin_3168IncomingLinks(View view) { + ActionInputPin modelElement = (ActionInputPin) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getIncomingTypeModelFacetLinks_ObjectFlow_4003(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_ControlFlow_4004(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_ExceptionHandler_4005(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4006(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4007(modelElement, crossReferencer)); + return result; + } + + /** + * @generated + */ public List<UMLLinkDescriptor> getValueSpecificationAction_3076IncomingLinks(View view) { ValueSpecificationAction modelElement = (ValueSpecificationAction) view.getElement(); CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); @@ -8136,6 +8459,111 @@ public class UMLDiagramUpdater implements DiagramUpdater { /** * @generated */ + public List<UMLLinkDescriptor> getReclassifyObjectAction_3121OutgoingLinks(View view) { + ReclassifyObjectAction modelElement = (ReclassifyObjectAction) view.getElement(); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getOutgoingFeatureModelFacetLinks_Action_LocalPrecondition_4001(modelElement)); + result.addAll(getOutgoingFeatureModelFacetLinks_Action_LocalPostcondition_4002(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_ObjectFlow_4003(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_ControlFlow_4004(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_ExceptionHandler_4005(modelElement)); + return result; + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getInputPin_3141OutgoingLinks(View view) { + InputPin modelElement = (InputPin) view.getElement(); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getOutgoingTypeModelFacetLinks_ObjectFlow_4003(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_ControlFlow_4004(modelElement)); + return result; + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getValuePin_3154OutgoingLinks(View view) { + ValuePin modelElement = (ValuePin) view.getElement(); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getOutgoingTypeModelFacetLinks_ObjectFlow_4003(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_ControlFlow_4004(modelElement)); + return result; + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getActionInputPin_3167OutgoingLinks(View view) { + ActionInputPin modelElement = (ActionInputPin) view.getElement(); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getOutgoingTypeModelFacetLinks_ObjectFlow_4003(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_ControlFlow_4004(modelElement)); + return result; + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getReadIsClassifiedObjectAction_3122OutgoingLinks(View view) { + ReadIsClassifiedObjectAction modelElement = (ReadIsClassifiedObjectAction) view.getElement(); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getOutgoingFeatureModelFacetLinks_Action_LocalPrecondition_4001(modelElement)); + result.addAll(getOutgoingFeatureModelFacetLinks_Action_LocalPostcondition_4002(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_ObjectFlow_4003(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_ControlFlow_4004(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_ExceptionHandler_4005(modelElement)); + return result; + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getOutputPin_3130OutgoingLinks(View view) { + OutputPin modelElement = (OutputPin) view.getElement(); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getOutgoingTypeModelFacetLinks_ObjectFlow_4003(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_ControlFlow_4004(modelElement)); + return result; + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getInputPin_3142OutgoingLinks(View view) { + InputPin modelElement = (InputPin) view.getElement(); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getOutgoingTypeModelFacetLinks_ObjectFlow_4003(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_ControlFlow_4004(modelElement)); + return result; + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getValuePin_3155OutgoingLinks(View view) { + ValuePin modelElement = (ValuePin) view.getElement(); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getOutgoingTypeModelFacetLinks_ObjectFlow_4003(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_ControlFlow_4004(modelElement)); + return result; + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getActionInputPin_3168OutgoingLinks(View view) { + ActionInputPin modelElement = (ActionInputPin) view.getElement(); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getOutgoingTypeModelFacetLinks_ObjectFlow_4003(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_ControlFlow_4004(modelElement)); + return result; + } + + /** + * @generated + */ public List<UMLLinkDescriptor> getValueSpecificationAction_3076OutgoingLinks(View view) { ValueSpecificationAction modelElement = (ValueSpecificationAction) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/part/UMLPaletteFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/part/UMLPaletteFactory.java index ad80c0dea9a..c08a8cce444 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/part/UMLPaletteFactory.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/part/UMLPaletteFactory.java @@ -251,6 +251,16 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { /** * @generated */ + private final static String CREATERECLASSIFYOBJECTACTION4CREATIONTOOL = "createReclassifyObjectAction4CreationTool";//$NON-NLS-1$ + + /** + * @generated + */ + private final static String CREATEREADISCLASSIFIEDOBJECTACTION5CREATIONTOOL = "createReadIsClassifiedObjectAction5CreationTool";//$NON-NLS-1$ + + /** + * @generated + */ private final static String CREATESTRUCTUREDACTIVITYNODE1CREATIONTOOL = "createStructuredActivityNode1CreationTool"; //$NON-NLS-1$ /** @@ -481,6 +491,12 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { if (toolId.equals(CREATEREADSELFACTION3CREATIONTOOL)) { return createReadSelfAction3CreationTool(); } + if (toolId.equals(CREATERECLASSIFYOBJECTACTION4CREATIONTOOL)) { + return createReclassifyObjectAction4CreationTool(); + } + if (toolId.equals(CREATEREADISCLASSIFIEDOBJECTACTION5CREATIONTOOL)) { + return createReadIsClassifiedObjectAction5CreationTool(); + } if (toolId.equals(CREATESTRUCTUREDACTIVITYNODE1CREATIONTOOL)) { return createStructuredActivityNode1CreationTool(); } @@ -831,7 +847,7 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { * @generated */ private Tool createOutputPin1CreationTool() { - List<IElementType> types = new ArrayList<IElementType>(14); + List<IElementType> types = new ArrayList<IElementType>(15); types.add(UMLElementTypes.OutputPin_3014); types.add(UMLElementTypes.OutputPin_3020); types.add(UMLElementTypes.OutputPin_3024); @@ -846,6 +862,7 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { types.add(UMLElementTypes.OutputPin_3127); types.add(UMLElementTypes.OutputPin_3128); types.add(UMLElementTypes.OutputPin_3129); + types.add(UMLElementTypes.OutputPin_3130); Tool tool = new AspectUnspecifiedTypeCreationTool(types); return tool; } @@ -854,7 +871,7 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { * @generated */ private Tool createInputPin2CreationTool() { - List<IElementType> types = new ArrayList<IElementType>(13); + List<IElementType> types = new ArrayList<IElementType>(15); types.add(UMLElementTypes.InputPin_3013); types.add(UMLElementTypes.InputPin_3019); types.add(UMLElementTypes.InputPin_3023); @@ -868,6 +885,8 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { types.add(UMLElementTypes.InputPin_3137); types.add(UMLElementTypes.InputPin_3138); types.add(UMLElementTypes.InputPin_3139); + types.add(UMLElementTypes.InputPin_3141); + types.add(UMLElementTypes.InputPin_3142); Tool tool = new AspectUnspecifiedTypeCreationTool(types); return tool; } @@ -876,7 +895,7 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { * @generated */ private Tool createActionInputPin3CreationTool() { - List<IElementType> types = new ArrayList<IElementType>(13); + List<IElementType> types = new ArrayList<IElementType>(15); types.add(UMLElementTypes.ActionInputPin_3016); types.add(UMLElementTypes.ActionInputPin_3018); types.add(UMLElementTypes.ActionInputPin_3021); @@ -890,6 +909,8 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { types.add(UMLElementTypes.ActionInputPin_3164); types.add(UMLElementTypes.ActionInputPin_3165); types.add(UMLElementTypes.ActionInputPin_3166); + types.add(UMLElementTypes.ActionInputPin_3167); + types.add(UMLElementTypes.ActionInputPin_3168); Tool tool = new AspectUnspecifiedTypeCreationTool(types); return tool; } @@ -898,7 +919,7 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { * @generated */ private Tool createValuePin4CreationTool() { - List<IElementType> types = new ArrayList<IElementType>(13); + List<IElementType> types = new ArrayList<IElementType>(15); types.add(UMLElementTypes.ValuePin_3015); types.add(UMLElementTypes.ValuePin_3017); types.add(UMLElementTypes.ValuePin_3022); @@ -912,6 +933,8 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { types.add(UMLElementTypes.ValuePin_3150); types.add(UMLElementTypes.ValuePin_3152); types.add(UMLElementTypes.ValuePin_3153); + types.add(UMLElementTypes.ValuePin_3154); + types.add(UMLElementTypes.ValuePin_3155); Tool tool = new AspectUnspecifiedTypeCreationTool(types); return tool; } @@ -1039,6 +1062,26 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { /** * @generated */ + private Tool createReclassifyObjectAction4CreationTool() { + List<IElementType> types = new ArrayList<IElementType>(1); + types.add(UMLElementTypes.ReclassifyObjectAction_3121); + Tool tool = new AspectUnspecifiedTypeCreationTool(types); + return tool; + } + + /** + * @generated + */ + private Tool createReadIsClassifiedObjectAction5CreationTool() { + List<IElementType> types = new ArrayList<IElementType>(1); + types.add(UMLElementTypes.ReadIsClassifiedObjectAction_3122); + Tool tool = new AspectUnspecifiedTypeCreationTool(types); + return tool; + } + + /** + * @generated + */ private Tool createStructuredActivityNode1CreationTool() { List<IElementType> types = new ArrayList<IElementType>(1); types.add(UMLElementTypes.StructuredActivityNode_3065); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/part/UMLVisualIDRegistry.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/part/UMLVisualIDRegistry.java index f2f4a790311..2c3a6f5be24 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/part/UMLVisualIDRegistry.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/part/UMLVisualIDRegistry.java @@ -425,6 +425,31 @@ public class UMLVisualIDRegistry { return OutputPinInReadExtentActionEditPart.VISUAL_ID; } break; + case ReclassifyObjectActionEditPart.VISUAL_ID: + if (UMLPackage.eINSTANCE.getInputPin().isSuperTypeOf(domainElement.eClass()) && isInputPin_3141((InputPin) domainElement)) { + return InputPinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID; + } + if (UMLPackage.eINSTANCE.getValuePin().isSuperTypeOf(domainElement.eClass()) && isValuePin_3154((ValuePin) domainElement)) { + return ValuePinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID; + } + if (UMLPackage.eINSTANCE.getActionInputPin().isSuperTypeOf(domainElement.eClass()) && isActionInputPin_3167((ActionInputPin) domainElement)) { + return ActionPinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID; + } + break; + case ReadIsClassifiedObjectActionEditPart.VISUAL_ID: + if (UMLPackage.eINSTANCE.getOutputPin().isSuperTypeOf(domainElement.eClass())) { + return OutputPinInReadIsClassifiedObjectActionEditPart.VISUAL_ID; + } + if (UMLPackage.eINSTANCE.getInputPin().isSuperTypeOf(domainElement.eClass()) && isInputPin_3142((InputPin) domainElement)) { + return InputPinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID; + } + if (UMLPackage.eINSTANCE.getValuePin().isSuperTypeOf(domainElement.eClass()) && isValuePin_3155((ValuePin) domainElement)) { + return ValuePinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID; + } + if (UMLPackage.eINSTANCE.getActionInputPin().isSuperTypeOf(domainElement.eClass()) && isActionInputPin_3168((ActionInputPin) domainElement)) { + return ActionPinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID; + } + break; case ActivityActivityParametersCompartmentEditPart.VISUAL_ID: if (UMLPackage.eINSTANCE.getParameter().isSuperTypeOf(domainElement.eClass())) { return ParameterEditPart.VISUAL_ID; @@ -591,6 +616,12 @@ public class UMLVisualIDRegistry { if (UMLPackage.eINSTANCE.getReadExtentAction().isSuperTypeOf(domainElement.eClass())) { return ReadExtentActionEditPart.VISUAL_ID; } + if (UMLPackage.eINSTANCE.getReclassifyObjectAction().isSuperTypeOf(domainElement.eClass())) { + return ReclassifyObjectActionEditPart.VISUAL_ID; + } + if (UMLPackage.eINSTANCE.getReadIsClassifiedObjectAction().isSuperTypeOf(domainElement.eClass())) { + return ReadIsClassifiedObjectActionEditPart.VISUAL_ID; + } break; case ConditionalNodeStructuredActivityNodeContentCompartmentEditPart.VISUAL_ID: if (UMLPackage.eINSTANCE.getInitialNode().isSuperTypeOf(domainElement.eClass())) { @@ -859,6 +890,12 @@ public class UMLVisualIDRegistry { if (UMLPackage.eINSTANCE.getReadExtentAction().isSuperTypeOf(domainElement.eClass())) { return ReadExtentActionEditPart.VISUAL_ID; } + if (UMLPackage.eINSTANCE.getReclassifyObjectAction().isSuperTypeOf(domainElement.eClass())) { + return ReclassifyObjectActionEditPart.VISUAL_ID; + } + if (UMLPackage.eINSTANCE.getReadIsClassifiedObjectAction().isSuperTypeOf(domainElement.eClass())) { + return ReadIsClassifiedObjectActionEditPart.VISUAL_ID; + } break; case LoopNodeStructuredActivityNodeContentCompartmentEditPart.VISUAL_ID: if (UMLPackage.eINSTANCE.getInitialNode().isSuperTypeOf(domainElement.eClass())) { @@ -1002,6 +1039,12 @@ public class UMLVisualIDRegistry { if (UMLPackage.eINSTANCE.getReadExtentAction().isSuperTypeOf(domainElement.eClass())) { return ReadExtentActionEditPart.VISUAL_ID; } + if (UMLPackage.eINSTANCE.getReclassifyObjectAction().isSuperTypeOf(domainElement.eClass())) { + return ReclassifyObjectActionEditPart.VISUAL_ID; + } + if (UMLPackage.eINSTANCE.getReadIsClassifiedObjectAction().isSuperTypeOf(domainElement.eClass())) { + return ReadIsClassifiedObjectActionEditPart.VISUAL_ID; + } break; case SequenceNodeStructuredActivityNodeContentCompartmentEditPart.VISUAL_ID: if (UMLPackage.eINSTANCE.getInitialNode().isSuperTypeOf(domainElement.eClass())) { @@ -1145,6 +1188,12 @@ public class UMLVisualIDRegistry { if (UMLPackage.eINSTANCE.getReadExtentAction().isSuperTypeOf(domainElement.eClass())) { return ReadExtentActionEditPart.VISUAL_ID; } + if (UMLPackage.eINSTANCE.getReclassifyObjectAction().isSuperTypeOf(domainElement.eClass())) { + return ReclassifyObjectActionEditPart.VISUAL_ID; + } + if (UMLPackage.eINSTANCE.getReadIsClassifiedObjectAction().isSuperTypeOf(domainElement.eClass())) { + return ReadIsClassifiedObjectActionEditPart.VISUAL_ID; + } break; case StructuredActivityNodeStructuredActivityNodeContentCompartmentEditPart.VISUAL_ID: if (UMLPackage.eINSTANCE.getInitialNode().isSuperTypeOf(domainElement.eClass())) { @@ -1288,6 +1337,12 @@ public class UMLVisualIDRegistry { if (UMLPackage.eINSTANCE.getReadExtentAction().isSuperTypeOf(domainElement.eClass())) { return ReadExtentActionEditPart.VISUAL_ID; } + if (UMLPackage.eINSTANCE.getReclassifyObjectAction().isSuperTypeOf(domainElement.eClass())) { + return ReclassifyObjectActionEditPart.VISUAL_ID; + } + if (UMLPackage.eINSTANCE.getReadIsClassifiedObjectAction().isSuperTypeOf(domainElement.eClass())) { + return ReadIsClassifiedObjectActionEditPart.VISUAL_ID; + } break; case ActivityPartitionActivityPartitionContentCompartmentEditPart.VISUAL_ID: if (UMLPackage.eINSTANCE.getInitialNode().isSuperTypeOf(domainElement.eClass())) { @@ -1434,6 +1489,12 @@ public class UMLVisualIDRegistry { if (UMLPackage.eINSTANCE.getReadExtentAction().isSuperTypeOf(domainElement.eClass())) { return ReadExtentActionEditPart.VISUAL_ID; } + if (UMLPackage.eINSTANCE.getReclassifyObjectAction().isSuperTypeOf(domainElement.eClass())) { + return ReclassifyObjectActionEditPart.VISUAL_ID; + } + if (UMLPackage.eINSTANCE.getReadIsClassifiedObjectAction().isSuperTypeOf(domainElement.eClass())) { + return ReadIsClassifiedObjectActionEditPart.VISUAL_ID; + } break; case InterruptibleActivityRegionInterruptibleActivityRegionContentCompartmentEditPart.VISUAL_ID: if (UMLPackage.eINSTANCE.getInitialNode().isSuperTypeOf(domainElement.eClass())) { @@ -1577,6 +1638,12 @@ public class UMLVisualIDRegistry { if (UMLPackage.eINSTANCE.getReadExtentAction().isSuperTypeOf(domainElement.eClass())) { return ReadExtentActionEditPart.VISUAL_ID; } + if (UMLPackage.eINSTANCE.getReclassifyObjectAction().isSuperTypeOf(domainElement.eClass())) { + return ReclassifyObjectActionEditPart.VISUAL_ID; + } + if (UMLPackage.eINSTANCE.getReadIsClassifiedObjectAction().isSuperTypeOf(domainElement.eClass())) { + return ReadIsClassifiedObjectActionEditPart.VISUAL_ID; + } break; case ActivityCNParametersCompartmentEditPart.VISUAL_ID: if (UMLPackage.eINSTANCE.getParameter().isSuperTypeOf(domainElement.eClass())) { @@ -1744,6 +1811,12 @@ public class UMLVisualIDRegistry { if (UMLPackage.eINSTANCE.getReadExtentAction().isSuperTypeOf(domainElement.eClass())) { return ReadExtentActionEditPart.VISUAL_ID; } + if (UMLPackage.eINSTANCE.getReclassifyObjectAction().isSuperTypeOf(domainElement.eClass())) { + return ReclassifyObjectActionEditPart.VISUAL_ID; + } + if (UMLPackage.eINSTANCE.getReadIsClassifiedObjectAction().isSuperTypeOf(domainElement.eClass())) { + return ReadIsClassifiedObjectActionEditPart.VISUAL_ID; + } break; } return -1; @@ -3446,6 +3519,111 @@ public class UMLVisualIDRegistry { return true; } break; + case ReclassifyObjectActionEditPart.VISUAL_ID: + if (ReclassifyObjectActionNameEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (ReclassifyObjectActionFloatingNameEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (InputPinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (ValuePinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (ActionPinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + break; + case InputPinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID: + if (InputPinInReclassifyObjectActionAsObjectLabelEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (InputPinInReclassifyObjectActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + break; + case ValuePinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID: + if (ValuePinInReclassifyObjectActionAsObjectLabelEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (ValuePinInReclassifyObjectActionAsObjectValueEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (ValuePinInReclassifyObjectActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + break; + case ActionPinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID: + if (ActionPinInReclassifyObjectActionAsObjectLabelEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (ActionPinInReclassifyObjectActionAsObjectValueEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (ActionPinInReclassifyObjectActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + break; + case ReadIsClassifiedObjectActionEditPart.VISUAL_ID: + if (ReadIsClassifiedObjectActionNameEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (ReadIsClassifiedObjectActionFloatingNameEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (OutputPinInReadIsClassifiedObjectActionEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (InputPinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (ValuePinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (ActionPinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + break; + case OutputPinInReadIsClassifiedObjectActionEditPart.VISUAL_ID: + if (OutputPinInReadIsClassifiedObjectActionLabelEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (OutputPinInReadIsClassifiedObjectActionAppliedStereotypeLabelEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + break; + case InputPinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID: + if (InputPinInReadIsClassifiedObjectActionAsObjectLabelEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (InputPinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + break; + case ValuePinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID: + if (ValuePinInReadIsClassifiedObjectActionAsObjectLabelEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (ValuePinInReadIsClassifiedObjectActionAsObjectValueEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (ValuePinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + break; + case ActionPinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID: + if (ActionPinInReadIsClassifiedObjectActionAsObjectLabelEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (ActionPinInReadIsClassifiedObjectActionAsObjectValueEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (ActionPinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + break; case ActivityActivityParametersCompartmentEditPart.VISUAL_ID: if (ParameterEditPart.VISUAL_ID == nodeVisualID) { return true; @@ -3612,6 +3790,12 @@ public class UMLVisualIDRegistry { if (ReadExtentActionEditPart.VISUAL_ID == nodeVisualID) { return true; } + if (ReclassifyObjectActionEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (ReadIsClassifiedObjectActionEditPart.VISUAL_ID == nodeVisualID) { + return true; + } break; case ConditionalNodeStructuredActivityNodeContentCompartmentEditPart.VISUAL_ID: if (InitialNodeEditPart.VISUAL_ID == nodeVisualID) { @@ -3880,6 +4064,12 @@ public class UMLVisualIDRegistry { if (ReadExtentActionEditPart.VISUAL_ID == nodeVisualID) { return true; } + if (ReclassifyObjectActionEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (ReadIsClassifiedObjectActionEditPart.VISUAL_ID == nodeVisualID) { + return true; + } break; case LoopNodeStructuredActivityNodeContentCompartmentEditPart.VISUAL_ID: if (InitialNodeEditPart.VISUAL_ID == nodeVisualID) { @@ -4023,6 +4213,12 @@ public class UMLVisualIDRegistry { if (ReadExtentActionEditPart.VISUAL_ID == nodeVisualID) { return true; } + if (ReclassifyObjectActionEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (ReadIsClassifiedObjectActionEditPart.VISUAL_ID == nodeVisualID) { + return true; + } break; case SequenceNodeStructuredActivityNodeContentCompartmentEditPart.VISUAL_ID: if (InitialNodeEditPart.VISUAL_ID == nodeVisualID) { @@ -4166,6 +4362,12 @@ public class UMLVisualIDRegistry { if (ReadExtentActionEditPart.VISUAL_ID == nodeVisualID) { return true; } + if (ReclassifyObjectActionEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (ReadIsClassifiedObjectActionEditPart.VISUAL_ID == nodeVisualID) { + return true; + } break; case StructuredActivityNodeStructuredActivityNodeContentCompartmentEditPart.VISUAL_ID: if (InitialNodeEditPart.VISUAL_ID == nodeVisualID) { @@ -4309,6 +4511,12 @@ public class UMLVisualIDRegistry { if (ReadExtentActionEditPart.VISUAL_ID == nodeVisualID) { return true; } + if (ReclassifyObjectActionEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (ReadIsClassifiedObjectActionEditPart.VISUAL_ID == nodeVisualID) { + return true; + } break; case ActivityPartitionActivityPartitionContentCompartmentEditPart.VISUAL_ID: if (InitialNodeEditPart.VISUAL_ID == nodeVisualID) { @@ -4455,6 +4663,12 @@ public class UMLVisualIDRegistry { if (ReadExtentActionEditPart.VISUAL_ID == nodeVisualID) { return true; } + if (ReclassifyObjectActionEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (ReadIsClassifiedObjectActionEditPart.VISUAL_ID == nodeVisualID) { + return true; + } break; case InterruptibleActivityRegionInterruptibleActivityRegionContentCompartmentEditPart.VISUAL_ID: if (InitialNodeEditPart.VISUAL_ID == nodeVisualID) { @@ -4598,6 +4812,12 @@ public class UMLVisualIDRegistry { if (ReadExtentActionEditPart.VISUAL_ID == nodeVisualID) { return true; } + if (ReclassifyObjectActionEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (ReadIsClassifiedObjectActionEditPart.VISUAL_ID == nodeVisualID) { + return true; + } break; case ActivityCNParametersCompartmentEditPart.VISUAL_ID: if (ParameterEditPart.VISUAL_ID == nodeVisualID) { @@ -4765,6 +4985,12 @@ public class UMLVisualIDRegistry { if (ReadExtentActionEditPart.VISUAL_ID == nodeVisualID) { return true; } + if (ReclassifyObjectActionEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (ReadIsClassifiedObjectActionEditPart.VISUAL_ID == nodeVisualID) { + return true; + } break; case ObjectFlowEditPart.VISUAL_ID: if (ObjectFlowNameEditPart.VISUAL_ID == nodeVisualID) { @@ -5352,6 +5578,54 @@ public class UMLVisualIDRegistry { /** * @generated */ + private static boolean isInputPin_3141(InputPin domainElement) { + Object result = UMLOCLFactory.getExpression(115, UMLPackage.eINSTANCE.getInputPin(), null).evaluate(domainElement); + return result instanceof Boolean && ((Boolean) result).booleanValue(); + } + + /** + * @generated + */ + private static boolean isValuePin_3154(ValuePin domainElement) { + Object result = UMLOCLFactory.getExpression(116, UMLPackage.eINSTANCE.getValuePin(), null).evaluate(domainElement); + return result instanceof Boolean && ((Boolean) result).booleanValue(); + } + + /** + * @generated + */ + private static boolean isActionInputPin_3167(ActionInputPin domainElement) { + Object result = UMLOCLFactory.getExpression(114, UMLPackage.eINSTANCE.getActionInputPin(), null).evaluate(domainElement); + return result instanceof Boolean && ((Boolean) result).booleanValue(); + } + + /** + * @generated + */ + private static boolean isInputPin_3142(InputPin domainElement) { + Object result = UMLOCLFactory.getExpression(119, UMLPackage.eINSTANCE.getInputPin(), null).evaluate(domainElement); + return result instanceof Boolean && ((Boolean) result).booleanValue(); + } + + /** + * @generated + */ + private static boolean isValuePin_3155(ValuePin domainElement) { + Object result = UMLOCLFactory.getExpression(117, UMLPackage.eINSTANCE.getValuePin(), null).evaluate(domainElement); + return result instanceof Boolean && ((Boolean) result).booleanValue(); + } + + /** + * @generated + */ + private static boolean isActionInputPin_3168(ActionInputPin domainElement) { + Object result = UMLOCLFactory.getExpression(118, UMLPackage.eINSTANCE.getActionInputPin(), null).evaluate(domainElement); + return result instanceof Boolean && ((Boolean) result).booleanValue(); + } + + /** + * @generated + */ public static boolean checkNodeVisualID(View containerView, EObject domainElement, int candidate) { if (candidate == -1) { // unrecognized id is always bad @@ -5471,6 +5745,7 @@ public class UMLVisualIDRegistry { case OutputPinInClearStructuralFeatureActionEditPart.VISUAL_ID: case OutputPinInReadLinkActionEditPart.VISUAL_ID: case OutputPinInReadExtentActionEditPart.VISUAL_ID: + case OutputPinInReadIsClassifiedObjectActionEditPart.VISUAL_ID: case InputPinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID: case InputPinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID: case InputPinInTestIdentityActionAsFirstEditPart.VISUAL_ID: @@ -5480,6 +5755,8 @@ public class UMLVisualIDRegistry { case InputPinInReadLinkActionAsInputValueEditPart.VISUAL_ID: case InputPinInDestroyLinkActionAsInputValueEditPart.VISUAL_ID: case InputPinInClearAssociationActionAsObjectEditPart.VISUAL_ID: + case InputPinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID: + case InputPinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID: case ValuePinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID: case ValuePinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID: case ValuePinInTestIdentityActionAsFirstEditPart.VISUAL_ID: @@ -5489,6 +5766,8 @@ public class UMLVisualIDRegistry { case ValuePinInCreateLinkActionAsInputValueEditPart.VISUAL_ID: case ValuePinInDestroyLinkActionAsInputValueEditPart.VISUAL_ID: case ValuePinInClearAssociationActionAsObjectEditPart.VISUAL_ID: + case ValuePinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID: + case ValuePinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID: case ActionPinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID: case ActionPinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID: case ActionPinInTestIdentityActionAsFirstEditPart.VISUAL_ID: @@ -5498,6 +5777,8 @@ public class UMLVisualIDRegistry { case ActionInputPinInReadLinkActionAsInputValueEditPart.VISUAL_ID: case ActionInputPinInDestroyLinkActionAsInputValueEditPart.VISUAL_ID: case ActionPinInClearAssociationActionAsObjectEditPart.VISUAL_ID: + case ActionPinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID: + case ActionPinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID: return true; default: break; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/providers/ElementInitializers.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/providers/ElementInitializers.java index fb963586b0c..38f1677162c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/providers/ElementInitializers.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/providers/ElementInitializers.java @@ -49,10 +49,12 @@ import org.eclipse.uml2.uml.OpaqueExpression; import org.eclipse.uml2.uml.OutputPin; import org.eclipse.uml2.uml.Parameter; import org.eclipse.uml2.uml.ReadExtentAction; +import org.eclipse.uml2.uml.ReadIsClassifiedObjectAction; import org.eclipse.uml2.uml.ReadLinkAction; import org.eclipse.uml2.uml.ReadSelfAction; import org.eclipse.uml2.uml.ReadStructuralFeatureAction; import org.eclipse.uml2.uml.ReadVariableAction; +import org.eclipse.uml2.uml.ReclassifyObjectAction; import org.eclipse.uml2.uml.SendObjectAction; import org.eclipse.uml2.uml.SendSignalAction; import org.eclipse.uml2.uml.SequenceNode; @@ -1997,6 +1999,132 @@ public class ElementInitializers { /** * @generated */ + public void init_ReclassifyObjectAction_3121(ReclassifyObjectAction instance) { + try { + Object value_0 = name_ReclassifyObjectAction_3121(instance); + if (value_0 != null) { + instance.setName((String) value_0); + } + } catch (RuntimeException e) { + UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ + } + } + + /** + * @generated + */ + public void init_InputPin_3141(InputPin instance) { + try { + Object value_0 = name_InputPin_3141(instance); + if (value_0 != null) { + instance.setName((String) value_0); + } + } catch (RuntimeException e) { + UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ + } + } + + /** + * @generated + */ + public void init_ValuePin_3154(ValuePin instance) { + try { + Object value_0 = name_ValuePin_3154(instance); + if (value_0 != null) { + instance.setName((String) value_0); + } + } catch (RuntimeException e) { + UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ + } + } + + /** + * @generated + */ + public void init_ActionInputPin_3167(ActionInputPin instance) { + try { + Object value_0 = name_ActionInputPin_3167(instance); + if (value_0 != null) { + instance.setName((String) value_0); + } + } catch (RuntimeException e) { + UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ + } + } + + /** + * @generated + */ + public void init_ReadIsClassifiedObjectAction_3122(ReadIsClassifiedObjectAction instance) { + try { + Object value_0 = name_ReadIsClassifiedObjectAction_3122(instance); + if (value_0 != null) { + instance.setName((String) value_0); + } + } catch (RuntimeException e) { + UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ + } + } + + /** + * @generated + */ + public void init_OutputPin_3130(OutputPin instance) { + try { + Object value_0 = name_OutputPin_3130(instance); + if (value_0 != null) { + instance.setName((String) value_0); + } + } catch (RuntimeException e) { + UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ + } + } + + /** + * @generated + */ + public void init_InputPin_3142(InputPin instance) { + try { + Object value_0 = name_InputPin_3142(instance); + if (value_0 != null) { + instance.setName((String) value_0); + } + } catch (RuntimeException e) { + UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ + } + } + + /** + * @generated + */ + public void init_ValuePin_3155(ValuePin instance) { + try { + Object value_0 = name_ValuePin_3155(instance); + if (value_0 != null) { + instance.setName((String) value_0); + } + } catch (RuntimeException e) { + UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ + } + } + + /** + * @generated + */ + public void init_ActionInputPin_3168(ActionInputPin instance) { + try { + Object value_0 = name_ActionInputPin_3168(instance); + if (value_0 != null) { + instance.setName((String) value_0); + } + } catch (RuntimeException e) { + UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ + } + } + + /** + * @generated + */ public void init_ObjectFlow_4003(ObjectFlow instance) { try { Object value_0 = name_ObjectFlow_4003(instance); @@ -3027,6 +3155,69 @@ public class ElementInitializers { /** * @generated */ + private String name_ReclassifyObjectAction_3121(ReclassifyObjectAction it) { + return LabelHelper.INSTANCE.findName(it.eContainer(), it); + } + + /** + * @generated + */ + private String name_InputPin_3141(InputPin it) { + return LabelHelper.INSTANCE.findName(it.eContainer(), it); + } + + /** + * @generated + */ + private String name_ValuePin_3154(ValuePin it) { + return LabelHelper.INSTANCE.findName(it.eContainer(), it); + } + + /** + * @generated + */ + private String name_ActionInputPin_3167(ActionInputPin it) { + return LabelHelper.INSTANCE.findName(it.eContainer(), it); + } + + /** + * @generated + */ + private String name_ReadIsClassifiedObjectAction_3122(ReadIsClassifiedObjectAction it) { + return LabelHelper.INSTANCE.findName(it.eContainer(), it); + } + + /** + * @generated + */ + private String name_OutputPin_3130(OutputPin it) { + return LabelHelper.INSTANCE.findName(it.eContainer(), it); + } + + /** + * @generated + */ + private String name_InputPin_3142(InputPin it) { + return LabelHelper.INSTANCE.findName(it.eContainer(), it); + } + + /** + * @generated + */ + private String name_ValuePin_3155(ValuePin it) { + return LabelHelper.INSTANCE.findName(it.eContainer(), it); + } + + /** + * @generated + */ + private String name_ActionInputPin_3168(ActionInputPin it) { + return LabelHelper.INSTANCE.findName(it.eContainer(), it); + } + + /** + * @generated + */ private String name_ObjectFlow_4003(ObjectFlow it) { return LabelHelper.INSTANCE.findName(it.eContainer(), it); } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/providers/UMLElementTypes.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/providers/UMLElementTypes.java index 557c77fa322..0bc5524461f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/providers/UMLElementTypes.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/providers/UMLElementTypes.java @@ -649,6 +649,51 @@ public class UMLElementTypes { /** * @generated */ + public static final IElementType ReclassifyObjectAction_3121 = getElementType("org.eclipse.papyrus.uml.diagram.activity.ReclassifyObjectAction_3121"); //$NON-NLS-1$ + + /** + * @generated + */ + public static final IElementType InputPin_3141 = getElementType("org.eclipse.papyrus.uml.diagram.activity.InputPin_3141"); //$NON-NLS-1$ + + /** + * @generated + */ + public static final IElementType ValuePin_3154 = getElementType("org.eclipse.papyrus.uml.diagram.activity.ValuePin_3154"); //$NON-NLS-1$ + + /** + * @generated + */ + public static final IElementType ActionInputPin_3167 = getElementType("org.eclipse.papyrus.uml.diagram.activity.ActionInputPin_3167"); //$NON-NLS-1$ + + /** + * @generated + */ + public static final IElementType ReadIsClassifiedObjectAction_3122 = getElementType("org.eclipse.papyrus.uml.diagram.activity.ReadIsClassifiedObjectAction_3122"); //$NON-NLS-1$ + + /** + * @generated + */ + public static final IElementType OutputPin_3130 = getElementType("org.eclipse.papyrus.uml.diagram.activity.OutputPin_3130"); //$NON-NLS-1$ + + /** + * @generated + */ + public static final IElementType InputPin_3142 = getElementType("org.eclipse.papyrus.uml.diagram.activity.InputPin_3142"); //$NON-NLS-1$ + + /** + * @generated + */ + public static final IElementType ValuePin_3155 = getElementType("org.eclipse.papyrus.uml.diagram.activity.ValuePin_3155"); //$NON-NLS-1$ + + /** + * @generated + */ + public static final IElementType ActionInputPin_3168 = getElementType("org.eclipse.papyrus.uml.diagram.activity.ActionInputPin_3168"); //$NON-NLS-1$ + + /** + * @generated + */ public static final IElementType ValueSpecificationAction_3076 = getElementType("org.eclipse.papyrus.uml.diagram.activity.ValueSpecificationAction_3076"); //$NON-NLS-1$ /** @@ -944,6 +989,15 @@ public class UMLElementTypes { elements.put(ActionInputPin_3166, UMLPackage.eINSTANCE.getActionInputPin()); elements.put(ReadExtentAction_3120, UMLPackage.eINSTANCE.getReadExtentAction()); elements.put(OutputPin_3129, UMLPackage.eINSTANCE.getOutputPin()); + elements.put(ReclassifyObjectAction_3121, UMLPackage.eINSTANCE.getReclassifyObjectAction()); + elements.put(InputPin_3141, UMLPackage.eINSTANCE.getInputPin()); + elements.put(ValuePin_3154, UMLPackage.eINSTANCE.getValuePin()); + elements.put(ActionInputPin_3167, UMLPackage.eINSTANCE.getActionInputPin()); + elements.put(ReadIsClassifiedObjectAction_3122, UMLPackage.eINSTANCE.getReadIsClassifiedObjectAction()); + elements.put(OutputPin_3130, UMLPackage.eINSTANCE.getOutputPin()); + elements.put(InputPin_3142, UMLPackage.eINSTANCE.getInputPin()); + elements.put(ValuePin_3155, UMLPackage.eINSTANCE.getValuePin()); + elements.put(ActionInputPin_3168, UMLPackage.eINSTANCE.getActionInputPin()); elements.put(ActionLocalPrecondition_4001, UMLPackage.eINSTANCE.getAction_LocalPrecondition()); elements.put(ActionLocalPostcondition_4002, UMLPackage.eINSTANCE.getAction_LocalPostcondition()); elements.put(ObjectFlow_4003, UMLPackage.eINSTANCE.getObjectFlow()); @@ -1104,6 +1158,15 @@ public class UMLElementTypes { KNOWN_ELEMENT_TYPES.add(ActionInputPin_3166); KNOWN_ELEMENT_TYPES.add(ReadExtentAction_3120); KNOWN_ELEMENT_TYPES.add(OutputPin_3129); + KNOWN_ELEMENT_TYPES.add(ReclassifyObjectAction_3121); + KNOWN_ELEMENT_TYPES.add(InputPin_3141); + KNOWN_ELEMENT_TYPES.add(ValuePin_3154); + KNOWN_ELEMENT_TYPES.add(ActionInputPin_3167); + KNOWN_ELEMENT_TYPES.add(ReadIsClassifiedObjectAction_3122); + KNOWN_ELEMENT_TYPES.add(OutputPin_3130); + KNOWN_ELEMENT_TYPES.add(InputPin_3142); + KNOWN_ELEMENT_TYPES.add(ValuePin_3155); + KNOWN_ELEMENT_TYPES.add(ActionInputPin_3168); KNOWN_ELEMENT_TYPES.add(ActionLocalPrecondition_4001); KNOWN_ELEMENT_TYPES.add(ActionLocalPostcondition_4002); KNOWN_ELEMENT_TYPES.add(ObjectFlow_4003); @@ -1392,6 +1455,24 @@ public class UMLElementTypes { return ReadExtentAction_3120; case OutputPinInReadExtentActionEditPart.VISUAL_ID: return OutputPin_3129; + case ReclassifyObjectActionEditPart.VISUAL_ID: + return ReclassifyObjectAction_3121; + case InputPinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID: + return InputPin_3141; + case ValuePinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID: + return ValuePin_3154; + case ActionPinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID: + return ActionInputPin_3167; + case ReadIsClassifiedObjectActionEditPart.VISUAL_ID: + return ReadIsClassifiedObjectAction_3122; + case OutputPinInReadIsClassifiedObjectActionEditPart.VISUAL_ID: + return OutputPin_3130; + case InputPinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID: + return InputPin_3142; + case ValuePinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID: + return ValuePin_3155; + case ActionPinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID: + return ActionInputPin_3168; case ActionLocalPreconditionEditPart.VISUAL_ID: return ActionLocalPrecondition_4001; case ActionLocalPostconditionEditPart.VISUAL_ID: diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/providers/UMLParserProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/providers/UMLParserProvider.java index 32997c86649..5cf6bd5b6ba 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/providers/UMLParserProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/providers/UMLParserProvider.java @@ -3993,18 +3993,18 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid /** * @generated */ - private IParser readExtentActionName_5401Parser; + private IParser readExtentActionName_5402Parser; /** * @generated */ - private IParser getReadExtentActionName_5401Parser() { - if (readExtentActionName_5401Parser == null) { + private IParser getReadExtentActionName_5402Parser() { + if (readExtentActionName_5402Parser == null) { EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }; MessageFormatParser parser = new MessageFormatParser(features); - readExtentActionName_5401Parser = parser; + readExtentActionName_5402Parser = parser; } - return readExtentActionName_5401Parser; + return readExtentActionName_5402Parser; } /** @@ -4040,6 +4040,344 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid /** * @generated */ + private IParser reclassifyObjectActionName_5199Parser; + + /** + * @generated + */ + private IParser getReclassifyObjectActionName_5199Parser() { + if (reclassifyObjectActionName_5199Parser == null) { + EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }; + MessageFormatParser parser = new MessageFormatParser(features); + reclassifyObjectActionName_5199Parser = parser; + } + return reclassifyObjectActionName_5199Parser; + } + + /** + * @generated + */ + private IParser reclassifyObjectActionName_5401Parser; + + /** + * @generated + */ + private IParser getReclassifyObjectActionName_5401Parser() { + if (reclassifyObjectActionName_5401Parser == null) { + EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }; + MessageFormatParser parser = new MessageFormatParser(features); + reclassifyObjectActionName_5401Parser = parser; + } + return reclassifyObjectActionName_5401Parser; + } + + /** + * @generated + */ + private PinParser inputPinLabel_5237Parser; + + /** + * @generated + */ + private IParser getInputPinLabel_5237Parser() { + if (inputPinLabel_5237Parser == null) { + inputPinLabel_5237Parser = new PinParser(); + } + return inputPinLabel_5237Parser; + } + + /** + * @generated + */ + private AppliedStereotypeParser inputPinLabel_5238Parser; + + /** + * @generated + */ + private IParser getInputPinLabel_5238Parser() { + if (inputPinLabel_5238Parser == null) { + inputPinLabel_5238Parser = new AppliedStereotypeParser(); + } + return inputPinLabel_5238Parser; + } + + /** + * @generated + */ + private PinParser valuePinLabel_5302Parser; + + /** + * @generated + */ + private IParser getValuePinLabel_5302Parser() { + if (valuePinLabel_5302Parser == null) { + valuePinLabel_5302Parser = new PinParser(); + } + return valuePinLabel_5302Parser; + } + + /** + * @generated + */ + private PinValueParser valuePinLabel_5303Parser; + + /** + * @generated + */ + private IParser getValuePinLabel_5303Parser() { + if (valuePinLabel_5303Parser == null) { + valuePinLabel_5303Parser = new PinValueParser(); + } + return valuePinLabel_5303Parser; + } + + /** + * @generated + */ + private AppliedStereotypeParser valuePinLabel_5304Parser; + + /** + * @generated + */ + private IParser getValuePinLabel_5304Parser() { + if (valuePinLabel_5304Parser == null) { + valuePinLabel_5304Parser = new AppliedStereotypeParser(); + } + return valuePinLabel_5304Parser; + } + + /** + * @generated + */ + private PinParser actionInputPinLabel_5305Parser; + + /** + * @generated + */ + private IParser getActionInputPinLabel_5305Parser() { + if (actionInputPinLabel_5305Parser == null) { + actionInputPinLabel_5305Parser = new PinParser(); + } + return actionInputPinLabel_5305Parser; + } + + /** + * @generated + */ + private PinValueParser actionInputPinLabel_5306Parser; + + /** + * @generated + */ + private IParser getActionInputPinLabel_5306Parser() { + if (actionInputPinLabel_5306Parser == null) { + actionInputPinLabel_5306Parser = new PinValueParser(); + } + return actionInputPinLabel_5306Parser; + } + + /** + * @generated + */ + private AppliedStereotypeParser actionInputPinLabel_5307Parser; + + /** + * @generated + */ + private IParser getActionInputPinLabel_5307Parser() { + if (actionInputPinLabel_5307Parser == null) { + actionInputPinLabel_5307Parser = new AppliedStereotypeParser(); + } + return actionInputPinLabel_5307Parser; + } + + /** + * @generated + */ + private IParser readIsClassifiedObjectActionName_5200Parser; + + /** + * @generated + */ + private IParser getReadIsClassifiedObjectActionName_5200Parser() { + if (readIsClassifiedObjectActionName_5200Parser == null) { + EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }; + MessageFormatParser parser = new MessageFormatParser(features); + readIsClassifiedObjectActionName_5200Parser = parser; + } + return readIsClassifiedObjectActionName_5200Parser; + } + + /** + * @generated + */ + private IParser readIsClassifiedObjectActionName_5403Parser; + + /** + * @generated + */ + private IParser getReadIsClassifiedObjectActionName_5403Parser() { + if (readIsClassifiedObjectActionName_5403Parser == null) { + EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }; + MessageFormatParser parser = new MessageFormatParser(features); + readIsClassifiedObjectActionName_5403Parser = parser; + } + return readIsClassifiedObjectActionName_5403Parser; + } + + /** + * @generated + */ + private PinParser outputPinLabel_5213Parser; + + /** + * @generated + */ + private IParser getOutputPinLabel_5213Parser() { + if (outputPinLabel_5213Parser == null) { + outputPinLabel_5213Parser = new PinParser(); + } + return outputPinLabel_5213Parser; + } + + /** + * @generated + */ + private AppliedStereotypeParser outputPinLabel_5214Parser; + + /** + * @generated + */ + private IParser getOutputPinLabel_5214Parser() { + if (outputPinLabel_5214Parser == null) { + outputPinLabel_5214Parser = new AppliedStereotypeParser(); + } + return outputPinLabel_5214Parser; + } + + /** + * @generated + */ + private PinParser inputPinLabel_5239Parser; + + /** + * @generated + */ + private IParser getInputPinLabel_5239Parser() { + if (inputPinLabel_5239Parser == null) { + inputPinLabel_5239Parser = new PinParser(); + } + return inputPinLabel_5239Parser; + } + + /** + * @generated + */ + private AppliedStereotypeParser inputPinLabel_5240Parser; + + /** + * @generated + */ + private IParser getInputPinLabel_5240Parser() { + if (inputPinLabel_5240Parser == null) { + inputPinLabel_5240Parser = new AppliedStereotypeParser(); + } + return inputPinLabel_5240Parser; + } + + /** + * @generated + */ + private PinParser valuePinLabel_5308Parser; + + /** + * @generated + */ + private IParser getValuePinLabel_5308Parser() { + if (valuePinLabel_5308Parser == null) { + valuePinLabel_5308Parser = new PinParser(); + } + return valuePinLabel_5308Parser; + } + + /** + * @generated + */ + private PinValueParser valuePinLabel_5309Parser; + + /** + * @generated + */ + private IParser getValuePinLabel_5309Parser() { + if (valuePinLabel_5309Parser == null) { + valuePinLabel_5309Parser = new PinValueParser(); + } + return valuePinLabel_5309Parser; + } + + /** + * @generated + */ + private AppliedStereotypeParser valuePinLabel_5310Parser; + + /** + * @generated + */ + private IParser getValuePinLabel_5310Parser() { + if (valuePinLabel_5310Parser == null) { + valuePinLabel_5310Parser = new AppliedStereotypeParser(); + } + return valuePinLabel_5310Parser; + } + + /** + * @generated + */ + private PinParser actionInputPinLabel_5311Parser; + + /** + * @generated + */ + private IParser getActionInputPinLabel_5311Parser() { + if (actionInputPinLabel_5311Parser == null) { + actionInputPinLabel_5311Parser = new PinParser(); + } + return actionInputPinLabel_5311Parser; + } + + /** + * @generated + */ + private PinValueParser actionInputPinLabel_5312Parser; + + /** + * @generated + */ + private IParser getActionInputPinLabel_5312Parser() { + if (actionInputPinLabel_5312Parser == null) { + actionInputPinLabel_5312Parser = new PinValueParser(); + } + return actionInputPinLabel_5312Parser; + } + + /** + * @generated + */ + private AppliedStereotypeParser actionInputPinLabel_5313Parser; + + /** + * @generated + */ + private IParser getActionInputPinLabel_5313Parser() { + if (actionInputPinLabel_5313Parser == null) { + actionInputPinLabel_5313Parser = new AppliedStereotypeParser(); + } + return actionInputPinLabel_5313Parser; + } + + /** + * @generated + */ private CommentParser commentBody_5138Parser; /** @@ -5373,11 +5711,55 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid case ReadExtentActionNameEditPart.VISUAL_ID: return getReadExtentActionName_5198Parser(); case ReadExtentActionFloatingNameEditPart.VISUAL_ID: - return getReadExtentActionName_5401Parser(); + return getReadExtentActionName_5402Parser(); case OutputPinInReadExtentActionLabelEditPart.VISUAL_ID: return getOutputPinLabel_5211Parser(); case OutputPinInReadExtentActionAppliedStereotypeLabelEditPart.VISUAL_ID: return getOutputPinLabel_5212Parser(); + case ReclassifyObjectActionNameEditPart.VISUAL_ID: + return getReclassifyObjectActionName_5199Parser(); + case ReclassifyObjectActionFloatingNameEditPart.VISUAL_ID: + return getReclassifyObjectActionName_5401Parser(); + case InputPinInReclassifyObjectActionAsObjectLabelEditPart.VISUAL_ID: + return getInputPinLabel_5237Parser(); + case InputPinInReclassifyObjectActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID: + return getInputPinLabel_5238Parser(); + case ValuePinInReclassifyObjectActionAsObjectLabelEditPart.VISUAL_ID: + return getValuePinLabel_5302Parser(); + case ValuePinInReclassifyObjectActionAsObjectValueEditPart.VISUAL_ID: + return getValuePinLabel_5303Parser(); + case ValuePinInReclassifyObjectActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID: + return getValuePinLabel_5304Parser(); + case ActionPinInReclassifyObjectActionAsObjectLabelEditPart.VISUAL_ID: + return getActionInputPinLabel_5305Parser(); + case ActionPinInReclassifyObjectActionAsObjectValueEditPart.VISUAL_ID: + return getActionInputPinLabel_5306Parser(); + case ActionPinInReclassifyObjectActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID: + return getActionInputPinLabel_5307Parser(); + case ReadIsClassifiedObjectActionNameEditPart.VISUAL_ID: + return getReadIsClassifiedObjectActionName_5200Parser(); + case ReadIsClassifiedObjectActionFloatingNameEditPart.VISUAL_ID: + return getReadIsClassifiedObjectActionName_5403Parser(); + case OutputPinInReadIsClassifiedObjectActionLabelEditPart.VISUAL_ID: + return getOutputPinLabel_5213Parser(); + case OutputPinInReadIsClassifiedObjectActionAppliedStereotypeLabelEditPart.VISUAL_ID: + return getOutputPinLabel_5214Parser(); + case InputPinInReadIsClassifiedObjectActionAsObjectLabelEditPart.VISUAL_ID: + return getInputPinLabel_5239Parser(); + case InputPinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID: + return getInputPinLabel_5240Parser(); + case ValuePinInReadIsClassifiedObjectActionAsObjectLabelEditPart.VISUAL_ID: + return getValuePinLabel_5308Parser(); + case ValuePinInReadIsClassifiedObjectActionAsObjectValueEditPart.VISUAL_ID: + return getValuePinLabel_5309Parser(); + case ValuePinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID: + return getValuePinLabel_5310Parser(); + case ActionPinInReadIsClassifiedObjectActionAsObjectLabelEditPart.VISUAL_ID: + return getActionInputPinLabel_5311Parser(); + case ActionPinInReadIsClassifiedObjectActionAsObjectValueEditPart.VISUAL_ID: + return getActionInputPinLabel_5312Parser(); + case ActionPinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID: + return getActionInputPinLabel_5313Parser(); case ObjectFlowNameEditPart.VISUAL_ID: return getObjectFlowName_6001Parser(); case ObjectFlowWeightEditPart.VISUAL_ID: diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/providers/UMLViewProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/providers/UMLViewProvider.java index e6d7ea6b252..9670ba5dd04 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/providers/UMLViewProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/providers/UMLViewProvider.java @@ -317,6 +317,15 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { case ActionPinInClearAssociationActionAsObjectEditPart.VISUAL_ID: case ReadExtentActionEditPart.VISUAL_ID: case OutputPinInReadExtentActionEditPart.VISUAL_ID: + case ReclassifyObjectActionEditPart.VISUAL_ID: + case InputPinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID: + case ValuePinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID: + case ActionPinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID: + case ReadIsClassifiedObjectActionEditPart.VISUAL_ID: + case OutputPinInReadIsClassifiedObjectActionEditPart.VISUAL_ID: + case InputPinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID: + case ValuePinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID: + case ActionPinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID: if (domainElement == null || visualID != UMLVisualIDRegistry.getNodeVisualID(op.getContainerView(), domainElement)) { return false; // visual id in semantic hint should match visual id for domain element } @@ -659,6 +668,24 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { return createReadExtentAction_3120(domainElement, containerView, index, persisted, preferencesHint); case OutputPinInReadExtentActionEditPart.VISUAL_ID: return createOutputPin_3129(domainElement, containerView, index, persisted, preferencesHint); + case ReclassifyObjectActionEditPart.VISUAL_ID: + return createReclassifyObjectAction_3121(domainElement, containerView, index, persisted, preferencesHint); + case InputPinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID: + return createInputPin_3141(domainElement, containerView, index, persisted, preferencesHint); + case ValuePinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID: + return createValuePin_3154(domainElement, containerView, index, persisted, preferencesHint); + case ActionPinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID: + return createActionInputPin_3167(domainElement, containerView, index, persisted, preferencesHint); + case ReadIsClassifiedObjectActionEditPart.VISUAL_ID: + return createReadIsClassifiedObjectAction_3122(domainElement, containerView, index, persisted, preferencesHint); + case OutputPinInReadIsClassifiedObjectActionEditPart.VISUAL_ID: + return createOutputPin_3130(domainElement, containerView, index, persisted, preferencesHint); + case InputPinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID: + return createInputPin_3142(domainElement, containerView, index, persisted, preferencesHint); + case ValuePinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID: + return createValuePin_3155(domainElement, containerView, index, persisted, preferencesHint); + case ActionPinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID: + return createActionInputPin_3168(domainElement, containerView, index, persisted, preferencesHint); } // can't happen, provided #provides(CreateNodeViewOperation) is correct return null; @@ -3796,11 +3823,11 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "ReadExtentAction"); Node label5198 = createLabel(node, UMLVisualIDRegistry.getType(ReadExtentActionNameEditPart.VISUAL_ID)); - Node label5401 = createLabel(node, UMLVisualIDRegistry.getType(ReadExtentActionFloatingNameEditPart.VISUAL_ID)); - label5401.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); - Location location5401 = (Location) label5401.getLayoutConstraint(); - location5401.setX(0); - location5401.setY(5); + Node label5402 = createLabel(node, UMLVisualIDRegistry.getType(ReadExtentActionFloatingNameEditPart.VISUAL_ID)); + label5402.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location5402 = (Location) label5402.getLayoutConstraint(); + location5402.setX(0); + location5402.setY(5); return node; } @@ -3833,6 +3860,252 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { /** * @generated */ + public Node createReclassifyObjectAction_3121(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(UMLVisualIDRegistry.getType(ReclassifyObjectActionEditPart.VISUAL_ID)); + ViewUtil.insertChildView(containerView, node, index, persisted); + node.setElement(domainElement); + // initializeFromPreferences + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "ReclassifyObjectAction"); + Node label5199 = createLabel(node, UMLVisualIDRegistry.getType(ReclassifyObjectActionNameEditPart.VISUAL_ID)); + Node label5401 = createLabel(node, UMLVisualIDRegistry.getType(ReclassifyObjectActionFloatingNameEditPart.VISUAL_ID)); + label5401.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location5401 = (Location) label5401.getLayoutConstraint(); + location5401.setX(0); + location5401.setY(5); + return node; + } + + /** + * @generated + */ + public Node createInputPin_3141(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(UMLVisualIDRegistry.getType(InputPinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID)); + ViewUtil.insertChildView(containerView, node, index, persisted); + node.setElement(domainElement); + // initializeFromPreferences + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "InputPin"); + Node label5237 = createLabel(node, UMLVisualIDRegistry.getType(InputPinInReclassifyObjectActionAsObjectLabelEditPart.VISUAL_ID)); + label5237.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location5237 = (Location) label5237.getLayoutConstraint(); + location5237.setX(0); + location5237.setY(5); + Node label5238 = createLabel(node, UMLVisualIDRegistry.getType(InputPinInReclassifyObjectActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID)); + label5238.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location5238 = (Location) label5238.getLayoutConstraint(); + location5238.setX(0); + location5238.setY(5); + return node; + } + + /** + * @generated + */ + public Node createValuePin_3154(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(UMLVisualIDRegistry.getType(ValuePinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID)); + ViewUtil.insertChildView(containerView, node, index, persisted); + node.setElement(domainElement); + // initializeFromPreferences + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "ValuePin"); + Node label5302 = createLabel(node, UMLVisualIDRegistry.getType(ValuePinInReclassifyObjectActionAsObjectLabelEditPart.VISUAL_ID)); + label5302.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location5302 = (Location) label5302.getLayoutConstraint(); + location5302.setX(0); + location5302.setY(5); + Node label5303 = createLabel(node, UMLVisualIDRegistry.getType(ValuePinInReclassifyObjectActionAsObjectValueEditPart.VISUAL_ID)); + label5303.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location5303 = (Location) label5303.getLayoutConstraint(); + location5303.setX(0); + location5303.setY(5); + Node label5304 = createLabel(node, UMLVisualIDRegistry.getType(ValuePinInReclassifyObjectActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID)); + label5304.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location5304 = (Location) label5304.getLayoutConstraint(); + location5304.setX(0); + location5304.setY(5); + return node; + } + + /** + * @generated + */ + public Node createActionInputPin_3167(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(UMLVisualIDRegistry.getType(ActionPinInReclassifyObjectActionAsObjectEditPart.VISUAL_ID)); + ViewUtil.insertChildView(containerView, node, index, persisted); + node.setElement(domainElement); + // initializeFromPreferences + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "ActionInputPin"); + Node label5305 = createLabel(node, UMLVisualIDRegistry.getType(ActionPinInReclassifyObjectActionAsObjectLabelEditPart.VISUAL_ID)); + label5305.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location5305 = (Location) label5305.getLayoutConstraint(); + location5305.setX(0); + location5305.setY(5); + Node label5306 = createLabel(node, UMLVisualIDRegistry.getType(ActionPinInReclassifyObjectActionAsObjectValueEditPart.VISUAL_ID)); + label5306.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location5306 = (Location) label5306.getLayoutConstraint(); + location5306.setX(0); + location5306.setY(5); + Node label5307 = createLabel(node, UMLVisualIDRegistry.getType(ActionPinInReclassifyObjectActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID)); + label5307.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location5307 = (Location) label5307.getLayoutConstraint(); + location5307.setX(0); + location5307.setY(5); + return node; + } + + /** + * @generated + */ + public Node createReadIsClassifiedObjectAction_3122(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(UMLVisualIDRegistry.getType(ReadIsClassifiedObjectActionEditPart.VISUAL_ID)); + ViewUtil.insertChildView(containerView, node, index, persisted); + node.setElement(domainElement); + // initializeFromPreferences + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "ReadIsClassifiedObjectAction"); + Node label5200 = createLabel(node, UMLVisualIDRegistry.getType(ReadIsClassifiedObjectActionNameEditPart.VISUAL_ID)); + Node label5403 = createLabel(node, UMLVisualIDRegistry.getType(ReadIsClassifiedObjectActionFloatingNameEditPart.VISUAL_ID)); + label5403.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location5403 = (Location) label5403.getLayoutConstraint(); + location5403.setX(0); + location5403.setY(5); + return node; + } + + /** + * @generated + */ + public Node createOutputPin_3130(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(UMLVisualIDRegistry.getType(OutputPinInReadIsClassifiedObjectActionEditPart.VISUAL_ID)); + ViewUtil.insertChildView(containerView, node, index, persisted); + node.setElement(domainElement); + // initializeFromPreferences + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "OutputPin"); + Node label5213 = createLabel(node, UMLVisualIDRegistry.getType(OutputPinInReadIsClassifiedObjectActionLabelEditPart.VISUAL_ID)); + label5213.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location5213 = (Location) label5213.getLayoutConstraint(); + location5213.setX(0); + location5213.setY(5); + Node label5214 = createLabel(node, UMLVisualIDRegistry.getType(OutputPinInReadIsClassifiedObjectActionAppliedStereotypeLabelEditPart.VISUAL_ID)); + label5214.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location5214 = (Location) label5214.getLayoutConstraint(); + location5214.setX(0); + location5214.setY(5); + return node; + } + + /** + * @generated + */ + public Node createInputPin_3142(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(UMLVisualIDRegistry.getType(InputPinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID)); + ViewUtil.insertChildView(containerView, node, index, persisted); + node.setElement(domainElement); + // initializeFromPreferences + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "InputPin"); + Node label5239 = createLabel(node, UMLVisualIDRegistry.getType(InputPinInReadIsClassifiedObjectActionAsObjectLabelEditPart.VISUAL_ID)); + label5239.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location5239 = (Location) label5239.getLayoutConstraint(); + location5239.setX(0); + location5239.setY(5); + Node label5240 = createLabel(node, UMLVisualIDRegistry.getType(InputPinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID)); + label5240.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location5240 = (Location) label5240.getLayoutConstraint(); + location5240.setX(0); + location5240.setY(5); + return node; + } + + /** + * @generated + */ + public Node createValuePin_3155(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(UMLVisualIDRegistry.getType(ValuePinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID)); + ViewUtil.insertChildView(containerView, node, index, persisted); + node.setElement(domainElement); + // initializeFromPreferences + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "ValuePin"); + Node label5308 = createLabel(node, UMLVisualIDRegistry.getType(ValuePinInReadIsClassifiedObjectActionAsObjectLabelEditPart.VISUAL_ID)); + label5308.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location5308 = (Location) label5308.getLayoutConstraint(); + location5308.setX(0); + location5308.setY(5); + Node label5309 = createLabel(node, UMLVisualIDRegistry.getType(ValuePinInReadIsClassifiedObjectActionAsObjectValueEditPart.VISUAL_ID)); + label5309.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location5309 = (Location) label5309.getLayoutConstraint(); + location5309.setX(0); + location5309.setY(5); + Node label5310 = createLabel(node, UMLVisualIDRegistry.getType(ValuePinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID)); + label5310.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location5310 = (Location) label5310.getLayoutConstraint(); + location5310.setX(0); + location5310.setY(5); + return node; + } + + /** + * @generated + */ + public Node createActionInputPin_3168(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(UMLVisualIDRegistry.getType(ActionPinInReadIsClassifiedObjectActionAsObjectEditPart.VISUAL_ID)); + ViewUtil.insertChildView(containerView, node, index, persisted); + node.setElement(domainElement); + // initializeFromPreferences + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "ActionInputPin"); + Node label5311 = createLabel(node, UMLVisualIDRegistry.getType(ActionPinInReadIsClassifiedObjectActionAsObjectLabelEditPart.VISUAL_ID)); + label5311.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location5311 = (Location) label5311.getLayoutConstraint(); + location5311.setX(0); + location5311.setY(5); + Node label5312 = createLabel(node, UMLVisualIDRegistry.getType(ActionPinInReadIsClassifiedObjectActionAsObjectValueEditPart.VISUAL_ID)); + label5312.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location5312 = (Location) label5312.getLayoutConstraint(); + location5312.setX(0); + location5312.setY(5); + Node label5313 = createLabel(node, UMLVisualIDRegistry.getType(ActionPinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID)); + label5313.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location5313 = (Location) label5313.getLayoutConstraint(); + location5313.setX(0); + location5313.setY(5); + return node; + } + + /** + * @generated + */ public Node createValueSpecificationAction_3076(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { Shape node = NotationFactory.eINSTANCE.createShape(); node.getStyles().add(NotationFactory.eINSTANCE.createHintedDiagramLinkStyle()); |