package org.framed.orm.ui.figure.shapes;

import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.PolylineConnection;
import org.eclipse.draw2d.geometry.PointList;
import org.eclipse.swt.SWT;

public class ORMConnectionMultiplePolyline extends PolylineConnection {
	boolean hasConstraint = false;
	
	@Override
	protected void outlineShape(Graphics g){
		PointList points = getPoints();
		
		g.setLineStyle(SWT.LINE_SOLID);
		g.setAntialias(SWT.ON);
		g.setLineStyle(SWT.LINE_CUSTOM);
		
		g.drawPolyline(points);
		
		if (hasConstraint){
			g.setLineStyle(SWT.LINE_DASH);
			g.setAntialias(SWT.ON);
			g.setLineDash(new float[] {5.0f, 5.0f});
			g.setLineStyle(SWT.LINE_CUSTOM);
			
			points.translate(3, 3);
			g.drawPolyline(points);
			
			points.translate(-6, -6);
			g.drawPolyline(points);
		}
	}
	
	public void setHasConstraint(boolean bol){
		hasConstraint = bol;
	}
}

@@ -191,16 +191,327 @@
 pse.
-swt.SWT;
+gef.EditPart;%0D%0Aimport org.eclipse.swt.SWT;%0D%0Aimport org.eclipse.swt.widgets.Display;%0D%0Aimport org.framed.orm.model.Relation;%0D%0A%0D%0A/**%0D%0A * 10.03.2016%0D%0A * This connection is used for the representation of relationship connections. %0D%0A * It distinguished between having constraints and not.%0D%0A * %0D%0A * @author Duc Dung Dam%0D%0A * */
 %0D%0A%0D%0A
@@ -676,16 +676,22 @@
  g)%7B%0D%0A%09%09
+final 
 PointLis
@@ -719,45 +719,55 @@
 );%0D%0A
-%09%09
 %0D%0A%09%09
-g.setLineStyle(SWT.LINE_SOLID);
+Display display = Display.getCurrent();%0D%0A%09%09
 %0D%0A%09%09
@@ -831,43 +831,8 @@
 );%0D%0A
-%09%09%0D%0A%09%09g.drawPolyline(points);%0D%0A%09%09%0D%0A
 %09%09if
@@ -889,36 +889,8 @@
 );%0D%0A
-%09%09%09g.setAntialias(SWT.ON);%0D%0A
 %09%09%09g
@@ -926,24 +926,80 @@
 f, 5.0f%7D);%0D%0A
+%09%09%09g.setLineWidth(5);%0D%0A%09%09%09g.drawPolyline(points);%0D%0A%09%09%09%0D%0A
 %09%09%09g.setLine
@@ -1017,46 +1017,102 @@
 INE_
-CUSTOM
+SOLID
 );%0D%0A%09%09%09
-%0D%0A%09%09%09points.translate(3, 
+g.setForegroundColor(display.getSystemColor(SWT.COLOR_WHITE));%0D%0A%09%09%09g.setLineWidth(
 3);%0D
@@ -1145,43 +1145,139 @@
 ;%0D%0A%09
+%09%7D%0D%0A
 %09%09%0D%0A%09%09
-%09points.translate(-6, -6);%0D%0A%09
+g.setLineStyle(SWT.LINE_SOLID);%0D%0A%09%09g.setForegroundColor(display.getSystemColor(SWT.COLOR_BLACK));%0D%0A%09%09g.setLineWidth(1);%0D%0A
 %09%09g.
@@ -1299,21 +1299,16 @@
 ints);%0D%0A
-%09%09%7D%0D%0A
 %09%7D%0D%0A%09%0D%0A%09

Fix bug that multiple polyline translated when shapes are dragged over the line.