Product Details
Eclipse IDE Pocket Guide

Eclipse IDE Pocket Guide
By Ed Burnette

List Price: £7.50
Price: £4.59 & eligible for FREE Super Saver Delivery. Details

Availability: Usually dispatched within 24 hours
Dispatched from and sold by Amazon.co.uk

37 new or used available from £2.20

Product Description

Eclipse is the world's most popular IDE for Java development. And although there are plenty of large tomes that cover all the nooks and crannies of Eclipse, what you really need is a quick, handy guide to the features that are used over and over again in Java programming. You need answers to basic questions such as: Where was that menu? What does that command do again? And how can I set my classpath on a per-project basis?

This practical pocket guide gets you up to speed quickly with Eclipse. It covers basic concepts, including Views and editors, as well as features that are not commonly understood, such as Perspectives and Launch Configurations. You'll learn how to write and debug your Java code--and how to integrate that code with tools such as Ant and JUnit. You'll also get a toolbox full of tips and tricks to handle common--and sometimes unexpected--tasks that you'll run across in your Java development cycle.

Additionally, the Eclipse IDE Pocket Guide has a thorough appendix detailing all of Eclipse's important views, menus, and commands.

The Eclipse IDE Pocket Guide is just the resource you need for using Eclipse, whether it's on a daily, weekly, or monthly basis. Put it in your back pocket, or just throw it in your backpack. With this guide in hand, you're ready to tackle the Eclipse programming environment.


Product Details

  • Amazon Sales Rank: #83751 in Books
  • Published on: 2005-08-12
  • Original language: English
  • Number of items: 1
  • Binding: Paperback
  • 117 pages

Editorial Reviews

From the Publisher
This practical pocket guide gets you up to speed quickly with Eclipse. It covers basic concepts, including Views and editors, as well as features that are not commonly understood, such as Perspectives and Launch Configurations. You'll learn how to write and debug your Java code--and how to integrate that code with tools such as Ant and JUnit. You'll also get a toolbox full of tips and tricks to handle common--and sometimes unexpected--tasks that you'll run across in your Java development cycle.

About the Author
Ed Burnette is editor of the articles section at eclipse.org, and author of the web site's "The Rich Client Platform (RCP) Tutorial" series. Ed also co-authored Eclipse in Action (Manning) and runs the eclipsepowered.org site, where he can often be found hanging out in the Eclipse community forums. He's written everything from multi-user servers to compilers to commercial video games since earning a Bachelor of Science degree in computer science from North Carolina State University. He is a Principal Systems Developer at SAS, and lives near Research Triangle Park, NC.

Excerpted from Eclipse IDE Pocket Guide by Ed Burnette. Copyright © 2005. Reprinted by permission. All rights reserved.
PART VI Tips and Tricks

The Eclipse IDE has an incredibly rich set of features, but many of them are hidden from view. With a little digging, you can discover its secrets and get the most out of the environment. This part of the book gets you started with several useful but less visible features.

Code Assist

The Java editor is always paying attention to what you type, ready to offer helpful suggestions through a feature called code assist (also called content assist). To use it, go to the Java editor in the Hello example and start a new statement in the main( ) method. Begin typing the following:

System.

Pause after the period. A code assist window (similar to that shown in Figure 23) will appear. The window shows you all the valid possibilities at this point. Type the letter o and the choices will narrow down to out. Press Enter to accept this choice. Given the long names most Java programs use, this can be a real time-saver.

Besides reducing typing, code assist is especially handy when you are exploring unfamiliar territory—for example, making calls to a library you haven’t used before. Code assist is activated automatically by certain keystrokes—like the period in
the previous example—but you can also invoke it at any time by pressing Ctrl+Space (Edit - Content Assist). This feature is fully configurable in the Java editor preferences (Window - Preferences - Java - Editor).

Templates

Eclipse provides a shorthand way of entering text called templates. For example, in the Java editor, if you type for and press Ctrl+Space, the code assist window will pop up as before, but this time it will display a few templates that start with the word "for" (see Figure 24).

Selecting the first one will cause code similar to this to appear in the editor:

for (int i = 0; i < array.length; i++) {

}

The cursor highlights the first variable i. If you start typing, all three occurrences of that variable will be modified. Pressing Tab will cause the variable array to be selected; pressing Tab again will put the cursor on the blank line between the braces so you can supply the body of the loop.

TIP
If you try this, you may see different variable names. Eclipse guesses which variables to use based on the surrounding code.

For a list of all predefined templates, and to create your own or export them to an XML file, see Window - Preferences - Java - Editor - Templates.

Automatic Typing

Closely related to code assist is a feature called automatic typing. If you’re following along with the earlier example shown in Figure 23, the text cursor should be positioned after System.out. Type .println( (that is, period, println, opening parenthesis). The Java editor will type the closing parenthesis for you automatically. Now, type a double quote, and the closing quote appears. Type in some text and then
press the Tab key. Tab advances to the next valid place for input, which is after the closing quote. Hit Tab again, and the cursor advances to the end. Type a semicolon to finish the statement.

TIP
Code assist and automatic typing take a little getting used to. At first you may be tempted to turn them off, but I suggest you give it time and try to learn to work with
them. After a while, you’ll wonder how you ever got by without the extra support.

Refactoring

Refactoring means transforming code without changing its functionality. Consider renaming, which is the simplest form of refactoring. If you rename a local variable from rose to daisy, it would smell as sweet.

Much has been written on refactoring, such as Refactoring: Improving the Design of Existing Code (Addison Wesley). Before Eclipse and similar tools were available, programmers had to do refactoring manually or with simple text substitutions.
For example, in the vi editor, running the command :1,$s/rose/daisy/g will replace "rose" with "daisy" everywhere in the current file.

If you’ve ever tried this, you know it’s usually a bad idea. Your simple search-and-replace operation can change more than just the variable you intended, even with a clever substitution string. Plus, if you need to change multiple files, you’ll have to go to a scripting language such as Perl.

Here’s how it works in Eclipse. To rename a symbol (i.e., a class, method, variable, etc.), select it in the editor and press Alt+Shift+R (Refactor - Rename). Type in the new name and press Enter to perform the change. Done!

If you like, you can select the Preview button before performing the changes; this will show you what the modified source will look like (see Figure 25). You can also undo the refactoring (Ctrl+Z or Edit - Undo) if you change your mind.

Here’s another handy refactoring supported by Eclipse: to move a class from one package to another, simply go to the Package Explorer view and drag the file to where you want it. Eclipse will take care of changing the package statement in the file and in all the other class files that refer to it. Neat, huh?

Eclipse implements over a dozen different types of refactorings, and more are being added all the time. See the Java Development User Guide (Window - Help Contents - JavaDevelopment User Guide) under Reference - Refactoring for more information.