Tải bản đầy đủ (.pdf) (1,421 trang)

Addison wesley eclipse building commercial quality plugins 2nd edition mar 2006 ISBN 032142672x

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (19.81 MB, 1,421 trang )

Eclipse:BuildingCommercial-QualityPlug-ins,
SecondEdition
ByEricClayberg,DanRubel
...............................................
Publisher:AddisonWesleyProfessional
PubDate:March22,2006
PrintISBN-10:0-321-42672-X
PrintISBN-13:978-0-321-42672-7
Pages:864

TableofContents|Index

"I'moftenasked,'WhatarethebestbooksaboutEclipse?'Numberoneonmylist,every
time,isEclipse:BuildingCommercial-QualityPlug-ins.Ifindittobetheclearestandmost
relevantbookaboutEclipseforthereal-worldsoftwaredeveloper.OtherEclipsebooks
focusontheinternalEclipsearchitectureoronrepeatingtheEclipsedocumentation,
whereasthisbookislaserfocusedontheissuesandconceptsthatmatterwhenyou're
tryingtobuildaproduct."--BjornFreeman-BensonDirector,OpenSourceProcess,Eclipse
Foundation
"Asthetitlesuggests,thismassivetomeisintendedasaguidetobestpracticesfor
writingEclipseplug-ins.Ithinkinthatrespectitsucceedshandily.Beforeyoueventhink
aboutdistributingaplug-inyou'vewritten,readthisbook."--ErnestFriedman-HillSheriff,
JavaRanch.com
"Eclipse:BuildingCommercial-QualityPlug-inswasaninvaluabletrainingaidforallofour
teammembers.Infact,trainingourteamwithouttheuseofthisbookasabasewould
havebeenvirtuallyimpossible.Itisnowrequiredreadingforallourdevelopersandhelped
usdeliverabrand-new,verycomplexproductontimeandonbudgetthankstothegreat
jobthisbookdoesofexplainingtheprocessofbuildingplug-insforEclipse."--Bruce
Gruenbaum
"ThisiseasilyoneofthemostusefulbooksIown.IfyouarenewtodevelopingEclipse
plug-ins,itisa'must-have'thatwillsaveyoulotsoftimeandeffort.Youwillfindlotsof


goodadviceinhere,especiallythingsthatwillhelpaddawholelayerofprofessionalism
andcompletenesstoanyplug-in.Thebookisveryfocused,well-structured,thorough,
clearlywritten,anddoesn'tcontainasinglepageof'wafflypagefiller.'Thediagrams
explainingtherelationshipsbetweenthedifferentcomponentsandmanifestsectionsare
excellentandaidinunderstandinghoweverythingfitstogether.Thisbookgoeswell
beyondActions,Views,andEditors,andIthinkeveryonewillbenefitfromtheauthors'
experience.Icertainlyhave."--TonySaveski
"Theauthorsofthisseminalbookhavedecadesofprovenexperiencewiththemost
productiveandrobustsoftwareengineeringtechnologieseverdeveloped.Their


experienceshavenowbeenwellappliedtotheuseofEclipseformoreeffectiveJava
development.Amust-haveforanyserioussoftwareengineeringprofessional!"--Ed
Klimas
"Justwantedtoalsoletyouknowthisisanexcellentbook!Thanksforputtingforththe
efforttocreateabookthatiseasytoreadandtechnicalatthesametime!"--Brooke
Hedrick
"Thekeytodevelopinggreatplug-insforEclipseisunderstandingwhereandhowto
extendtheIDE,andthat'swhatthisbookgivesyou.Itisamustforseriousplug-in
developers,especiallythosebuildingcommercialapplications.Iwouldn'tbewithoutit."-BrianWilkerson
"Ifyou'relookingforjustoneEclipseplug-indevelopmentbookthatwillbeyourguide,
thisistheone.WhilethereareotherbooksavailableonEclipse,fewdiveasdeepas
Eclipse:BuildingCommercial-QualityPlug-ins."--SimonArcher
Eclipsehasestablisheditselfasadominantforceintheapplication-developmentspace.
KeytothesuccessofEclipseistheabilityofdeveloperstoextenditsfunctionalityusing
plug-ins.
ThisneweditionofEclipse:BuildingCommercial-QualityPlug-insisthedefinitive,start-tofinishguidetobuildingcommercial-qualityEclipseplug-ins,withanemphasisonadding
thesophisticationandpolishthatpayingcustomersdemand.Thebookprovidesbotha
quickintroductiontousingEclipsefornewusersandareferenceforexperiencedEclipse
userswishingtoexpandtheirknowledgeandimprovethequalityoftheirEclipse-based

