brock
brock

Reputation: 469

How do I add a mouse listener to all open editors?

I'm trying to write a view plugin that, when opened, will cycle through all the currently open editors and add a mouse listener to each. I know I can get all the editors by using something like:

PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences()

However, I'm at a loss as to how add the listener. From the editor reference I can get the editor part, but I don't know how to get the underlying control to which I would add my mouse listener. What am I missing? Thanks!

Upvotes: 1

Views: 218

Answers (1)

greg-449
greg-449

Reputation: 111217

Editors may have lots of controls, so there is no one control you could add your listener to.

You can add a listener that is called from everything in the application using Display.addFilter, something like:

Display display = Display.getDefault();

display.addFilter(SWT.MouseDown, listener);

Upvotes: 2

Related Questions