计算机专业毕业论文外文翻译.docx
《计算机专业毕业论文外文翻译.docx》由会员分享,可在线阅读,更多相关《计算机专业毕业论文外文翻译.docx(15页珍藏版)》请在冰点文库上搜索。
![计算机专业毕业论文外文翻译.docx](https://file1.bingdoc.com/fileroot1/2023-7/5/f3f6d062-3e4b-4abb-9469-02cc819d910c/f3f6d062-3e4b-4abb-9469-02cc819d910c1.gif)
计算机专业毕业论文外文翻译
附录
(英文翻译)
RichClientTutorialPart1
TheRichClientPlatform(RCP)isanexcitingnewwaytobuildJavaapplicationsthatcancompetewithnativeapplicationsonanyplatform.ThistutorialisdesignedtogetyoustartedbuildingRCPapplicationsquickly.IthasbeenupdatedforEclipse3.1.2
ByEdBurnette,SAS
July28,2004
Updatedfor3.1.2:
February6,2006
Introduction
Trythisexperiment:
ShowEclipsetosomefriendsorco-workerswhohaven'tseenitbeforeandaskthemtoguesswhatlanguageitiswrittenin.Chancesare,they'llguessVB,C++,orC#,becausethoselanguagesareusedmostoftenforhighqualityclientsideapplications.ThenwatchthelookontheirfaceswhenyoutellthemitwascreatedinJava,especiallyiftheyareJavaprogrammers.
Becauseofitsuniqueopensourcelicense,youcanusethetechnologiesthatwentintoEclipsetocreateyourowncommercialqualityprograms.Beforeversion3.0,thiswaspossiblebutdifficult,especiallywhenyouwantedtoheavilycustomizethemenus,layouts,andotheruserinterfaceelements.Thatwasbecausethe"IDE-ness"ofEclipsewashard-wiredintoit.Version3.0introducedtheRichClientPlatform(RCP),whichisbasicallyarefactoringofthefundamentalpartsofEclipse'sUI,allowingittobeusedfornon-IDEapplications.Version3.1updatedRCPwithnewcapabilities,and,mostimportantly,newtoolingsupporttomakeiteasiertocreatethanbefore.
Ifyouwanttocuttothechaseandlookatthecodeforthispartyoucanfinditintheaccompanyingzipfile.Otherwise,let'stakealookathowtoconstructanRCPapplication.
Gettingstarted
RCPapplicationsarebasedonthefamiliarEclipseplug-inarchitecture,(ifit'snotfamiliartoyou,seethereferencessection).Therefore,you'llneedtocreateaplug-intobeyourmainprogram.Eclipse'sPlug-inDevelopmentEnvironment(PDE)providesanumberofwizardsandeditorsthattakesomeofthedrudgeryoutoftheprocess.PDEisincludedwiththeEclipseSDKdownloadsothatisthepackageyoushouldbeusing.Herearethestepsyoushouldfollowtogetstarted.
First,bringupEclipseandselectFile>New>Project,thenexpandPlug-inDevelopmentanddouble-clickPlug-inProjecttobringupthePlug-inProjectwizard.Onthesubsequentpages,enteraProjectnamesuchasorg.eclipse.ui.tutorials.rcp.part1,indicateyouwantaJavaproject,selecttheversionofEclipseyou'retargeting(atleast3.1),andenabletheoptiontoCreateanOSGibundlemanifest.ThenclickNext>.
BeginninginEclipse3.1youwillgetbestresultsbyusingtheOSGibundlemanifest.Incontrasttopreviousversions,thisisnowthedefault.
InthenextpageoftheWizardyoucanchangethePlug-inIDandotherparameters.Ofparticularimportanceisthequestion,"Wouldyouliketocreatearichclientapplication?
".SelectYes.Thegeneratedplug-inclassisoptionalbutforthisexamplejustleavealltheotheroptionsattheirdefaultvalues.ClickNext>tocontinue.
IfyougetadialogaskingifEclipsecanswitchtothePlug-inDevelopmentPerspectiveclickRemembermydecisionandselectYes(thisisoptional).
StartingwithEclipse3.1,severaltemplateshavebeenprovidedtomakecreatinganRCPapplicationabreeze.We'llusethesimplestoneavailableandseehowitworks.MakesuretheoptiontoCreateaplug-inusingoneofthetemplatesisenabled,thenselecttheHelloRCPtemplate.ThisisRCP'sequivalentof"Hello,world".ClickFinishtoacceptallthedefaultsandgeneratetheproject(seeFigure1).EclipsewillopenthePlug-inManifestEditor.ThePlug-inManifesteditorputsafriendlyfaceonthevariousconfiguration
filesthatcontrolyourRCPapplication.
Figure1.TheHelloWorldRCPprojectwascreatedbyaPDEwizard.
Takingitforaspin
TryingoutRCPapplicationsusedtobesomewhattedious.Youhadtocreateacustomlaunchconfiguration,entertherightapplicationname,andtweaktheplug-insthatwereincluded.ThankfullythePDEkeepstrackofallthisnow.AllyouhavetodoisclickontheLaunchanEclipseApplicationbuttoninthePlug-inManifesteditor'sOverviewpage.Youshouldseeabare-bonesWorkbenchstartup(seeFigure2).
Figure2.ByusingthetemplatesyoucanbeupandrunninganRCPapplicationinminutes.
Makingitaproduct
InEclipsetermsaproductiseverythingthatgoeswithyourapplication,includingalltheotherplug-insitdependson,acommandtoruntheapplication(calledthenativelauncher),andanybranding(icons,etc.)thatmakeyourapplicationdistinctive.Althoughaswe'vejustseenyoucanrunaRCPapplicationwithoutdefiningaproduct,havingonemakesitawholeloteasiertoruntheapplicationoutsideofEclipse.ThisisoneofthemajorinnovationsthatEclipse3.1broughttoRCPdevelopment.
SomeofthemorecomplicatedRCPtemplatesalreadycomewithaproductdefined,buttheHelloRCPtemplatedoesnotsowe'llhavetomakeone.
Inordertocreateaproduct,theeasiestwayistoaddaproductconfigurationfiletotheproject.Rightclickontheplug-inprojectandselectNew>ProductConfiguration.Thenenterafilenameforthisnewconfigurationfile,suchaspart1.product.Leavetheotheroptionsattheirdefaultvalues.ThenclickFinish.TheProductConfigurationeditorwillopen.Thiseditorletsyoucontrolexactlywhatmakesupyourproductincludingallitsplug-insandbrandingelements.
IntheOverviewpage,selecttheNew...buttontocreateanewproductextension.Typeinorbrowsetothedefiningplug-in(org.eclipse.ui.tutorials.rcp.part1).EnteraProductIDsuchasproduct,andfortheProductApplicationselectorg.eclipse.ui.tutorials.rcp.part1.application.ClickFinishtodefinetheproduct.BackintheOverviewpage,typeinanewProductName,forexampleRCPTutorial1.
InEclipse3.1.0ifyoucreatetheproductbeforefillingintheProductNameyoumayseeanerrorappearintheProblemsview.TheerrorwillgoawaywhenyouSynchronize(seebelow).Thisisaknownbugthatisfixedinnewerversions.AlwaysusethelatestavailablemaintenancereleasefortheversionofEclipseyou'retargeting!
NowselecttheConfigurationtabandclickAdd....Selecttheplug-inyoujustcreated(org.eclipse.ui.tutorials.rcp.part1)andthenclickonAddRequiredPlug-ins.ThengobacktotheOverviewpageandpressCtrl+SorFile>Savetosaveyourwork.
Ifyourapplicationneedstoreferenceplug-insthatcannotbedetermineduntilruntime(forexamplethetomcatplug-in),thenaddthemmanuallyintheConfigurationtab.
Atthispointyoushouldtestouttheproducttomakesureitrunscorrectly.IntheTestingsectionoftheOverviewpage,clickonSynchronizethenclickonLaunchtheproduct.Ifallgoeswell,theapplicationshouldstartupjustlikebefore.
Plug-insvs.features
OntheOverviewpageyoumayhavenoticedanoptionthatsaystheproductconfigurationisbasedoneitherplug-insorfeatures.Thesimplestkindofconfigurationisonebasedonplug-ins,sothat'swhatthistutorialuses.IfyourproductneedsautomaticupdateorJavaWebStartsupport,theneventuallyyoushouldconvertittousefeatures.Buttakemyadviceandgetitworkingwithoutthemfirst.
RunningitoutsideofEclipse
Thewholepointofallthisistobeabletodeployandrunstand-aloneapplicationswithouttheuserhavingtoknowanythingabouttheJavaandEclipsecodebeingusedunderthecovers.Forarealapplicationyoumaywanttoprovideaself-containedexecutablegeneratedbyaninstallprogramlikeInstallShieldorNSIS.That'sreallybeyondthescopeofthisarticlethough,sowe'lldosomethingsimpler.
TheEclipseplug-inloaderexpectsthingstobeinacertainlayoutsowe'llneedtocreateasimplifiedversionoftheEclipseinstalldirectory.Thisdirectoryhastocontainthenativelauncherprogram,configfiles,andalltheplug-insrequiredbytheproduct.Thankfully,we'vegiventhePDEenoughinformationthatitcanputallthistogetherforusnow.
IntheExportingsectionoftheProductConfigurationeditor,clickthelinktoUsetheEclipseProductexportwizard.SettherootdirectorytosomethinglikeRcpTutorial1.ThenselecttheoptiontodeployintoaDirectory,andenteradirectorypathtoatemporary(scratch)areasuchasC:
\Deploy.ChecktheoptiontoIncludesourcecodeifyou'rebuildinganopensourceproject.PressFinishtobuildandexporttheprogram.
ThecompileroptionsforsourceandclasscompatibilityintheEclipseProductexportwizardwilloverrideanyoptionsyouhavespecifiedonyourprojectorglobalpreferences.AspartoftheExportprocess,theplug-iniscodeisrecompiledbyanAntscriptusingtheseoptions.
TheapplicationisnowreadytorunoutsideEclipse.Whenyou'redoneyoushouldhaveastructurethatlookslikethisinyourdeploymentdirectory:
RcpTutorial1
|.eclipseproduct
|eclipse.exe
|startup.jar
+---configuration
|config.ini
+---plugins
mands_3.1.0.jar
org.eclipse.core.expressions_3.1.0.jar
org.eclipse.core.runtime_3.1.2.jar
org.eclipse.help_3.1.0.jar
org.eclipse.jface_3.1.1.jar
org.eclipse.osgi_3.1.2.jar
org.eclipse.swt.win32.win32.x86_3.1.2.jar
org.eclipse.swt_3.1.0.jar
org.eclipse.ui.tutorials.rcp.part1_1.0.0.jar
org.eclipse.ui.workbench_3.1.2.jar
org.eclipse.ui_3.1.2.jar
Notethatalltheplug-insaredeployedasjarfiles.ThisistherecommendedformatstartinginEclipse3.1.Amongotherthingsthissavesdiskspaceinthedeployedapplication.
PreviousversionsofthistutorialrecommendedusingabatchfileorshellscripttoinvokeyourRCPprogram.Itturnsoutthisisabadideabecauseyouwillnotbeabletofullybrandyourapplicationlateron.Forexample,youwon'tbe