products.
RevisedtotakeadvantageofpureEclipse3.1and3.2APIs,thiswidelypraisedbestseller
presentsdetailed,practicalcoverageofeveryaspectofplug-indevelopmentandspecific
solutionsforthechallengesdevelopersaremostlikelytoencounter.Allcodeexamples,
relevantAPIlistings,diagrams,andscreencaptureshavebeenupdated.
SomeEclipseconcepts--suchasactions,views,andeditors--havenotchangedradically,
butnowhaveadditionalfunctionalityandcapabilities.Otherareas,suchastheEclipse
plug-ininfrastructure,havechangeddrasticallyduetotheEclipseshifttowardsanOSGibasedinfrastructure.Thiseditionisfullyupdatedtoaddressthesenewadvancesfor
Eclipsedevelopers.
IncludesaquickintroductiontoEclipseforexperiencedJavaprogrammers
ServesasasystematicreferenceforexperiencedEclipseusers
IntroducesallthetoolsyouneedtobuildEclipseandRationalplug-ins
ExplainstheEclipsearchitectureandthestructureofplug-insandextensionpoints
OfferspracticalguidanceonbuildingEclipseuserinterfaceswithSWTandJFace
Showshowtousechangetracking,perspectives,builders,markers,natures,and
more
Coversinternationalization,helpsystems,features,andbranding
ThisbookisdesignedforanyonewhowantsadeepunderstandingofEclipse,andevery
experienceddeveloperinterestedinextendingEclipseortheRationalSoftware


DevelopmentPlatform.


Eclipse:BuildingCommercial-QualityPlug-ins,
SecondEdition
ByEricClayberg,DanRubel
...............................................
Publisher:AddisonWesleyProfessional
PubDate:March22,2006

PrintISBN-10:0-321-42672-X
PrintISBN-13:978-0-321-42672-7
Pages:864

TableofContents|Index








































Copyright
PraiseforEclipse:BuildingCommercial-QualityPlug-ins
TheEclipseSeries
Foreword
Foreword
Preface
Chapter1.UsingEclipseTools
Section1.1.GettingStarted
Section1.2.TheEclipseWorkbench
Section1.3.SettingUpYourEnvironment
Section1.4.CreatingaProject
Section1.5.Navigating
Section1.6.Searching
Section1.7.WritingCode
Section1.8.TeamDevelopmentUsingCVS
Section1.9.RunningApplications

Section1.10.IntroductiontoDebugging
Section1.11.IntroductiontoTesting
Section1.12.Summary
Chapter2.ASimplePlug-inExample
Section2.1.TheFavoritesPlug-in
Section2.2.CreatingaPlug-inProject















































































Section2.3.ReviewingtheGeneratedCode
Section2.4.BuildingaProduct
Section2.5.InstallingandRunningtheProduct
Section2.6.DebuggingtheProduct
Section2.7.PDEViews
Section2.8.WritingPlug-inTests
Section2.9.Summary

Chapter3.EclipseInfrastructure
Section3.1.StructuralOverview
Section3.2.Plug-inDirectoryorJARfile
Section3.3.Plug-inManifest
Section3.4.Plug-inClass
Section3.5.Plug-inModel
Section3.6.Logging
Section3.7.EclipsePlug-ins
Section3.8.Summary
Chapter4.TheStandardWidgetToolkit
Section4.1.SWTHistoryandGoals
Section4.2.SWTWidgets
Section4.3.LayoutManagement
Section4.4.ResourceManagement
Section4.5.Summary
Chapter5.JFaceViewers
Section5.1.List-OrientedViewers
Section5.1.1.Labelproviders
Section5.1.2.Contentproviders
Section5.1.3.Viewersorters
Section5.1.4.Viewerfilters
Section5.1.5.StructuredViewerclass
Section5.1.6.ListViewerclass
Section5.1.7.TableViewerclass
Section5.1.8.TreeViewerclass
Section5.2.TextViewers
Section5.3.Summary
Chapter6.Actions
Section6.1.IActionversusIActionDelegate
Section6.2.WorkbenchWindowActions

Section6.3.ObjectActions
Section6.4.ViewActions














































































Section6.5.EditorActions
Section6.6.KeyBindings
Section6.7.RFRSConsiderations
Section6.8.Summary
Chapter7.Views
Section7.1.ViewDeclaration
Section7.2.ViewPart
Section7.3.ViewActions
Section7.4.LinkingtheView
Section7.5.SavingViewState
Section7.6.Testing
Section7.7.ImageCaching

