Geertjan's Blog

  • November 8, 2007

Hyperlinking to NetBeans API Sources

Geertjan Wielenga
Product Manager
When you're writing NetBeans modules, one of the most crucial things you need to set up is NetBeans API source navigation. There are help topics in the helpset that describe this, but I've found that few people are aware of the help topics in the IDE that relate to NetBeans module development. It is the "last but not least" section in the helpset, which in 6.0 is simply called "NetBeans Modules" (the helpset is under Help > Help Contents).

Source navigation means holding down the Ctrl key and moving your mouse over some identifier in your code. When you do that, the identifier becomes blue and underlined, like a hyperlink, and then when you click the hyperlink, the editor opens at some related point. But... this is also true in relation to NetBeans API sources. For example, here I've moved the mouse over 'TopComponent', while holding down the Ctrl key:

I click the hyperlink and the source of the 'TopComponent' class opens in the editor:

Of course, this is handy, because now I can read the Javadoc in the sources, without leaving the editor. I can also look at the other methods in the class, i.e., those that I am not using or maybe am not even aware of. However, to make this possible, you need to register a ZIP file containing the NetBeans Platform sources in the NetBeans Platform Manager, like this:

Go here and you will be on "/download/6.0/nightly/latest/zip". Many ZIP distros are found there, of the very latest build. There, get netbeans-6.0-200711080000-platform-src.zip (or whatever the name is, depending on the current date) and then put that ZIP in the NetBeans Platform Manager (which is under the Tools menu) shown above. Then you'll be able to hyperlink to NetBeans API sources.

Join the discussion

Comments ( 8 )
  • Dan Friday, November 9, 2007

    I do not know what differences there may be between the latest platform sourcecode and the code actually compiled into NB6_b2, but if you want the exact platform code for your installation go to :


  • Tom Friday, November 9, 2007

    This doesn't appear to work very well. I've downloaded netbeans-6.0beta2-200710212201-platform-src.zip and configured it in netbeans. Holding control over something I know is in the source zip highlights and gets underlined but when I actually click on it it silently does nothing. Sometimes part of the interface will repaint but the contents don't change. It works correctly for my own sources and the JDK sources though. I remember getting this configured in 5.5 long ago but don't understand why it doesn't work now. As an aside, it seems like it would make sense if the source and javadoc were available from the update center. Having to jump through hoops to get something so basic seems silly.

  • Geertjan Friday, November 9, 2007

    Well, go to the Plugin Manager, to the Available tab, and type 'javadoc'. You will find a module called 'NetBeans API Documentation'. That's the Javadoc, Tom, and so it IS available from the update center. However, that's not the sources and I agree those should be available in a simpler way. About your specific problem, that's strange. Maybe you need a restart. Maybe you need to put the ZIP into the Javadoc tab as well as the Sources tab.

  • Markus Wednesday, December 5, 2007

    This was an excellent tips. I wish I knew about this a long time ago.

    It works for most of the platform, but for me it doesn't work for Visual Library, even though I can see the files in the zip I downloaded.

    Can you hyperlink org.netbeans.api.visual.graph.GraphScene?

  • Dan Tuesday, December 11, 2007
  • Odszkodowania Wednesday, January 30, 2008
  • norling Tuesday, February 12, 2008

    I also have problem with Visual Library and org.netbeans.api.visual.graph.Graph.

  • cheng Wednesday, August 26, 2009

    I think Netbean Platform manager is probably outdated. Visual Library is now part of Netbeans Platform but the platform manager is not adding the visual library source code. It's included in the downloaded - just not added I think.

    You can add it manually as I have done.

    Unzip the plateform source code to some location.

    Go to tools>library>new library.

    In classpath, choose org-netbeans-visual-lib.jar from the netbeans-6.X/platformZ/modules/.

    In source, choose api.visual/src in the location you unzip your plate form source.

Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.