Академический Документы
Профессиональный Документы
Культура Документы
com
tech facts at your fingertips
CONTENTS INCLUDE:
Getting Eclipse
n
Workbench 101
n
Development with Eclipse
n
Keyboard Shortcuts
n
Plug-ins
n
Community Web Sites By Ed Burnette & Adam Houghton
n
Hot Tips and more...
Eclipse is the leading Integrated Development Environment Go to the eclipse.org download site—http://download.
(IDE) for Java, with a rich ecosystem of plug-ins and an open eclipse.org/eclipse/downloads—and choose the package
source framework that supports other languages and projects. that’s right for you:
You’ll find this reference card useful for getting started with
Eclipse and exploring the breadth of its features. Package Major Features
Eclipse IDE for Java Java IDE with incremental compilation, cross-referencing,
We rundown the Eclipse distributions and configuration
Developers code-assist, and Mylyn task management.
options, then guide you through Views, Editors, and Perspec-
Eclipse IDE for Java Adds JEE validation, app server support, graphical
tives in Workbench 101. We list the top shortcuts and toolbar
EE Developers HTML/JSP/JSF editing, and database tools.
actions for everyday development. And, we provide a guide to
Eclipse IDE for C/ C/C++ IDE with syntax highlighting and code
the best places for finding plug-ins and getting involved with
C++ Developers completion, launcher, debugger, and makefile generator.
the Eclipse community.
Eclipse for RCP/ Java IDE plus the Plug-In Development Environment for
www.dzone.com
We focus on the Windows and Mac OS X versions, but Eclipse Plug-In Developers creating Eclipse plug-ins and applications.
runs on any modern operating system. Each Eclipse release is Eclipse Classic The original Java IDE and Rich Client Platform.
tested and validated on different versions of Windows, Linux,
OS X, Solaris, and AIX.
What version should I get?
At any given time up to five different build types are available.
OS Friendly To see these, select All versions from the download page or
Hot Upgrade to Vista? Eclipse 3.3 runs great on 32-bit visit http://download.eclipse.org/eclipse/downloads
Tip versions of Microsoft’s latest operating system
and uses native WPF components. Eclipse 3.4 Version Frequency Stability Audience
adds support for 64-bit Windows XP and Vista. Releases Yearly Best Everyone
Mac user? Eclipse for OS X is a Universal Maintenance Builds Quarterly Best Everyone
Binary, so it natively supports both Intel and Stable/Milestone 6 Weeks Good Users interested in the
PowerPC Macs. Builds latest features
Hot Never install a new version of Eclipse on top of n New issue every 1-2 weeks
5. Explore
Eclipse’s main window is called the Workbench window. Its
Eclipse will start and greet you with the menus and toolbars should be familiar with users of any desk-
Welcome screen. Take a few minutes to explore,
then click the Workbench arrow icon to get started.
top applications, but some other elements like views, editors,
and perspectives may not be.
Views
Messed Up Workspace?
Hot If your Eclipse installation has startup errors or a
A view is a window that lets you examine something, such as
Tip corrupted configuration, it might be time to get a
a list of files in your projects. Eclipse comes with dozens of
fresh start. Start Eclipse with the –clean option,
different views. Some open automatically when you use certain
and all cached framework and runtime data will perspectives, but you can use the Window > Show View
be cleared out. This often helps fix plug-in issues menu to open them at any time. Here’s a partial list of views
and improve general stability. included in the Eclipse SDK:
Breakpoints Shows a list of all the breakpoints you have set in your projects
T hird - P arty D istrib u t o rs
Console Displays the output of your program.
There are many third-party distributions of Eclipse available. Debug Lists all programs that were launched by Eclipse. Use it to pause
Some are free and just repackage the open source Eclipse program execution, view tracebacks, and locate the cause of
deadlocks.
code. Others are commercial, building on top of Eclipse
Declaration Shows the source code where the selected object is declared.
by adding unique features and support. The most popular
ones are listed here. Display Shows expression results in an unstructured format.
Error Log View internal errors and stack dumps when reporting
Distributions Resource Price Eclipse problems.
Easy Eclipse: Prepackaged releases http://www.easyeclipse.org Free History Shows the CVS change history of the file.
of Eclipse targeted for specific types of Javadoc Shows the description (from comments) of the selected object.
developers.
JUnit Shows the progress and results of JUnit tests.
Aptana Studio: A popular IDE for http://www.aptana.com Free
Navigator Shows all projects in the workspace as they exist on disk.
HTML/CSS/JavaScript development,
with plug-ins for Adobe AIR, Ruby on Outline Displays the structure of the currently open file.
Rails (RadRails), and PHP development.
Package Explorer Shows all your projects, Java packages, and files.
Built on Eclipse.
Problems Shows compiler errors and warnings in your code.
PHPeclipse: An IDE for PHP development http://www.phpeclipse.net Free
built on Eclipse. Search Shows the results of any search operation.
PyDEV: An Eclipse-based environment http://pydev.sourceforge.net Free Tasks Lists all the markers placed in your source code.
for developing in Python and Jython. Variables Shows all the parameters and local variables in scope
while debugging.
MyEclipseIDE: Inexpensive end-to-end http://www.myeclipseide.com $
Java and J2EE development environment.
BEA Workshop: End-to-end browser-to- http://workshopstudio.bea.com $$$ Multiple views can be stacked together in the same rectangular
database solution built on Eclipse. area. The title bar will show a tab for each view, but only one
IBM RAD: Helps developers to quickly http://www-306.ibm.com/ $$$$$ of them can be active at a time. If the window is too narrow to
create Web, SOA, Java, J2EE and portal software/awdtools/developer/ show all the tabs, a special menu will appear to give you access
applications. application
to the hidden ones.
Editors
DEVELOPMENT WITH ECLIPSE
Editors are very similar to views, but they are constrained Eclipse can be used to create anything from a Java program
to a single rectangular area in the Workbench window. to the next bestselling novel. Regardless of what you’re creat-
Editors may be text-based (like the Java editor) or graphical ing, a few basic concepts remain the same…
(such as a diagram editor). You can save or revert an editor’s
Managing Projects
contents. An asterisk in the editor’s title bar indicates it has
An Eclipse project is a directory that contains any source files,
unsaved data.
metadata, resources, and derived files. Typically projects are
Perspectives subdirectories of your workspace directory, but Eclipse allows
them to be anywhere on the file system. You can either create
a project from scratch or import an existing project from the
file system, from CVS, or from an existing Ant build file.
A perspective is a set of views, editors, and toolbars, along with
1. Select File > New > Java Project
their arrangement within the Workbench window. Perspectives This brings up the “New Java Project” dialog box.
are not “modes”. As you perform a task, you may rearrange
windows, new views, and so on. Your arrangement is saved
under the current perspective. The next time you have to 2. Fill in your project name and click “Next”
For most projects, it’s best to leave the default options selected.
perform the same kind of task, simply switch to that perspective This will create a new project in the standard location: a new directory
and Eclipse will put everything back the way you left it. off of the main workspace directory. The project will use the default
JDK and store compiled class files in their own directory.
For the most part you will be using the built-in Java or
Debug perspectives, but you can also select Window > Save
Perspective As… to save your current arrangement under a 3. Review your build settings and click “Finish”
The last dialog window lets you define jar files and dependent projects.
new name. Don’t worry if these aren’t available yet—it’s easy to change build setting later.
Toolbar
Five useful icons on the Eclipse toolbar: 4. Start coding!
If you need to change the project settings, select Projects > Properties
or right click on a project name and click Properties.
Formatting
Control the minutiae of code formatting with Eclipse’s plethora
of Formatter options. Spend hours tweaking your settings in
Window > Preferences > Java > Code Style > Formatter,
then format all of your code with Ctrl+Shift+F. Save your
formatting profile by selecting “Export” in the profile properties,
then share it with your team members.
Refactoring
Eclipse has a powerful set of refactoring tools to help re-
shape your code. Rename variables, move classes between
packages, and extract methods without fear of breaking the
build. Highlight an element and press Alt+Shift+T to see the
list of available refactorings.
Automatic Clean Up
Hot Forgetful about formatting? Set up Eclipse to
Synchronizing Tip automatically format source code and organize
CVS synchronization is built into Eclipse. Right click on a imports on every save. Select Window >
resource and select Team >… to see options for synchronizing, Preferences > Java Editor > Save Actions to
committing, and updating. The Team Synchronizing Perspective enable these actions. This dialog also lets you
provides helpful tools for keeping track of pushes and configure actions like removing unnecessary
managing merges. The CVS Repository Exploring perspective casts or adding missing annotations.
lets you browse branches and check out projects from existing
CVS repositories.
Not using CVS? There are Eclipse plug-ins for every type of
version control system, including Subversion, Visual SourceSafe,
Git, and Mercurial. Check out the Plug-ins section for the
best places to find and download plug-ins.
Here are our Top 50 favorite keyboard shortcuts defined by Ctrl+E Cmd+E Open Editor Window
Eclipse. You can replace any of these (or even switch to Emacs Ctrl+M Cmd+M Maximize Editor Window
bindings) by selecting Window > Preferences > General > Keys. Ctrl+W Cmd+W Close Editor Window
Ctrl+Page Up Cmd+Page Up Switch to Tab Left
Debugging Shortcuts
Ctrl+Page Down Cmd+Page Down Switch to Tab Right
Windows OS X Shortcut
Ctrl+F8 Cmd+F8 Change Perspective
F5 F5 Step Into
Ctrl+Shift+S Cmd+Shift+S Save All
F6 F6 Step Over
Ctrl+Shift+W Cmd+Shift+W Close All
F7 F7 Step Return
F5 F5 Refresh
F8 F8 Resume
F11 F11 Debug Last Launched
Ctrl+F11 Cmd+F11 Run Last Launched Plug-ins
Ctrl+R Cmd+R Run to Line
Ctrl+Shift+B Cmd+Shift+B Toggle Breakpoint on Line Aside from a small “bootstrapping” core runtime, Eclipse is made
up entirely of plug-ins. Small collections of plug-ins are logically
Navigation Shortcuts grouped into “features” that are installed and uninstalled as a
Windows OS X Shortcut unit. This figure shows how everything fits together:
F3 F3 Format Source
Ctrl+Shift+G Cmd+Shift+G Find Reference Eclipse SDK
Ctrl+Shift+R Cmd+Shift+R Open Resource
Eclipse Platform
Ctrl+Shift+T Cmd+Shift+T Open Type
User Interface
Ctrl+H Cmd+H Open Search Dialog
Workbench
JDT
Ctrl+O Cmd+O Quick Outline Java
Development JFace
Ctrl+T Cmd+T Quick Hierarchy Plug-in A
Tools
Ctrl+L Cmd+L Go to Line SWT
Coding Shortcuts
The Eclipse SDK is pre-packaged with over 100 plug-ins including
Windows OS X Shortcut
plug-ins for basic text editing, Java development, online help,
Ctrl+1 Cmd+1 Quick Fix
and plug-in development. Literally thousands of other plug-ins
Ctrl+Space Cmd+Space Content Assist
have been written to add support for other languages, report-
F2 F2 Show Tooltip Description
ing, charting, database manipulation, J2EE, UML, GUI editing,
Shift+F2 Shift+F2 Show External Javadoc
RSS reading, and so forth.
Ctrl+Shift+O Cmd+Shift+O Organize Imports
There are several places on the web where you can find and
Ctrl+Shift+F Cmd+Shift+F Format Source
install plug-ins. The main ones are:
Ctrl+I Cmd+I Correct Indentation
Ctrl+/ Cmd+/ Toggle Comment
Plug-in Resource Description
Ctrl+F Cmd+F Find and Replace
Eclipse Downloads Home Select “By Project” or “By Topic” to access the
Ctrl+D Cmd+D Delete Line http://download.eclipse.org/ plug-ins produced by all projects at eclipse.org.
eclipse/downloads Most are downloaded as zip files that need to be
Ctrl+Alt+Up Cmd+Option+Up Copy Lines Up
manually unpacked like the Eclipse SDK.
Alt+Up Option+Up Move Lines Up
Eclipse Plugin Central This site offers a plug-in directory, reviews,
Ctrl+Alt+Down Cmd+Option+Down Copy Lines Down http://eclipseplugincentral.com ratings, news, forums, and listings for products
and services.
Alt+Down Option+Down Move Lines Down
Yoxos Subscription Service For a small yearly fee you can access the Yoxos
Java Refactoring Shortcuts http://www.yoxos.com Install Manager, which provides a convenient
automatic discovery and update service for a
Windows OS X Shortcut consistent and tested set of plug-ins.
Alt+Shift+R Cmd+Option+R Rename Element Source Forge A large and growing number of Eclipse plug-ins
http://sf.net are being developed in this open source nexus.
Alt+Shift+L Cmd+Option+L Extract to Local Variable
Pulse 2.0 Service Pulse 2.0 is a free service for discovering,
Alt+Shift+M Cmd+Option+M Extract to Method http://www.poweredbypulse.com downloading, and managing Eclipse plug-ins.
Pulse allows sharing of profiles among multiple
Ctrl+Shift+Y Cmd+Option+Y Change Method Signature
computes—great for bringing work home or
Ctrl+Shift+Z Cmd+Option+Z Undo Refactoring showing tips to team members.
taken the first steps in joining the Eclipse community. To help Eclipsepedia The official eclipse.org wiki.
you go further, web sites, articles, and other resources are http://wiki.eclipse.org
available to assist you, as are thousands of Eclipse enthusiasts IBM AlphaWorks Part of IBM’s emerging technologies web site,
and professionals from around the world. http://alphaworks.ibm.com/ this is dedicated to Eclipse and WebSphere-
eclipse related projects and plug-ins.
Community Web Sites Description IBM developerWorks developerWorks hosts a variety of tutorials,
Eclipse Zone An online community for Eclipse users that http://www.ibm.com/ articles, and related information on Eclipse and
http://eclipsezone.com includes exclusive articles, podcasts, and developerworks/opensource other open source projects.
forums.
Apache Apache software is used throughout Eclipse,
Eclipse Home Page The Eclipse Foundation’s home page. http://www.apache.org and the two projects collaborate in many areas.
http://www.eclipse.org
O’Reilly Open Source The O’Reilly Resource Center provides a broad
Eclipse Newsgroups Get peer support from thousands of other http://opensource.oreilly.com range of references and links to publications
http://www.eclipse.org/newsgroups users and developers. about open source.
n
Flexible Rails: n
NetBeans IDE 6 with Ajax
Flex 3 on Rails 2 Java Editor
n
RSS and Atom n
Groovy GWT Style, Configuration
and JSNI Reference
DZone, Inc.
ISBN-13: 978-1-934238-04-2
1251 NW Maynard
ISBN-10: 1-934238-04-X
Cary, NC 27513
50795
888.678.0399
The DZone Network is a group of free online services that aim to 919.678.0300
satisfy the information needs of software developers and architects.
Refcardz Feedback Welcome
From news, blogs, tutorials, source code and more, DZone offers refcardz@dzone.com
$7.95
Copyright © 2008 DZone, Inc. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by means electronic, Version 1.0
mechanical, photocopying, or otherwise, without prior written permission of the publisher.