Section7.8.Auto-sizingTableColumns
Section7.9.RFRSConsiderations
Section7.10.Summary
Chapter8.Editors
Section8.1.EditorDeclaration
Section8.2.EditorPart
Section8.3.Editing
Section8.4.EditorLifecycle
Section8.5.EditorActions
Section8.6.LinkingtheEditor
Section8.7.RFRSConsiderations
Section8.8.Summary
Chapter9.ResourceChangeTracking
Section9.1.IResourceChangeListener
Section9.2.ProcessingChangeEvents
Section9.3.BatchingChangeEvents
Section9.4.ProgressMonitor
Section9.5.DelayedChangedEvents
Section9.6.Summary
Chapter10.Perspectives
Section10.1.CreatingaPerspective
Section10.2.EnhancinganExistingPerspective
Section10.3.RFRSConsiderations
Section10.4.Summary
Chapter11.DialogsandWizards
Section11.1.Dialogs
Section11.2.Wizards














































































Section11.3.RFRSConsiderations
Section11.4.Summary
Chapter12.PreferencePages
Section12.1.CreatingaPreferencePage
Section12.2.PreferencePageAPIs
Section12.3.PreferenceAPIs
Section12.4.RFRSConsiderations
Section12.5.Summary
Chapter13.Properties
Section13.1.CreatingProperties
Section13.2.DisplayingPropertiesinthePropertiesDialog
Section13.3.DisplayingPropertiesinthePropertiesView
Section13.4.PropertyPagesReusedasPreferencePages
Section13.5.RFRSConsiderations
Section13.6.Summary
Chapter14.Builders,Markers,andNatures
Section14.1.Builders
Section14.2.Markers

Section14.3.Natures
Section14.4.RFRSConsiderations
Section14.5.Summary
Chapter15.ImplementingHelp
Section15.1.UsingHelp
Section15.2.ImplementingHelp
Section15.3.Context-SensitiveHelp(F1)
Section15.4.AccessingHelpProgrammatically
Section15.5.CheatSheets
Section15.6.RFRSConsiderations
Section15.7.Summary
Chapter16.Internationalization
Section16.1.ExternalizingthePlug-inManifest
Section16.2.ExternalizingPlug-inStrings
Section16.3.UsingFragments
Section16.4.Summary
Chapter17.CreatingNewExtensionPoints
Section17.1.TheExtensionPointMechanism
Section17.2.DefininganExtensionPoint
Section17.3.CodeBehindanExtensionPoint
Section17.4.ExtensionPointDocumentation































































Section17.5.UsingtheExtensionPoint
Section17.6.RFRSConsiderations
Section17.7.Summary
Chapter18.Features,Branding,andUpdates
Section18.1.FeatureProjects
Section18.2.Branding
Section18.3.UpdateSites
Section18.4.RFRSConsiderations

Section18.5.Summary
Chapter19.BuildingaProduct
Section19.1.ABriefIntroductiontoAnt
Section19.2.BuildingtheFavoritesProduct
Section19.3.Summary
Chapter20.AdvancedTopics
Section20.1.AdvancedSearchReferenceProjects
Section20.2.AccessingInternalCode
Section20.3.Adapters
Section20.4.OpeningaBrowserorCreatinganEmail
Section20.5.TypesSpecifiedinanExtensionPoint
Section20.6.ModifyingEclipsetoFindPartIdentifiers
Section20.7.LabelDecorators
Section20.8.BackgroundTasksJobsAPI
Section20.9.Plug-inClassLoaders
Section20.10.EarlyStartup
Section20.11.RichClientPlatform
Section20.12.Conclusion
AppendixA.EclipsePlug-insandResources
SectionA.1.Plug-ins
SectionA.2.Resources
AppendixB.ReadyforRationalSoftware
Trademarks
Index


Copyright
Manyofthedesignationsusedbymanufacturersandsellersto
distinguishtheirproductsareclaimedastrademarks.Where
thosedesignationsappearinthisbook,andthepublisherwas

awareofatrademarkclaim,thedesignationshavebeenprinted
withinitialcapitallettersorinallcapitals.
Theauthorsandpublisherhavetakencareinthepreparationof
thisbook,butmakenoexpressedorimpliedwarrantyofany
kindandassumenoresponsibilityforerrorsoromissions.No
liabilityisassumedforincidentalorconsequentialdamagesin
connectionwithorarisingoutoftheuseoftheinformationor
programscontainedherein.
Thepublisheroffersexcellentdiscountsonthisbookwhen
orderedinquantityforbulkpurchasesorspecialsales,which
mayincludeelectronicversionsand/orcustomcoversand
contentparticulartoyourbusiness,traininggoals,marketing
focus,andbrandinginterests.Formoreinformation,please
contact:
U.S.CorporateandGovernmentSales
(800)382-3419

