Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Getting the Position of an Editor (How to get the absolute Position of an Editor)
Getting the Position of an Editor [message #1016674] Thu, 07 March 2013 05:33 Go to previous message
Mark Geiger is currently offline Mark Geiger
Messages: 2
Registered: March 2013
Junior Member
I tried several things, but sadly none of them seem to work how i need it to.

        final IWorkbenchPart activePart = PlatformUI.getWorkbench()
            .getActiveWorkbenchWindow().getActivePage().getActivePart();
        WorkflowEditor editor = (WorkflowEditor) activePart;      
        GraphicalViewer viewer = editor.getViewer();
        FigureCanvas figure = ((FigureCanvas) viewer.getControl());

        figure.getBounds().x
        figure.getViewport().getClientArea().x
        figure.getShell().getBounds().x
        figure.getLocation().x


all of these returns just give me the position of the application itself or just 0.

But what i figured out, when i add a MouseListener to the "figure", the MouseEvents give me the Positions i need.
        figure.addMouseMoveListener(new MouseMoveListener() {   
            @Override
            public void mouseMove(MouseEvent arg0) {
                // TODO Auto-generated method stub
                offsetx = MouseInfo.getPointerInfo().getLocation().x - arg0.x;
                offsety = MouseInfo.getPointerInfo().getLocation().y - arg0.y;
                
            }
        });


I need a way to get these informations. Is it possible to get the informations the MouseEvent has, without using an EventListener?
 
Read Message
Read Message
Read Message
Previous Topic:Transfer Crashes Application
Next Topic:How to disable resize of views
Goto Forum:
  


Current Time: Wed May 22 11:22:03 EDT 2013

Powered by FUDForum. Page generated in 0.01548 seconds