Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » Restricting the dragging of editpart
Restricting the dragging of editpart [message #196428] Thu, 10 July 2008 02:59 Go to next message
Eclipse UserFriend
Hello,

I have a editpart1(child) inside of editpart2(parent) and editpart3(child)
inside editpart4(parent). Now I can drag editpart1 to inside of editpart4.
How can I restrict this?. It has to be always inside its parent not into
other editpart parent.

Thanks In Advance,
Nagesh.
Re: Restricting the dragging of editpart [message #196673 is a reply to message #196428] Fri, 11 July 2008 10:25 Go to previous messageGo to next message
Eclipse UserFriend
I may be misunderstanding your question here but i suggest that you take
another look at your ecore model, since a child should only be able to be
drawn within its own parent.... so if I am understanding you correctly it
may be because your relationships are wrong, so that would be the first
thing to check!
Re: Restricting the dragging of editpart [message #196797 is a reply to message #196673] Mon, 14 July 2008 00:36 Go to previous messageGo to next message
Eclipse UserFriend
Hello Gary,

Thanks for reply. You are right on the normal case. But in our domain its
allowed that the child element can remain within parent as well as
standalone outside the parent.
The constraint is that, incase it is within parent, user should NOT
be able to drag it out and put it under the root, or under another parent.
How can we make this?.

On the other side, is it possible to keep on reading the dragging event of
editpart's outer view and while outer view touches the parent borer
automatically resizing the parent?.


Thanks In Advance,
Nagesh.
Re: Restricting the dragging of editpart [message #196940 is a reply to message #196797] Mon, 14 July 2008 10:16 Go to previous messageGo to next message
Eclipse UserFriend
Hi, sorry i'm not entirly sure I can completly solve that problem, but
maby I can help a little!
If you make your root root class an abstract class and your parent classes
inherit from it, you will be able to move the child between its own parent
and the root only!
....This will only solve the problem of you been able to place the child
in another parent!
....I'm not realy sure how you could restrict movement from the parent to
the root though!!!

Sorry I can't be of more help!
Re: Restricting the dragging of editpart [message #198520 is a reply to message #196940] Wed, 23 July 2008 07:38 Go to previous message
Eclipse UserFriend
I got solution. We can drag tracking event in editpart like below,

public DragTracker getDragTracker(Request request)
{
//Handling dragging of component
return new DragEditPartsTracker(this)
{
@Override
protected boolean handleDragInProgress() {
// TODO Auto-generated method stub
return super.handleDragInProgress();
}
};
}

and you can lock this editpart to its parent so that it can't come out of
its parent,


public DragTracker getDragTracker(Request request)
{
//Handling dragging of component
return new DragEditPartsTracker(this)
{
@Override
protected boolean handleDragStarted() {
lockTargetEditPart(getParent());
return super.handleDragStarted();
}
};
}

--Nagesh
Previous Topic:No Errors in Problems View after Validation
Next Topic:Mark Nodes in a Model after Validation
Goto Forum:
  


Current Time: Wed May 07 03:17:06 EDT 2025

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

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

Back to the top