ForsalesoutsidetheUnitedStatespleasecontact:
InternationalSales

VisitusontheWeb:www.awprofessional.com
ThisBookIsSafariEnabled


TheSafari®Enabledicononthecoverofyourfavorite
technologybookmeansthebookisavailablethroughSafari
Bookshelf.Whenyoubuythisbook,yougetfreeaccesstothe
onlineeditionfor45days.
SafariBookshelfisanelectronicreferencelibrarythatletsyou
easilysearchthousandsoftechnicalbooks,findcodesamples,

downloadchapters,andaccesstechnicalinformationwhenever
andwhereveryouneedit.
Togain45-daySafariEnabledaccesstothisbook:
Goto />Completethebriefregistrationform
EnterthecouponcodeCBIN-7SNH-GN25-UVHZ-SLX7
IfyouhavedifficultyregisteringonSafariBookshelfor
accessingtheonlineedition,pleasee-mail
LibraryofCongressCataloging-in-PublicationData

Clayberg,Eric.
Eclipse:buildingcommercial-qualityplugins/EricClayberg,DanRubel.--2nded.
p.cm.
Includesbibliographicalreferencesandindex.
ISBN0-321-42672-X(pbk.:alk.paper)
1.Computersoftware-Development.2.Java(Computerprogramlanguage)I.Rubel,Dan.II.Ti
QA76.76.D47C5742006
005.1--dc22
2006004362


Copyright©2006PearsonEducation,Inc.
Allrightsreserved.PrintedintheUnitedStatesofAmerica.This
publicationisprotectedbycopyright,andpermissionmustbe
obtainedfromthepublisherpriortoanyprohibited
reproduction,storageinaretrievalsystem,ortransmissionin
anyformorbyanymeans,electronic,mechanical,
photocopying,recording,orlikewise.Forinformationregarding
permissions,writeto:
PearsonEducation,Inc.
RightsandContractsDepartment

75ArlingtonStreet,Suite300
Boston,MA02116
Fax:(617)848-7047
TextprintedintheUnitedStatesonrecycledpaperatCourierin
Stoughton,Massachusetts.
Firstprinting,March2006

Dedication
Toourwives,KarenandKathy,andourchildren,Beth,Lauren,
Lee,andDavid




PraiseforEclipse:BuildingCommercialQualityPlug-ins
"I'moftenasked,'WhatarethebestbooksaboutEclipse?'
Numberoneonmylist,everytime,isEclipse:Building
Commercial-QualityPlug-ins.Ifindittobetheclearest
andmostrelevantbookaboutEclipseforthereal-world
softwaredeveloper.OtherEclipsebooksfocusonthe
internalEclipsearchitectureoronrepeatingtheEclipse
documentation,whereasthisbookislaserfocusedonthe
issuesandconceptsthatmatterwhenyou'retryingto
buildaproduct."
BjornFreeman-BensonDirector,OpenSourceProcess,
EclipseFoundation
"Asthetitlesuggests,thismassivetomeisintendedasa
guidetobestpracticesforwritingEclipseplug-ins.Ithink
inthatrespectitsucceedshandily.Beforeyoueventhink
aboutdistributingaplug-inyou'vewritten,readthis

book."
ErnestFriedman-HillSheriff,JavaRanch.com
"Ifyou'relookingforjustoneEclipseplug-indevelopment
bookthatwillbeyourguide,thisistheone.Whilethere
areotherbooksavailableonEclipse,fewdiveasdeepas
Eclipse:BuildingCommercial-QualityPlug-ins."
SimonArcher
"Eclipse:BuildingCommercial-QualityPlug-inswasan
invaluabletrainingaidforallofourteammembers.In
fact,trainingourteamwithouttheuseofthisbookasa


basewouldhavebeenvirtuallyimpossible.Itisnow
requiredreadingforallourdevelopersandhelpedus
deliverabrand-new,verycomplexproductontimeandon
budgetthankstothegreatjobthisbookdoesof
explainingtheprocessofbuildingplug-insforEclipse."
BruceGruenbaum
"ThisiseasilyoneofthemostusefulbooksIown.Ifyou
arenewtodevelopingEclipseplug-ins,itisa'must-have'
thatwillsaveyoulotsoftimeandeffort.Youwillfindlots
ofgoodadviceinhere,especiallythingsthatwillhelpadd
awholelayerofprofessionalismandcompletenesstoany
plug-in.Thebookisveryfocused,well-structured,
thorough,clearlywritten,anddoesn'tcontainasingle
pageof'wafflypagefiller.'Thediagramsexplainingthe
relationshipsbetweenthedifferentcomponentsand
manifestsectionsareexcellentandaidinunderstanding
howeverythingfitstogether.Thisbookgoeswellbeyond
Actions,Views,andEditors,andIthinkeveryonewill

