Keeping it Classy

by rgrunber

If you’re like me, and developing/maintaining Eclipse plugins, you’ve probably grown accustomed to looking up various classes that are a part of the Eclipse platform. Imagine my surprise when I started using a fresh version of Juno and saw this as I tried to open up the Type Hierarchy :

Ok, so maybe I haven’t got any projects in the workspace, but that shouldn’t mean I can’t at least browse around. If you create a plug-in project, you’ll still only get access to the Eclipse platform classes that are referenced by your project (and their dependencies it seems). I guess this explains why I never .. ever had to deal with this issue. I almost always have a bunch of plugin projects ready, and loaded before doing any kind of source browsing. As a result, the set of dependencies was large enough that it probably looked like I had the full platform’s sources available for viewing.

I guess that’s better than nothing, but what if you want to the comfort of knowing you’ve got the Eclipse platform’s classes at the ready for your viewing pleasure?

Not too long ago a colleague of mine had a similar problem, and shared the solution. They were having problems accessing a class that they knew was part of the Eclipse platform. From what I recall, it was referenced in another class that was viewable, but the source was not browsable. Either way, the solution was this :

So provided you have your target platform set, you’ll want to select the “Include all plugins from target in Java search” option. If your target platform isn’t set for some reason, just go to Windows -> Preferences -> Plug-in Development -> Target Platform, and add one based on the currently running platform, which should be the default option.

Once that’s done, you’ll have to apply the changes, and wait just a bit for the classes to be indexed. After that you’ll finally be able to browse all the platform sources regardless of the contents in your workspace.