Much ado about scripting, Linux & Eclipse: card subject to change

2007-06-23

And Now For Something Completely Different...

Much like Ian's post the other day, I've always wanted to blog that line. Anyway, it's been brought to my attention that of late I've been apparently posting less-than-positive things about Eclipse, so to balance that out, here's my top three cool UI features in Eclipse 3.3, in order from oldest to newest:

#3: Use PDE UI to generate an Ant build.xml script for a plugin project

This has been around for years, true, but it's certainly top on my list of time-savers. Here's a quick HOWTO for taking a plugin and ending up with a versioned, Update Manager-compatible OSGi bundle.

  1. Create, import, or extract a plugin project from CVS.
  2. Right-click the plugin's plugin.xml and select PDE Tools > Create Ant Build File.
  3. Open the Ant view (CTRL-3, Ant or SHIFT-ALT-Q,Q > Ant) then drag the newly-generated build.xml into that view to see all the available targets. It's like the Outline view, but you can launch targets by double-clicking them.
  4. Double-click the build.update.jar target to run that build. You should see a new jar created in the root of your plugin project. (If you don't, select the plugin project's folder in the Package Explorer, Project Explorer, or Navigator view, and hit F5 to refresh.)
  5. You can run other targets, like src.zip to create a source zip, or edit them to suit your needs. If you delete the build.xml you can always regenerate it from the latest template.

#2: Use Package Explorer + Working Sets + Filters to clean up your view

I've been using these for at least a year by now, but only recently discovered that they behave differently in the Package Explorer than in the other filesystem views, like Navigator and Project Explorer. The best by far, for me, is the way the Package Explorer does things. Here's a shot of how one of my rather project-heavy workspaces looks in the Navigator view, compared to the Package Explorer with Working Sets set as my Top Level Elements:

To make this work, open the Package Explorer view, then click the menu icon (an arrow pointing down in the top right corner of the view -- I'll just call it Menu for simplicity). Here's a few things you can do to alter your view:
  • Toggle Working Sets / Projects:
    Menu > Top Level Elements > {Working Sets | Projects}
  • Select what Working Set(s) to show (when TLE = Projects):
    Menu > Top Level Elements > Projects, then
    Menu > Select Working Sets...
  • Select, create, edit, or delete Working Sets (when TLE = Working Sets):
    Menu > Top Level Elements > Working Sets, then
    Menu > Configure Working Sets...
  • Hide closed projects, empty packages, libraries, non-Java files, etc.:
    Menu > Filters

#1: Use Autopin UI Tweaklet to manage open editor tabs

This is my most recent discovery, and once you get used to it, a great new way to manage editor tabs.

First, download & install the Tweaklet plugin(s) from either the Platform UI Incubator downloads or updates site.

Then, marvel as a whole new way of working with tabs is revealed: you only ever have one tab in use until you start editing that file. When you do, the Autopin tweaklet automatically pins the tab, and subsequent files are opened in a second one, then a third, and so on.

Like Working Sets, this is also fantastic when dealing with massive workspaces or when you have a lot of files that reference other files. Eg., when drilling down from one Java class into another and into another to find the method you need, or for PHP scripts that include() or require() others, again, looking for methods or variable declarations, or even in concert with the full-text search (CTRL-H, first tab) to find that elusive build-related metafile which needs to be fixed, without ending up with 20 open files. Kick ass.

The bottom line here is that there's lots of hidden features in Eclipse to make your life easier and your work more efficient. And because we all work a little differently, there's lots of ways to tweak the way the UI behaves to accomodate all our differences. Eclipse is you? Aye!

2 comments:

Wassim Melhem said...

Honored to have made your top 3, and thank you for choosing PDE :)

Nick said...

Dude, you sound like an airline.

"You have a choice when developing plugins, and we're glad you chose to fly with PDE Air. PDE Air, we love to generate ant scripts, and it shows."