benefitfromtheauthors'experience.Icertainlyhave."
TonySaveski
"Theauthorsofthisseminalbookhavedecadesofproven
experiencewiththemostproductiveandrobustsoftware
engineeringtechnologieseverdeveloped.Their
experienceshavenowbeenwellappliedtotheuseof
EclipseformoreeffectiveJavadevelopment.Amust-have
foranyserioussoftwareengineeringprofessional!"
EdKlimas
"Justwantedtoalsoletyouknowthisisanexcellent
book!Thanksforputtingforththeefforttocreateabook
thatiseasytoreadandtechnicalatthesametime!"


BrookeHedrick
"Thekeytodevelopinggreatplug-insforEclipseis
understandingwhereandhowtoextendtheIDE,and
that'swhatthisbookgivesyou.Itisamustforserious
plug-indevelopers,especiallythosebuildingcommercial
applications.Iwouldn'tbewithoutit."
BrianWilkerson


TheEclipseSeries
SERIESEDITORS
ErichGamma LeeNackman JohnWiegand
Eclipseisauniversaltoolplatform,anopenextensible
integrateddevelopmentenvironment(IDE)foranythingand
nothinginparticular.Eclipserepresentsoneofthemostexciting
initiativeshatchedfromtheworldofapplicationdevelopmentin

alongtime,andithastheconsiderablesupportoftheleading
companiesandorganizationsinthetechnologysector.Eclipseis
gainingwidespreadacceptanceinboththecommercialand
academicarenas.
TheEclipseSeriesfromAddison-Wesleyisthedefinitiveseries
ofbooksdedicatedtotheEclipseplatform.Booksintheseries
promisetobringyouthekeytechnicalinformationyouneedto
analyzeEclipse,high-qualityinsightintothispowerful
technology,andthepracticaladviceyouneedtobuildtoolsto
supportthisevolutionaryOpenSourceplatform.Leading
expertsErichGamma,LeeNackman,andJohnWiegandarethe
serieseditors.
TitlesintheEclipseSeries
JohnArthorneandChrisLaffra
OfficialEclipse3.0FAQs
0-321-26838-5
FrankBudinsky,DavidSteinberg,EdMerks,RayEllersick,and
TimothyJ.Grose
EclipseModelingFramework
0-13-142542-0
DavidCarlson


EclipseDistilled
0-321-28815-7
EricClaybergandDanRubel
Eclipse:BuildingCommercial-QualityPlug-ins,SecondEdition
0-321-42672-X
AdrianColyer,AndyClement,GeorgeHarley,andMatthew
Webster

EclipseAspectJ:Aspect-OrientedProgrammingwithAspectJand
theEclipseAspectJDevelopmentTools
0-321-24587-3
ErichGammaandKentBeck
ContributingtoEclipse:Principles,Patterns,andPlug-Ins
0-321-20575-8
JeffMcAfferandJean-MichelLemieux
EclipseRichClientPlatform:Designing,Coding,andPackaging
Java™Applications
0-321-33461-2
SteveNorthoverandMikeWilson
SWT:TheStandardWidgetToolkit,Volume1
0-321-25663-8
Formoreinformationonbooksinthisseriesvisit
www.awprofessional.com/series/eclipse


Foreword
Tothemillionsofdevelopers,engineers,andusersalloverthe
world,Eclipseisanextensibleplatformfortoolintegration.To
thehundredsofthousandsofcommercialcustomersusingitto
developplug-insorcompletetoolplatforms,Eclipserepresents
aproven,reliable,scalabletechnologyonwhichcommercial
productscanbequicklydesigned,developed,anddeployed.
Tothethousandsofstudentsandresearchers,Eclipse
representsastableplatformforinnovation,freedom,and
experimentation.Toalltheseindividuals,groups,and
organizations,Eclipseisavendor-neutralplatformtotool
integrationsupportedbyadiverseEclipseEcosystem.
TheEclipsevendor-neutralplatformisbuiltonindustry

