Author: dazarov
Date: 2008-10-30 12:03:06 -0400 (Thu, 30 Oct 2008)
New Revision: 11342
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/figures/ConnectionFigure.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/ConnectionFigure.java
trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/editor/figures/ConnectionFigure.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-3065
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/figures/ConnectionFigure.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/figures/ConnectionFigure.java 2008-10-30
16:02:17 UTC (rev 11341)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/figures/ConnectionFigure.java 2008-10-30
16:03:06 UTC (rev 11342)
@@ -17,7 +17,7 @@
import org.eclipse.draw2d.PolylineConnection;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.PointList;
-
+import org.eclipse.swt.SWT;
import org.jboss.tools.jsf.ui.editor.edit.LinkEditPart;
import org.jboss.tools.jsf.ui.editor.model.ILink;
@@ -84,77 +84,91 @@
editPart.clear();
}
- PointList points;
- Point point;
- Point beg = new Point(0, 0), end = new Point(0, 0);
- Point corner = new Point(0, 0);
- boolean horiz;
-
protected void outlineShape(Graphics g) {
- points = getPoints();
- point = points.getPoint(0);
+ g.setLineCap(SWT.CAP_ROUND);
+
+ PointList points = getPoints();
+ Point point = points.getPoint(0);
+ Point beg = new Point();
+ Point end = new Point();
+ Point eCorner = new Point();
+ Point bCorner = new Point();
+ boolean horiz;
beg.x = point.x;
beg.y = point.y;
-
+
if (points.getFirstPoint().y == points.getLastPoint().y) {
super.outlineShape(g);
return;
}
-
+ if (Math.abs(points.getFirstPoint().y - points.getLastPoint().y) < 4) {
+ int delta = Math.abs(points.getFirstPoint().y - points.getLastPoint().y);
+ if(points.size() == 4){
+ Point point1 = points.getPoint(0);
+ Point point2 = points.getPoint(1);
+ Point point3 = points.getPoint(2);
+ Point point4 = points.getPoint(3);
+ if(point1.x < point4.x){
+ point2.x -= delta/2;
+ point3.x += delta/2;
+ }else{
+ point2.x += delta/2;
+ point3.x -= delta/2;
+ }
+ g.drawLine(point1, point2);
+ g.drawLine(point2, point3);
+ g.drawLine(point3, point4);
+ return;
+ }
+ }
+
for (int i = 1; i < points.size(); i++) {
point = points.getPoint(i);
end.x = point.x;
end.y = point.y;
-
+
if (beg.y == end.y)
horiz = true;
else
horiz = false;
-
+
+ eCorner.x = 0;
if (i != 1) {
if (horiz) {
- if (end.x > beg.x) {
- corner.x = beg.x + 1;
+ if (end.x > beg.x)
beg.x += 2;
- } else {
- corner.x = beg.x - 1;
+ else
beg.x -= 2;
- }
} else {
- if (end.y > beg.y) {
- corner.y = beg.y + 1;
+ if (end.y > beg.y)
beg.y += 2;
- } else {
- corner.y = beg.y - 1;
+ else
beg.y -= 2;
- }
}
+ eCorner.x = beg.x;
+ eCorner.y = beg.y;
}
- if (corner.x != 0)
- g.drawLine(corner, corner);
- corner.x = 0;
-
- if (i != points.size() - 1) {
+
+ if (bCorner.x != 0 && eCorner.x != 0)
+ g.drawLine(bCorner, eCorner);
+
+ bCorner.x = 0;
+ if (i != (points.size() - 1)) {
if (horiz) {
- if (end.x > beg.x) {
- corner.x = end.x - 1;
+ if (end.x > beg.x)
end.x -= 2;
-
- } else {
- corner.x = end.x + 1;
+ else
end.x += 2;
- }
} else {
- if (end.y > beg.y) {
- corner.y = end.y - 1;
+ if (end.y > beg.y)
end.y -= 2;
- } else {
- corner.y = end.y + 1;
+ else
end.y += 2;
- }
}
+ bCorner.x = end.x;
+ bCorner.y = end.y;
}
-
+
g.drawLine(beg, end);
point = points.getPoint(i);
beg.x = point.x;
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/ConnectionFigure.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/ConnectionFigure.java 2008-10-30
16:02:17 UTC (rev 11341)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/ConnectionFigure.java 2008-10-30
16:03:06 UTC (rev 11342)
@@ -87,15 +87,8 @@
}
protected void outlineShape(Graphics g) {
- Page page=null;
- if(link != null && link.getFromElement() instanceof Page)
- page = (Page)link.getFromElement();
+ g.setLineCap(SWT.CAP_ROUND);
- if(page != null && !page.isConfirmed()){
- g.setLineDash(new int[]{3,3});
- g.setLineStyle(SWT.LINE_CUSTOM);
- }
-
PointList points = getPoints();
Point point = points.getPoint(0);
Point beg = new Point();
@@ -144,17 +137,15 @@
eCorner.x = 0;
if (i != 1) {
if (horiz) {
- if (end.x > beg.x) {
+ if (end.x > beg.x)
beg.x += 2;
- } else {
+ else
beg.x -= 2;
- }
} else {
- if (end.y > beg.y) {
+ if (end.y > beg.y)
beg.y += 2;
- } else {
+ else
beg.y -= 2;
- }
}
eCorner.x = beg.x;
eCorner.y = beg.y;
@@ -162,21 +153,19 @@
if (bCorner.x != 0 && eCorner.x != 0)
g.drawLine(bCorner, eCorner);
+
bCorner.x = 0;
-
- if (i != points.size() - 1) {
+ if (i != (points.size() - 1)) {
if (horiz) {
- if (end.x > beg.x) {
+ if (end.x > beg.x)
end.x -= 2;
- } else {
+ else
end.x += 2;
- }
} else {
- if (end.y > beg.y) {
+ if (end.y > beg.y)
end.y -= 2;
- } else {
+ else
end.y += 2;
- }
}
bCorner.x = end.x;
bCorner.y = end.y;
Modified:
trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/editor/figures/ConnectionFigure.java
===================================================================
---
trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/editor/figures/ConnectionFigure.java 2008-10-30
16:02:17 UTC (rev 11341)
+++
trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/editor/figures/ConnectionFigure.java 2008-10-30
16:03:06 UTC (rev 11342)
@@ -16,7 +16,7 @@
import org.eclipse.draw2d.PolylineConnection;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.PointList;
-
+import org.eclipse.swt.SWT;
import org.jboss.tools.struts.ui.editor.edit.LinkEditPart;
import org.jboss.tools.struts.ui.editor.model.ILink;
@@ -89,73 +89,90 @@
public void clear(){
if(editPart != null)editPart.clear();
}
- PointList points;
- Point point;
- Point beg = new Point(0,0), end = new Point(0,0);
- Point corner = new Point(0,0);
- boolean horiz;
protected void outlineShape(Graphics g) {
- points = getPoints();
- point = points.getPoint(0);
+ g.setLineCap(SWT.CAP_ROUND);
+
+ PointList points = getPoints();
+ Point point = points.getPoint(0);
+ Point beg = new Point();
+ Point end = new Point();
+ Point eCorner = new Point();
+ Point bCorner = new Point();
+ boolean horiz;
beg.x = point.x;
beg.y = point.y;
-
-
- if(points.getFirstPoint().y == points.getLastPoint().y){
+
+ if (points.getFirstPoint().y == points.getLastPoint().y) {
super.outlineShape(g);
return;
}
-
- for(int i=1;i<points.size();i++){
+ if (Math.abs(points.getFirstPoint().y - points.getLastPoint().y) < 4) {
+ int delta = Math.abs(points.getFirstPoint().y - points.getLastPoint().y);
+ if(points.size() == 4){
+ Point point1 = points.getPoint(0);
+ Point point2 = points.getPoint(1);
+ Point point3 = points.getPoint(2);
+ Point point4 = points.getPoint(3);
+ if(point1.x < point4.x){
+ point2.x -= delta/2;
+ point3.x += delta/2;
+ }else{
+ point2.x += delta/2;
+ point3.x -= delta/2;
+ }
+ g.drawLine(point1, point2);
+ g.drawLine(point2, point3);
+ g.drawLine(point3, point4);
+ return;
+ }
+ }
+
+ for (int i = 1; i < points.size(); i++) {
point = points.getPoint(i);
end.x = point.x;
end.y = point.y;
-
- if(beg.y == end.y)horiz = true;
- else horiz = false;
-
- if(i != 1){
- if(horiz){
- if(end.x > beg.x){
- corner.x = beg.x+1;
- beg.x+=2;
- }else{
- corner.x = beg.x-1;
- beg.x-=2;
- }
- }else{
- if(end.y > beg.y){
- corner.y = beg.y+1;
- beg.y+=2;
- }else{
- corner.y = beg.y-1;
- beg.y-=2;
- }
+
+ if (beg.y == end.y)
+ horiz = true;
+ else
+ horiz = false;
+
+ eCorner.x = 0;
+ if (i != 1) {
+ if (horiz) {
+ if (end.x > beg.x)
+ beg.x += 2;
+ else
+ beg.x -= 2;
+ } else {
+ if (end.y > beg.y)
+ beg.y += 2;
+ else
+ beg.y -= 2;
}
+ eCorner.x = beg.x;
+ eCorner.y = beg.y;
}
- if(corner.x != 0)g.drawLine(corner, corner);
- corner.x = 0;
- if(i != points.size()-1){
- if(horiz){
- if(end.x > beg.x){
- corner.x = end.x-1;
- end.x-=2;
-
- }else{
- corner.x = end.x+1;
- end.x+=2;
- }
- }else{
- if(end.y > beg.y){
- corner.y = end.y-1;
- end.y-=2;
- }else{
- corner.y = end.y+1;
- end.y+=2;
- }
+ if (bCorner.x != 0 && eCorner.x != 0)
+ g.drawLine(bCorner, eCorner);
+
+ bCorner.x = 0;
+ if (i != (points.size() - 1)) {
+ if (horiz) {
+ if (end.x > beg.x)
+ end.x -= 2;
+ else
+ end.x += 2;
+ } else {
+ if (end.y > beg.y)
+ end.y -= 2;
+ else
+ end.y += 2;
}
+ bCorner.x = end.x;
+ bCorner.y = end.y;
}
g.drawLine(beg, end);