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.
Get Eclipse Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.