standards,whichsupportawiderangeoftools,platforms,and
languages.TheEclipseTechnologyisroyalty-freeandhas
worldwideredistributionrights.Theplatformwasdesignedfrom
acleanslatetobeextensibleandtoprovideexemplaritytools.
Eclipsedevelopmentisbasedonrulesofopensource
engagements.Thisincludesopen,transparent,merit-based,
andcollaborativedevelopment.Allindividualscanparticipate
andcontribute.Allplansaredevelopedinthepublicarena.This
platformandtheopensourcedevelopmentprocesscreatesan
environmentforcreativity,originality,andfreedom.Eclipseis
unparalleledintoday'ssoftware-toolenvironment.
Thesoftware-toolindustryisundergoingmassivechangesfrom
thecommoditizationofthetechnologytothecompany
consolidation.Newtechnologyeffortsarebeingredesigned,
whileacommonsetoftoolinginfrastructureisadoptedasan
industrystandard.Successfuldevelopersanddevelopment
paradigmsarebeingchallengedtoadoptnewskillsandnew,
moreefficientmethods.Oldbusinessmodelsarebeing
challengedwithfreesoftware,andnewbusinessmodelsare


beingdeveloped.
Thesoftware-toolindustryisdeeplyappreciativeofEric
ClaybergandDanRubelforthisauthoritativebook.Thisbook
providestheknowledgebasesothatdevelopers,engineers,and
userscanlearnandusetheEclipseTechnology.Thisenables
themtorespondtothesetechnologyandindustrychange
agents.
EricandDanleveragelongcareersofbuildingsoftwaretooling.
TheyeachhaveextensiveexperiencewithusingSmalltalkfor

seventeenyears,Javafortenyears,andEclipseforsixyears.
Theyhavedevelopedextensivevendorandcustomer
relationshipsthatenablethemtoexperiencefirsthandthe
necessaryelementsforbuildingsuccessfulsoftware.Theyare
abletocombinethisdirectknowledgeofthetechnologywith
theexperiencesoftheuserstocreateabookthatprovidesan
in-depthdescriptionoftheprocesstobuildcommercial-quality
Eclipseextensions.
Thisbookprovidesanintroductionandoverviewtothenew
developeroftheentireprocessofplug-indevelopment,
includingallthebestpracticestoachievehigh-qualityresults.
ThisisareferencebookforexperiencedEclipsedevelopers.It
discussestheAPIsanddemonstratesmanysamplesand
examples.Detailedtutorialsareprovidedforbothnewand
experienceddevelopers.EricandDanleveragetheirbroad
knowledgeofuserinterface(UI)developmentandpresentthe
EclipseSWTUI.Thisestablishesthebuildingblocksforall
EclipseUIdevelopment.Theseauthorsarticulatethe
developmentchallengesofbuildingtoolsoftwareandestablish
provenin-depthsolutionstotheproblems.
Ifyouareadeveloper,engineer,oruserwishingtobuildoruse
Eclipse,thisbookprovidesbothafoundationandreference.It
alsoprovidestheintellectualfoundationtocontributetothe
opensourceEclipseprojectandtodevelopcommercial
software.


SkipMcGaughey





Foreword
Inthe1990s,whenJavawasinitsinfancy,learningtheJava
classlibrariesinvolvedstudyingahandfulofclassesinfouror
fivepackages.TheJavaclasslibrarieshavegrowninsizeand
complexity,presentingasignificantproblemtodevelopers
wishingtolearnJavatoday.JustlikeJava,theEclipseplatform
hasnecessarilygrownovertheyears,andtherefore
considerablymoretimeandeffortisrequiredtolearnEclipse
3.1thanitspredecessors.OneoftheprinciplesoftheEclipse
platformisthataplug-inshouldintegrateseamlesslywiththe
workbenchandwithotherplug-ins.Toachieveseamless
integration,itisnecessaryforplug-indeveloperstounderstand
thebestpractices,conventions,andstrategiesrelatedto
buildingsoftwareforEclipse.Eclipse:BuildingCommercialQualityPlug-inscoverseverythingyouneedtoknowtodevelop
Eclipseplug-insofwhichyouwillbeproud.
ThroughthedevelopmentofaFavoritesplug-in,theEclipse
StandardWidgetToolkit(SWT)andJFaceframeworksare
thoroughlydiscussed,teachingyouhowtobuildprofessionallookinguserinterfacessuchasviews,editors,preferences
pages,anddialogs.Inadditiontostock-in-tradesubjects,such
asuser-interfacedesign,lesser-understoodEclipsetopics(for
example,buildingfeaturesandproductbranding)are
extensivelycovered,aswellasthebestdiscussionIhaveseen
onusingAnttobuildaproductfromasinglesourcethattargets
multipleversionsofEclipse.
JavadevelopersnewtoEclipseoftenhavedifficulty
understandingtheextensionpointmechanismandthecritical
linkbetweenaplug-in'sdeclarativemanifestandtheJavacode
necessarytoimplementaplug-in'sfunctionalbehavior.This

