Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnsgar Radermacher2019-09-02 11:47:14 +0000
committerAnsgar Radermacher2019-09-17 14:53:30 +0000
commit5a78fb90b4a84b08202d306ddcfafe87556a8656 (patch)
tree53568bb7fd4cf88a0a9552c66578d6c089de833b
parentd524c0f61415905804178a77188771e424b306ee (diff)
downloadorg.eclipse.papyrus-5a78fb90b4a84b08202d306ddcfafe87556a8656.tar.gz
org.eclipse.papyrus-5a78fb90b4a84b08202d306ddcfafe87556a8656.tar.xz
org.eclipse.papyrus-5a78fb90b4a84b08202d306ddcfafe87556a8656.zip
Bug 527181 - [Composite structure diagram] Initial port location on a part is top-left corner
- Add non-null check Signed-off-by: Ansgar Radermacher <ansgar.radermacher@cea.fr>
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/CompositeSideAffixedNodesCreationEditPolicy.java20
1 files changed, 12 insertions, 8 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/CompositeSideAffixedNodesCreationEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/CompositeSideAffixedNodesCreationEditPolicy.java
index 4225557b771..af16831df22 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/CompositeSideAffixedNodesCreationEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/CompositeSideAffixedNodesCreationEditPolicy.java
@@ -32,6 +32,7 @@ import org.eclipse.uml2.uml.Port;
/**
* This EditPolicy takes care of the correct placement of ports, see bug 527181
+ *
* @since 3.1
*/
public class CompositeSideAffixedNodesCreationEditPolicy extends SideAffixedNodesCreationEditPolicy {
@@ -46,7 +47,7 @@ public class CompositeSideAffixedNodesCreationEditPolicy extends SideAffixedNode
if (portEObj instanceof Port) {
final NodeEditPart partEditPart = (NodeEditPart) getHost();
if (partEditPart.getFigure().getBounds().width != 0) {
- Point initialLocation = CompositeStructureDiagramUtils.getInitialPortLocation(getHost(), (Port) portEObj, descriptor);
+ Point initialLocation = CompositeStructureDiagramUtils.getInitialPortLocation(getHost(), portEObj, descriptor);
if (initialLocation != null) {
return new SetBoundsCommand(partEditPart.getEditingDomain(),
DiagramUIMessages.SetLocationCommand_Label_Resize, descriptor, initialLocation);
@@ -58,13 +59,16 @@ public class CompositeSideAffixedNodesCreationEditPolicy extends SideAffixedNode
@Override
public void figureMoved(IFigure source) {
- Point initialLocation = CompositeStructureDiagramUtils.getInitialPortLocation(getHost(), (Port) portEObj, descriptor);
- SetBoundsCommand cmd = new SetBoundsCommand(partEditPart.getEditingDomain(),
- DiagramUIMessages.SetLocationCommand_Label_Resize, descriptor, initialLocation);
- try {
- cmd.execute(null, descriptor);
- } catch (ExecutionException e) {
- Activator.log.error(e);
+ Point initialLocation = CompositeStructureDiagramUtils.getInitialPortLocation(getHost(), portEObj, descriptor);
+ // can be null, see bug 527181
+ if (initialLocation != null) {
+ SetBoundsCommand cmd = new SetBoundsCommand(partEditPart.getEditingDomain(),
+ DiagramUIMessages.SetLocationCommand_Label_Resize, descriptor, initialLocation);
+ try {
+ cmd.execute(null, descriptor);
+ } catch (ExecutionException e) {
+ Activator.log.error(e);
+ }
}
source.removeFigureListener(this);
}

Back to the top