Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2011-05-30 08:38:28 +0000
committerHenrik Rentz-Reichert2011-05-30 08:38:28 +0000
commit8ad30223a35df80e4368d325995dc1bb148ddcc3 (patch)
treecf29dbdb69bd3d60fe10be8a7c1b2b69763411ac
parentd3b5e8acff851fe5507b3291c3affce298ed3714 (diff)
downloadorg.eclipse.etrice-8ad30223a35df80e4368d325995dc1bb148ddcc3.tar.gz
org.eclipse.etrice-8ad30223a35df80e4368d325995dc1bb148ddcc3.tar.xz
org.eclipse.etrice-8ad30223a35df80e4368d325995dc1bb148ddcc3.zip
[ui.behavior] 347509: different positions of the same Transitionpoint
https://bugs.eclipse.org/bugs/show_bug.cgi?id=347509 Small outer Entry/ExitPoint can be moved independently. If inner point is moved then outer point's position is adjusted again.
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/TrPointSupport.java48
1 files changed, 35 insertions, 13 deletions
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/TrPointSupport.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/TrPointSupport.java
index 045ef7efd..317624359 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/TrPointSupport.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/TrPointSupport.java
@@ -380,7 +380,7 @@ public class TrPointSupport {
return false;
if (isSubTP(context.getPictogramElement()))
- return false;
+ return true;
return isValidPosition(context, context, StateGraphSupport.MARGIN);
}
@@ -393,9 +393,10 @@ public class TrPointSupport {
@Override
protected void postMoveShape(IMoveShapeContext context) {
ContainerShape shapeToMove = (ContainerShape) context.getShape();
-
- int margin = StateGraphSupport.MARGIN;
- int size = ITEM_SIZE;
+ boolean subtp = isSubTP(context.getPictogramElement());
+
+ int margin = subtp?StateSupport.MARGIN:StateGraphSupport.MARGIN;
+ int size = subtp?ITEM_SIZE_SMALL:ITEM_SIZE;
int x = context.getX();
int y = context.getY();
@@ -403,14 +404,34 @@ public class TrPointSupport {
int height = context.getTargetContainer().getGraphicsAlgorithm().getGraphicsAlgorithmChildren().get(0).getHeight();
// project onto boundary
- if (x<=margin)
- x = 0;
- if (y<=margin)
- y = 0;
- if ((width-margin)<=x)
- x = width;
- if ((height-margin)<=y)
- y = height;
+ {
+ int dx = (x<=width/2)? x:width-x;
+ int dy = (y<=height/2)? y:height-y;
+ if (dx>dy) {
+ // keep x, project y
+ if (y<=height/2)
+ y = 0;
+ else
+ y = height-0;
+
+ if (x<0)
+ x = 0;
+ else if (x>width-0)
+ x = width-0;
+ }
+ else {
+ // keep y, project x
+ if (x<=width/2)
+ x = 0;
+ else
+ x = width-0;
+
+ if (y<0)
+ y = 0;
+ else if (y>height-0)
+ y = height-0;
+ }
+ }
Graphiti.getGaService().setLocation(shapeToMove.getGraphicsAlgorithm(), x, y, avoidNegativeCoordinates());
@@ -419,7 +440,8 @@ public class TrPointSupport {
adjustLabel((Text) ga, x, y, width, margin, size);
}
- adjustSubTPs(shapeToMove);
+ if (!subtp)
+ adjustSubTPs(shapeToMove);
}
/**

Back to the top