計算機專業畢業論文外文翻譯7_第1頁
計算機專業畢業論文外文翻譯7_第2頁
計算機專業畢業論文外文翻譯7_第3頁
計算機專業畢業論文外文翻譯7_第4頁
計算機專業畢業論文外文翻譯7_第5頁
已閱讀5頁,還剩9頁未讀 繼續免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、附錄 (英文翻譯)Rich Client Tutorial Part 1The Rich Client Platform (RCP) is an exciting new way to build Java applications that can compete with native applications on any platform. This tutorial is designed to get you started building RCP applications quickly. It has been updated for Eclipse By Ed Burnet

2、te, SASJuly 28, 2004Updated for : February 6, 2006 IntroductionTry this experiment: Show Eclipse to some friends or co-workers who haven't seen it before and ask them to guess what language it is written in. Chances are, they'll guess VB, C+, or C#, because those languages are used most ofte

3、n for high quality client side applications. Then watch the look on their faces when you tell them it was created in Java, especially if they are Java programmers.Because of its unique open source license, you can use the technologies that went into Eclipse to create your own commercial quality prog

4、rams. Before version 3.0, this was possible but difficult, especially when you wanted to heavily customize the menus, layouts, and other user interface elements. That was because the "IDE-ness" of Eclipse was hard-wired into it. Version 3.0 introduced the Rich Client Platform (RCP), which

5、is basically a refactoring of the fundamental parts of Eclipse's UI, allowing it to be used for non-IDE applications. Version 3.1 updated RCP with new capabilities, and, most importantly, new tooling support to make it easier to create than before.If you want to cut to the chase and look at the

6、code for this part you can find it in the accompanying zip file. Otherwise, let's take a look at how to construct an RCP application.Getting startedRCP applications are based on the familiar Eclipse plug-in architecture, (if it's not familiar to you, see the references section). Therefore, y

7、ou'll need to create a plug-in to be your main program. Eclipse's Plug-in Development Environment (PDE) provides a number of wizards and editors that take some of the drudgery out of the process. PDE is included with the Eclipse SDK download so that is the package you should be using. Here a

8、re the steps you should follow to get started.First, bring up Eclipse and select File > New > Project, then expand Plug-in Development and double-click Plug-in Project to bring up the Plug-in Project wizard. On the subsequent pages, enter a Project name such as , indicate you want a Java proje

9、ct, select the version of Eclipse you're targeting (at least 3.1), and enable the option to Create an OSGi bundle manifest. Then click Next >.Beginning in Eclipse 3.1 you will get best results by using the OSGi bundle manifest. In contrast to previous versions, this is now the default.In the

10、next page of the Wizard you can change the Plug-in ID and other parameters. Of particular importance is the question, "Would you like to create a rich client application?". Select Yes. The generated plug-in class is optional but for this example just leave all the other options at their de

11、fault values. Click Next > to continue.If you get a dialog asking if Eclipse can switch to the Plug-in Development Perspective click Remember my decision and select Yes (this is optional).Starting with Eclipse 3.1, several templates have been provided to make creating an RCP application a breeze.

12、 We'll use the simplest one available and see how it works. Make sure the option to Create a plug-in using one of the templates is enabled, then select the Hello RCP template. This is RCP's equivalent of "Hello, world". Click Finish to accept all the defaults and generate the proje

13、ct (see Figure 1). Eclipse will open the Plug-in Manifest Editor. The Plug-in Manifest editor puts a friendly face on the various configuration files that control your RCP application.Figure 1. The Hello World RCP project was created by a PDE wizard.Taking it for a spinTrying out RCP applications us

14、ed to be somewhat tedious. You had to create a custom launch configuration, enter the right application name, and tweak the plug-ins that were included. Thankfully the PDE keeps track of all this now. All you have to do is click on the Launch an Eclipse Application button in the Plug-in Manifest edi

