I have a graphical editor on which a lot many shapes can be dragged and

dropped.

I wish to somehow ensure that these shapes cannot be dragged into negative

x and y co-ordinates.

The parent of the root edit part is ScalableRootEditPart

The figure associated with the edit part of may parent model is

Figure figure = new Layer();

figure.setBorder(new MarginBorder(3));

figure.setLayoutManager(new XYLayout());

The patchy way I have done it right now is to put a hack in the

refreshVisuals() of my shape edit part where in i have done this

Rectangle bounds = new Rectangle(getCastedModel().getLocation(),

getCastedModel().getSize());

if(bounds.x < 0) {

bounds.x = 0;

getCastedModel().setLocation(new Point(0, bounds.y));

}

if(bounds.y < 0) {

bounds.y = 0;

getCastedModel().setLocation(new Point(bounds.x, 0));

}

((GraphicalEditPart) getParent()).setLayoutConstraint(this,

getFigure(), bounds);

I do not like this way to do it and am sure there would be a better GEF

way to address this. Please let me know the proper way to do it

Thanks in Advance,

Siddharth]]>