Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » Location on figures on the Editor
Location on figures on the Editor [message #104098] Thu, 15 February 2007 00:25 Go to next message
Eclipse UserFriend
Hi,

Is it possible to drag & drop figures on the editor in the vertical manner?
And they shouldnt overlap.
I dont how to get the coordinates(location) of the figure on the Editor.

Regards,
Sandip
Re: Location on figures on the Editor [message #104307 is a reply to message #104098] Thu, 15 February 2007 10:08 Go to previous message
Eclipse UserFriend
One way to implement the horizontal/vertical dragging will be using as
specialized DragEditPartsTracker for example let's say i want the
LEDEditPart (in the logic example) to move horizontally

I'll create a new class let's call it MyHorizontalDragTracker it should
look like that

public class MyHorizontalDragTracker
extends DragEditPartsTrackerEx {

public MyHorizontalDragTracker(EditPart sourceEditPart) {
super(sourceEditPart);
}

protected void updateTargetRequest() {
repairStartLocation();
ChangeBoundsRequest request =
(ChangeBoundsRequest)getTargetRequest();
request.setEditParts(getOperationSet());
Dimension delta = getDragMoveDelta();
delta.height = 0;
Point moveDelta = new Point(delta.width, delta.height);
request.getExtendedData().clear();
request.setMoveDelta(moveDelta);
request.setLocation(getLocation());
request.setType(getCommandName());
}

notice that in update target request i set the height to 0 ; if i want
it to move vertically i'll set the width to 0

then in my edit part (LEDEditPart in this case) I'll override
getDragTracker and return my new Tracker like that

public DragTracker getDragTracker(Request request) {
// TODO Auto-generated method stub

return new MyHorizontalDragTracker(this);
}

Keep in mind this is just a quick way for doing it (there might be
better ways) , for example you will find that I'm not handling snap to
grid in this tracker.

another way will be by changing the request it self, which means you
will need a specialized layout edit policy



Sandip Sahoo wrote:
> Hi,
>
> Is it possible to drag & drop figures on the editor in the vertical manner?
> And they shouldnt overlap.
> I dont how to get the coordinates(location) of the figure on the Editor.
>
> Regards,
> Sandip
>
>
>
>
Previous Topic:How to add more tabs to property window of an eclipse
Next Topic:3.3M4 Europa Where is GMF??
Goto Forum:
  


Current Time: Wed Apr 30 09:02:25 EDT 2025

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

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

Back to the top