Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Create a new Figure where the Drop occurs
Create a new Figure where the Drop occurs [message #53526] Fri, 10 January 2003 16:30 Go to next message
Eclipse UserFriend
Originally posted by: sy_cheung2.yahoo.com

Hi,

I want to create a new Figure in my Diagram where the Drop occurs. In order
to do that I change the NativeDropRequest to save the (x,y) of the drop
event and in my TextTransferDropTargetListener, I call the getCurrentEvent()
and get the (x,y) of that event.

But what I find out is the (x,y) co-ordinate of the getCurrentEvent() is
different from what i expected. I drop the text in the top left side of my
diagram, the (x,y) co-ordinate of the getCurrentEvent() is (357, 369). I
expect x, y-coordinate should be in the range of 100. So even I drop in in
the top lef side of my diagram, the figure is created in the bottom right
side of my diagram.

Could someone please tell me if my approach is correct? If not, please tell
me what did I miss.

Thank you.

Changes I made in the TextTransferDropTargetListener:

protected Request createTargetRequest() {

DropTargetEvent event = getCurrentEvent();

NativeDropRequest dropRequesgetCurrentEventt = new NativeDropRequest();

System.out.println("x" + event.x + "y"+event.y);

dropRequest.setX(event.x);

dropRequest.setY(event.y);

return dropRequest;

}

protected void updateTargetRequest(){

DropTargetEvent event = getCurrentEvent();

System.out.println("x" + event.x + "y"+event.y);

getNativeDropRequest().setX(event.x);

getNativeDropRequest().setY(event.y);

getNativeDropRequest().setData(getCurrentEvent().data);

}
Re: Create a new Figure where the Drop occurs [message #53553 is a reply to message #53526] Thu, 09 January 2003 16:46 Go to previous messageGo to next message
Manfred Goetz is currently offline Manfred GoetzFriend
Messages: 8
Registered: July 2009
Junior Member
No time to check this now, but try
AbstractTransferDropTargetListener.getDropLocation()


"Sam Cheung" <sy_cheung2@yahoo.com> wrote in message
news:avmrj2$8gp$1@rogue.oti.com...
> Hi,
>
> I want to create a new Figure in my Diagram where the Drop occurs. In
order
> to do that I change the NativeDropRequest to save the (x,y) of the drop
> event and in my TextTransferDropTargetListener, I call the
getCurrentEvent()
> and get the (x,y) of that event.
>
> But what I find out is the (x,y) co-ordinate of the getCurrentEvent() is
> different from what i expected. I drop the text in the top left side of my
> diagram, the (x,y) co-ordinate of the getCurrentEvent() is (357, 369). I
> expect x, y-coordinate should be in the range of 100. So even I drop in
in
> the top lef side of my diagram, the figure is created in the bottom right
> side of my diagram.
>
> Could someone please tell me if my approach is correct? If not, please
tell
> me what did I miss.
>
> Thank you.
>
> Changes I made in the TextTransferDropTargetListener:
>
> protected Request createTargetRequest() {
>
> DropTargetEvent event = getCurrentEvent();
>
> NativeDropRequest dropRequesgetCurrentEventt = new NativeDropRequest();
>
> System.out.println("x" + event.x + "y"+event.y);
>
> dropRequest.setX(event.x);
>
> dropRequest.setY(event.y);
>
> return dropRequest;
>
> }
>
> protected void updateTargetRequest(){
>
> DropTargetEvent event = getCurrentEvent();
>
> System.out.println("x" + event.x + "y"+event.y);
>
> getNativeDropRequest().setX(event.x);
>
> getNativeDropRequest().setY(event.y);
>
> getNativeDropRequest().setData(getCurrentEvent().data);
>
> }
>
>
Re: Create a new Figure where the Drop occurs [message #58627 is a reply to message #53553] Tue, 28 January 2003 15:18 Go to previous message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

"Manfred Goetz" <xgoetz@de.ibm.com> wrote in message
news:avmsm9$9du$1@rogue.oti.com...
> No time to check this now, but try
> AbstractTransferDropTargetListener.getDropLocation()

Yes, I think that one is EditPartViewer-relative.

SWT sends a Display-relative coordinate.

>
>
> "Sam Cheung" <sy_cheung2@yahoo.com> wrote in message
> news:avmrj2$8gp$1@rogue.oti.com...
> > Hi,
> >
> > I want to create a new Figure in my Diagram where the Drop occurs. In
> order
> > to do that I change the NativeDropRequest to save the (x,y) of the drop
> > event and in my TextTransferDropTargetListener, I call the
> getCurrentEvent()
> > and get the (x,y) of that event.
> >
> > But what I find out is the (x,y) co-ordinate of the getCurrentEvent() is
> > different from what i expected. I drop the text in the top left side of
my
> > diagram, the (x,y) co-ordinate of the getCurrentEvent() is (357, 369).
I
> > expect x, y-coordinate should be in the range of 100. So even I drop in
> in
> > the top lef side of my diagram, the figure is created in the bottom
right
> > side of my diagram.
> >
> > Could someone please tell me if my approach is correct? If not, please
> tell
> > me what did I miss.
> >
> > Thank you.
> >
> > Changes I made in the TextTransferDropTargetListener:
> >
> > protected Request createTargetRequest() {
> >
> > DropTargetEvent event = getCurrentEvent();
> >
> > NativeDropRequest dropRequesgetCurrentEventt = new NativeDropRequest();
> >
> > System.out.println("x" + event.x + "y"+event.y);
> >
> > dropRequest.setX(event.x);
> >
> > dropRequest.setY(event.y);
> >
> > return dropRequest;
> >
> > }
> >
> > protected void updateTargetRequest(){
> >
> > DropTargetEvent event = getCurrentEvent();
> >
> > System.out.println("x" + event.x + "y"+event.y);
> >
> > getNativeDropRequest().setX(event.x);
> >
> > getNativeDropRequest().setY(event.y);
> >
> > getNativeDropRequest().setData(getCurrentEvent().data);
> >
> > }
> >
> >
>
>
Previous Topic:Error Messages
Next Topic:Updating figures from other threads
Goto Forum:
  


Current Time: Fri Jul 19 12:17:32 GMT 2024

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

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

Back to the top