An RCP Code Encyclopedia

May 4th, 2007  |  Published in Rich Client Platform, Tips  |  4 Comments

One suggestion I always make to developers getting started with the Rich Client Platform is to set up a research workspace containing all of the Eclipse IDE plug-ins. The Eclipse IDE (along with the PDE and JDT) is the ultimate RCP application and examining this code is the best way to learn how things should be done.

Are you developing a forms-based editor? Check out the PDE UI plug-ins to see how the Manifest Editor is constructed. Would you like to create a preference page with an unusual UI layout? Look through the many Eclipse IDE preference pages to find something similar. Then go look at the code.

I almost always have my research workspace open as I’m developing applications. It’s like having an RCP code encyclopedia! Follow these steps to create one:

  • Create a new workspace called “Research” or whatever you like, and launch Eclipse using that workspace.
  • On the General -> Workspace preference page, uncheck the Build automatically checkbox. This will stop Eclipse from attempting to build the huge pile of code you’re about to import into the workspace. This is also why it’s better to create a separate research workspace rather than importing the code into your programming workspace.
  • Workspace preference page

  • Switch to the Plug-in Development perspective.
  • Select the Plug-ins view, which should be stacked behind the Package Explorer view.
  • Select all the plug-ins in the view. Right-click and select Import as -> Source Project from the context menu.
  • Import Eclipse plug-ins

Now you can explore the Eclipse source code whenever you like. You can do advanced searches and follow references wherever they lead. Enjoy!

Responses

  1. Martin Coetzee says:

    May 4th, 2007 at 6:42 pm (#)

    Thanks for the tip! I’ve ben doing some RCP dev for a couple of years now, and this will def. help when doing coding, to quickly check how the eclipse code looks like.

    Cheers,
    Martin

  2. Wassim Melhem says:

    May 4th, 2007 at 8:51 pm (#)

    Good post.

    From the context menu, I would rather recommend the ‘Add to Java Search’ functionality instead of the import functionality. This way you would be able to browse the code without having to import the entire universe into your workspace.

    The ‘Add to Java Search’ is a hidden treasure. Hopefully, we can have it better integrated with JDT in 3.4.

    See
    https://bugs.eclipse.org/bugs/show_bug.cgi?id=81281
    https://bugs.eclipse.org/bugs/show_bug.cgi?id=113882

  3. pjpaulin says:

    May 7th, 2007 at 4:47 pm (#)

    Hi Wassim,

    Thanks for the suggestion. I wasn’t familiar with the ‘Add to Java Search’ functionality, and I’ll definitely use it in my development workspaces. I’m also looking forward to seeing what develops in this area.

    I’ll still be keeping my research workspace, though, as it’s a workaround for some of the issues in the bugzilla entries you listed. I also really like the ability to search and browse through the non-RCP code (PDE, JDT, etc) which isn’t included in my target platform.

    — Patrick

  4. Dimitri Missoh says:

    June 27th, 2007 at 11:38 am (#)

    Thank you for your usefull article. It was very helpfull for a newbie like me.

Leave a Response