Wednesday, September 23, 2009

New plug-in: scrolling with middle button

My favorite way to scroll site contents in internet browsers is to press middle mouse button and slightly move mouse up or down. It's usually more convenient than rotating mouse wheel or grabbing scrollbar. This feature is supported by every popular browser but it's also being added to other applications (even the primitive Notepad in Windows has it!). I got used to it so much that I really miss it in Eclipse.

So I've done a little investigation to check whether it would be possible to add such a feature to Eclipse workbench. It turns out it would be very hard to do, as there's no general API in SWT to programmatically invoke scrolling. Only limited number of custom widgets provide methods that can do it. Fortunately, StyledText which is used by all text editors in Eclipse is one of them. This allowed me to prepare a plug-in that adds MMB scrolling at least to text editors. It's not much, but better than nothing. If you're interested, please visit the project page or go directly for download.

I'll be trying to hack other popular editors and viewers, so the list of scrollable elements may get longer in next versions. If you know something that may be useful for this task, please let me know :)