Eclipse Plugin: Wicked Shell

A lot of Java development involves an IDE and a Shell window or two. The Shell is Command Prompt (cmd.exe) in my case as I develop on Windows. This cool Eclipse plugin reduces one window in my task bar: Wicked Shell. It just puts the OS’s default shell, bash for Linux and cmd.exe for Windows, in Eclipse as a view. You can have multiple shells open. It provides look and feel customizations, command history and code completion…

Pretty cool. Check it out…

Eclipse Tip: Java Editor Breadcrumb Navigation Bar

One new feature of Eclipse 3.4 is the Java editor’s Breadcrumb Navigation Bar. This can be enabled with the keyboard shortcut Alt+Shift+B or using a tool bar button. Like the name suggests it provides a breadcrumb path for the current element in the editor. This is kind of like the location bar in Windows Explorer in Vista. You can navigate to other elements in the same level. ex. the highest level shows all the elements of the class. Or you can right click on the path element to perform any action using the context menu. ex. quickly copy the fully qualified name.

Eclipse Tip: Custom Surround With

Previously I have posted the following tips:

Eclipse Tip: Surround With
Eclipse Tip: Remove Surrounding Statement

I thought that I will add to it a little bit. In Eclipse you can now add your own “Surround With” templates. Let us say we need to surround a piece of code with comments like:

Select the code and press Alt+Shift+Z and select “Configure Templates”.

Now create a template with the variable ${line_selection} in it. By using this variable the template shows up automatically in the Surround With templates and this is the location where the selected text will be in the end. Here is the template for the above example.

// ** Start Comment
// ${todo} ${cursor}
${line_selection}
// ** End Comment

Eclipse Tip: Add imports with Code Templates

Code templates have been in Eclipse for a long time. I have blogged about it a long time ago. I have been using it for inserting commonly used statements like logging statements…

When I am inserting a logger declaration I always end up with this:

Eclipse does not know which logger to import. In my case I want it to import the apache logger. Now there is a way you can tell Eclipse to import this automatically. Just edit the code template and add the following:

${:import(org.apache.log4j.Logger)}

This is cool and saves a bit of time. :-) For more information on template variables look here.

Eclipse Tip: Format edited lines on Save

Hm… It has been a long time since I posted an Eclipse Tip. I thought I will blog about this cool new feature in Eclipse Ganymede.

Previously I have posted about Save Actions in Eclipse. One of the feature I always use is to format code on save. But I run into trouble when I am editing code originally written by someone else who use a different formatting scheme or no formatting at all. Now the entire file is reformatted and it is a nightmare to check it in. Eclipse now has an option now to format only edited code on save. I am loving this feature…

Eclipse Tip: Remove Surrounding Statement

Eclipse Tip Remove Surrounding Statement

One of my previous tips from long ago is the Surround With feature. What we have today is kind of the opposite to that. It removes the surrounding statement.

Let say we have a if statement. We go to the starting or ending brace of the statement and press the magic key, Crtl + 1 or choose Edit > Quick Fix. Eclipse shows a quick fix option to remove the surrounding statement.

It is a simple feature but kind of useful if you want to remove a if statement in the middle of a complex set of nested if statements. Well I guess one should not have a complex set of nested if statements…

Eclipse vs Netbeans: Mark Occurrences

Eclipse vs Netbeans Mark Occurrences

 

Regular readers to this blog would know that I am a fan of Eclipse. I post a few tips about Eclipse, I have developed a couple of Eclipse plugins and I am an Eclipse user since 2002. 

With that out the way there is a lot of hype about Netbeans these days as the 6.0 release is coming up. I have been checking it out from time to time. But downloading the IDE and trying out a few simple programs does not do any justice to evaluating it. So when I was asked to do a few internal tools and proof of concepts at work I decided to use Netbeans for it. It is tough, not because Netbeans is bad but because I have been using Eclipse of so long that using it as almost second nature to me. To work with Netbeans I have to learn using it and unlearn using Eclipse.

So instead of giving my Eclipse biased opinion of Netbeans I thought pick up a few tips I have posted about Eclipse and post how the same tip or feature works in Netbeans. I am hoping that by doing this I will learn more about Netbeans.

One of the features I use the most in Eclipse is ‘Mark Occurrences‘. I was happy to see this feature in Netbeans Editor. Just place the edit cursor over the method or variable and Netbeans will highlight all the occurrences or references of this. The above screenshot shows how this feature looks in both Eclipse (top) and Netbeans editors. Very similar. Well that was an easy one…

Hello Android

HelloAndroid

Well here is my obligatory Hello World app with Android SDK. I would try developing a more serious app if the phone with Android were to be released soon. For now I do have Windows Mobile phone, Cingular 8525, with .Net compact framework waiting for me to develop on. But this sure is an interesting area to keep an eye on…

Eclipse Tip: Hover to view source

Eclipse Tip Hover to view source

There are different hovers in Eclipse which are shown based on modifiers like Shift, Ctrl… One of such hovers is pops up when the ‘Shift’ key is pressed when hovering over a class or method in the Java editor. This shows the source code of the class or method. This is pretty handy to identify quickly the method or class that is being used. This helps a lot during code reviews or when I am looking at my own code after a long time.