Dr. Axel Rauschmayer is a freelance software engineer, blogger and educator, located in Munich, Germany. Axel is a DZone MVB and is not an employee of DZone and has posted 246 posts at DZone. You can read more from them at their website. View Full User Profile

Five Cool Features of Eclipse 3.5

08.23.2009
| 9888 views |
  • submit to reddit

(1) Block selection mode: works for cut, copy, and paste.



(2) Go to the implementation of an interface method.


(3) Better completion of inner interface implementations: When completing an interface such as Runnable, stubs for the methods are created immediately (instead of on demand, via a quick fix, as a second step).

   public static void main(String[] args) {
        new Runnable() {
           
            public void run() {
                // TODO Auto-generated method stub
               
            }
        };
    }

(4) “Invert if” quick fix (when the cursor is on the “if” keyword). Turns
   public static void main(String[] args) {
       if (args.length == 0) {
           System.out.println("Need at least one argument.");
       } else {
           processArguments(args);
       }
   }

into

   if (args.length != 0) {
       processArguments(args);
   } else {
       System.out.println("Need at least one argument.");
   }

(5) Improved systrace for inner classes. Completing the word “systrace” inserts a system.out.println() with the name of the current method (if you do println debugging, you’ll always find where the printing happens). Prior to 3.5, this did not work well for inner classes. This has been fixed:

   public static void main(String[] args) {
       new Runnable() {
           public void run() {
               System.out
                       .println("SidebarPanel.main(...).new Runnable() {...}.run()");
           }
       };
   }


[Source of (2) and (4): Philip Mayer]

From http://2ality.blogspot.com

Published at DZone with permission of Axel Rauschmayer, author and DZone MVB.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Tags:

Comments

Benjamin Winterberg replied on Mon, 2009/08/24 - 8:08am

Nice Post. The 'invert if' quick fix is very nice! I prefer to code the shorter block first because it improves readablitiy. Now Im able to switch the blocks easily if one block or another increases in code. :)

Feel free to check out these 5 tweaks for Eclipse Galileo.

Matthew Passell replied on Mon, 2009/08/24 - 10:45am

For readers stuck on Eclipse 3.4.x for some reason (MyEclipse!) or another, you should know that the "invert if" quick fix is available in 3.4 as well (and 3.3 for that matter).

--Matt
The Software Grove

Erik Post replied on Mon, 2009/08/24 - 10:55am

Rectangle selection? Sweet, just like emacs :D Now if only NetBeans could do this... :/

Gregory Smith replied on Mon, 2009/08/24 - 1:01pm

Now if only they would allow relative addressing of your libraries.

Zart Colwin replied on Tue, 2009/08/25 - 2:54pm in response to: Gregory Smith

relative addressing of your libraries

This is the case if your libraries are inside one of the project that compose your current workspace. The trick is to create a project just to hold your shared libraries. Use the  command File/New/Project.../General/Project to create the simplest possible project - these simple projects have no compiler, no facet, no nothing. Name it "Libraries", you can now put your shared libraries in this project and reference them using relative addressing.

ZartC.

 

Benjamin Winterberg replied on Mon, 2009/08/31 - 3:06pm

Adressing library paths relatively is supported by Eclipse since ... ehm... all times!?

Anyway I prefer Maven2 for managing library dependencies.

Gregory Smith replied on Wed, 2009/09/23 - 12:55pm

First of all, I have no desire to place all of my jars in a single project. Secondly placing them in a single project does not in any way address the problem that Eclipse does not support relative addressing.

I should be able to have a set of projects in any directory and reference dependencies in those projects relatively. I should be able to have different versions of these projects sets located in arbitrary directories and be able to reference dependencies within the other projects in the same set regardless of where the set is located on my filesystem.

Almost any other tool is going to support this basic, and extremely valuable feature. Ant supports relative addressing. The old Borland JBuilder supported relative addressing. Even a simple shell script would support relative addressing. It in incomprehensible why Eclipse would not support relative addressing or why people offer supposed work-arounds that do not in any way fix the basic problem.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.