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?