Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » How do I prevent an EditPart from moving
How do I prevent an EditPart from moving [message #74375] Sun, 05 November 2006 16:05 Go to next message
Eclipse UserFriend
Originally posted by: awm_abu.yahoo.com

Hello all,

I am trying to create some editparts that cannot be moved or resized.
I have managed to disallow resizing by using the NonResizableEditPolicyEx
However I haven't managed to stop them from moving.
Not sure which editpolicy I should be using for this.
Can someone point me in the right direction ?

Thanks.
Re: How do I prevent an EditPart from moving [message #74691 is a reply to message #74375] Mon, 06 November 2006 15:59 Go to previous message
Eclipse UserFriend
Originally posted by: vcciubot.uwaterloo.ca

In the parent edit part override the layout policy to skip the type of
edit parts you would like to prevent from moving.


installEditPolicy(EditPolicy.LAYOUT_ROLE, new XYLayoutEditPolicy() {
protected Command getResizeChildrenCommand(ChangeBoundsRequest request) {
CompoundCommand resize = new CompoundCommand();
Command c;
GraphicalEditPart child;
List children = request.getEditParts();

for (int i = 0; i < children.size(); i++) {
child = (GraphicalEditPart)children.get(i);
if (child instanceof BlockEditPart)//skipped!!!!
continue;
c = createChangeConstraintCommand(request, child,
translateToModelConstraint(
getConstraintFor(request, child)));
resize.add(c);
}
return resize.unwrap();
}
});

On Sun, 05 Nov 2006 16:05:23 +0000, Alan wrote:

> Hello all,
>
> I am trying to create some editparts that cannot be moved or resized.
> I have managed to disallow resizing by using the NonResizableEditPolicyEx
> However I haven't managed to stop them from moving.
> Not sure which editpolicy I should be using for this.
> Can someone point me in the right direction ?
>
> Thanks.
Previous Topic:Obtain active editor name from paint method
Next Topic:New Article on GMF- Your Feedback required.
Goto Forum:
  


Current Time: Wed Jul 17 03:28:30 GMT 2024

Powered by FUDForum. Page generated in 0.03509 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top