bookservesasaroadmaptousingthePlug-inDevelopment
Environment(PDE)andtheextensionpointsdefinedbythe


Eclipseplatform.Italsoprovidesthemissinglinkthat
developersneedtounderstandthemaspectsofaplug-inthat
shouldbedescribedinthemanifest,howtodevelopaplug-in
usingexistingextensionpoints,andhowtocontributewhich
otherdevelopersmayfurthercontribute.
WhenIfirstsawCodePro,Iwasbothimpressedwiththe
productivitygainsitbroughttoEclipseandtheextenttowhich
itsplug-insintegratedwiththeEclipseplatform.Havingused
CodeProforawhile,ithasbecomeapartofmydevelopment
toolkitthatIcannotdowithout.Bydrawingontheirextensive
experiencegainedwhiledevelopingCodePro,EricandDanhave
doneanexcellentjobofcapturinginthisbookthoseaspectsof
plug-indevelopmentnecessarytocreateahigh-qualityand
professional-lookingEclipseproduct.
SimonArcher




Preface
WhenwewerefirstexposedtoEclipsebackinlate1999,we
werestruckbythemagnitudeoftheproblemIBMwastryingto
solve.IBMwantedtounifyallitsdevelopmentenvironmentson
asinglecodebase.Atthetime,thecompanywasusingamix
oftechnologycomposedofahodgepodgeofC/C++,Java,and
Smalltalk.

ManyofIBM'smostimportanttools,includingtheawardwinningVisualAgeforJavaIDE,wereactuallywrittenin
Smalltalkawonderfullanguageforbuildingsophisticatedtools,
butonethatwasrapidlylosingmarketsharetolanguageslike
Java.WhileIBMhadoneoftheworld'slargestcollectionsof
Smalltalkdevelopers,therewasn'tagreatdealofindustry
supportforitoutsideofIBM,andtherewereveryfew
independentsoftwarevendors(ISVs)qualifiedtocreate
Smalltalk-basedadd-ons.
Meanwhile,Javawaswinningtheheartsandmindsof
developersworldwidewithitspromiseofeasyportabilityacross
awiderangeofplatforms,whileprovidingtherichapplication
programminginterface(API)neededtobuildthelatest
generationofWeb-basedbusinessapplications.Moreimportant,
Javawasanobject-oriented(OO)language,whichmeantthat
IBMcouldleveragethelargebodyofhighlyskilledobjectorienteddevelopersithadbuiltupovertheyearsofcreating
Smalltalk-basedtools.Infact,IBMtookitspremiereObject
TechnologyInternational(OTI)group,whichhadbeen
responsibleforcreatingIBM'sVisualAgeSmalltalkand
VisualAgeJavaenvironments(VisualAgeSmalltalkwasthefirst
oftheVisualAgebrandfamilyandVisualAgeJavawasbuilt
usingit),andtaskedthegroupwithcreatingahighlyextensible
integrateddevelopmentenvironment(IDE)constructionset
basedinJava.Eclipsewasthehappyresult.


OTIwasabletoapplyitshighlyevolvedOOskillstoproducean
IDEunmatchedinpower,flexibility,andextensibility.Thegroup
wasabletoreplicatemostofthefeaturesthathadmade
Smalltalk-basedIDEssopopularthedecadebefore,while
simultaneouslypushingthestateoftheartinIDEdevelopment

aheadbyanorderofmagnitude.
TheJavaworldhadneverseenanythingaspowerfuloras
compellingasEclipse,anditnowstands,withMicrosoft's.NET,
asoneoftheworld'spremierdevelopmentenvironments.That
alonemakesEclipseaperfectplatformfordeveloperswishing
togettheirtoolsouttoaswideanaudienceaspossible.The
factthatEclipseiscompletelyfreeandopensourceisicingon
thecake.Anopen,extensibleIDEbasethatisavailableforfree
toanyonewithacomputerisapowerfulmotivatortothe
prospectivetooldeveloper.
Itcertainlywastous.AtInstantiationsandearlierat
ObjectShare,wehadspentthebetterpartofadecadeas
entrepreneursfocusedonbuildingadd-ontoolsforvarious
IDEs.Wehadstartedwithbuildingadd-onsforDigitalk's
Smalltalk/V,migratedtodevelopingtoolsforIBM'sVisualAge
Smalltalk,andeventuallyendedupcreatingtoolsforIBM's
VisualAgeJava(includingouraward-winningVAAssistproduct
andourjFactorproduct,oneoftheworld'sfirstJavarefactoring
tools).Everyoneoftheseenvironmentsprovidedameansto
extendtheIDE,buttheyweregenerallynotwell-documented
andcertainlynotstandardizedinanyway.Smallmarketshares
(relativetotoolssuchasVisualBasic)andaneclecticuserbase
alsoafflictedtheseenvironmentsand,byextension,us.
AsanAdvancedIBMBusinessPartner,wewerefortunateto
havebuiltalongandtrustedrelationshipwiththefolksatIBM
responsibleforthecreationofEclipse.Thatrelationshipmeant
thatwewereinauniquepositiontobebriefedonthe
technologyandtostartusingitonadailybasisnearlyayear
andhalfbeforetherestoftheworldevenheardaboutit.When
IBMfinallyannouncedEclipsetotheworldinmid-2001,our