15、tor's Overview page. You should see a bare-bones Workbench start up (see Figure 2).Figure 2. By using the templates you can be up and running an RCP application in minutes.Making it a productIn Eclipse terms a product is everything that goes with your application, including all the other plug-in

16、s it depends on, a command to run the application (called the native launcher), and any branding (icons, etc.) that make your application distinctive. Although as we've just seen you can run a RCP application without defining a product, having one makes it a whole lot easier to run the applicati

17、on outside of Eclipse. This is one of the major innovations that Eclipse 3.1 brought to RCP development.Some of the more complicated RCP templates already come with a product defined, but the Hello RCP template does not so we'll have to make one.In order to create a product, the easiest way is t

18、o add a product configuration file to the project. Right click on the plug-in project and select New > Product Configuration. Then enter a file name for this new configuration file, such as duct. Leave the other options at their default values. Then click Finish. The Product Configuratio

19、n editor will open. This editor lets you control exactly what makes up your product including all its plug-ins and branding elements.In the Overview page, select the New. button to create a new product extension. Type in or browse to the defining plug-in (). Enter a Product ID such as product, and f

20、or the Product Application select . Click Finish to define the product. Back in the Overview page, type in a new Product Name, for example RCP Tutorial 1.In Eclipse if you create the product before filling in the Product Name you may see an error appear in the Problems view. The error will go away w

21、hen you Synchronize (see below). This is a known bug that is fixed in newer versions. Always use the latest available maintenance release for the version of Eclipse you're targeting!Now select the Configuration tab and click Add. Select the plug-in you just created () and then click on Add Requi

22、red Plug-ins. Then go back to the Overview page and press Ctrl+S or File > Save to save your work.If your application needs to reference plug-ins that cannot be determined until run time (for example the tomcat plug-in), then add them manually in the Configuration tab.At this point you should tes

23、t out the product to make sure it runs correctly. In the Testing section of the Overview page, click on Synchronize then click on Launch the product. If all goes well, the application should start up just like before.Plug-ins vs. featuresOn the Overview page you may have noticed an option that says

24、the product configuration is based on either plug-ins or features. The simplest kind of configuration is one based on plug-ins, so that's what this tutorial uses. If your product needs automatic update or Java Web Start support, then eventually you should convert it to use features. But take my

25、advice and get it working without them first.Running it outside of EclipseThe whole point of all this is to be able to deploy and run stand-alone applications without the user having to know anything about the Java and Eclipse code being used under the covers. For a real application you may want to

26、provide a self-contained executable generated by an install program like InstallShield or NSIS. That's really beyond the scope of this article though, so we'll do something simpler.The Eclipse plug-in loader expects things to be in a certain layout so we'll need to create a simplified ve

27、rsion of the Eclipse install directory. This directory has to contain the native launcher program, config files, and all the plug-ins required by the product. Thankfully, we've given the PDE enough information that it can put all this together for us now.In the Exporting section of the Product C

28、onfiguration editor, click the link to Use the Eclipse Product export wizard. Set the root directory to something like RcpTutorial1. Then select the option to deploy into a Directory, and enter a directory path to a temporary (scratch) area such as C:Deploy. Check the option to Include source code i

29、f you're building an open source project. Press Finish to build and export the program.The compiler options for source and class compatibility in the Eclipse Product export wizard will override any options you have specified on your project or global preferences. As part of the Export process, t

30、he plug-in is code is recompiled by an Ant script using these options.The application is now ready to run outside Eclipse. When you're done you should have a structure that looks like this in your deployment directory: RcpTutorial1 | .eclipseproduct | eclipse.exe | startup.jar +- configuration |

31、 config.ini +- plugins.jar.jar.jar.jar .jar.jar.jar.jar .jar.jar.jarNote that all the plug-ins are deployed as jar files. This is the recommended format starting in Eclipse 3.1. Among other things this saves disk space in the deployed application.Previous versions of this tutorial recommended using

