Archive for May, 2010|Monthly archive page

Debugging Eclipse UI layouts with Picasso

I always seem to spend too much time dinking around with UI layouts.  In fact, today I’ve been fighting an odd problem where I had a bunch of extra space in a dialog between two other elements.  I had spent excessive time trying things, over and over again, with no success.  That’s usually a sign to take a step back from the keyboard.

I vaguely remembered there was a tool that painted each composite in the UI a different color.  I Googled and found Simon Archer and Chris Aniszczyk’s Picasso tool.  Picasso is found in the PDE incubator source code (unfortunately it doesn’t get full billing on the PDE incubator page).

I ran my app with Picasso enabled, and clearly saw that something was amiss between my text and my table.  I hovered over the lime green box and was able to get a large screen of useful information (not shown): what the element is, its parentage, layout, etc.  I was able to quickly fix my mistake.

How to use:

  • Import the project into your workspace from the PDE incubator repository.
  • In your run config:
    • Plug-ins: add org.eclipse.pde.picasso.
    • Tracing: enable tracing and turn on org.eclipse.pde.picasso.
  • Start your app.
Advertisements

Is upgrade to “Eclipse RCP, 2nd Edition” worth it?

Today I received my copy of the Eclipse Rich Client Platform, 2nd (McAffer, Lemieux, Aniszczyk).

If you are interested in RCP development, this is the book to own.

But if you already own the 1st edition, is it worth buying the newer edition?  So you can decide for yourself, here are the major differences:

Software management. This chapter has been re-written to discuss software management using p2, which replaced the Update Manager

Action and Commands.  A chapter has been added to discuss the newer Commands API, as well as their differences with Actions.

Installing and Updating with P2.  More p2 information

PDE build. PDE Build is one of the more error-prone and time consuming aspects of working with Eclipse products.  (It’s also powerful and useful.  This chapter is completely reworked.  Lots of clarification as well as updated information.

Testing. A new chapter on testing an RCP application.  A great addition to the book.

A DataBinding reference chapter has been added.

One other thing I really liked was the new font– much more readable IMO.  I also like the Pointers section at the end of each chapter.  Very nice touches.

Tim O’Reilly, Cloud Computing Keynote

This isn’t necessarily an Eclipse-specific post.    I’m trying to expand my desktop/IDE-centric worldview a bit, and thought other tools developers might find this interesting.

Also, I enjoy listening to Tim O’Reilly.   His talk encompasses Cloud Computing, Open Source Software, Open Data, and tools for using/sharing Open Data. As a tools developer, I found it thought-provoking.

Essential Plugin: Platform ‘Core Tools’

I wanted to mention another Essential Eclipse Plug-in: the Eclipse Platform Team’s ‘Core Tools’.  I consider it essential to my work based on its inclusion of a single tool: “Find Unreferenced Members”.

Armed with this tool and some unit tests, you can really clean up some code.

Plug-in developers are the primary audience for ‘Core Tools’.  It contributes tools for validating plug-ins/class loading and Eclipse metadata browsing.  You can find more info on its capabilities here: http://www.eclipse.org/eclipse/platform-core/downloads/tools/readme.html.

The essential tool to any Java developer is “Find Unreferenced Members”.

  • Right click on a project, package, or file.
  • Select “Find Unreferenced Members”.
  • A Search view appears with member candidates for removal.
  • Note the matches are only a good set of candidates.  The tool analyzes the Java code in your workspace to determine unused members.  There may be false candidates.  For example, a no-arg constructor might be unreferenced, but as any plug-in developer knows, it’s required if the class is instantiated via plug-in.

The update site is here: http://www.eclipse.org/eclipse/platform-core/downloads.php#updates.

Update: It’s now here:  http://eclipse.org/eclipse/platform-core/updates.

Deadlock Debugging in Eclipse

My Eclipse-based product dead-locked this morning.

If I had launched from my Eclipse dev environment, I could use the debugger to show me the threads and locks that are giving me trouble.  Darin Swanson has the best explanation of this.

If I had started the product with “-debug -consoleLog‘ or with java.exe instead of javaw.exe, I could have hit ctrl-Break (Windows) to get a thread dump.

But I had started the product from the install bundle, so didn’t have these options.  I also didn’t think the deadlock would necessarily reproduce if I re-ran the product.  A little research showed I had more tools at my disposal than I originally realized.

jconsole/jstack

If I had started the product with the Java 6 (or with Java 1.5 using the -Dcom.sun.management.jmxremote VM option), I could use jconsole to attach to my process.  Besides the stack trace, this allows all kinds of interesting monitoring.

To use the tool, you’ll need the process ID.  You can use the task manager on Windows or the  JDK tool jps to get the list of Java process IDs.

The JDK tool jstack works great to just get a quick stack dump from the command-line.  Again, you’ll need the process ID.

I need to spend some time exploring the JMX tools.  Some cool and useful stuff in here.

SendSignal.exe

Another option is Send Signal, a nice program that send the Ctrl-Break signal to your Java process.

More

Much of the information new to me came from these 2 excellent resources.  Both pages have  other ways to get stack traces, including on *nix, and other useful debugging tips.