teamatInstantiationshadbuiltsomeofthefirstdemo
applicationsIBMhadtoshow.LaterthatyearwhenIBM
releaseditsfirstEclipse-basedcommercialtool,WebSphere
StudioApplicationDeveloperv4.0(v4.0sothatitsynchronized
withitsthencurrentVisualAgeforJavav4.0),ourCodePro
productbecametheveryfirstcommercialadd-onavailableforit
(andforEclipseingeneral)onthesameday.
Currently,theCodeProproductaddshundredsofenhancements
toEclipseandanyEclipse-basedIDE.DevelopingCodeProover
thelastseveralyearshasprovideduswithanopportunityto
learnthedetailsofEclipsedevelopmentatalevelmatchedby
veryfewothers(withtheobviousexceptionoftheIBMandOTI
developers,whoeat,sleep,andbreathethisstuffonadaily
basis).CodeProhasalsoservedasatestbedformanyofthe
ideasandtechniquespresentedinthisbook,providinguswitha
uniqueperspectivefromwhichtowrite.

GoalsoftheBook
Thisbookprovidesanin-depthdescriptionoftheprocess
involvedinbuildingcommercial-qualityextensionsforthe
EclipseandtheIBMSoftwareDevelopmentPlatform(SDP)IBM's
commercialversionofEclipsedevelopmentenvironments.Tous,
"commercial-quality"issynonymouswith"commercial-grade"
or"high-quality."Producingacommercial-qualityplug-inmeans
goingaboveandbeyondtheminimalrequirementsneededto
integratewithEclipse.Itmeansattendingtoallthosedetails
thatcontributetothe"fitandpolish"ofacommercialoffering.
IntheworldofEclipseplug-ins,veryfewpeopletakethetime

toreallygotheextramile,andmostplug-insfallintotheopen
source,amateurcategory.Forfolksinterestedinproducing
high-qualityplug-ins(whichwouldcertainlybethecaseforany
softwarecompanywantingtodevelopEclipse-basedproducts),
therearemanydetailstoconsider.Ourbookismeantto
encompasstheentireprocessofplug-indevelopment,including


alltheextrathingsthatneedtobedonetoachievehigh-quality
results.Thisbookhasseveralcomplementarygoals:
ProvideaquickintroductiontousingEclipsefornewusers
ProvideareferenceforexperiencedEclipseuserswishingto
expandtheirknowledgeandimprovethequalityoftheir
Eclipse-basedproducts
ProvideadetailedtutorialoncreatingsophisticatedEclipse
plug-inssuitablefornewandexperiencedusers
ThefirstthreechaptersintroducetheEclipsedevelopment
environmentandoutlinetheprocessofbuildingasimpleplugin.Theintentionofthesechaptersistohelpdevelopersnewto
Eclipsequicklypulltogetheraplug-intheycanuseto
experimentwith.
Thefirstchapter,inparticular,introducesthereadertothe
minimumsetofEclipsetoolsthatheorshewillneedtobuild
plug-ins.ItisafairlyquickoverviewoftheEclipseIDEand
relevanttools(onecouldwriteanentirebookonthattopic
alone),andwewouldexpectexpertEclipseuserstoskipthat
chapterentirely.
Thesecondchapterintroducestheexamplethatwewilluse
throughoutmostofthebookandprovidesaveryquick
introductiontobuildingaworkingplug-infromstarttofinish.
Thethirdchapterpresentsahigh-leveloverviewoftheEclipse

architectureandthestructureofplug-insandextensionpoints.
ThefourthandfifthchapterscovertheStandardWidgetToolkit
(SWT)andJFace,whicharethebuildingblocksforallEclipse
userinterfaces(UIs).Thesechapterscanactasastand-alone
reference;theyareintendedtoprovidejustenoughdetailto
getyougoing.Bothofthesetopicsarerichenoughtowarrant


×