32、a batch file or shell script to invoke your RCP program. It turns out this is a bad idea because you will not be able to fully brand your application later on. For example, you won't be able to add a splash screen. Besides, the export wizard does not support the batch file approach so just stick

33、 with the native launcher.Give it a try! Execute the native launcher (eclipse or eclipse.exe by default) outside Eclipse and watch the application come up. The name of the launcher is controlled by branding options in the product configuration.TroubleshootingError: Launching failed because the plug-

34、in is not included. You can get this error when testing the product if you've forgotten to list the plug-ins that make up the product. In the Product Configuration editor, select the Configuration tab, and add all your plug-ins plus all the ones they require as instructed above. Compatibility an

35、d migrationIf you are migrating a plug-in from version 2.1 to version 3.1 there are number of issues covered in the on-line documentation that you need to be aware of. If you're making the smaller step from 3.0 to 3.1, the number of differences is much smaller. See the References section for mor

36、e information.One word of advice: be careful not to duplicate any information in both plug-in.xml and MANIFEST.MF. Typically this would not occur unless you are converting an older plug-in that did not use MANIFEST.MF into one that does, and even then only if you are editing the files by hand instea

37、d of going through the PDE.ConclusionIn part 1 of this tutorial, we looked at what is necessary to create a bare-bones Rich Client application. The next part will delve into the classes created by the wizards such as the WorkbenchAdvisor class. All the sample code for this part may be found in the a

38、ccompanying zip file.ReferencesRCP Tutorial Part 2 RCP Tutorial Part 3 Eclipse Rich Client Platform RCP Browser example (project org.eclipse.ui.examples.rcp.browser) PDE Does Plug-ins How to Internationalize your Eclipse Plug-in Notes on the Eclipse Plug-in Architecture Plug-in Migration Guide: Migr

39、ating to 3.1 from 3.0 Plug-in Migration Guide: Migrating to 3.0 from 2.1譯文:Rich Client教程第一部分The Rich Client Platform (RCP)是一種創建Java應用程序的令人興奮的新方法,可以和任何平臺下的自帶應用程序進行競爭。這個教程會使你較快學會創建RCP應用程序,已更新到Eclipse 版本作者: Ed Burnette, SASJuly 28, 2004更新到: February 6, 2006介紹試試這樣的試驗:展示Eclipse給一些以前從來沒有看見過它的朋友或同事,并讓他們猜測一

40、下它是用什么語言編寫的。很大可能,他們會猜VB, C+, or C#,因為那些語言通常用于優質客戶端應用程序。告訴他們這是用Java編制的,看看他們的表情,尤其他們是java程序員的話。因為它獨一無二的開放源碼許可的緣故,你可以使用Eclipse生成你自己的商用的優質程序。在3.0以前的版本,這樣是可能的但是非常的麻煩,特別當你想要著重個性化設計菜單,編排,以及其他的用戶接口部分。主要是由于Eclipse 的“集成電路設備”固化。3.0版本引入了the Rich Client Platform (RCP),主要基于Eclipse的用戶界面基本部分進行了重新分解。3.1版本對RCP進行了一些新特

41、性的更新,并且最重要的是,通過新工具的支持使它比以前更加容易創建。如果你想直接跳到重點,看這部分的代碼你可以在accompanying zip file.里找到。否則的話,讓我們看看怎樣構建一個RCP。 開始RCP應用程序是基于熟悉的Eclipse插件結構,(如果你對這部分不熟悉的話,請看參考書目部分)。因此,你將需要創建一個插件程序成為你的主程序。Eclipse的插件發展環境(PDE)提供大量的向導和編輯器,負擔了創建中的一些苦工。PDE包含在了你將使用的Eclipse SDK下載包里。現在跟著一下步驟開始。首先,打開Eclipse,選擇File > New > Project,

