Skip to main content

"Fisheye View" plugin for NetBeans

Posted by timboudreau on April 27, 2009 at 2:57 AM PDT

While I'm on my plugin-writing rampage, I just committed a plugin I was working on a few years ago to NetBeans source base. It's a fisheye view of the editor. Just drag the mouse in the error marker bar on the left of the editor, and get an overview of your whole file and rapidly navigate it! A picture is worth a thousand words...



NetbeansFishEyeView.png



The basic thinking is, if you're working in a source file you're familiar with, you probably know your way around it well enough that an outline of what it looks like will be useful, and being able to scroll through it all very rapidly is more efficient than dragging a scrollbar (if you just want to look, but not scroll anywhere, just release the mouse outside the error marker bar; if you release it inside it, the editor will be scrolled to what you were looking at and the caret moved there).

And if an error marker shows up somewhere in your source file, but it's above or below what is visible, then in one mouse gesture you can both see the error message (which you could see by hovering the mouse on the error marker bar beside the editor, or in the task list if you have it open), and you can also see the code associated with the error without losing your place in the editor by scrolling or changing the caret position.

It shows any annotation (error markers, breakpoints, bookmarks, etc.) by highlighting it, and providing a description is one is available (same as the tooltip for the mark in the error bar).
It also was a chance to have fun with some animated fade-ins for the component itself and the text-bubbles that show the annotation text.

The code for it is actually not NetBeans-specific. It is a general-purpose text fish-eye view for Swing text components which will work with any JTextComponent and another component to drag the mouse on, so this can be used in any Swing application (as long as you don't mind that it will screw around with the glass pane of whatever window it's in) - the sources are in contrib/fisheye - just one interface to implement to use it.

Alas, I'm doing a bit of a hack to hook into the error marker bar, so it is using an implementation dependency to get access to it. So publishing a binary would be somewhat useless, since it requires that it run against the exact version of the error marker bar that it was compiled against. But I can probably get it on the update center for development builds.

So ideally this would be tuned a little more and go into the actual NetBeans distro. If you think this would be a Good Thing, you can vote for enhancement request 163729.

And of course, if you think it's a horrible or insane idea, comment below :-)

Related Topics >>

Comments

Right now, I'm afraid so. Hopefully I can get it into the dev update center soon.

That's pretty awesome, Tim.

You shouldn't need a library wrapper - there's already a module in contrib/ that integrates it. At present you'll need to build it (a silly Windows keepalive bug in Mercurial has prevented me from adding it to the daily build update centers). You should just be able to build nb and build contrib/fisheye, start the IDE and it's there.

Tim -- I really like the idea... just can't get it to work. I created a module project, downloaded the source files, created an nbm, and installed it, but nothing happens when I drag in the error column of the editor. I'm using NB 6.5.1. Any thoughts?

I'm a neophyte with NB modules, so this isn't clear to me. Does this mean that rather creating an nbm and adding a plugin, I need to build the entire NB IDE, incorporating Fisheye?