Tuesday, November 6, 2012

Debugging with sysouts made awesome

At times I like to debug by writing to console. However, in a long debugging session I often end up with several sysout statements in several files/methods, which makes it hard to track where a particular line of console output came from.

In the past I tried to use code templates to also print the 'enclosing type' and 'enclosing method', but I often forgot to use the template. In any case, via templates you cannot 'link' back to the source code.

Jeeeyul presents a neat solution - just replace PrintStream by a DebugStream so that you can also print 'file : line number : method name' information. I took this code, added it to a plugin and then added this plugin to my launch config. Now everytime I launch an Eclipse Application 'DebugStream' gets activated. 

Essentially, the plugin converts console messages from
Hello World.
to include a link to the source code
(HelloWorld.java:10) main(..) : Hello World.

Saturday, July 28, 2012

Going back to school

After working at IBM for 5 years, I am going back to school. August 10th is my last day as a 'full-time' JDT committer, after which I head to University of British Columbia for Masters in Computer Science. I am looking forward to spending two fun-filled years in Vancouver. :-)

It has been fun contributing to Eclipse so far, and in my free time I will likely continue to contribute. So, I will not actually say 'Good bye'.

Sunday, July 1, 2012

Eclipse Tip: Stepping into selection and hyperlink debugging

The Java debugger allows you to step into a single method within a series of chained or nested method calls. Simply select the method you wish to step into and select Step into Selection from the Java editor context menu. I prefer to use the shortcut Ctrl+F5.


You can also step into a method by using hyperlink navigation. Simply place the cursor over the method you wish to step into and use Ctrl+Alt+Click to step into the method (rather than Ctrl+Click which will navigate to the source code).

Saturday, June 30, 2012

Improving Java code quality with Eclipse Juno

The Eclipse Java compiler performs more checks and analyses than are mandated by the Java Language Specification. See Java > Compiler > Errors/Warnings preference page for available options.

Now several of these options should be obvious, however a few maybe not :-) In Juno we (I mean Stephan) added a few pages to give some background on certain analyses and hints on how to make the best use of them.




Please let us know if these pages could be improved, or if you want to know more details on some other compiler options as well.

Thursday, June 28, 2012

Eclipse Demo Camp 2012 - Bangalore

The Demo Camp happened last Friday, and was great fun! A couple of things stood out for me.

First, I was pleasantly surprised to see people from Bosch already exploring Orion and evaluating how they can use the Orion platform and the Orion editors at their work.

Second, I came to know about Eclipse Spykit which looks an interesting project. Based on Runtime Spy Eclipse Spykit creates more charts and does a bit more analysis on what happens during Eclipse startup. Annamali started this project and mentioned that he is looking for contributors.

Oh yeah, the Fajitas were good and the wine was excellent!

Tuesday, June 19, 2012

Eclipse Demo Camp 2012 - Bangalore

It's demo camp time again! I will be speaking this Friday at the Eclipse Demo Camp Bangalore where I will demo some of the interesting new features in JDT for Juno and also show off a few tips and tricks. 


It should be fun discussing Eclipse over some Tapas and wine :-) Thanks Annamalai for organizing this!

Thursday, June 14, 2012

JDT Tip: Toggle between inserting and replacing content assist


When content assist is invoked on an existing identifier, it can either replace the identifier with the chosen completion or do an insert.

The default behavior is to insert. You can toggle this behavior while inside the content assist selection dialog by pressing and holding the Ctrl key while selecting the completion. The highlighted text is overwritten.

If you wish the completion to overwrite without pressing the Ctrl key then you can select 'Preferences > Java > Editor > Content Assist > Completion overwrites'.