42、然后展開Plug-in Development,雙擊Plug-in Project來打開Plug-in Project 向導。在接下來的頁面上,輸入一個項目的名字,例如,說明你想要一個Java 項目,選擇你需要的Eclipse版本,并且勾選Create an OSGi bundle manifest選項。然后單擊Next插圖一. PDE向導創建的The Hello World RCP 項目換一個角度理解試用RCP應用程序通常有些單調乏味。你不得不生成一個定制的首次配置,輸入正確的應用程序名稱,并且管理調整所有包含的插件。非常感激PDE現在保存所有這些記錄。你全部需要做的只是單擊Manifest

43、編輯器總覽頁上的Eclipse 應用程序按鈕。你將看到一個簡單的工作臺頁面跳出來(見插圖二)。插圖二. 使用模板,你可以在幾分鐘之內創建運行一個RCP應用程序創建一個產品對于Eclipse來說,一個產品是你的應用程序及所伴隨的所有相關設置,包括它依靠的所有其他插件,用來運行程序的命令(稱為自帶的發射臺),和一些使你的產品與眾不同的商標(標記,等等)。雖然我們只在意你可以不需要定義一個產品來運行RCP應用程序,使不依賴Eclipse而運行一個應用程序更加輕松簡單。引入RCP開發這是Eclipse 3.1版本的主要創新。一些更加復雜的RCP模板已經和產品一起定義了,但是Hello RCP 模板沒有

44、帶,所以我們將需要定義一個。為了創建一個產品,最簡單的方法是給項目增加一個產品配置文件,在plug-in項目上右鍵單擊,選擇New > Product Configuration。接下來,給這個這個新配置文件輸入一個文件名,例如duct。保留余下的選擇和默認值一致。然后單擊Finish。 產品配置編輯器將會打開。這個編輯器允許你嚴密的控制構成你產品的所有plug-ins和商標元素在總覽頁面,選擇New. 按鈕來創建一個新的產品擴展名。輸入或者使用瀏覽方式找到定義的plug-in()。輸入一個產品ID, 例如product,對應的產品應用程序選擇org.eclipse.u

45、i.tutorials.rcp.part1.application.。單擊Finish 來完成定義產品。回到總覽頁面,輸入一個新的產品名稱,比如RCP Tutorial 1。在Eclipse 版本,如果你在填入產品名稱之前創建一個產品,你可能會看見一個出錯信息出現在問題視窗。當你同步的時候,出錯信息將會消失(見后面)。這是一個已知的缺陷,在后續版本作了修正。總是使用最新修正可用的Eclipse版本現在選擇配置標簽,并且單擊Add,選擇你前面所創建的插件程序(org.eclipse.ui.tutorials.rcp.part1),然后單擊Add Required Plug-ins,回到總覽頁面,

46、按住Ctrl+S,或者選擇File > Save來保存你的工作。如果你的應用程序需要涉及的plug-ins直到運行的時候才能決定(例如:tomcat plug-in),那就在配置表標簽內手動增加。到這個階段,你應該測試產品確認它運行正常。在總覽頁面的測試部分,單擊同步,然后單擊運行產品。如果一切順利,應用程序窗口應該像先前一樣跳出來。依賴插件還是依賴特性在總覽頁面,你可能注意到一個選項關于:產品的配置是基于插件或特性兩者任何一個。這種最簡單的配置是一種基于插件,這個教程所用的。如果你的產品需要自動升級或java網站的初始支持,那么最終你需要將它轉換成特性。但是請接受我的建議,先在不使用特性情況下使它工作在Eclipse環境外運行最重要的觀點是:配置和運行一個獨立的應用程序,不需要用戶知道任何封裝起來的Java 和 Eclipse代碼。對于一個真正的應用程序,你可能想要提供通過安裝程序例如InstallShield 或者NSIS一個完整執行包。這個遠遠超過了這篇文章的范圍,因此我們只作簡單介紹。Eclipse插件導入裝置期望事件按某種規劃執行,因此我們需要創建一個簡單版本

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
  • 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論