DekGenius.com
Previous Section  < Day Day Up >  Next Section

Introduction

This chapter continues our coverage of the JDT, exploring actions such as refactoring, as well as searching, building, and launching applications. You perform such actions everyday in Eclipse, and they're essential skills.

We'll start this chapter with a look at how to handle refactoring in Eclipse—specifically, how to rename and move elements. One of the major advantages of using a good Java IDE such as Eclipse is that when you rename and move Java elements, the IDE automatically updates all references to those items throughout your code.

Besides renaming and moving elements, Eclipse supports many other refactoring operations. Here's the whole list:

  • Rename elements

  • Move elements

  • Change a method's signature

  • Convert an anonymous class to a nested class

  • Convert a nested type to a top-level type

  • Push down or pull up elements in terms of nesting level

  • Convert methods and static fields to inline

  • Convert local variables to fields

  • Extract methods, variables, or constants

  • Encapsulate fields

All of these are helpful while coding—if you know how they work and what they do.

Eclipse 3.0

In addition to the preceding list, Eclipse 3.0 adds these refactoring options:

  • Move members to a new file

  • Generalize types

  • Create factory methods

    Previous Section  < Day Day Up >  Next Section