|
Lines 24-29
Link Here
|
| 24 |
import org.eclipse.draw2d.XYAnchor; |
24 |
import org.eclipse.draw2d.XYAnchor; |
| 25 |
import org.eclipse.draw2d.geometry.Dimension; |
25 |
import org.eclipse.draw2d.geometry.Dimension; |
| 26 |
import org.eclipse.draw2d.geometry.Point; |
26 |
import org.eclipse.draw2d.geometry.Point; |
|
|
27 |
import org.eclipse.draw2d.geometry.PointList; |
| 28 |
import org.eclipse.draw2d.geometry.PrecisionPoint; |
| 27 |
import org.eclipse.draw2d.geometry.Rectangle; |
29 |
import org.eclipse.draw2d.geometry.Rectangle; |
| 28 |
import org.eclipse.emf.common.notify.Notification; |
30 |
import org.eclipse.emf.common.notify.Notification; |
| 29 |
import org.eclipse.emf.common.notify.Notifier; |
31 |
import org.eclipse.emf.common.notify.Notifier; |
|
Lines 263-268
Link Here
|
| 263 |
} |
265 |
} |
| 264 |
return getContentPane(); |
266 |
return getContentPane(); |
| 265 |
} |
267 |
} |
|
|
268 |
|
| 269 |
static class SlidableAnchorEx extends SlidableAnchor{ |
| 270 |
SlidableAnchorEx(IFigure f, PrecisionPoint p) { |
| 271 |
super(f,p); |
| 272 |
} |
| 273 |
|
| 274 |
protected Point getLocation(Point ownReference, Point foreignReference) { |
| 275 |
PointList intersections = getIntersectionPoints(ownReference, foreignReference); |
| 276 |
if (intersections!=null && intersections.size()!=0) { |
| 277 |
int size = intersections.size(); |
| 278 |
double dist = foreignReference.getDistance(ownReference); |
| 279 |
for(int i = 0; i < size; i ++){ |
| 280 |
Point loc = intersections.getPoint(i); |
| 281 |
if(isInOrder(foreignReference,ownReference,dist, loc)){ |
| 282 |
return loc; |
| 283 |
} |
| 284 |
} |
| 285 |
return intersections.getFirstPoint(); |
| 286 |
} |
| 287 |
return null; |
| 288 |
} |
| 289 |
|
| 290 |
private boolean isInOrder(Point start, Point end, double dist, Point loc) { |
| 291 |
double total = loc.getDistance(start); |
| 292 |
double dist2 = loc.getDistance(end); |
| 293 |
if(total < dist || total < dist2) |
| 294 |
return false; |
| 295 |
|
| 296 |
if(Math.abs(total - dist - dist2) < 0.01) |
| 297 |
return true; |
| 298 |
|
| 299 |
return false; |
| 300 |
} |
| 301 |
} |
| 266 |
|
302 |
|
| 267 |
/** |
303 |
/** |
| 268 |
* @generated |
304 |
* @generated |
|
Lines 272-278
Link Here
|
| 272 |
IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore(); |
308 |
IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore(); |
| 273 |
String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.WIDTH); |
309 |
String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.WIDTH); |
| 274 |
String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.HEIGHT); |
310 |
String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.HEIGHT); |
| 275 |
DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight)); |
311 |
DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight)){ |
|
|
312 |
|
| 313 |
protected ConnectionAnchor createAnchor(PrecisionPoint p) { |
| 314 |
if (p==null) |
| 315 |
// If the old terminal for the connection anchor cannot be resolved (by SlidableAnchor) a null |
| 316 |
// PrecisionPoint will passed in - this is handled here |
| 317 |
return createDefaultAnchor(); |
| 318 |
return new SlidableAnchorEx(this, p); |
| 319 |
} |
| 320 |
}; |
| 276 |
|
321 |
|
| 277 |
return result; |
322 |
return result; |
| 278 |
} |
323 |
} |
|
Lines 1263-1269
Link Here
|
| 1263 |
// return targetAnchor; |
1308 |
// return targetAnchor; |
| 1264 |
return super.getTargetConnectionAnchor(request); |
1309 |
return super.getTargetConnectionAnchor(request); |
| 1265 |
} |
1310 |
} |
| 1266 |
|
1311 |
|
| 1267 |
/** |
1312 |
/** |
| 1268 |
* Handle lost message |
1313 |
* Handle lost message |
| 1269 |
*/ |
1314 |
*/ |
|
Lines 1273-1280
Link Here
|
| 1273 |
Point referencePoint = targetConnectionAnchor.getReferencePoint(); |
1318 |
Point referencePoint = targetConnectionAnchor.getReferencePoint(); |
| 1274 |
if(connEditPart instanceof Message6EditPart && referencePoint.x != 0 && referencePoint.y != 0) { |
1319 |
if(connEditPart instanceof Message6EditPart && referencePoint.x != 0 && referencePoint.y != 0) { |
| 1275 |
targetConnectionAnchor = new XYAnchor(referencePoint); |
1320 |
targetConnectionAnchor = new XYAnchor(referencePoint); |
| 1276 |
} |
1321 |
} |
| 1277 |
|
|
|
| 1278 |
return targetConnectionAnchor; |
1322 |
return targetConnectionAnchor; |
| 1279 |
} |
1323 |
} |
| 1280 |
|
1324 |
|