making the most of
DESCRIPTION
Doug Tidwell, Eric Long & Akmal Chaudhri IBM Developer Relations. Making the most of. Agenda. An introduction to Eclipse Installing and running Eclipse The Eclipse Java Development Tools The Eclipse debugger Extending Eclipse with plug-ins The Web Tools Platform Creating Eclipse plug-ins - PowerPoint PPT PresentationTRANSCRIPT
Presented by IBM Presented by IBM developerWorksdeveloperWorksibm.com/developerWorksibm.com/developerWorks
Making the most of Making the most of
© 2011 IBM © 2011 IBM Corporation.Corporation.
Making Making the the
most of most of Doug Tidwell, Eric Long & Akmal Chaudhri IBM Developer Relations
T18.T18.22
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
AgendaAgenda• An introduction to Eclipse• Installing and running Eclipse• The Eclipse Java Development Tools• The Eclipse debugger• Extending Eclipse with plug-ins• The Web Tools Platform• Creating Eclipse plug-ins• Eclipse resources
Presented by IBM Presented by IBM developerWorksdeveloperWorksibm.com/developerWorksibm.com/developerWorks
Making the most of Making the most of
© 2011 IBM © 2011 IBM Corporation.Corporation.
An overview of EclipseAn overview of Eclipse
T18.T18.44
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
What we'll coverWhat we'll cover• Eclipse and The Eclipse Foundation• Eclipse architecture• Major Eclipse projects• Eclipse in the marketplace
Presented by IBM Presented by IBM developerWorksdeveloperWorksibm.com/developerWorksibm.com/developerWorks
Making the most of Making the most of
© 2011 IBM © 2011 IBM Corporation.Corporation.
Eclipse and Eclipse and The Eclipse FoundationThe Eclipse Foundation
T18.T18.66
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
What is Eclipse?What is Eclipse?
• A technology platform – originally an IDE, now can be anything (see the Eclipse Rich Client Platform)
• An open source project – The Eclipse Public License is OSI certified.
T18.T18.77
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
What is Eclipse?What is Eclipse?
• A communitycommunity – The most vital part of the platform.– Hundreds of companies and thousands of
programmers are working to improve and extend it all the time.
• See eclipse.org/community.
T18.T18.88
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
The Eclipse FoundationThe Eclipse Foundation• Launched by IBM in November 2001• Originally led by Borland, IBM, Merant,
QNX, Rational and others• Today dozens of vendors participate,
including Intel, BEA, Oracle, HP, SAP, Hitachi, Telelogic and Ericsson.
• The Eclipse Foundation is non-profit and not controlled by IBMnot controlled by IBM.– The current head of the foundation is from
Oracle, for example.
T18.T18.99
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
The Eclipse FoundationThe Eclipse Foundation• There are four levels of membership in
The Eclipse Foundation:– Strategic membersStrategic members – Contribute
developers and financial resources– Add-in provider membersAdd-in provider members – Participate in
Eclipse development– Associate membersAssociate members – Non-profit orgs,
universities, standards bodies and so forth; want to participate in Eclipse development
– Committer membersCommitter members – Individuals who are core developers and can commit changes to the source code
T18.T18.1010
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Strategic members (developers)Strategic members (developers)
T18.T18.1111
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Strategic members (consumers)Strategic members (consumers)
T18.T18.1212
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
[Some of the] other members…[Some of the] other members…
Presented by IBM Presented by IBM developerWorksdeveloperWorksibm.com/developerWorksibm.com/developerWorks
Making the most of Making the most of
© 2011 IBM © 2011 IBM Corporation.Corporation.
Eclipse architectureEclipse architecture
T18.T18.1414
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Platform
Eclipse architectureEclipse architecture
Rich Client Platform
applications
Development tools
Eclipse plug-in
development
RCP app
TPTP BIRT WTP
EMF GEF JDT
CDT
PDE
… ATF
T18.T18.1515
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Platform
Eclipse architectureEclipse architecture
Platform
Platform runtime
Help UpdatePlatform
debug
Platform resources
Team Search Ant
Platform UI
CVS SWT Compare
Platform text
Releaseengineering
T18.T18.1616
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Eclipse architectureEclipse architecture
WorkbenchHelp
System
WorkspaceTeam
Components
C++plug-in
Modelingplug-in
GUI builderplug-in
Presented by IBM Presented by IBM developerWorksdeveloperWorksibm.com/developerWorksibm.com/developerWorks
Making the most of Making the most of
© 2011 IBM © 2011 IBM Corporation.Corporation.
Eclipse projectsEclipse projects
T18.T18.1818
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Eclipse projectsEclipse projects• Eclipse project (the core platform)
– Provide the base Eclipse platform, not just an IDE anymore
• Eclipse Tools project– Coordinates groups building world-class
tools for Eclipse, also provides input for Eclipse future directions
• Eclipse Technology project– Research, incubation and education
• Java Development Tools (JDT) project– The original focus of the IDE
T18.T18.1919
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Eclipse projectsEclipse projects• Web Tools Platform (WTP) project
– "Generic, extensible and standards-based" tools for the Web + Java EE
• Data Tools Platform (DTP) project– “Generic, extensible and standards-based”
tools for databases
• Ajax Tools Framework (ATF) project– An open, extensible framework
• Test and Performance Tools Platform project (TPTP)– World-class testing and performance tools
T18.T18.2020
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Eclipse projectsEclipse projects• The Eclipse Modeling Project
– Integrates several model-based frameworks and technologies:
• The Eclipse Modeling Framework (EMF)• The Graphical Editing Framework (GEF)• UML2• Object Constraint Language (OCL)• XML Schema Infoset Modeling
• The C Development Tools (CDT) project– Provide C/C++ tools that are as complete as
the Java tools
T18.T18.2121
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Eclipse projectsEclipse projects• Business Intelligence and Reporting
Tools project (BIRT) – Lots of applications need reporting
functions. The BIRT project intends to provide a complete suite of reporting tools and frameworks.
• ECESIS– Open-source courseware, including slides,
lab exercises and solutions.
Presented by IBM Presented by IBM developerWorksdeveloperWorksibm.com/developerWorksibm.com/developerWorks
Making the most of Making the most of
© 2011 IBM © 2011 IBM Corporation.Corporation.
Eclipse in the Eclipse in the marketplacemarketplace
T18.T18.2323
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Eclipse is valuable…Eclipse is valuable…• ……to users,to users, because:
– All Eclipse-based tools work the same way– Hundreds of plug-ins are available to extend
Eclipse
• ……to ISVs,to ISVs, because:– They don't have to write an enormous
amount of code (editors, debuggers, and so forth)
– Their work fits in to an established, rapidly growing platform
– They can combine their work with other Eclipse plug-ins to create custom solutions
T18.T18.2424
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Case study: NASACase study: NASA• "Among the reasons for using open
source software is the philosophical idea that spending taxpayer money to do spending taxpayer money to do things that have already been done things that have already been done is just not justifiableis just not justifiable. Many development groups within NASA … are being paid by the taxpayers to do space exploration and that’s where the money should be spent."
• From the case study NASA Uses Eclipse for Interplanetary Operations, available at eclipse.org/community/casestudies.
T18.T18.2525
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Eclipse by the numbersEclipse by the numbers• Tens of millions of downloads• More than 1 million users in more than
125 countries• More than 1,000 plug-ins at eclipseplugincentral.com
• More than 950 Eclipse-related projects at SourceForge
• Hundreds of articles on Eclipse at developerWorks, eclipse.org and elsewhere
T18.T18.2626
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Eclipse booksEclipse books
T18.T18.2727
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
The dominant development The dominant development platformplatform• "Can anybody ignore Eclipse? No …
maybe Microsoft."– Carl Zetie, Forrester analyst
• "The game is not over, but when we think of developer ecosystems other than Visual Studio we think Eclipse. We don't think NetBeans."– A Microsoft spokesperson at EclipseCon
2005
• From
T18.T18.2828
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Industry awardsIndustry awards• developer.com –
Development Tool of the Year 2006• Java Developer's Journal Readers'
Choice Awards 2005– Best Java Application– Best Team Development Tool – Most Innovative Java Product– Best Java Class Library (Eclipse SWT)– Best Java Debugging Tool
• Software Development magazine –Best Open Source Tool
T18.T18.2929
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Industry awardsIndustry awards• SD Times – Best in Category,
Tools and Environments 2005• Jolt Awards 2005 – Product
Excellence Award for Languages and Development Environments
• eclipse.org/community/awards.php lists many other awards…
Presented by IBM Presented by IBM developerWorksdeveloperWorksibm.com/developerWorksibm.com/developerWorks
Making the most of Making the most of
© 2011 IBM © 2011 IBM Corporation.Corporation.
SummarySummary
T18.T18.3131
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
SummarySummary• Eclipse has evolved from a base for
building developer tools into a general-purpose framework.
• IBM created the Eclipse Foundation, but doesn't have any more rights than any other Strategic member.
• IBM and dozens of other vendors provide hundreds of Eclipse-based products.
• Eclipse has more industry support (downloads, products, users, books, etc.) than any other tools platform.
T18.T18.3232
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
The bottom line:
Eclipse is a great platform by itself, but the Eclipse communitythe Eclipse community is why you should use it.
Presented by IBM Presented by IBM developerWorksdeveloperWorksibm.com/developerWorksibm.com/developerWorks
Making the most of Making the most of
© 2011 IBM © 2011 IBM Corporation.Corporation.
Installing and running Installing and running EclipseEclipse
T18.T18.3434
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
What we'll coverWhat we'll cover• Installing Eclipse• Running Eclipse• Eclipse terms and concepts:
Perspectives, views, editors and other useful things
• Other IDE functions
Presented by IBM Presented by IBM developerWorksdeveloperWorksibm.com/developerWorksibm.com/developerWorks
Making the most of Making the most of
© 2011 IBM © 2011 IBM Corporation.Corporation.
Installing EclipseInstalling Eclipse
T18.T18.3636
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Installing EclipseInstalling Eclipse
• Installing Eclipse is very simple. To get started, go to eclipse.org and click the Downloads link.
T18.T18.3737
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Installing EclipseInstalling Eclipse• Download the Eclipse SDK.
– Currently the file name is eclipse-SDK-3.2-win32.zip (for Windows)
– This file contains everything from Eclipse, including the Eclipse platform and the SDK.
– Download the file (use a mirror if you can) and unzip it.
– You're done!You're done!• There are instructions on the Eclipse download
page if you need them.
T18.T18.3838
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
The Java Runtime EnvironmentThe Java Runtime Environment• Because Eclipse is written in Java, you
have to have a Java Runtime Environment (JRE) on your machine. – A JRE isn't included with Eclipse itself.
• eclipse.org lists sites with JREs available if you need one. – The Eclipse Foundation wisely doesn't
recommend any particular JRE.
• JRE 1.5.0_02 works well, although you can have multiple JREs/JDKs installed on your machine and switch between them in Eclipse.
Presented by IBM Presented by IBM developerWorksdeveloperWorksibm.com/developerWorksibm.com/developerWorks
Making the most of Making the most of
© 2011 IBM © 2011 IBM Corporation.Corporation.
Running EclipseRunning Eclipse
T18.T18.4040
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Running EclipseRunning Eclipse• Now that you've installed Eclipse, use
the eclipse command to run it:
T18.T18.4141
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Performance tipPerformance tip• If Eclipse runs slowly, try adding this
switch to the command line or shortcut: eclipse –vmargs –Xms256M
• This starts the Java virtual machine with 256MB of RAM.
• Eclipse loads plug-ins only when you need them, but it can start to slow down if you use lots of tools.– This tip is particularly helpful on Windows
platforms.
Presented by IBM Presented by IBM developerWorksdeveloperWorksibm.com/developerWorksibm.com/developerWorks
Making the most of Making the most of
© 2011 IBM © 2011 IBM Corporation.Corporation.
Eclipse terms and Eclipse terms and conceptsconcepts
T18.T18.4343
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Eclipse terms and conceptsEclipse terms and concepts• Workspace• Workbench• Perspectives• Views• Editors• Preferences
T18.T18.4444
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
WorkspaceWorkspace• The workspace is a physical location on
your machine. – It contains projects, folders, and files.– A project is a collection of folders and files
for a particular task. – A folder is a subdirectory; it can contain
folders and other files. – A file is just a file.
• In other words, a workspace is just a directory.
T18.T18.4545
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Choosing a workspaceChoosing a workspace
• The first time you run Eclipse, you'll be asked to choose a workspace.
• You can also create different workspaces… – To open Eclipse in a particular workspace, type eclipse –data c:\workspace.
T18.T18.4646
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Using different workspacesUsing different workspaces
• You can create shortcuts for different workspaces and launch those workspaces easily.
T18.T18.4747
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Switching workspacesSwitching workspaces
• You can use the Switch Workspace… item on the File menu to change workspaces.
• You can change to another workspace without restarting Eclipse.
T18.T18.4848
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
WorkbenchWorkbench• The workbench is the Eclipse
environment. – When you open Eclipse, you see a
workbench that displays the resources in a particular workspace.
– A workbench contains perspectives, views, and editors.
T18.T18.4949
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
The workbenchThe workbench
T18.T18.5050
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
PerspectivesPerspectives• A perspective is a set of views organized for a
particular task. – If you're writing Java code, certain views are useful.– If you're debugging Java code, other views are useful. – A perspective lets you arrange the views you need.
• Eclipse comes with several perspectives installed.
T18.T18.5151
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
PerspectivesPerspectives
• As you install plug-ins for various tasks, other perspectives may appear. – The dialog on the left lists the perspectives shipped
with the basic Eclipse SDK.– The dialog on the right is from IBM's WebSphere
Business Integration Modeler, an Eclipse-based product with many advanced features.
T18.T18.5252
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Customizing perspectivesCustomizing perspectives• You can customize a
perspective in many ways:– You can change the views
that are part of a perspective
– You can change how those views are arranged on the screen
• If you use the Customize Perspective… menu item, you can define which menu items and toolbar buttons are available for a given perspective.
T18.T18.5353
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Customizing perspectivesCustomizing perspectives
T18.T18.5454
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Saving perspectivesSaving perspectives• When you have the
views and toolbars and everything else arranged the way you want, you can save that as your own perspective.
• You can overwrite existing perspectives if you want.
T18.T18.5555
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
ViewsViews• A view is a window on some resources in
your workspace. – One view might list all the files in your
workspace– Another view might list all the Java classes
in a JAR file.
• You can open and close and arrange views any way you like.
• Two views might display the same thing in different ways.
T18.T18.5656
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Two views of the same fileTwo views of the same file
T18.T18.5757
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Opening viewsOpening views• The Window
Show View menu lets you open a view at any time.
• Click the Other… item to see a complete list of views.
T18.T18.5858
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Moving and stacking viewsMoving and stacking views
• To move a view, click and drag its tab. If more than one view is in the same space, they'll be stacked.
• The Problems, Javadoc, Declaration and Console views are stacked here.
T18.T18.5959
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Fast viewsFast views
• A fast view has an icon; you can click on that icon to go directly to the view.
• To create one, choose Fast View from the view's menu.
T18.T18.6060
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
PreferencesPreferences• Eclipse has a number of preferences you
can set.• Whenever you install a plug-in, that
plug-in can have preferences also.– As a result, your Eclipse installation can
have literally hundreds of settings.
• Choose WindowPreferences to get to the Preferences dialog.
• You can change just about everything.
T18.T18.6161
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
PreferencesPreferences
T18.T18.6262
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
PreferencesPreferences
• If you have more than one Java Runtime Environment installed on your machine, you can tell Eclipse which one to use.
• You can add new environments or change the default any time you want.
T18.T18.6363
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
EditorsEditors
• An editor allows you to modify a resource. There are different kinds of editors for different kinds of resources, as you'd expect.
• Like all views, editors can be stacked. The asterisk next to the file name above means that HelloWorld.java has been changed.
T18.T18.6464
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
The Java editorThe Java editor
Presented by IBM Presented by IBM developerWorksdeveloperWorksibm.com/developerWorksibm.com/developerWorks
Making the most of Making the most of
© 2011 IBM © 2011 IBM Corporation.Corporation.
Other IDE functionsOther IDE functions
T18.T18.6666
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Other IDE functionsOther IDE functions• In addition to the editors themselves, Eclipse
has several useful features for working with files.– Searching– Bookmarking– Tasks– Local history– File comparison (think "visual diff")– Import/export– Team functions (CVS)– File manipulation (navigation, cut/copy/paste)– Properties– Help
T18.T18.6767
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
SearchingSearching• Eclipse has a very sophisticated search
facility. • You can search through:
– Files– The help system– Java source– Plug-ins
• There are special search options for each kind of search.
T18.T18.6868
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
SearchingSearching
T18.T18.6969
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
SearchingSearching
• The results of the search show up in the Search view. You can double-click on a match and go directly to that file.
• There are toolbar buttons in the Search view; these let you move through the search results. – There will be different buttons depending on the kind
of search.
T18.T18.7070
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
BookmarkingBookmarking
• You can create a bookmark in a file and go directly to that spot whenever you want.
• To create a bookmark, right-click in the gray area on the left-hand side of the editor. You'll be asked to give the bookmark a name; that's how you reference it later.
T18.T18.7171
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
BookmarkingBookmarking
• All your bookmarks are listed in the Bookmarks view.
• Notice that the bookmarks here are in different projects, and that not all of them are in Java files.
• You can set a bookmark wherever you want.
T18.T18.7272
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
TasksTasks
• You can create tasks throughout your project.– It's a way of building a to-do list.
• You can associate a task with a line in a file ("add better error checking here") or create a more general task ("set up an Ant script to automatically regenerate the Javadoc").
T18.T18.7373
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
TasksTasks
• The first task here is a generic task that applies to the workspace.
• The second is a specific task that applies to a particular line in a particular file.
• As with bookmarks, you can create a task for any line in any file.
T18.T18.7474
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Local historyLocal history• Each time you save a
file, Eclipse creates a new version.
• You can compare versions later; you can even restore deleted files later.
• Think of local history as a mini version control system…
T18.T18.7575
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Comparing filesComparing files• Highlight any two files
and select Compare With Each Other from the context menu
• Differences are shown visually
• Move information from one file to another:– Entire file– Current change
• Select next or previous change
T18.T18.7676
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Import/exportImport/export• Eclipse supports many different ways to
import and export resources.– You can import an existing project from
another workspace– You can import or export a zip file, a JAR
archive, an EAR file, etc.
• You can also drag and drop files from the operating system into the Eclipse environment.– Dragging and dropping files from Eclipse
into operating system containers (Windows Explorer, for example) also works.
T18.T18.7777
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Navigating resourcesNavigating resources• The Navigate menu has
many ways to find and view your resources.– Go Into
• Also available from context menu
• Go backwards and forwards using the arrow icons
• At lower levels the view includes the name of a folder or file
– GoTo• Start typing the name
of the resource to limit the choice
• All other resources are hidden
T18.T18.7878
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Copying, moving, renamingCopying, moving, renaming• Copying and moving resources:
– Use the command from the context menu, or
– Drag and drop the resource• Copy by holding the Ctrl key as you drag
– The Ctrl+X, Ctrl+C and Ctrl+V combinations work most of the time as well (depends on the view)
• Renaming is part of Eclipse's refactoring support.
T18.T18.7979
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
PropertiesProperties• All resources have
properties– The Properties view
gives basic information on the resource
– The Properties dialog (right-click the resource and select Properties) gives much more detailed info
– Some resources have more properties than others.
T18.T18.8080
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Team functionsTeam functions• Eclipse has built-in support for
versioning, configuration management and interacting with code repositories such as CVS.– There is an open source plug-in for
Subversion as well.
• Eclipse also supports FTP and WebDAV.• As with everything in the world of
Eclipse, many groups (including IBM) have taken these basic functions and extended them.
T18.T18.8181
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Help is on the wayHelp is on the way• Eclipse's help system is very
sophisticated. Choose HelpHelp Contents to see it.
• You can view help topics from a list, or you can search for what you need.
• When you install a plug-in, its help information is integrated with everything else in the platform. – You can create a plug-in that does nothing
more than add information to the help system.
T18.T18.8282
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
HelpHelp
Presented by IBM Presented by IBM developerWorksdeveloperWorksibm.com/developerWorksibm.com/developerWorks
Making the most of Making the most of
© 2011 IBM © 2011 IBM Corporation.Corporation.
SummarySummary
T18.T18.8484
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
SummarySummary• We've looked at the basics of installing
and running Eclipse.– We also discussed the basic terminology of
Eclipse, such as perspectives, views, editors and so forth.
• Eclipse is extremely customizable, so you can make the tool work however you think best.
• Eclipse also gives you very powerful editing tools to help you manage your code and documents.
Presented by IBM Presented by IBM developerWorksdeveloperWorksibm.com/developerWorksibm.com/developerWorks
Making the most of Making the most of
© 2011 IBM © 2011 IBM Corporation.Corporation.
Eclipse Java Eclipse Java Development Tools (JDT)Development Tools (JDT)
T18.T18.8686
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
What we'll cover hereWhat we'll cover here• The JDT environment• Creating and running a program• Scrapbook pages• Using JUnit, Ant and javadoc
Presented by IBM Presented by IBM developerWorksdeveloperWorksibm.com/developerWorksibm.com/developerWorks
Making the most of Making the most of
© 2011 IBM © 2011 IBM Corporation.Corporation.
The JDT environmentThe JDT environment
T18.T18.8888
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
The JDT environmentThe JDT environment
• A set of tools for writing, compiling, testing, and debugging Java code. – Note: Compiling happens automatically whenever
you save your code. It's not a separate step.
• The Eclipse SDK includes the Java tools. See eclipse.org/jdt if you want to learn more about the project.
T18.T18.8989
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
JDT perspectivesJDT perspectives• The most useful
perspectives for Java development are Java and Debug. – There are also the
Java Browsing and Java Type Hierarchy perspectives.
• We'll look at the Java perspective now; we'll cover the Eclipse Debugger later.
T18.T18.9090
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
The Java perspectiveThe Java perspective
Syntax-aware Java
editorClass hierarchy
Class outline
T18.T18.9191
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
The Java editorThe Java editor• As you'd expect from a world-class IDE,
Eclipse has a color-coded Java editor.• As you type, it automatically highlights
the Java syntax and indents your code. • If there are errors, they're indicated
when you save the file (if not before).
T18.T18.9292
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
The Java editorThe Java editor
T18.T18.9393
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Code assistCode assist
• If you type Ctrl+Space, Eclipse shows you the relevant method signatures and the javadoc for each.
• This works for code you write as well as the standard Java libraries.
• You don't have to run javadoc against your code for this to work. The documentation above comes from the comment in the source code.
T18.T18.9494
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Quick fixQuick fix• For many common
problems, Eclipse can offer fixes for you.– If a package statement
doesn't match a .java file's location, Eclipse will move the file or update the package statement.
– If you're missing an import statement, Eclipse can automatically add it.
• If a Quick Fix is available, the red X will have a light bulb icon behind it.
T18.T18.9595
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Organize importsOrganize imports• If you use a Java class
without a corresponding import statement, Eclipse will add them for you automatically.
• By default Eclipse imports java.io.OutputStream instead of java.io.*.
• If you remove all instances of a class and invoke Organize Imports again, Eclipse removes the import statements you don't need.
T18.T18.9696
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Code refactoringCode refactoring
• Eclipse has very powerful code refactoring features. – You can move a class up or down in the class
hierarchy.– You can rename a field and its associated get and set
methods– You can move a class to another package…
T18.T18.9797
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
GlobalizationGlobalization• Eclipse has an
"Externalize Strings" function that helps you manage translation or localization of your projects.
Presented by IBM Presented by IBM developerWorksdeveloperWorksibm.com/developerWorksibm.com/developerWorks
Making the most of Making the most of
© 2011 IBM © 2011 IBM Corporation.Corporation.
Creating and running Java Creating and running Java programsprograms
T18.T18.9999
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Creating and running Java Creating and running Java programsprograms• It's a short process:
1.Create a Java project2.Create a Java package 3.Create a Java class in that package4.Run your code
– [You may need to set up a run configuration first…]
T18.T18.100100
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Creating a Java projectCreating a Java project• Start with
FileNew Project…
• Choose Java Project, give it a name and click Finish.
T18.T18.101101
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Creating a Java packageCreating a Java package
• To create a Java package, right-click on your new project in the Package Explorer, then choose NewPackage.
T18.T18.102102
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Creating a Java packageCreating a Java package• Enter a name for
your package. • If you break Java
style rules (maybe your package begins with an uppercase letter), Eclipse reminds you.
T18.T18.103103
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Creating a Java packageCreating a Java package
• Your new package appears in the Package Explorer view beneath your project.
T18.T18.104104
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Creating a Java classCreating a Java class
• To create a Java class, right-click on your new package in the Package Explorer, then choose NewClass.
T18.T18.105105
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Creating a Java classCreating a Java class• Enter a name for
your class. • Eclipse reminds you
of style rules here as well.
• You can set the details of your class, including its superclasses, visibility and interfaces.
T18.T18.106106
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Creating a Java classCreating a Java class
• Your new class appears in the Package Explorer beneath your package.
• Eclipse also opens the source file for your class in the Java editor.
T18.T18.107107
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
A shortcutA shortcut• You can create a new
package and a new class at the same time.
• Simply create a new class and enter a new package name while you're in the wizard.
T18.T18.108108
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Running your codeRunning your code• To run your code,
right-click on the Java file, then choose Run AsJava Application.
T18.T18.109109
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Running your codeRunning your code
• Because this is a console application (it uses System.out.println), you'll see the output in the Console view.– By default, System.outSystem.out is displayed in blackin black, System.errSystem.err
is displayed in redin red and System.inSystem.in shows up in greenin green.
• If the Console doesn't appear, you can open it through WindowShow View…
T18.T18.110110
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Re-running your codeRe-running your code• Once you've run your
code, you can click Run Last Launched (Ctrl+F11) to run it again.
• Your program's name also appears in the Run History menu.
T18.T18.111111
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Creating a run configurationCreating a run configuration• If you need to set
command-line arguments, JVM parameters, etc., you need to create a Run configuration.
• Select your class in the Package Explorer, then choose RunRun…– Click "Java
Application" in the list on the left to get started.
T18.T18.112112
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Creating a run configurationCreating a run configuration• This run
configuration sets the language and country code for the JVM.
• You can also set the classpath, command line arguments and other details.
Presented by IBM Presented by IBM developerWorksdeveloperWorksibm.com/developerWorksibm.com/developerWorks
Making the most of Making the most of
© 2011 IBM © 2011 IBM Corporation.Corporation.
Scrapbook pagesScrapbook pages
T18.T18.114114
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Scrapbook pagesScrapbook pages• You can create a
scrapbook page with the Java tools. A scrapbook page lets you enter and execute lines of Java code without building a class to hold them.
• The wizard to create a new scrapbook page is under New JavaJava Run/Debug.
T18.T18.115115
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Scrapbook pagesScrapbook pages
• You can highlight some code, right-click on it, then choose Inspect, Display or Execute.
• The code we're entering is System.out.println ("Here's the value of PI: " + Math.PI);– Content assist appears when we type "Math."
T18.T18.116116
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Scrapbook pagesScrapbook pages
• If you highlight the code, right-click it and choose Execute, you'll see these results in the Console view.
T18.T18.117117
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Scrapbook pagesScrapbook pages• If you choose
Inspect, the scrapbook page shows you the value of whatever you've highlighted. – In this example, we've
only highlighted Math.PI, not the whole line of code.
• Display inserts the value of whatever you've highlighted.
Presented by IBM Presented by IBM developerWorksdeveloperWorksibm.com/developerWorksibm.com/developerWorks
Making the most of Making the most of
© 2011 IBM © 2011 IBM Corporation.Corporation.
Using JUnit, Ant and Using JUnit, Ant and javadocjavadoc
T18.T18.119119
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Using JUnitUsing JUnit• JUnit was created by programming
legends Kent Beck and Erich Gamma.• It makes it easy to implement Test-
Driven Development (TDD), (sometimes called Test First Development).
• Eclipse has JUnit support built in.– JUnit 3.8.1 has been in Eclipse for quite a
while; JUnit 4 support was added in Version 3.2.
T18.T18.120120
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Creating a test caseCreating a test case• Right-click on a Java
file and choose NewJUnit Test Case.
T18.T18.121121
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Creating a test caseCreating a test case• When you create a
JUnit test case, you name the test case (the test case is a Java class).
• You also specify the class you'll be testing.
• The JUnit JAR file is not on the project's classpath; click the link at the bottom of the panel to add it.
T18.T18.122122
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Creating a test caseCreating a test case• As you create your
test case, Eclipse's JUnit support shows you a list of all the methods you can test.– This includes methods
of the class you're testing and all the methods of its superclasses.
T18.T18.123123
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Creating a test caseCreating a test case• In this example, we ask Eclipse to
generate a JUnit TestCase for the getGreeting() method.
• The complete testGetGreeting() method is:
public void testGetGreeting() { HelloWorld hw = new HelloWorld(); assertEquals("Hello, World!",
hw.getGreeting());}
• We're saying that getGreeting() should always return the string "Hello, World!"
T18.T18.124124
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Running a test caseRunning a test case
• Our test case is the Java class TestHelloWorld.
• To run the class, select the test class in the Package Explorer, then choose Run AsJUnit Test.
T18.T18.125125
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Running a test caseRunning a test case• The results of
running your test case appear in the JUnit view.– Green is good…
• You can also create and run JUnit TestSuites. A TestSuite is an ordered collection of TestCases.
• Run your test cases early and often…
T18.T18.126126
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Using AntUsing Ant• Ant (ant.apache.org) is an XML- and
Java-based build tool.– Designed to have the same functionality as make without its [many, many, many] quirks.
– You can extend Ant to do other tasks if you want.
• An Ant build file (named build.xml by default) can define a number of targets.
• You can define which target gets built from the command line (or the Eclipse equivalent), or let Ant figure out which one should be created.
T18.T18.127127
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Using AntUsing Ant• Once you've created
your build.xml file (or whatever you choose to call it), you can right-click on it and choose Run Ant…
T18.T18.128128
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Using Using javadocjavadoc• You can export your
project to javadoc.
• When you do this, Eclipse runs javadoc against your code and exports the generated files to the directory you choose.
T18.T18.129129
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Using Using javadocjavadoc• When you generate
the javadocs, you specify which packages and classes should be processed.
• You can also decide which class members are processed (public, protected, private)
T18.T18.130130
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Using Using javadocjavadoc• You can customize
the files that are generated, such as index pages or navigation bars.
• If you want, you can create links to the standard Java libraries.
T18.T18.131131
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Using Using javadocjavadoc• The generated
documentation is put in the doc folder of your project by default.
Presented by IBM Presented by IBM developerWorksdeveloperWorksibm.com/developerWorksibm.com/developerWorks
Making the most of Making the most of
© 2011 IBM © 2011 IBM Corporation.Corporation.
SummarySummary
T18.T18.133133
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
SummarySummary• We've covered (although very quickly)
the Java development functions in Eclipse, including:– Various automatic coding features – How to create and run Java code – Using scrapbook pages– Automating testing with JUnit– Using ant and javadoc inside Eclipse
Presented by IBM Presented by IBM developerWorksdeveloperWorksibm.com/developerWorksibm.com/developerWorks
Making the most of Making the most of
© 2011 IBM © 2011 IBM Corporation.Corporation.
The Eclipse debuggerThe Eclipse debugger
T18.T18.135135
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
What we'll cover hereWhat we'll cover here• Using the debugger:
– Starting the debugger– Setting breakpoints– Stepping through the code– Inspecting variables and expressions
• Hot code replace– Note: We'll talk about these features Note: We'll talk about these features
briefly in the first section, then briefly in the first section, then demonstrate them in the second. demonstrate them in the second.
Presented by IBM Presented by IBM developerWorksdeveloperWorksibm.com/developerWorksibm.com/developerWorks
Making the most of Making the most of
© 2011 IBM © 2011 IBM Corporation.Corporation.
Using the debuggerUsing the debugger
T18.T18.137137
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
The Eclipse debuggerThe Eclipse debugger• The Eclipse Java tools
include a world-class debugger.
• To debug your code, you run it in debug mode.
– You don't have to change your code or recompile it in any way.
• Right-click on the Java file, then select Debug AsJava Application (instead of Run AsJava Application).
T18.T18.138138
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
The debug perspectiveThe debug perspective
Source
Console
Execution Stack
Variables, breakpoin
ts, expressio
ns
T18.T18.139139
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Stop in Stop in main()main()• Depending on the
structure of your code, you may want to stop the debugger in the main() method.
• To do this, you have to create a debug configuration, just like you would a run configuration.
T18.T18.140140
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
BreakpointsBreakpoints• The simplest kind of
breakpoint is a line breakpoint.
– To create one, double-click in the margin next to a line of code.
– Double-click the icon to remove it.
• A method breakpoint stops when the debugger enters or exits a particular method.
• You can set an exception breakpoint on a particular Java exception (caught or uncaught).
T18.T18.141141
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
BreakpointsBreakpoints• An expression
breakpoint stops when a condition either becomes true or it changes. – An expression can be
more than a simple variable name…
– You can use code assist as you type an expression.
• You can set a hit count on a breakpoint, telling Eclipse to stop after a breakpoint has been reached a certain number of times.
T18.T18.142142
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Stepping through codeStepping through code1. Resume – Continues execution until breakpoint or thread ends
2. Suspend – Interrupts a running thread
3. Terminate – Ends the execution of the selected thread
4. Disconnect – Disconnect from a remote debugging session
5. Remove terminated launches – Closes all terminated debug sessions
6. Step Into – Steps into a method and executes its first line of code
7. Step Over – Executes the next line of code in the current method
8. Step Return – Continues execution until the end of the current method (until a return)
9. Drop to Frame – Returns to a previous stack frame
10. Step with Filters – Continues execution until the next line of code which is not filtered out
1 2 3 4 5 6 7 8 9 10
T18.T18.143143
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Step filteringStep filtering• You can set filters in
your debugging session.
• This tells the debugger not to stop on certain lines of code.
• If you combine filters with the Step with Filters button, each step with the debugger (step into, step over or step return) will skip the filtered lines of code.
T18.T18.144144
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Inspecting variables & Inspecting variables & expressionsexpressions• The debugger has a
variables view that shows all the variables currently in scope.– You can change the
values of those variables if you want.
• There's also an expressions view that lets you evaluate expressions.– These typically involve
some variable in scope, but can be any Java language expression.
T18.T18.145145
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Stack framesStack frames
• Whenever a thread invokes a method, that invocation is added to the stack.– main() called getUserInput(), which called itsAMatch().
• The Drop to Frame button lets you go backwards to the point at which a thread invoked a particular method.– Variable values are not reset to their previous state.
T18.T18.146146
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Re-running the debuggerRe-running the debugger• Once you've run your
code, you can click Debug Last Launched (F11) to run it again.
• Your program's name also appears in the Debug History menu.
T18.T18.147147
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Advanced debugger featuresAdvanced debugger features• Although the debugger that ships with the
Eclipse SDK is a Java debugger, the debugger component itself can be extended.– The C Development Tools extend the Eclipse
debugger to provide similar tools for C and C++ code, for example.
• Eclipse also has a remote debugging feature that's very powerful.– The debugger is on one machine, the code being
debugged is on another. – See eclipse.org/eclipse/faq/eclipse-faq.html #users_18 for more details on how to set up remote debugging.
Presented by IBM Presented by IBM developerWorksdeveloperWorksibm.com/developerWorksibm.com/developerWorks
Making the most of Making the most of
© 2011 IBM © 2011 IBM Corporation.Corporation.
Hot code replaceHot code replace
T18.T18.149149
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Hot code replaceHot code replace• One of the coolest features of the Java
debugger is the ability to replace code currently running in the debugger.– You don't have to restart the debugger or
recreate the state of your program when you changed the code.
T18.T18.150150
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Hot code replaceHot code replace• How it works:
– The JVM you're using must support hot code replace (most JVMs 1.4.x and later do)
– You can't do anything that changes the "signature" of a class (add or remove methods or instance variables, move it up and down in the class hierarchy, and so forth)
– You can't change the main() method– You go back up the stack to whatever called
the code you changed, but that's probably what you wanted to do anyway.
T18.T18.151151
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Hot code replaceHot code replace• Here's the console:Starting the example:Enter any string. To quit, type Quit.QuitYou typed "Quit"Enter any string. To quit, type Quit.QuitYou typed "Quit"Enter any string. To quit, type Quit.
• Our code never exits, regardless of what we type. We'll run this through the debugger again…
T18.T18.152152
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Hot code replaceHot code replace• We're stepping through the code when
we realize the problem. This line: s.equals(exiting)should be: s.toString().equals (exiting.toString())
• With hot code replace, we can fix the code without restarting the debugger.
• As the debugging session continues, we can verify that our code change fixed the problem.
Presented by IBM Presented by IBM developerWorksdeveloperWorksibm.com/developerWorksibm.com/developerWorks
Making the most of Making the most of
© 2011 IBM © 2011 IBM Corporation.Corporation.
SummarySummary
T18.T18.154154
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
SummarySummary• We looked at the debugger in detail,
including:– How to start the debugger– The different kinds of breakpoints and how
to set them– Stepping through the code– Inspecting variables and expressions– How to use Eclipse's hot code replace
feature
Presented by IBM Presented by IBM developerWorksdeveloperWorksibm.com/developerWorksibm.com/developerWorks
Making the most of Making the most of
© 2011 IBM © 2011 IBM Corporation.Corporation.
Extending Eclipse Extending Eclipse with plug-inswith plug-ins
V1.3
T18.T18.156156
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
What we'll coverWhat we'll cover• A brief discussion of the Eclipse plug-in
architecture• Finding, installing and updating plug-ins • Some popular plug-ins• Demo: Building graphical applications
with the Eclipse Visual Editor (VE)• The Callisto Project
Presented by IBM Presented by IBM developerWorksdeveloperWorksibm.com/developerWorksibm.com/developerWorks
Making the most of Making the most of
© 2011 IBM © 2011 IBM Corporation.Corporation.
The Eclipse plug-in The Eclipse plug-in architecturearchitecture
T18.T18.158158
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
The Eclipse plug-in architectureThe Eclipse plug-in architecture• The Eclipse platform provides some
basic functions; everything else Eclipse does is through plug-ins.– The Java development tools are technically a
set of plug-ins, even though they come as part of the basic Eclipse SDK.
T18.T18.159159
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
The Eclipse plug-in architectureThe Eclipse plug-in architecture
WorkbenchHelp
System
WorkspaceTeam
Components
C++plug-in
GUI builderplug-in
Modelingplug-in
YOUR plug-inYOUR plug-in
Presented by IBM Presented by IBM developerWorksdeveloperWorksibm.com/developerWorksibm.com/developerWorks
Making the most of Making the most of
© 2011 IBM © 2011 IBM Corporation.Corporation.
Finding, installing and Finding, installing and updating plug-insupdating plug-ins
T18.T18.161161
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
eclipseplugincentral.comeclipseplugincentral.com• The Eclipse
community now has a single portal for finding plug-ins.
• There are more than 1000 plug-ins listed at the site. There's also a search feature to help you find what you're looking for.
• There are also more than 950 Eclipse-related projects at Source Forge...
T18.T18.162162
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Finding plug-insFinding plug-ins• The best way to install a plug-in is from
an update site.– If you use an update site, Eclipse can check
for newer versions of the plug-in and install the updates for you.
• If you want, you can download a zip file and unpack it into the eclipse directory.– This works, but it's error prone and Eclipse
won't be able to update the plug-in.
T18.T18.163163
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Installing plug-insInstalling plug-ins• To start installing
plug-ins, choose Software UpdatesFind and Install…
• You can look for new features to install, or look for updates for what you've got installed already.
T18.T18.164164
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Installing local plug-insInstalling local plug-ins• If you've downloaded
and unzipped a plug-in into a directory, you can define that directory as a local site for plug-ins.
• You can tell Eclipse to look for new or updated plug-ins there.– Eclipse can't update
the plug-in automatically, though.
T18.T18.165165
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Installing remote plug-insInstalling remote plug-ins• The best way to get a plug-in is to install
it directly from the site that hosts the plug-in.
• Given a URL, the workbench looks for a file named site.xml. – Eclipse uses the site.xml file to determine
what plug-ins are on that site, what the current versions of those plug-ins are and what other plug-ins they require, if any.
T18.T18.166166
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Installing remote plug-insInstalling remote plug-ins• You can add a new site
bookmark that points to the plug-in's URL.
• Eclipse uses the site to look for new plug-ins.
• When you check for updates, Eclipse looks at the site for any new versions of the plug-in.
• Some plug-ins automatically define site bookmarks when you install them.
T18.T18.167167
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Installing remote plug-insInstalling remote plug-ins
• In this case, Eclipse has contacted the Functional Programming Tools update site and has found several features. – You decide which ones to install; Eclipse doesn't
install anything without your permission.
T18.T18.168168
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
DependenciesDependencies• Some plug-ins require other plug-ins.
– For example, the Graphical Editing Framework and the Eclipse Modeling Framework are used by lots of plug-ins.
• When you try to install a plug-in, Eclipse checks to see if the required plug-ins are already installed. – If not, Eclipse will tell you (and possibly
check the Internet for them).
T18.T18.169169
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Installing remote plug-insInstalling remote plug-ins
• You have to accept the plug-in's license agreement before you can install it. – Be sure to read the agreement carefully…
• Eclipse won't install a plug-in that doesn't have a license agreement.
T18.T18.170170
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Installing remote plug-insInstalling remote plug-ins• Most open source
plug-ins aren't signed.
• Eclipse warns you about this, but you're free to ignore it and install the plug-in anyway.
T18.T18.171171
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Installing remote plug-insInstalling remote plug-ins
• After you've answered all of the questions, Eclipse starts to download and install the plug-in.
• All you have to do now is wait…
T18.T18.172172
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Installing remote plug-insInstalling remote plug-ins
• When the plug-in has been downloaded and installed, you might see a message like this.
• Restart the workbench if it's at all possible.
T18.T18.173173
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Installing remote-plug-insInstalling remote-plug-ins
• When the workbench restarts, the plug-ins you just installed are available.– In this example, there is a new wizard to create an
SQL file.
T18.T18.174174
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Updating remote plug-insUpdating remote plug-ins• After you've defined
your update sites, you can tell Eclipse which ones to visit.
• In this case, we're looking for updates to the Perl tools.
T18.T18.175175
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Managing your configurationManaging your configuration
• The Manage Configuration… menu item lets you look at everything you have installed. – You can search for updates for particular features
you've installed– You can also disable or enable a particular feature.
T18.T18.176176
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Extension locationsExtension locations• If you install new Eclipse
builds frequently, you can create an extension location.
• An extension location contains plug-ins and features that are in a directory as if they were installed in Eclipse.
• When you create an extension location, Eclipse will use the plug-ins installed there automatically; you don't have to copy them to each Eclipse installation.
T18.T18.177177
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Extension locationsExtension locations
• An extension location is the directory eclipse with the empty file .eclipseextension and the directories features and plugins.– Type echo 2>.eclipseextension to create an empty
file.
• Put the features you want under features, and the plug-ins you want under plugins.
Presented by IBM Presented by IBM developerWorksdeveloperWorksibm.com/developerWorksibm.com/developerWorks
Making the most of Making the most of
© 2011 IBM © 2011 IBM Corporation.Corporation.
Some popular plug-insSome popular plug-ins
T18.T18.179179
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Some popular plug-insSome popular plug-ins• We'll look at several popular plug-ins
that add features to Eclipse.– Hopefully you can find plug-ins that add the
functions you're looking for.– If not, many plug-ins are open source, so
you can often take the source of someone else's plug-in and customize it to your needs.
T18.T18.180180
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
The Web Tools Project (WTP)The Web Tools Project (WTP)• The Eclipse Web Tools Project (WTP) adds
many powerful features to the Eclipse platform:– Web site design and development– JSP and JSF support– Web services creation, testing and monitoring
• It consists of three subprojects: Web Standard Tools (WST), Java EE Standard Tools (JST) and Java Server Faces Tools (JSF).
• eclipse.org/webtools
T18.T18.181181
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
The Data Tools Project (DTP)The Data Tools Project (DTP)• The Data Tools Project (DTP) is now
separate from the Web Tools Project.– There are some basic database tools in the
WTP, but the advanced work on database tools is in the DTP.
– The latest beta of the tools contains support for XQuery, for example.
• eclipse.org/datatools
T18.T18.182182
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
The Ajax Tools Framework (ATF)The Ajax Tools Framework (ATF)• IBM, BEA, Oracle, Laszlo and others are
working on the Ajax Tools Framework (ATF).– The goal of the project is to build tools that
work with the most popular Ajax frameworks (Dojo and Rico, for example)
– You can define profiles for your favorite Ajax toolkit as well.
– The latest version of these tools is available at eclipse.org/atf.
T18.T18.183183
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Language toolsLanguage tools• PHP
– You have multiple choices here. The most popular plug-in is PHP Eclipse, phpeclipse.sourceforge.net.
– There is now an official Eclipse project for PHP; see eclipse.org/php for more information.
• Perl– There are several tools for Perl; the most popular is
EPIC, the Eclipse Perl Integration project. e-p-i-c.sf.net/updates is the Eclipse update site.
• C Development Tools (CDT) project– The goal of the project is to provide Eclipse support
for C and C++ that's comparable for Eclipse support for Java. eclipse.org/cdt
T18.T18.184184
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Language toolsLanguage tools• Ruby
– The Ruby Development Tools feature a custom editor, a custom Ruby search dialog and a Ruby debugger. It reuses regular expression support from the EPIC project. www.rubypeople.org
• Python– The Pydev toolkit is one of the most popular,
although there are others. sourceforge.net/projects/pydev
• Functional programming– The EclipseFP project provides support for the
functional programming languages Haskell and OCaml.
– eclipsefp.sourceforge.net
T18.T18.185185
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Other notable plug-insOther notable plug-ins• UML2 - An EMF-based implementation of UML
2.0.– eclipse.org/uml2– There are a number of commercial UML tools for
Eclipse, including IBM's Rational Software Architect and Rational Software Modeler.
• BIRT – Business Intelligence and Reporting Tools– A sophisticated report generation facility. eclipse.org/birt
• TPTP - Test and Performance Tools Project– Tools for profiling applications, identifying
bottlenecks, etc. eclipse.org/test-and-performance
T18.T18.186186
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Other notable plug-insOther notable plug-ins• Aspect-oriented programming
– AspectJ is an aspect-oriented extension to Java eclipse.org/aspectj
– AJDT is a set of aspect-oriented development tools for AspectJ eclipse.org/ajdt
• WSVT – Web Services Validation Tools– See eclipse.org/wsvt for downloadable
files and information about the project.
• FTP and WebDAV support– Look for eclipse-FTP-WebDAV-3.0.1.zip
on your favorite Eclipse mirror.
T18.T18.187187
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
The Eclipse Visual Editor projectThe Eclipse Visual Editor project• You can get an open source graphical
editor through the Eclipse Visual Editor project, eclipse.org/vep.– The Visual Editor is built on the Graphical
Editing Framework (GEF) and the Eclipse Modeling Framework (EMF).
• Other vendors have commercial visual editors…
T18.T18.188188
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Two common frameworksTwo common frameworks• The Eclipse Modeling Framework (EMF)
and the Graphical Editing Framework (GEF) are behind many of the Eclipse projects we've mentioned already. – EMF – eclipse.org/emf– GEF – eclipse.org/gef
Presented by IBM Presented by IBM developerWorksdeveloperWorksibm.com/developerWorksibm.com/developerWorks
Making the most of Making the most of
© 2011 IBM © 2011 IBM Corporation.Corporation.
Demo: Demo: The Eclipse Visual EditorThe Eclipse Visual Editor
T18.T18.190190
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Demo: The Eclipse Visual EditorDemo: The Eclipse Visual Editor• We'll take a brief look at the Eclipse
Visual Editor. This is an open source, professional-quality GUI build tool.
• As we mentioned before, the Visual Editor is built on both GEF and EMF.
Presented by IBM Presented by IBM developerWorksdeveloperWorksibm.com/developerWorksibm.com/developerWorks
Making the most of Making the most of
© 2011 IBM © 2011 IBM Corporation.Corporation.
The Callisto projectThe Callisto project
T18.T18.192192
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Ten simultaneous releasesTen simultaneous releases• The Callisto project
(eclipse.org/ projects/ callisto.php) released Eclipse V3.2 and nine major Eclipse projects simultaneously.
– Users have ten major pieces of software that have been tested together.
• This shipped at the end of June 2006.
• Eclipse 3.2 base platform
• BIRT
• CDT
• Data Tools Platform
• EMF
• GEF
• Graphical Modeling Framework
• Test and Performance Tools Project
• Web Tools Project
• Visual Editor
T18.T18.193193
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Updating CallistoUpdating Callisto• Point the Update
Manager at download.eclipse.org/ callisto/releases/ to download, install and update the various components.
• You select the components that you're interested in, and Eclipse does the rest.
• You must have Eclipse 3.2 installed to use this site.
Presented by IBM Presented by IBM developerWorksdeveloperWorksibm.com/developerWorksibm.com/developerWorks
Making the most of Making the most of
© 2011 IBM © 2011 IBM Corporation.Corporation.
SummarySummary
T18.T18.195195
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
SummarySummary• We've taken a brief look at the Eclipse plug-in
architecture. • We looked at ways to find, install and update
plug-ins, including update sites and extension locations.
• We also looked at some popular plug-ins.• We used the Eclipse Visual Editor to build an
application. The Visual Editor is built on Eclipse and two plug-in frameworks that extend the Eclipse platform.
• Finally, we looked at the Eclipse Callisto release.
Presented by IBM Presented by IBM developerWorksdeveloperWorksibm.com/developerWorksibm.com/developerWorks
Making the most of Making the most of
© 2011 IBM © 2011 IBM Corporation.Corporation.
The Eclipse The Eclipse Web Tools PlatformWeb Tools Platform(and related tools)(and related tools)
T18.T18.197197
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
What we'll coverWhat we'll cover• The Web Tools Platform (WTP)• The Data Tools Platform (DTP)• The Ajax Tools Framework (ATF)
Presented by IBM Presented by IBM developerWorksdeveloperWorksibm.com/developerWorksibm.com/developerWorks
Making the most of Making the most of
© 2011 IBM © 2011 IBM Corporation.Corporation.
The Web Tools PlatformThe Web Tools Platform
T18.T18.199199
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
The Web Tools PlatformThe Web Tools Platform• End user tools and APIs for Web and Java EE
application development• WTP is two subprojects and one incubation
project:– Web Standard Tools (WST)– Java EE Standard Tools (JST)– Java Server Faces (JSF) tools
• Supports open standards from OASIS, the W3C, JCP, WS-I.org and others
• Includes tools for open source and commercial products (Apache Tomcat, BEA WebLogic, IBM WebSphere)
• eclipse.org/webtools
T18.T18.200200
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Project goalsProject goals• API declaration where appropriate• Simple to use – wizards, editing support• Large-scale development• User experience – dynamic help,
graphical WSDL editor• Responsive UI• Seamless editing of resources
– JDT-like features applied to other languages (HTML, JSP, XML…)
• Flexible project layout• Vendor ecosystem support
T18.T18.201201
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
The Web Standard Tools (WST)The Web Standard Tools (WST)• Basic server tools
– Support for server types and server connectivity (Web, DB)
– Configure, publish, start/stop, debug
• Structured Source Editor framework• Web Language Tools
– HTML source editor– CSS source editor– JavaScript source editor
T18.T18.202202
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
The Web Standard ToolsThe Web Standard Tools• XML language tools
– XML source editor– XSD source editor– DTD source editor
• Web services tools– WSDL editor– Web service explorer– Web service wizard– TCP/IP monitor– WS-I test tools
T18.T18.203203
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Server toolsServer tools• Preferences pages to configure various server
runtimes• Supported runtimes:
– IBM WebSphere– Apache Tomcat– JBoss– JOnAS– BEA WebLogic– Apache Geronimo (with a plug-in)
• Highly extensible server frameworks• Supports generic server adapters and custom
server adapters
T18.T18.204204
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Server toolsServer tools
T18.T18.205205
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Server toolsServer tools
• When you've configured a server, you can start and stop it, republish applications and examine its configuration.– Here we see a Tomcat server with two applications
deployed to it.
T18.T18.206206
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Structured source editorsStructured source editors• Editors for:
– XML– DTDs – HTML– CSS– JavaScript– JSPs
• These include the usual Eclipse editor features:– Syntax highlighting– Quick fix– Delimiter matching– Content assist
T18.T18.207207
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
XML toolsXML tools• Custom editors for
XML files, XML schemas, DTDs and WSDL files
• XML Catalog support – A repository for DTDs, XSDs, or any XML resource (WSDL, XSL, etc.)– Based on the OASIS
XML catalog standard
T18.T18.208208
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Web services toolsWeb services tools
• This is the WSDL editor, a graphical application that shows the structure of a Web service interface.
• The structure of the XML types passed by a Web service is displayed as well.
T18.T18.209209
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Web services toolsWeb services tools• Wizards to create
Web services– Top-down – Start
with a WSDL interface, go to code
– Bottom-up – Start with code, generate the WSDL interface
• Supports Apache Axis 1.2 and many other Web service runtimes.
T18.T18.210210
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Java EE standard tools (JST)Java EE standard tools (JST)• Java EE core tools
– Natures and builders– Java EE views and navigators– Java EE models
• Java EE projects and modules– Flexible directory layout– Support for WAR files, EJBs, JARs, EAR files,
etc.– Models and source editors for deployment
descriptors– Java EE navigator view– Ability to target different servers
T18.T18.211211
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Java EE standard toolsJava EE standard tools• Servlet tools• JSP tools
– JSP editor, HTML code assist, editors for Java, JavaScript, taglibs
– JSR-45 compliant debugging
• Java EE server tools – extend WST– Supports deploy, debug, project restart on Java EE
runtimes– Generic server adapter– Custom (Java) server adapter for total control
• Javadoc annotation support– Extensible facility to define tagsets– Code assist in Java editors and builders for code
generation
T18.T18.212212
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Java EE standard toolsJava EE standard tools
• Wizards make it easy to create EJB projects and deploy them to a server.
• If you change the project, Eclipse automatically republishes and redeploys it for you.
T18.T18.213213
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
XDoclet supportXDoclet support
T18.T18.214214
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Standards supportStandards support• WST:
– HTML 4.0.1– XHTML 1.0 / 1.1– XML Catalogs 1.0– CSS 2.0– ECMAScript 262– SQL99/SQL2003– XML 1.0– XML Schema 1.0– WSDL 1.1– SOAP 1.1– WS-I basic profile 1.1, attachment profile 1.0
T18.T18.215215
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Standards supportStandards support• JST – JCP standards
– Java EE 1.2, 1.3, 1.4– Servlets– JSP– EJB– JAX-RPC– JSR 109– JSR 045– JSR 921– JDBC 2.1
Presented by IBM Presented by IBM developerWorksdeveloperWorksibm.com/developerWorksibm.com/developerWorks
Making the most of Making the most of
© 2011 IBM © 2011 IBM Corporation.Corporation.
The Data Tools ProjectThe Data Tools Project
T18.T18.217217
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
The Data Tools ProjectThe Data Tools Project• Designed to provide world-class support
for relational databases
• Ships with support for DB2, SQL Server, Informix, Sybase, Oracle, MySQL, Cloudscape/Derby, etc.
– You can add your own JDBC drivers if you want.
T18.T18.218218
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Relational database toolsRelational database tools• Wizard to create live
connections to database servers over JDBC
• Supported servers:
– Apache Derby / Cloudscape
– DB2
– Informix
– MySQL
– SQL Server
– Oracle
– Sybase
– You can add your own…
T18.T18.219219
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Relational database toolsRelational database tools• Database Explorer –
View database schemas, tables, views, stored procedures and user-defined functions
• Supports working in disconnected mode
T18.T18.220220
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
ConnectionsConnections• To work with databases, you create
connection objects.
– Each object stores details about JDBC drivers, URL formats, table names, user IDs and passwords, etc.
• Once you've created a connection, you can reuse it in different projects.
Presented by IBM Presented by IBM developerWorksdeveloperWorksibm.com/developerWorksibm.com/developerWorks
Making the most of Making the most of
© 2011 IBM © 2011 IBM Corporation.Corporation.
The Ajax Tools FrameworkThe Ajax Tools Framework
T18.T18.222222
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
The Ajax Tools FrameworkThe Ajax Tools Framework• Ajax is an emerging technology that will be
very important in the forseeable future.
• The ATF supports Dojo and Rico out of the box, but can be extended to support any Ajax toolkit you want.
– There are more than 150 Ajax toolkits...• We'll look at a quick example that uses
visual controls from the Rico toolkit, a database connection from the DTP, and uses a servlet built on the WTP.
Presented by IBM Presented by IBM developerWorksdeveloperWorksibm.com/developerWorksibm.com/developerWorks
Making the most of Making the most of
© 2011 IBM © 2011 IBM Corporation.Corporation.
DemosDemos
T18.T18.224224
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
DemosDemos• We'll take a quick look at:
– A Web service built with the Web Tools– A simple Ajax application
Presented by IBM Presented by IBM developerWorksdeveloperWorksibm.com/developerWorksibm.com/developerWorks
Making the most of Making the most of
© 2011 IBM © 2011 IBM Corporation.Corporation.
SummarySummary
T18.T18.226226
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
SummarySummary• The Web Tools Project is part of the continuing
evolution of open source tools.– Much of the code in the WTP was originally closed
source code in products from IBM, BEA, etc.
• In addition to being open source, the project also helps advance open standards.
• The Data Tools Project provides the same vendor-neutral, standards-based support for databases.
• The Ajax Tools Framework is still in its infancy, but is shaping up as an extremely powerful and flexible tool.
Presented by IBM Presented by IBM developerWorksdeveloperWorksibm.com/developerWorksibm.com/developerWorks
Making the most of Making the most of
© 2011 IBM © 2011 IBM Corporation.Corporation.
Creating Eclipse plug-insCreating Eclipse plug-ins
T18.T18.228228
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
What we'll coverWhat we'll cover• The Eclipse plug-in architecture• The Plug-in Development Environment
– We'll build a small plug-in and deploy it in the Eclipse workbench.
• Suggested enhancements
T18.T18.229229
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
The challenge of writing plug-insThe challenge of writing plug-ins• There are two things you need to learn
when writing plug-ins:– How to write the code of the plug-in itself– [Most importantly] How to find the parts of
Eclipse (or EMF, GEF, etc.) that do 90% of what you want to do.
• Learning to reuse as much code as possible is the most important skill. – Reusing code means you get your work
done faster, and it means that users of your plug-in will see many of the same components they see in other plug-ins.
Presented by IBM Presented by IBM developerWorksdeveloperWorksibm.com/developerWorksibm.com/developerWorks
Making the most of Making the most of
© 2011 IBM © 2011 IBM Corporation.Corporation.
The Eclipse plug-in The Eclipse plug-in architecturearchitecture
T18.T18.231231
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
The Eclipse plug-in architectureThe Eclipse plug-in architecture
WorkbenchHelp
System
WorkspaceTeam
Components
C++plug-in
Modelingplug-in
GUI builderplug-in
T18.T18.232232
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
The Eclipse plug-in architectureThe Eclipse plug-in architecture• In Eclipse, everything is a plug-in except
the Platform Runtime (the kernel).• Everything else, including most of the
things you probably use, is a plug-in:– The Java Development Tools– The Eclipse Modeling Framework– The Visual Editor– The Web Standards Tools– Etc.
T18.T18.233233
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Extension pointsExtension points• An extension point is similar to a Java
interface. • When a plug-in uses an extension point,
it tells Eclipse that it can perform certain functions. – Or, to look at it another way, that it
implements certain interfaces.
T18.T18.234234
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Extension pointsExtension points• In a few minutes we'll create a plug-in
that uses the extension points for the help system and an action set.– Using an extension point from the help
system tells Eclipse to ask our plug-in for information whenever the help system is loaded.
– Using an action set tells Eclipse to look at our plug-in when the UI is created. Our action set creates a menu item and a toolbar button that must be drawn when the workbench appears.
T18.T18.235235
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Extension pointsExtension points• We also use the extension points for a
preferences page and the Welcome screen.– The preferences page extension point
means we'll see an OOPSLA preference page under WindowPreferences.
– The Welcome screen extension point lets us put introductory information linked to the Welcome screen seen the first time users open a particular workspace.
T18.T18.236236
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Extension pointsExtension points• In addition to the Eclipse platform's
extension points, plug-ins can provide their own.– The Eclipse Modeling Framework and the
Graphical Editing Framework both provide their own extension points.
– The EMF and GEF use Eclipse extension points to provide certain functions.
– We can write plug-ins that use the extension points defined in the EMF and GEF, which in turn use the extension points defined by Eclipse.
T18.T18.237237
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Plug-in development toolsPlug-in development tools
• In Eclipse Version 3.1, the plug-in development tools were greatly enhanced. This is the visual editor for plugin.xml.
• We'll look at the Plug-in Development Environment in just a few minutes.
T18.T18.238238
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Plug-in development toolsPlug-in development tools• The plug-in development tools make it
easy to edit the XML file that describes the plug-in.
• The description file defines:– What extension points the plug-in uses– What extension points it contributes– Its dependencies (JAR files, other plug-ins) – The properties of the extension points the
plug-in uses
T18.T18.239239
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Features and plug-insFeatures and plug-ins• An Eclipse feature is
a collection of plug-ins. It is the smallest thing you can download and install separately.
• For example, the Ruby Development Tools are a feature; they include many different plug-ins.
• What we download and install is the feature.
plug-in3 plug-in4
plug-in1 plug-in2
feature
T18.T18.240240
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Features and plug-insFeatures and plug-ins• What we'll develop here would normally
be part of a feature, although we won't go that far in our example.
• To publish our plug-in, we would normally:– Create a feature project to include our plug-
ins– Create an update site that uses a site.xml
file to describe our features– Publish the site.xml file, the feature
description and the plug-ins to a Web site.
Presented by IBM Presented by IBM developerWorksdeveloperWorksibm.com/developerWorksibm.com/developerWorks
Making the most of Making the most of
© 2011 IBM © 2011 IBM Corporation.Corporation.
The Plug-in Development The Plug-in Development Environment (PDE)Environment (PDE)
T18.T18.242242
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
The Plug-in Development The Plug-in Development EnvironmentEnvironment• We'll use the PDE tools to create a new
plug-in.• We'll start with the wizards that are part
of the development tools.• After we've built a small plug-in, we'll
test it in the Eclipse workbench.
T18.T18.243243
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Getting startedGetting started• We'll go through these steps:
– Create a plug-in project and a new plug-in– Launch the plug-in in a new workbench
• We'll finish with some improvements we could make to the plug-in.– These are left as an exercise for the
reader…
T18.T18.244244
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Create a new plug-in projectCreate a new plug-in project• Our first step is to
create a new project for our plug-in.
• Select FileNew Other, then select Plug-in Project.
• Click Next to continue.
T18.T18.245245
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Create a new plug-in projectCreate a new plug-in project• Give your project a
name, and take the defaults for the rest of the choices.– You can target Eclipse
V3.0, 3.1 or 3.2.– You can also create a
plug-in that runs with an OSGi framework.
• Click Next to continue.
T18.T18.246246
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Create a new plug-in projectCreate a new plug-in project• Fill in the details of
your plug-in. The ID uniquely identifies the plug-in.
• The version number is used by the update manager.
• Our plug-in will contribute to the UI, but we're not creating an RCP application here.
• Click Next to continue.
T18.T18.247247
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Create a new plug-in projectCreate a new plug-in project• Select the Custom
plug-in wizard.• We'll choose which
extension points we want to use on the next panel.
• Click Next to continue.
T18.T18.248248
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Create a new plug-in projectCreate a new plug-in project• Select these
templates:– "Hello World" Action
Set– Help Table of
Contents– Preference Page– Universal Welcome
Contribution
• Click Next to continue.
T18.T18.249249
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Create a new plug-in projectCreate a new plug-in project• Enter a message in
the Message Box Text field. – This text appears
when the user clicks on our menu or toolbar button.
• Click Next to continue.
T18.T18.250250
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Create a new plug-in projectCreate a new plug-in project• Enter a title for the
table of contents.• Select the Primary
check box; this creates a new major heading in the Help window.
• Click Next to continue.
T18.T18.251251
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Create a new plug-in projectCreate a new plug-in project• Enter a name for
your preferences page. (OOPSLA Preferences is what we entered here.)
• Click Next to continue.
T18.T18.252252
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Create a new plug-in projectCreate a new plug-in project• Enter the OOPSLA
2006 URL as the link for the Overview page. (http://www.oopsla.org/2006/)
• Click Finish to create your plug-in.
• Eclipse generates the plugin.xml file, the Java classes and other things you need to run your plug-in.
T18.T18.253253
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Create a new plug-in projectCreate a new plug-in project
• Eclipse will most likely ask you if you want to switch to the Plug-in Development perspective. – Click the "Remember my decision" check box, then
click Yes to continue.
T18.T18.254254
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Create a new plug-in projectCreate a new plug-in project• Eclipse creates
several files, including:– Java source code– XML files that describe
the plug-in– HTML files that add
information to the help system.
T18.T18.255255
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
The plug-in editorThe plug-in editor• When the PDE finishes creating the files
for your plug-in, you'll see the Plug-In Development perspective.
• We'll look at the editor for the plug-in descriptor files next.
T18.T18.256256
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
The plug-in editorThe plug-in editor
T18.T18.257257
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
The plug-in editorThe plug-in editor
• There are several tabs at the bottom of the plug-in editor. We'll focus on the Overview tab.
• When you're ready to enhance the generated plug-in code, the other tabs (especially the Extensions tab) help you do that.
T18.T18.258258
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Launch the plug-inLaunch the plug-in• In the right-hand
column of the Overview page, click "Launch an Eclipse application" in the Testing section.
• This launches a new Eclipse workbench with our plug-in installed.
T18.T18.259259
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
The welcome screenThe welcome screen• The new workbench
appears with the welcome screen loaded.
• Click on the Overview button.
T18.T18.260260
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
The overview pageThe overview page
• On the overview page there will be a link labeled "Lorem ipsum."
• Clicking this link takes you to the OOPSLA 2006 Web site. – We defined the target of this link in the plug-in
wizard.
T18.T18.261261
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
The menu item and toolbar The menu item and toolbar buttonbutton
• Closing the welcome screen, we can see our plug-in has added two items to the user interface:– A menu named Sample Menu that contains a single
item named Sample Action– A toolbar button with the hover text "Hello, Eclipse
world"
T18.T18.262262
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
The message dialogThe message dialog
• Clicking the toolbar button or selecting the menu item causes this exciting message to appear.
• The text of the message is whatever we typed in the plug-in wizard.
T18.T18.263263
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
The preferences pageThe preferences page• Select
WindowPreferences and click "OOPSLA Preferences" on the left-hand side.
• There are custom editors for each of these preferences, and an Eclipse API that manages the user's preferences automatically.
T18.T18.264264
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
The preferences pageThe preferences page• To test how the preferences page works,
change some of the values and click OK.• When you restart the workbench, the
values you changed have automatically been saved and restored in the preferences dialog.
• Eclipse provides an API for you to access the preferences store for your plug-in.– You probably want your code to behave
differently depending on how the user has set their preferences.
T18.T18.265265
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
The help systemThe help system• The last contribution
our plug-in has made to the UI is in the help system.
• The PDE generates a bunch of HTML files that are deployed to the help system; our job is to write the information our users need and publish it.
T18.T18.266266
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
The help systemThe help system• Now that our plug-in has added
information to the help system, all of that information is available through the search facility.
• A later version of the plug-in can contribute more information to the help facility.
• We can also write another plug-in that adds more information to the section created by this plug-in.
Presented by IBM Presented by IBM developerWorksdeveloperWorksibm.com/developerWorksibm.com/developerWorks
Making the most of Making the most of
© 2011 IBM © 2011 IBM Corporation.Corporation.
Suggested EnhancementsSuggested Enhancements
T18.T18.268268
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Suggested enhancementsSuggested enhancements• Modify the "Lorem ipsum" text that
appears on the overview page. • Find the file that contains this text and
modify it. The format of that file is straightforward.
T18.T18.269269
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Suggested enhancementsSuggested enhancements• When we implemented the Action Set
extension point, we changed the message text to "Hello, OOPSLA!" The hover text of the toolbar button wasn't changed.
• Find the hover text and change it so it's consistent with the message text.
T18.T18.270270
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Suggested enhancementsSuggested enhancements• The preferences page contains four
different property editors: A directory path editor, a simple text editor (an entry field), a choice editor (radio buttons) and a boolean editor (a check box).
• Add more properties and controls to the preferences page. Look for editors for colors, dates and other kinds of values.
T18.T18.271271
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Suggested enhancementsSuggested enhancements• Add a name property to the preferences
page. When the user clicks our toolbar button or the menu item, display the message "Hello, Akmal!" if the name property is Akmal.– Define a default name if you want.– Define a default message if the name
property isn't set or if it's blank.
Presented by IBM Presented by IBM developerWorksdeveloperWorksibm.com/developerWorksibm.com/developerWorks
Making the most of Making the most of
© 2011 IBM © 2011 IBM Corporation.Corporation.
SummarySummary
T18.T18.273273
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
SummarySummary• We've taken a very brief look at the
plug-in development environment.• The PDE tools are very good at helping
you get started. You get running code with very little effort, then you can start adding features to your plug-in one by one.
Presented by IBM Presented by IBM developerWorksdeveloperWorksibm.com/developerWorksibm.com/developerWorks
Making the most of Making the most of
© 2011 IBM © 2011 IBM Corporation.Corporation.
Eclipse resourcesEclipse resources
T18.T18.275275
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Eclipse Web sitesEclipse Web sites• In addition to the content at developerWorks
(more on that in a minute), here are a couple of sites you should visit:
• The Eclipse CornerEclipse Corner at eclipse.org is a great site for articles by Eclipse insiders.– eclipse.org/articles/
• O'Reilly's Java developer site has quite a few articles on Eclipse as well. – Go to onjava.com, search for "eclipse."
T18.T18.276276
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Eclipse communitiesEclipse communities• Eclipse is a great tool by itself, but the
community behind it is what makes Eclipse so exciting.
• In addition to the forums and FAQs at the Eclipse sites mentioned earlier, there are communities for specific interest, languages, and so forth.
• Visit eclipse.org/community to find links to Eclipse groups all over the world.– There are communities in French, German,
Korean and Japanese.– The Italian community is particularly active…
T18.T18.277277
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Eclipse booksEclipse books• Fortunately for us, many of the chief
developers of Eclipse have written very helpful books.
• We'll mention a couple of books we've found useful. – More Eclipse books are being published all
the time, so keep your eyes open for new titles.
– We've found Eclipse books in English, French, German, Spanish, Japanese and Chinese…
T18.T18.278278
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
The Java Developer's GuideThe Java Developer's Guide• Probably the most
popular book on Eclipse.
• Make sure you get the second edition; it covers Eclipse V3.x.
• ISBN 0321305027
T18.T18.279279
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Contributing to EclipseContributing to Eclipse• If you want to write
plug-ins, you must you must get this bookget this book.
• Written by gurus Erich Gamma and Kent Beck, it shows you how to extend Eclipse.– Any book written by
Erich Gamma or Kent Beck is probably really good…
• ISBN 0321205758
T18.T18.280280
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
The Official Eclipse 3.0 FAQsThe Official Eclipse 3.0 FAQs• This book is a great
resource for developers.
• You can install the You can install the full text of the full text of the book as a plug-in book as a plug-in for the Eclipse for the Eclipse help system.help system.
• ISBN 0321268385
T18.T18.281281
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
ibm.com/developerworks/opensourceibm.com/developerworks/opensource• The developerWorks
open source zone has articles, tutorials and sample code built on open source products.
• A recent sample featured articles on:– Apache Geronimo– Eclipse– iText (a Java PDF
library)– Apache Derby – PHP
T18.T18.282282
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
../top-projects/eclipse.html../top-projects/eclipse.html
• If you're in the developerWorks open source zone, click the Eclipse link in the right-hand navigation for a page just for Eclipse.
• ibm.com/developerworks/opensource/ top-projects/eclipse.html
T18.T18.283283
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Trial downloads of IBM productsTrial downloads of IBM products
• Visit ibm.com/developerworks/downloads for trial versions of hundreds of IBM products.– IBM's Eclipse-based development tools from Rational and
WebSphere are available here.
• When you download the trial versions, you also get links to installation help, tutorials, demos, forums, newsgroups and other types of support.
T18.T18.284284
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
The The developerdeveloperWorksWorks Software Eval Kit Software Eval Kit
• Visit …/developerworks/offers/sek to order the free Software Evaluation Kit.– From the downloads page, click the "developerWorks
Software Evaluation Kit" link in the right-hand navigation.
• 14 GB of IBM products for Windows and Linux
T18.T18.285285
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Software Development Platform Software Development Platform webcastswebcasts
• Visit ibm.com/developerworks/offers/lp/wc/ to sign up for free Webcasts on Eclipse and Eclipse-based development tools.
• If you attend the Webcast live, you can submit questions and interact with the experts. (If you miss it, you can listen to the Webcast later…)
T18.T18.286286
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
The The ddWW Software Architect Kit Software Architect Kit• Themes:
– Patterns-based development
– How to apply Model-Driven Architecture
– Structural review & control
– SOAs
• Includes Webcasts, demos, whitepapers, free downloads and exclusive Grady Booch podcasts.
• ibm.com/ developerworks/ architecture/kits
T18.T18.287287
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
developerdeveloperWorksWorks tutorials and training tutorials and training
• developerWorks has 500+ tutorials on a variety of topics, including:– Build a Web service using the Eclipse Web Tools Platform– Building Eclipse plug-ins using templates– Building cheat sheets in Eclipse
• ibm.com/developerworks/training
T18.T18.288288
Presented by IBM Presented by IBM developerWorks – developerWorks – ibm.com/developerworksibm.com/developerworks
© 2011 IBM Corporation.© 2011 IBM Corporation. Making the most of Making the most of
Also see…Also see…• …Wayne Beaton's "Eclipse hints, tips
and random musings" blog– ibm.com/developerworks/blogs/beaton
• …Eclipse-related Redbooks– Visit ibm.com/redbooks, search for "Eclipse"– One of the best is Eclipse Development
using the Graphical Editing Framework and the Eclipse Modeling Framework (ISBN 0738453161)
Presented by IBM Presented by IBM developerWorksdeveloperWorksibm.com/developerWorksibm.com/developerWorks
Making the most of Making the most of
© 2011 IBM © 2011 IBM Corporation.Corporation.
Thanks!Thanks!
Doug Tidwell, Eric Long & Akmal Chaudhri IBM Developer Relations