Commit 42436eb8 authored by Carmen Carlan's avatar Carmen Carlan
Browse files

Fixed the bug. Visual feedback when creating a connection reflects the...

Fixed the bug. Visual feedback when creating a connection reflects the location of the source and target connector.
refs 2359
parent 652e19a3
...@@ -26,12 +26,14 @@ import java.util.Collection; ...@@ -26,12 +26,14 @@ import java.util.Collection;
import org.eclipse.draw2d.ConnectionAnchor; import org.eclipse.draw2d.ConnectionAnchor;
import org.eclipse.draw2d.IFigure; import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Label; import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.XYAnchor;
import org.eclipse.draw2d.geometry.Rectangle; import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EObject;
import org.eclipse.gef.ConnectionEditPart; import org.eclipse.gef.ConnectionEditPart;
import org.eclipse.gef.DragTracker; import org.eclipse.gef.DragTracker;
import org.eclipse.gef.NodeEditPart; import org.eclipse.gef.NodeEditPart;
import org.eclipse.gef.Request; import org.eclipse.gef.Request;
import org.eclipse.gef.requests.CreateConnectionRequest;
import org.eclipse.gef.requests.SelectionRequest; import org.eclipse.gef.requests.SelectionRequest;
import org.eclipse.gef.tools.ConnectionDragCreationTool; import org.eclipse.gef.tools.ConnectionDragCreationTool;
import org.eclipse.gef.tools.DragEditPartsTracker; import org.eclipse.gef.tools.DragEditPartsTracker;
...@@ -318,6 +320,9 @@ public abstract class PositionedEditPartBase<T extends ILayoutedModelElement> ex ...@@ -318,6 +320,9 @@ public abstract class PositionedEditPartBase<T extends ILayoutedModelElement> ex
*/ */
@Override @Override
public ConnectionAnchor getSourceConnectionAnchor(Request request) { public ConnectionAnchor getSourceConnectionAnchor(Request request) {
if(request instanceof CreateConnectionRequest) {
return new XYAnchor(((CreateConnectionRequest)request).getLocation());
}
return defaultConnectionAnchor(); return defaultConnectionAnchor();
} }
...@@ -338,6 +343,9 @@ public abstract class PositionedEditPartBase<T extends ILayoutedModelElement> ex ...@@ -338,6 +343,9 @@ public abstract class PositionedEditPartBase<T extends ILayoutedModelElement> ex
*/ */
@Override @Override
public ConnectionAnchor getTargetConnectionAnchor(Request request) { public ConnectionAnchor getTargetConnectionAnchor(Request request) {
if(request instanceof CreateConnectionRequest) {
return new XYAnchor(((CreateConnectionRequest)request).getLocation());
}
return defaultConnectionAnchor(); return defaultConnectionAnchor();
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment