Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » How can I get current MouseLocation in RootEditPart?
How can I get current MouseLocation in RootEditPart? [message #220314] Sat, 29 July 2006 03:29 Go to next message
arfeifei is currently offline arfeifeiFriend
Messages: 12
Registered: July 2009
Junior Member
Hi!
I wanna get the current mouse location in RootGraphicEditPart.the
problem is only you move the mouse to a exist figure on the root diagram
it works. when I move mouse to other place .it doesn't revoke the listener.
why? is there anything I did wrong?

thanks in advance

arfeifei

here is the code

MyRootDiagramEditoPart...


private Point location = new Point();

private MouseMotionListener mouseListener = new MouseMotionListener.Stub(){
public void mouseEntered(MouseEvent me) {
location.x = me.x;
location.y = me.y;
}
public void mouseExited(MouseEvent me) {
location.x = me.x;
location.y = me.y;
}
public void mouseHover(MouseEvent me) {
location.x = me.x;
location.y = me.y;
}
public void mouseMoved(MouseEvent me) {
location.x = me.x;
location.y = me.y;
}
};

...
@Override
public void activate() {
super.activate();
getFigure().addMouseMotionListener(mouseListener);
}

@Override
public void deactivate() {
getFigure().removeMouseMotionListener(mouseListener);
super.deactivate();
}

public Point getLocation() {
return location;
}
Re: How can I get current MouseLocation in RootEditPart? [message #220322 is a reply to message #220314] Sat, 29 July 2006 04:38 Go to previous message
arfeifei is currently offline arfeifeiFriend
Messages: 12
Registered: July 2009
Junior Member
ok I figured that out ! ;-) thanks
based on
http://dev.eclipse.org/newslists/news.eclipse.tools.gef/msg1 4686.html

"arfeifei" <arfeifei@gmail.com> wrote in message
news:eaekmg$gaf$1@utils.eclipse.org...
> Hi!
> I wanna get the current mouse location in RootGraphicEditPart.the
> problem is only you move the mouse to a exist figure on the root diagram
> it works. when I move mouse to other place .it doesn't revoke the
> listener.
> why? is there anything I did wrong?
>
> thanks in advance
>
> arfeifei
>
> here is the code
>
> MyRootDiagramEditoPart...
>
>
> private Point location = new Point();
>
> private MouseMotionListener mouseListener = new
> MouseMotionListener.Stub(){
> public void mouseEntered(MouseEvent me) {
> location.x = me.x;
> location.y = me.y;
> }
> public void mouseExited(MouseEvent me) {
> location.x = me.x;
> location.y = me.y;
> }
> public void mouseHover(MouseEvent me) {
> location.x = me.x;
> location.y = me.y;
> }
> public void mouseMoved(MouseEvent me) {
> location.x = me.x;
> location.y = me.y;
> }
> };
>
> ..
> @Override
> public void activate() {
> super.activate();
> getFigure().addMouseMotionListener(mouseListener);
> }
>
> @Override
> public void deactivate() {
> getFigure().removeMouseMotionListener(mouseListener);
> super.deactivate();
> }
>
> public Point getLocation() {
> return location;
> }
>
Previous Topic:graphical editor with two display modes.
Next Topic:Who to change Z-order of EditParts?
Goto Forum:
  


Current Time: Thu Apr 25 12:37:03 GMT 2024

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

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

Back to the top