From dba99fb3a8703629505cd59e5f7f49722db34158 Mon Sep 17 00:00:00 2001 From: atischenko Date: Sun, 25 Jan 2015 14:10:04 +0100 Subject: Merge ReadExtentAction in activityD to master. Signed-off-by: atischenko --- .../messages.properties | 2 + .../model/activityDiagram.gmfgen | 227 +++++- .../plugin.properties | 2 + .../plugin.xml | 50 +- .../OutputPinInReadExtentActionCreateCommand.java | 105 +++ .../commands/ReadExtentActionCreateCommand.java | 101 +++ ...ExtentActionAppliedStereotypeLabelEditPart.java | 788 ++++++++++++++++++++ .../parts/OutputPinInReadExtentActionEditPart.java | 251 +++++++ .../OutputPinInReadExtentActionLabelEditPart.java | 785 ++++++++++++++++++++ .../edit/parts/ReadExtentActionEditPart.java | 332 +++++++++ .../ReadExtentActionFloatingNameEditPart.java | 786 ++++++++++++++++++++ .../edit/parts/ReadExtentActionNameEditPart.java | 797 +++++++++++++++++++++ .../activity/edit/parts/UMLEditPartFactory.java | 12 + ...ivityContentCompartmentCanonicalEditPolicy.java | 2 + ...tyContentCompartmentItemSemanticEditPolicy.java | 6 + ...ityCNContentCompartmentCanonicalEditPolicy.java | 2 + ...CNContentCompartmentItemSemanticEditPolicy.java | 6 + .../ActivityDiagramCanonicalEditPolicy.java | 14 + ...itionContentCompartmentCanonicalEditPolicy.java | 2 + ...yNodeContentCompartmentCanonicalEditPolicy.java | 2 + ...egionContentCompartmentCanonicalEditPolicy.java | 2 + ...onContentCompartmentItemSemanticEditPolicy.java | 6 + ...yNodeContentCompartmentCanonicalEditPolicy.java | 2 + ...inInReadExtentActionItemSemanticEditPolicy.java | 192 +++++ .../ReadExtentActionCanonicalEditPolicy.java | 155 ++++ .../ReadExtentActionItemSemanticEditPolicy.java | 240 +++++++ ...yNodeContentCompartmentCanonicalEditPolicy.java | 2 + ...yNodeContentCompartmentCanonicalEditPolicy.java | 2 + .../uml/diagram/activity/part/Messages.java | 10 + .../diagram/activity/part/UMLDiagramUpdater.java | 107 +++ .../diagram/activity/part/UMLPaletteFactory.java | 21 +- .../diagram/activity/part/UMLVisualIDRegistry.java | 73 ++ .../activity/providers/ElementInitializers.java | 43 ++ .../activity/providers/UMLElementTypes.java | 18 + .../activity/providers/UMLParserProvider.java | 72 ++ .../activity/providers/UMLViewProvider.java | 54 ++ 36 files changed, 5238 insertions(+), 33 deletions(-) create mode 100644 plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInReadExtentActionCreateCommand.java create mode 100644 plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ReadExtentActionCreateCommand.java create mode 100644 plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/OutputPinInReadExtentActionAppliedStereotypeLabelEditPart.java create mode 100644 plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/OutputPinInReadExtentActionEditPart.java create mode 100644 plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/OutputPinInReadExtentActionLabelEditPart.java create mode 100644 plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ReadExtentActionEditPart.java create mode 100644 plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ReadExtentActionFloatingNameEditPart.java create mode 100644 plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ReadExtentActionNameEditPart.java create mode 100644 plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/OutputPinInReadExtentActionItemSemanticEditPolicy.java create mode 100644 plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ReadExtentActionCanonicalEditPolicy.java create mode 100644 plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ReadExtentActionItemSemanticEditPolicy.java (limited to 'plugins') 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 d95ab2fbee5..67ebdbba545 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 @@ -562,3 +562,5 @@ DestroyLinkAction3CreationTool_title=Destroy Link Action DestroyLinkAction3CreationTool_desc=Create a Destroy Link Action node ClearAssociationAction3CreationTool_title=Clear Association Action ClearAssociationAction3CreationTool_desc=Create a Clear Association Action +ReadExtentAction4CreationTool_title=Read Extent Action +ReadExtentAction4CreationTool_desc=Create a Read Extent 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 4a0cc64291f..05faf5d93be 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 @@ -13292,6 +13292,188 @@ parser="/0/@labelParsers/@implementations.1"/> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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"/> + + 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"/> + 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"/> + 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"/> + 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"/> 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 871ff4d140f..445ff01e917 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 @@ -192,3 +192,5 @@ metatype.name.ClearAssociationAction_3119=ClearAssotiationAction metatype.name.InputPin_3140=InputPin metatype.name.ValuePin_3153=ValuePin metatype.name.ActionInputPin_3166=ActionInputPin +metatype.name.ReadExtentAction_3120=ReadExtentAction +metatype.name.OutputPin_3129=OutputPin 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 112be9aef08..0a4ffb1d0c4 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 @@ - + @@ -179,13 +179,13 @@ - + - + @@ -211,16 +211,6 @@ - - - - - + + + + + + + + + + + + + + @@ -3505,6 +3515,16 @@ self.structuralFeature.oclAsType(Property).opposite.type = self.object.type]]> path="" small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/ClearAssociationAction.gif"> + + id="createClearAssociationAction3CreationTool" path="/createNodes1Group/createOtherActionsGroup"> + + 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.OutputPinInReadExtentActionAppliedStereotypeLabelEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public OutputPinInReadExtentActionAppliedStereotypeLabelEditPart(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() { + + @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_3129, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.OutputPinInReadExtentActionAppliedStereotypeLabelEditPart.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 int 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 true 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 true 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/OutputPinInReadExtentActionEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/OutputPinInReadExtentActionEditPart.java new file mode 100644 index 00000000000..98bfe04ce81 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/OutputPinInReadExtentActionEditPart.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.OutputPinInReadExtentActionItemSemanticEditPolicy; +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 OutputPinInReadExtentActionEditPart extends AbstractPinEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 3129; + + /** + * @generated + */ + protected IFigure contentPane; + + /** + * @generated + */ + protected IFigure primaryShape; + + /** + * @generated + */ + public OutputPinInReadExtentActionEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, getPrimaryDragEditPolicy()); + installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new OutputPinInReadExtentActionItemSemanticEditPolicy()); + 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 OutputPinInReadExtentActionLabelEditPart.VISUAL_ID: + case OutputPinInReadExtentActionAppliedStereotypeLabelEditPart.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 OutputPinInReadExtentActionLabelEditPart) { + IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure()); + borderItemContainer.add(borderItemEditPart.getFigure(), locator); + } else if (borderItemEditPart instanceof OutputPinInReadExtentActionAppliedStereotypeLabelEditPart) { + 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 generated 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(OutputPinInReadExtentActionLabelEditPart.VISUAL_ID)); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/OutputPinInReadExtentActionLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/OutputPinInReadExtentActionLabelEditPart.java new file mode 100644 index 00000000000..4b45f265958 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/OutputPinInReadExtentActionLabelEditPart.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.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.editparts.AbstractLabelEditPart; +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 OutputPinInReadExtentActionLabelEditPart extends AbstractLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 5211; + + /** + * @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.OutputPinInReadExtentActionLabelEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public OutputPinInReadExtentActionLabelEditPart(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() { + + @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_3129, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.OutputPinInReadExtentActionLabelEditPart.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 int 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 true 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 true 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/ReadExtentActionEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ReadExtentActionEditPart.java new file mode 100644 index 00000000000..5a9f9bded2b --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ReadExtentActionEditPart.java @@ -0,0 +1,332 @@ +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.ReadExtentActionItemSemanticEditPolicy; +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 ReadExtentActionEditPart extends RoundedCompartmentEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 3120; + + /** + * @generated + */ + protected IFigure contentPane; + + /** + * @generated + */ + protected IFigure primaryShape; + + /** + * @generated + */ + public ReadExtentActionEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy()); + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ReadExtentActionItemSemanticEditPolicy()); + 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.ReadExtentActionCanonicalEditPolicy()); + 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 ReadExtentActionFloatingNameEditPart.VISUAL_ID: + return new BorderItemSelectionEditPolicy() { + + @Override + protected List createSelectionHandles() { + MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost()); + mh.setBorder(null); + return Collections.singletonList(mh); + } + }; + case OutputPinInReadExtentActionEditPart.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 ReadExtentActionNameEditPart) { + ((ReadExtentActionNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); + return true; + } + // Papyrus Gencode :Affixed Pin locator for Actions + if (childEditPart instanceof OutputPinInReadExtentActionEditPart) { + IBorderItemLocator locator = new PinPositionLocator(getMainFigure(), PositionConstants.EAST); + getBorderedFigure().getBorderItemContainer().add(((OutputPinInReadExtentActionEditPart) childEditPart).getFigure(), locator); + return true; + } + return false; + } + + /** + * @generated + */ + protected boolean removeFixedChild(EditPart childEditPart) { + if (childEditPart instanceof ReadExtentActionNameEditPart) { + return true; + } + if (childEditPart instanceof OutputPinInReadExtentActionEditPart) { + getBorderedFigure().getBorderItemContainer().remove(((OutputPinInReadExtentActionEditPart) 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 ReadExtentActionFloatingNameEditPart) { + 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 generated 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(ReadExtentActionNameEditPart.VISUAL_ID)); + } +} 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 new file mode 100644 index 00000000000..fb084c6ab01 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ReadExtentActionFloatingNameEditPart.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 ReadExtentActionFloatingNameEditPart 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.ReadExtentActionFloatingNameEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public ReadExtentActionFloatingNameEditPart(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() { + + @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.ReadExtentAction_3120, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadExtentActionFloatingNameEditPart.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 int 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 true 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 true 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/ReadExtentActionNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ReadExtentActionNameEditPart.java new file mode 100644 index 00000000000..8a1d0f9dd8f --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ReadExtentActionNameEditPart.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 ReadExtentActionNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit { + + /** + * @generated + */ + public static final int VISUAL_ID = 5198; + + /** + * @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 ReadExtentActionNameEditPart(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() { + + @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.ReadExtentAction_3120, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadExtentActionNameEditPart.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 int 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 true 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 true 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 19ac68f7c40..aebf2d4bd2d 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 @@ -885,6 +885,18 @@ public class UMLEditPartFactory implements EditPartFactory { return new ActionPinInClearAssociationActionAsObjectValueEditPart(view); case ActionPinInClearAssociationActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID: return new ActionPinInClearAssociationActionAsObjectAppliedStereotypeLabelEditPart(view); + case ReadExtentActionEditPart.VISUAL_ID: + return new ReadExtentActionEditPart(view); + case ReadExtentActionNameEditPart.VISUAL_ID: + return new ReadExtentActionNameEditPart(view); + case ReadExtentActionFloatingNameEditPart.VISUAL_ID: + return new ReadExtentActionFloatingNameEditPart(view); + case OutputPinInReadExtentActionEditPart.VISUAL_ID: + return new OutputPinInReadExtentActionEditPart(view); + case OutputPinInReadExtentActionLabelEditPart.VISUAL_ID: + return new OutputPinInReadExtentActionLabelEditPart(view); + case OutputPinInReadExtentActionAppliedStereotypeLabelEditPart.VISUAL_ID: + return new OutputPinInReadExtentActionAppliedStereotypeLabelEditPart(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/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 80fe9bee5ff..a30b5b05845 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 @@ -81,6 +81,7 @@ import org.eclipse.papyrus.uml.diagram.activity.edit.parts.JoinNodeEditPart; 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.ReadLinkActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadSelfActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadStructuralFeatureActionEditPart; @@ -200,6 +201,7 @@ public class ActivityActivityContentCompartmentCanonicalEditPolicy extends Canon case ReadLinkActionEditPart.VISUAL_ID: case DestroyLinkActionEditPart.VISUAL_ID: case ClearAssociationActionEditPart.VISUAL_ID: + case ReadExtentActionEditPart.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 ddc516d4234..853de375a86 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 @@ -335,6 +335,12 @@ public class ActivityActivityContentCompartmentItemSemanticEditPolicy extends UM req.setContainmentFeature(containmentFeature); return getGEFWrapper(getSemanticCreationCommand(req)); } + if (UMLElementTypes.ReadExtentAction_3120 == 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 ab9fb77d5f1..6c135b3ae22 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 @@ -68,6 +68,7 @@ import org.eclipse.papyrus.uml.diagram.activity.edit.parts.JoinNodeEditPart; 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.ReadLinkActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadSelfActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadStructuralFeatureActionEditPart; @@ -204,6 +205,7 @@ public class ActivityCNContentCompartmentCanonicalEditPolicy extends CanonicalEd case ReadLinkActionEditPart.VISUAL_ID: case DestroyLinkActionEditPart.VISUAL_ID: case ClearAssociationActionEditPart.VISUAL_ID: + case ReadExtentActionEditPart.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 72737616f11..fc0dd192402 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 @@ -322,6 +322,12 @@ public class ActivityCNContentCompartmentItemSemanticEditPolicy extends UMLBaseI req.setContainmentFeature(containmentFeature); return getGEFWrapper(getSemanticCreationCommand(req)); } + if (UMLElementTypes.ReadExtentAction_3120 == 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 8a5c18a1862..28cc054ec7d 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 @@ -1209,6 +1209,20 @@ public class ActivityDiagramCanonicalEditPolicy extends CanonicalEditPolicy { domain2NotationMap.putView(view.getElement(), view); break; } + case ReadExtentActionEditPart.VISUAL_ID: { + if (!domain2NotationMap.containsKey(view.getElement())) { + result.addAll(UMLDiagramUpdater.INSTANCE.getReadExtentAction_3120ContainedLinks(view)); + } + domain2NotationMap.putView(view.getElement(), view); + break; + } + case OutputPinInReadExtentActionEditPart.VISUAL_ID: { + if (!domain2NotationMap.containsKey(view.getElement())) { + result.addAll(UMLDiagramUpdater.INSTANCE.getOutputPin_3129ContainedLinks(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 67851226854..6445779f290 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 @@ -79,6 +79,7 @@ import org.eclipse.papyrus.uml.diagram.activity.edit.parts.JoinNodeEditPart; 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.ReadLinkActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadSelfActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadStructuralFeatureActionEditPart; @@ -213,6 +214,7 @@ public class ActivityPartitionActivityPartitionContentCompartmentCanonicalEditPo case ReadLinkActionEditPart.VISUAL_ID: case DestroyLinkActionEditPart.VISUAL_ID: case ClearAssociationActionEditPart.VISUAL_ID: + case ReadExtentActionEditPart.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 14d8b7ec928..297572f9e93 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 @@ -78,6 +78,7 @@ import org.eclipse.papyrus.uml.diagram.activity.edit.parts.JoinNodeEditPart; 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.ReadLinkActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadSelfActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadStructuralFeatureActionEditPart; @@ -211,6 +212,7 @@ public class ExpansionRegionStructuredActivityNodeContentCompartmentCanonicalEdi case ReadLinkActionEditPart.VISUAL_ID: case DestroyLinkActionEditPart.VISUAL_ID: case ClearAssociationActionEditPart.VISUAL_ID: + case ReadExtentActionEditPart.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/InterruptibleActivityRegionInterruptibleActivityRegionContentCompartmentCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/InterruptibleActivityRegionInterruptibleActivityRegionContentCompartmentCanonicalEditPolicy.java index 061f0537eae..df9cfb487d1 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 @@ -78,6 +78,7 @@ import org.eclipse.papyrus.uml.diagram.activity.edit.parts.JoinNodeEditPart; 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.ReadLinkActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadSelfActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadStructuralFeatureActionEditPart; @@ -211,6 +212,7 @@ public class InterruptibleActivityRegionInterruptibleActivityRegionContentCompar case ReadLinkActionEditPart.VISUAL_ID: case DestroyLinkActionEditPart.VISUAL_ID: case ClearAssociationActionEditPart.VISUAL_ID: + case ReadExtentActionEditPart.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 b2da8406b78..4a0dc409efb 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 @@ -317,6 +317,12 @@ public class InterruptibleActivityRegionInterruptibleActivityRegionContentCompar req.setContainmentFeature(containmentFeature); return getGEFWrapper(getSemanticCreationCommand(req)); } + if (UMLElementTypes.ReadExtentAction_3120 == 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 6f6ab112a30..96086356e03 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 @@ -78,6 +78,7 @@ import org.eclipse.papyrus.uml.diagram.activity.edit.parts.JoinNodeEditPart; 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.ReadLinkActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadSelfActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadStructuralFeatureActionEditPart; @@ -211,6 +212,7 @@ public class LoopNodeStructuredActivityNodeContentCompartmentCanonicalEditPolicy case ReadLinkActionEditPart.VISUAL_ID: case DestroyLinkActionEditPart.VISUAL_ID: case ClearAssociationActionEditPart.VISUAL_ID: + case ReadExtentActionEditPart.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/OutputPinInReadExtentActionItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/OutputPinInReadExtentActionItemSemanticEditPolicy.java new file mode 100644 index 00000000000..eb6d16c259c --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/OutputPinInReadExtentActionItemSemanticEditPolicy.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 OutputPinInReadExtentActionItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { + + /** + * @generated + */ + public OutputPinInReadExtentActionItemSemanticEditPolicy() { + super(UMLElementTypes.OutputPin_3129); + } + + /** + * @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/ReadExtentActionCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ReadExtentActionCanonicalEditPolicy.java new file mode 100644 index 00000000000..cffb432c030 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ReadExtentActionCanonicalEditPolicy.java @@ -0,0 +1,155 @@ +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.OutputPinInReadExtentActionEditPart; +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 ReadExtentActionCanonicalEditPolicy 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.getReadExtentAction_Result(); + } + + /** + * @generated + */ + protected List getSemanticChildrenList() { + View viewObject = (View) getHost().getModel(); + LinkedList result = new LinkedList(); + List childDescriptors = UMLDiagramUpdater.INSTANCE.getReadExtentAction_3120SemanticChildren(viewObject); + for (UMLNodeDescriptor d : childDescriptors) { + result.add(d.getModelElement()); + } + return result; + } + + /** + * @generated + */ + protected boolean isOrphaned(Collection semanticChildren, final View view) { + return isMyDiagramElement(view) && !semanticChildren.contains(view.getElement()); + } + + /** + * @generated + */ + private boolean isMyDiagramElement(View view) { + return OutputPinInReadExtentActionEditPart.VISUAL_ID == UMLVisualIDRegistry.getVisualID(view); + } + + /** + * @generated + */ + protected void refreshSemantic() { + if (resolveSemanticElement() == null) { + return; + } + LinkedList createdViews = new LinkedList(); + List childDescriptors = UMLDiagramUpdater.INSTANCE.getReadExtentAction_3120SemanticChildren((View) getHost().getModel()); + LinkedList orphaned = new LinkedList(); + // we care to check only views we recognize as ours + LinkedList knownViewChildren = new LinkedList(); + 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 descriptorsIterator = childDescriptors.iterator(); descriptorsIterator.hasNext();) { + UMLNodeDescriptor next = descriptorsIterator.next(); + String hint = UMLVisualIDRegistry.getType(next.getVisualID()); + LinkedList perfectMatch = new LinkedList(); // 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 viewDescriptors = new ArrayList(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 nl = (List) 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/ReadExtentActionItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ReadExtentActionItemSemanticEditPolicy.java new file mode 100644 index 00000000000..bef5873e9a1 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ReadExtentActionItemSemanticEditPolicy.java @@ -0,0 +1,240 @@ +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 ReadExtentActionItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { + + /** + * @generated + */ + public ReadExtentActionItemSemanticEditPolicy() { + super(UMLElementTypes.ReadExtentAction_3120); + } + + /** + * @generated + */ + protected Command getCreateCommand(CreateElementRequest req) { + IElementType requestElementType = req.getElementType(); + if (requestElementType == null) { + return super.getCreateCommand(req); + } + if (UMLElementTypes.OutputPin_3129 == requestElementType) { + // adjust the containment feature + EReference containmentFeature = UMLPackage.eINSTANCE.getReadExtentAction_Result(); + 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 41e5bca6166..55b828767db 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 @@ -78,6 +78,7 @@ import org.eclipse.papyrus.uml.diagram.activity.edit.parts.JoinNodeEditPart; 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.ReadLinkActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadSelfActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadStructuralFeatureActionEditPart; @@ -211,6 +212,7 @@ public class SequenceNodeStructuredActivityNodeContentCompartmentCanonicalEditPo case ReadLinkActionEditPart.VISUAL_ID: case DestroyLinkActionEditPart.VISUAL_ID: case ClearAssociationActionEditPart.VISUAL_ID: + case ReadExtentActionEditPart.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 3a992333687..9fc992842d9 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 @@ -78,6 +78,7 @@ import org.eclipse.papyrus.uml.diagram.activity.edit.parts.JoinNodeEditPart; 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.ReadLinkActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadSelfActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadStructuralFeatureActionEditPart; @@ -211,6 +212,7 @@ public class StructuredActivityNodeStructuredActivityNodeContentCompartmentCanon case ReadLinkActionEditPart.VISUAL_ID: case DestroyLinkActionEditPart.VISUAL_ID: case ClearAssociationActionEditPart.VISUAL_ID: + case ReadExtentActionEditPart.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/part/Messages.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/part/Messages.java index 7b9b94f356a..f2029a6c4d7 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 @@ -973,6 +973,16 @@ public class Messages extends NLS { */ public static String ClearAssociationAction3CreationTool_desc; + /** + * @generated + */ + public static String ReadExtentAction4CreationTool_title; + + /** + * @generated + */ + public static String ReadExtentAction4CreationTool_desc; + /** * @generated */ 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 2badb2d5ca7..f52364eddf0 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 @@ -78,6 +78,7 @@ import org.eclipse.uml2.uml.OutputPin; 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.ReadLinkAction; import org.eclipse.uml2.uml.ReadSelfAction; import org.eclipse.uml2.uml.ReadStructuralFeatureAction; @@ -169,6 +170,8 @@ public class UMLDiagramUpdater implements DiagramUpdater { return getDestroyLinkAction_3118SemanticChildren(view); case ClearAssociationActionEditPart.VISUAL_ID: return getClearAssociationAction_3119SemanticChildren(view); + case ReadExtentActionEditPart.VISUAL_ID: + return getReadExtentAction_3120SemanticChildren(view); case ActivityActivityParametersCompartmentEditPart.VISUAL_ID: return getActivityActivityFigureParameterCompartment_7001SemanticChildren(view); case ActivityActivityPreConditionsCompartmentEditPart.VISUAL_ID: @@ -981,6 +984,25 @@ public class UMLDiagramUpdater implements DiagramUpdater { return result; } + /** + * @generated + */ + public List getReadExtentAction_3120SemanticChildren(View view) { + if (!view.isSetElement()) { + return Collections.emptyList(); + } + ReadExtentAction modelElement = (ReadExtentAction) view.getElement(); + LinkedList result = new LinkedList(); + { + OutputPin childElement = modelElement.getResult(); + int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement); + if (visualID == OutputPinInReadExtentActionEditPart.VISUAL_ID) { + result.add(new UMLNodeDescriptor(childElement, visualID)); + } + } + return result; + } + /** * @generated */ @@ -3075,6 +3097,10 @@ public class UMLDiagramUpdater implements DiagramUpdater { return getValuePin_3153ContainedLinks(view); case ActionPinInClearAssociationActionAsObjectEditPart.VISUAL_ID: return getActionInputPin_3166ContainedLinks(view); + case ReadExtentActionEditPart.VISUAL_ID: + return getReadExtentAction_3120ContainedLinks(view); + case OutputPinInReadExtentActionEditPart.VISUAL_ID: + return getOutputPin_3129ContainedLinks(view); case ObjectFlowEditPart.VISUAL_ID: return getObjectFlow_4003ContainedLinks(view); case ControlFlowEditPart.VISUAL_ID: @@ -3356,6 +3382,10 @@ public class UMLDiagramUpdater implements DiagramUpdater { return getValuePin_3153IncomingLinks(view); case ActionPinInClearAssociationActionAsObjectEditPart.VISUAL_ID: return getActionInputPin_3166IncomingLinks(view); + case ReadExtentActionEditPart.VISUAL_ID: + return getReadExtentAction_3120IncomingLinks(view); + case OutputPinInReadExtentActionEditPart.VISUAL_ID: + return getOutputPin_3129IncomingLinks(view); case ObjectFlowEditPart.VISUAL_ID: return getObjectFlow_4003IncomingLinks(view); case ControlFlowEditPart.VISUAL_ID: @@ -3637,6 +3667,10 @@ public class UMLDiagramUpdater implements DiagramUpdater { return getValuePin_3153OutgoingLinks(view); case ActionPinInClearAssociationActionAsObjectEditPart.VISUAL_ID: return getActionInputPin_3166OutgoingLinks(view); + case ReadExtentActionEditPart.VISUAL_ID: + return getReadExtentAction_3120OutgoingLinks(view); + case OutputPinInReadExtentActionEditPart.VISUAL_ID: + return getOutputPin_3129OutgoingLinks(view); case ObjectFlowEditPart.VISUAL_ID: return getObjectFlow_4003OutgoingLinks(view); case ControlFlowEditPart.VISUAL_ID: @@ -4595,6 +4629,25 @@ public class UMLDiagramUpdater implements DiagramUpdater { return Collections.emptyList(); } + /** + * @generated + */ + public List getReadExtentAction_3120ContainedLinks(View view) { + ReadExtentAction modelElement = (ReadExtentAction) view.getElement(); + LinkedList result = new LinkedList(); + 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 getOutputPin_3129ContainedLinks(View view) { + return Collections.emptyList(); + } + /** * @generated */ @@ -6436,6 +6489,35 @@ public class UMLDiagramUpdater implements DiagramUpdater { return result; } + /** + * @generated + */ + public List getReadExtentAction_3120IncomingLinks(View view) { + ReadExtentAction modelElement = (ReadExtentAction) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + LinkedList result = new LinkedList(); + 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 getOutputPin_3129IncomingLinks(View view) { + OutputPin modelElement = (OutputPin) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + LinkedList result = new LinkedList(); + 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 */ @@ -8026,6 +8108,31 @@ public class UMLDiagramUpdater implements DiagramUpdater { return result; } + /** + * @generated + */ + public List getReadExtentAction_3120OutgoingLinks(View view) { + ReadExtentAction modelElement = (ReadExtentAction) view.getElement(); + LinkedList result = new LinkedList(); + 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 getOutputPin_3129OutgoingLinks(View view) { + OutputPin modelElement = (OutputPin) view.getElement(); + LinkedList result = new LinkedList(); + result.addAll(getOutgoingTypeModelFacetLinks_ObjectFlow_4003(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_ControlFlow_4004(modelElement)); + return result; + } + /** * @generated */ 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 5cd21a26f1f..ad80c0dea9a 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 @@ -318,6 +318,11 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { */ private final static String CREATECLEARASSOCIATIONACTION3CREATIONTOOL = "createClearAssociationAction3CreationTool";//$NON-NLS-1$ + /** + * @generated + */ + private final static String CREATEREADEXTENTACTION4CREATIONTOOL = "createReadExtentAction4CreationTool";//$NON-NLS-1$ + /** * @generated */ @@ -518,6 +523,9 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { if (toolId.equals(CREATECLEARASSOCIATIONACTION3CREATIONTOOL)) { return createClearAssociationAction3CreationTool(); } + if (toolId.equals(CREATEREADEXTENTACTION4CREATIONTOOL)) { + return createReadExtentAction4CreationTool(); + } if (toolId.equals(CREATECREATELINKACTION1CREATIONTOOL)) { return createCreateLinkAction1CreationTool(); } @@ -823,7 +831,7 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { * @generated */ private Tool createOutputPin1CreationTool() { - List types = new ArrayList(13); + List types = new ArrayList(14); types.add(UMLElementTypes.OutputPin_3014); types.add(UMLElementTypes.OutputPin_3020); types.add(UMLElementTypes.OutputPin_3024); @@ -837,6 +845,7 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { types.add(UMLElementTypes.OutputPin_3126); types.add(UMLElementTypes.OutputPin_3127); types.add(UMLElementTypes.OutputPin_3128); + types.add(UMLElementTypes.OutputPin_3129); Tool tool = new AspectUnspecifiedTypeCreationTool(types); return tool; } @@ -1167,6 +1176,16 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { return tool; } + /** + * @generated + */ + private Tool createReadExtentAction4CreationTool() { + List types = new ArrayList(1); + types.add(UMLElementTypes.ReadExtentAction_3120); + Tool tool = new AspectUnspecifiedTypeCreationTool(types); + return tool; + } + /** * @generated */ 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 527d890be01..f2f4a790311 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 @@ -420,6 +420,11 @@ public class UMLVisualIDRegistry { return ActionPinInClearAssociationActionAsObjectEditPart.VISUAL_ID; } break; + case ReadExtentActionEditPart.VISUAL_ID: + if (UMLPackage.eINSTANCE.getOutputPin().isSuperTypeOf(domainElement.eClass())) { + return OutputPinInReadExtentActionEditPart.VISUAL_ID; + } + break; case ActivityActivityParametersCompartmentEditPart.VISUAL_ID: if (UMLPackage.eINSTANCE.getParameter().isSuperTypeOf(domainElement.eClass())) { return ParameterEditPart.VISUAL_ID; @@ -583,6 +588,9 @@ public class UMLVisualIDRegistry { if (UMLPackage.eINSTANCE.getClearAssociationAction().isSuperTypeOf(domainElement.eClass())) { return ClearAssociationActionEditPart.VISUAL_ID; } + if (UMLPackage.eINSTANCE.getReadExtentAction().isSuperTypeOf(domainElement.eClass())) { + return ReadExtentActionEditPart.VISUAL_ID; + } break; case ConditionalNodeStructuredActivityNodeContentCompartmentEditPart.VISUAL_ID: if (UMLPackage.eINSTANCE.getInitialNode().isSuperTypeOf(domainElement.eClass())) { @@ -848,6 +856,9 @@ public class UMLVisualIDRegistry { if (UMLPackage.eINSTANCE.getClearAssociationAction().isSuperTypeOf(domainElement.eClass())) { return ClearAssociationActionEditPart.VISUAL_ID; } + if (UMLPackage.eINSTANCE.getReadExtentAction().isSuperTypeOf(domainElement.eClass())) { + return ReadExtentActionEditPart.VISUAL_ID; + } break; case LoopNodeStructuredActivityNodeContentCompartmentEditPart.VISUAL_ID: if (UMLPackage.eINSTANCE.getInitialNode().isSuperTypeOf(domainElement.eClass())) { @@ -988,6 +999,9 @@ public class UMLVisualIDRegistry { if (UMLPackage.eINSTANCE.getClearAssociationAction().isSuperTypeOf(domainElement.eClass())) { return ClearAssociationActionEditPart.VISUAL_ID; } + if (UMLPackage.eINSTANCE.getReadExtentAction().isSuperTypeOf(domainElement.eClass())) { + return ReadExtentActionEditPart.VISUAL_ID; + } break; case SequenceNodeStructuredActivityNodeContentCompartmentEditPart.VISUAL_ID: if (UMLPackage.eINSTANCE.getInitialNode().isSuperTypeOf(domainElement.eClass())) { @@ -1128,6 +1142,9 @@ public class UMLVisualIDRegistry { if (UMLPackage.eINSTANCE.getClearAssociationAction().isSuperTypeOf(domainElement.eClass())) { return ClearAssociationActionEditPart.VISUAL_ID; } + if (UMLPackage.eINSTANCE.getReadExtentAction().isSuperTypeOf(domainElement.eClass())) { + return ReadExtentActionEditPart.VISUAL_ID; + } break; case StructuredActivityNodeStructuredActivityNodeContentCompartmentEditPart.VISUAL_ID: if (UMLPackage.eINSTANCE.getInitialNode().isSuperTypeOf(domainElement.eClass())) { @@ -1268,6 +1285,9 @@ public class UMLVisualIDRegistry { if (UMLPackage.eINSTANCE.getClearAssociationAction().isSuperTypeOf(domainElement.eClass())) { return ClearAssociationActionEditPart.VISUAL_ID; } + if (UMLPackage.eINSTANCE.getReadExtentAction().isSuperTypeOf(domainElement.eClass())) { + return ReadExtentActionEditPart.VISUAL_ID; + } break; case ActivityPartitionActivityPartitionContentCompartmentEditPart.VISUAL_ID: if (UMLPackage.eINSTANCE.getInitialNode().isSuperTypeOf(domainElement.eClass())) { @@ -1411,6 +1431,9 @@ public class UMLVisualIDRegistry { if (UMLPackage.eINSTANCE.getClearAssociationAction().isSuperTypeOf(domainElement.eClass())) { return ClearAssociationActionEditPart.VISUAL_ID; } + if (UMLPackage.eINSTANCE.getReadExtentAction().isSuperTypeOf(domainElement.eClass())) { + return ReadExtentActionEditPart.VISUAL_ID; + } break; case InterruptibleActivityRegionInterruptibleActivityRegionContentCompartmentEditPart.VISUAL_ID: if (UMLPackage.eINSTANCE.getInitialNode().isSuperTypeOf(domainElement.eClass())) { @@ -1551,6 +1574,9 @@ public class UMLVisualIDRegistry { if (UMLPackage.eINSTANCE.getClearAssociationAction().isSuperTypeOf(domainElement.eClass())) { return ClearAssociationActionEditPart.VISUAL_ID; } + if (UMLPackage.eINSTANCE.getReadExtentAction().isSuperTypeOf(domainElement.eClass())) { + return ReadExtentActionEditPart.VISUAL_ID; + } break; case ActivityCNParametersCompartmentEditPart.VISUAL_ID: if (UMLPackage.eINSTANCE.getParameter().isSuperTypeOf(domainElement.eClass())) { @@ -1715,6 +1741,9 @@ public class UMLVisualIDRegistry { if (UMLPackage.eINSTANCE.getClearAssociationAction().isSuperTypeOf(domainElement.eClass())) { return ClearAssociationActionEditPart.VISUAL_ID; } + if (UMLPackage.eINSTANCE.getReadExtentAction().isSuperTypeOf(domainElement.eClass())) { + return ReadExtentActionEditPart.VISUAL_ID; + } break; } return -1; @@ -3398,6 +3427,25 @@ public class UMLVisualIDRegistry { return true; } break; + case ReadExtentActionEditPart.VISUAL_ID: + if (ReadExtentActionNameEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (ReadExtentActionFloatingNameEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (OutputPinInReadExtentActionEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + break; + case OutputPinInReadExtentActionEditPart.VISUAL_ID: + if (OutputPinInReadExtentActionLabelEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (OutputPinInReadExtentActionAppliedStereotypeLabelEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + break; case ActivityActivityParametersCompartmentEditPart.VISUAL_ID: if (ParameterEditPart.VISUAL_ID == nodeVisualID) { return true; @@ -3561,6 +3609,9 @@ public class UMLVisualIDRegistry { if (ClearAssociationActionEditPart.VISUAL_ID == nodeVisualID) { return true; } + if (ReadExtentActionEditPart.VISUAL_ID == nodeVisualID) { + return true; + } break; case ConditionalNodeStructuredActivityNodeContentCompartmentEditPart.VISUAL_ID: if (InitialNodeEditPart.VISUAL_ID == nodeVisualID) { @@ -3826,6 +3877,9 @@ public class UMLVisualIDRegistry { if (ClearAssociationActionEditPart.VISUAL_ID == nodeVisualID) { return true; } + if (ReadExtentActionEditPart.VISUAL_ID == nodeVisualID) { + return true; + } break; case LoopNodeStructuredActivityNodeContentCompartmentEditPart.VISUAL_ID: if (InitialNodeEditPart.VISUAL_ID == nodeVisualID) { @@ -3966,6 +4020,9 @@ public class UMLVisualIDRegistry { if (ClearAssociationActionEditPart.VISUAL_ID == nodeVisualID) { return true; } + if (ReadExtentActionEditPart.VISUAL_ID == nodeVisualID) { + return true; + } break; case SequenceNodeStructuredActivityNodeContentCompartmentEditPart.VISUAL_ID: if (InitialNodeEditPart.VISUAL_ID == nodeVisualID) { @@ -4106,6 +4163,9 @@ public class UMLVisualIDRegistry { if (ClearAssociationActionEditPart.VISUAL_ID == nodeVisualID) { return true; } + if (ReadExtentActionEditPart.VISUAL_ID == nodeVisualID) { + return true; + } break; case StructuredActivityNodeStructuredActivityNodeContentCompartmentEditPart.VISUAL_ID: if (InitialNodeEditPart.VISUAL_ID == nodeVisualID) { @@ -4246,6 +4306,9 @@ public class UMLVisualIDRegistry { if (ClearAssociationActionEditPart.VISUAL_ID == nodeVisualID) { return true; } + if (ReadExtentActionEditPart.VISUAL_ID == nodeVisualID) { + return true; + } break; case ActivityPartitionActivityPartitionContentCompartmentEditPart.VISUAL_ID: if (InitialNodeEditPart.VISUAL_ID == nodeVisualID) { @@ -4389,6 +4452,9 @@ public class UMLVisualIDRegistry { if (ClearAssociationActionEditPart.VISUAL_ID == nodeVisualID) { return true; } + if (ReadExtentActionEditPart.VISUAL_ID == nodeVisualID) { + return true; + } break; case InterruptibleActivityRegionInterruptibleActivityRegionContentCompartmentEditPart.VISUAL_ID: if (InitialNodeEditPart.VISUAL_ID == nodeVisualID) { @@ -4529,6 +4595,9 @@ public class UMLVisualIDRegistry { if (ClearAssociationActionEditPart.VISUAL_ID == nodeVisualID) { return true; } + if (ReadExtentActionEditPart.VISUAL_ID == nodeVisualID) { + return true; + } break; case ActivityCNParametersCompartmentEditPart.VISUAL_ID: if (ParameterEditPart.VISUAL_ID == nodeVisualID) { @@ -4693,6 +4762,9 @@ public class UMLVisualIDRegistry { if (ClearAssociationActionEditPart.VISUAL_ID == nodeVisualID) { return true; } + if (ReadExtentActionEditPart.VISUAL_ID == nodeVisualID) { + return true; + } break; case ObjectFlowEditPart.VISUAL_ID: if (ObjectFlowNameEditPart.VISUAL_ID == nodeVisualID) { @@ -5398,6 +5470,7 @@ public class UMLVisualIDRegistry { case OutputPinInTestIdentityActionEditPart.VISUAL_ID: case OutputPinInClearStructuralFeatureActionEditPart.VISUAL_ID: case OutputPinInReadLinkActionEditPart.VISUAL_ID: + case OutputPinInReadExtentActionEditPart.VISUAL_ID: case InputPinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID: case InputPinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID: case InputPinInTestIdentityActionAsFirstEditPart.VISUAL_ID: 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 8a12c441729..fb963586b0c 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 @@ -48,6 +48,7 @@ import org.eclipse.uml2.uml.OpaqueAction; 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.ReadLinkAction; import org.eclipse.uml2.uml.ReadSelfAction; import org.eclipse.uml2.uml.ReadStructuralFeatureAction; @@ -1965,6 +1966,34 @@ public class ElementInitializers { } } + /** + * @generated + */ + public void init_ReadExtentAction_3120(ReadExtentAction instance) { + try { + Object value_0 = name_ReadExtentAction_3120(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_3129(OutputPin instance) { + try { + Object value_0 = name_OutputPin_3129(instance); + if (value_0 != null) { + instance.setName((String) value_0); + } + } catch (RuntimeException e) { + UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ + } + } + /** * @generated */ @@ -2981,6 +3010,20 @@ public class ElementInitializers { return LabelHelper.INSTANCE.findName(it.eContainer(), it); } + /** + * @generated + */ + private String name_ReadExtentAction_3120(ReadExtentAction it) { + return LabelHelper.INSTANCE.findName(it.eContainer(), it); + } + + /** + * @generated + */ + private String name_OutputPin_3129(OutputPin it) { + return LabelHelper.INSTANCE.findName(it.eContainer(), it); + } + /** * @generated */ 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 b390f50bedf..557c77fa322 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 @@ -636,6 +636,16 @@ public class UMLElementTypes { */ public static final IElementType ActionInputPin_3166 = getElementType("org.eclipse.papyrus.uml.diagram.activity.ActionInputPin_3166"); //$NON-NLS-1$ + /** + * @generated + */ + public static final IElementType ReadExtentAction_3120 = getElementType("org.eclipse.papyrus.uml.diagram.activity.ReadExtentAction_3120"); //$NON-NLS-1$ + + /** + * @generated + */ + public static final IElementType OutputPin_3129 = getElementType("org.eclipse.papyrus.uml.diagram.activity.OutputPin_3129"); //$NON-NLS-1$ + /** * @generated */ @@ -932,6 +942,8 @@ public class UMLElementTypes { elements.put(InputPin_3140, UMLPackage.eINSTANCE.getInputPin()); elements.put(ValuePin_3153, UMLPackage.eINSTANCE.getValuePin()); elements.put(ActionInputPin_3166, UMLPackage.eINSTANCE.getActionInputPin()); + elements.put(ReadExtentAction_3120, UMLPackage.eINSTANCE.getReadExtentAction()); + elements.put(OutputPin_3129, UMLPackage.eINSTANCE.getOutputPin()); elements.put(ActionLocalPrecondition_4001, UMLPackage.eINSTANCE.getAction_LocalPrecondition()); elements.put(ActionLocalPostcondition_4002, UMLPackage.eINSTANCE.getAction_LocalPostcondition()); elements.put(ObjectFlow_4003, UMLPackage.eINSTANCE.getObjectFlow()); @@ -1090,6 +1102,8 @@ public class UMLElementTypes { KNOWN_ELEMENT_TYPES.add(InputPin_3140); KNOWN_ELEMENT_TYPES.add(ValuePin_3153); KNOWN_ELEMENT_TYPES.add(ActionInputPin_3166); + KNOWN_ELEMENT_TYPES.add(ReadExtentAction_3120); + KNOWN_ELEMENT_TYPES.add(OutputPin_3129); KNOWN_ELEMENT_TYPES.add(ActionLocalPrecondition_4001); KNOWN_ELEMENT_TYPES.add(ActionLocalPostcondition_4002); KNOWN_ELEMENT_TYPES.add(ObjectFlow_4003); @@ -1374,6 +1388,10 @@ public class UMLElementTypes { return ValuePin_3153; case ActionPinInClearAssociationActionAsObjectEditPart.VISUAL_ID: return ActionInputPin_3166; + case ReadExtentActionEditPart.VISUAL_ID: + return ReadExtentAction_3120; + case OutputPinInReadExtentActionEditPart.VISUAL_ID: + return OutputPin_3129; 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 0993a87a5ed..32997c86649 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 @@ -3973,6 +3973,70 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid return actionInputPinLabel_5301Parser; } + /** + * @generated + */ + private IParser readExtentActionName_5198Parser; + + /** + * @generated + */ + private IParser getReadExtentActionName_5198Parser() { + if (readExtentActionName_5198Parser == null) { + EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }; + MessageFormatParser parser = new MessageFormatParser(features); + readExtentActionName_5198Parser = parser; + } + return readExtentActionName_5198Parser; + } + + /** + * @generated + */ + private IParser readExtentActionName_5401Parser; + + /** + * @generated + */ + private IParser getReadExtentActionName_5401Parser() { + if (readExtentActionName_5401Parser == null) { + EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }; + MessageFormatParser parser = new MessageFormatParser(features); + readExtentActionName_5401Parser = parser; + } + return readExtentActionName_5401Parser; + } + + /** + * @generated + */ + private PinParser outputPinLabel_5211Parser; + + /** + * @generated + */ + private IParser getOutputPinLabel_5211Parser() { + if (outputPinLabel_5211Parser == null) { + outputPinLabel_5211Parser = new PinParser(); + } + return outputPinLabel_5211Parser; + } + + /** + * @generated + */ + private AppliedStereotypeParser outputPinLabel_5212Parser; + + /** + * @generated + */ + private IParser getOutputPinLabel_5212Parser() { + if (outputPinLabel_5212Parser == null) { + outputPinLabel_5212Parser = new AppliedStereotypeParser(); + } + return outputPinLabel_5212Parser; + } + /** * @generated */ @@ -5306,6 +5370,14 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid return getActionInputPinLabel_5300Parser(); case ActionPinInClearAssociationActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID: return getActionInputPinLabel_5301Parser(); + case ReadExtentActionNameEditPart.VISUAL_ID: + return getReadExtentActionName_5198Parser(); + case ReadExtentActionFloatingNameEditPart.VISUAL_ID: + return getReadExtentActionName_5401Parser(); + case OutputPinInReadExtentActionLabelEditPart.VISUAL_ID: + return getOutputPinLabel_5211Parser(); + case OutputPinInReadExtentActionAppliedStereotypeLabelEditPart.VISUAL_ID: + return getOutputPinLabel_5212Parser(); 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 f1a0fc2e2da..e6d7ea6b252 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 @@ -315,6 +315,8 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { case InputPinInClearAssociationActionAsObjectEditPart.VISUAL_ID: case ValuePinInClearAssociationActionAsObjectEditPart.VISUAL_ID: case ActionPinInClearAssociationActionAsObjectEditPart.VISUAL_ID: + case ReadExtentActionEditPart.VISUAL_ID: + case OutputPinInReadExtentActionEditPart.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 } @@ -653,6 +655,10 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { return createValuePin_3153(domainElement, containerView, index, persisted, preferencesHint); case ActionPinInClearAssociationActionAsObjectEditPart.VISUAL_ID: return createActionInputPin_3166(domainElement, containerView, index, persisted, preferencesHint); + case ReadExtentActionEditPart.VISUAL_ID: + return createReadExtentAction_3120(domainElement, containerView, index, persisted, preferencesHint); + case OutputPinInReadExtentActionEditPart.VISUAL_ID: + return createOutputPin_3129(domainElement, containerView, index, persisted, preferencesHint); } // can't happen, provided #provides(CreateNodeViewOperation) is correct return null; @@ -3776,6 +3782,54 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { return node; } + /** + * @generated + */ + public Node createReadExtentAction_3120(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(ReadExtentActionEditPart.VISUAL_ID)); + ViewUtil.insertChildView(containerView, node, index, persisted); + node.setElement(domainElement); + // initializeFromPreferences + 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); + return node; + } + + /** + * @generated + */ + public Node createOutputPin_3129(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(OutputPinInReadExtentActionEditPart.VISUAL_ID)); + ViewUtil.insertChildView(containerView, node, index, persisted); + node.setElement(domainElement); + // initializeFromPreferences + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "OutputPin"); + Node label5211 = createLabel(node, UMLVisualIDRegistry.getType(OutputPinInReadExtentActionLabelEditPart.VISUAL_ID)); + label5211.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location5211 = (Location) label5211.getLayoutConstraint(); + location5211.setX(0); + location5211.setY(5); + Node label5212 = createLabel(node, UMLVisualIDRegistry.getType(OutputPinInReadExtentActionAppliedStereotypeLabelEditPart.VISUAL_ID)); + label5212.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location5212 = (Location) label5212.getLayoutConstraint(); + location5212.setX(0); + location5212.setY(5); + return node; + } + /** * @generated */ -- cgit v1.2.3