文庫發(fā)布:eclipse簡介_第1頁
文庫發(fā)布:eclipse簡介_第2頁
文庫發(fā)布:eclipse簡介_第3頁
文庫發(fā)布:eclipse簡介_第4頁
文庫發(fā)布:eclipse簡介_第5頁
已閱讀5頁,還剩35頁未讀, 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

Eclipse

平臺及應用中南大學信息科學與工程學院任勝兵第一章Eclipse平臺簡介中南大學信息科學與工程學院任勝兵1.1Eclipse平臺的目標ProvideopenplatformforapplicationdevelopmenttoolsRunonawiderangeofoperatingsystemsGUIandnon-GUILanguage-neutralPermitunrestrictedcontenttypesHTML,Java,C,JSP,EJB,XML,GIF,…FacilitateseamlesstoolintegrationAtUIanddeeperAddnewtoolstoexistinginstalledproductsAttractcommunityoftooldevelopersIncludingindependentsoftwarevendors(ISVs)CapitalizeonpopularityofJavaforwritingtools1.2

Eclipse平臺結構PlatformRuntimeWorkspaceHelpTeamWorkbenchJFaceSWTEclipseProjectJavaDevelopmentTools(JDT)TheirToolYourToolAnotherToolPlug-inDevelopmentEnvironment(PDE)EclipsePlatformDebug平臺結構簡介PlatformRuntime:負責管理插件注冊表和插件。插件是一種結構化組件,使用plugin.xml來向系統(tǒng)描述自己。Workspace:管理Eclipse平臺中的資源,包括項目、文件和文件夾。Workbench:高級用戶界面框架,用于構建由插件構建的復雜用戶界面的產品。SWT:與本機底層窗口系統(tǒng)緊密集成的小窗口工具箱和圖形庫;Jface:使用SWT實現(xiàn)的用戶界面工具箱。Team:定義附加API,允許插件集成版本和配置管理資源庫的功能等。Help:允許用戶瀏覽、搜索和打印系統(tǒng)幫助文檔。Debug:公共的調試用戶界面和一般化的調試模式。平臺運行時間(PlatformRuntime)EclipsePlatformRuntimeismicro-kernelAllfunctionalitysuppliedbyplug-insEclipsePlatformRuntimehandlesstartupDiscoversplug-insinstalledondiskMatchesupextensionswithextensionpointsBuildsglobalplug-inregistryCachesregistryondiskfornexttime插件描述:Plugin.xml<plugin

id=“com.example.tool"name=“ExamplePlug-inTool"class="com.example.tool.ToolPlugin"><requires><importplugin="org.eclipse.core.resources"/>

<importplugin="org.eclipse.ui"/></requires><runtime><libraryname=“tool.jar"/></runtime><extension

point="org.eclipse.ui.preferencepages"><pageid="com.example.tool.preferences"icon="icons/knob.gif"title=“ToolKnobs"class="com.example.tool.ToolPreferenceWizard“/></extension>

<extension-point

name=“FrobProviders“

id="com.example.tool.frobProvider"/></plugin>Declarecontribution

thisplug-inmakesDeclarenewextensionpointopentocontributionsfromotherplug-insLocationofplug-in’scodeOtherplug-insneededPlug-inidentification插件典型體系結構Plug-inADeclaresextensionpointPDeclaresinterfaceItogowithPPlug-inBImplementsinterfaceIwithitsownclassCContributesclassCtoextensionpointPPlug-inAinstantiatesCandcallsitsImethodsplug-inAplug-inBclassCinterfaceIextension

pointPextensioncontributescreates,callsimplements工作臺(Workbench)WorkbenchisUIpersonalityofEclipsePlatformUIparadigmcenteredaroundEditorsViewsPerspectivesToolbarPerspectiveandFastViewbarResourceNavigatorviewStackedviewsPropertiesviewTasksviewOutlineviewBookmarksviewMenubarMessageareaEditorStatusareaTexteditorSWTSWT=StandardWidgetToolkitGenericgraphicsandGUIwidgetsetbuttons,lists,text,menus,trees,styledtext...SimpleSmallFastOS-independentAPIUsesnativewidgetswhereavailableEmulateswidgetswhereunavailableJFaceJFaceissetofUIframeworksforcommonUItasksDesignedtobeusedinconjunctionwithSWTClassesforhandlingcommonUItasksAPIandimplementationarewindow-systemindependent透視圖(Perspective)PerspectivesarearrangementsofviewsandeditorsDifferentperspectivessuitedfordifferentusertasksUserscanquicklyswitchbetweenperspectivesTaskorientationlimitsvisibleviews,actionsScalestolargenumbersofinstalledtoolsPerspectivescontrolViewvisibilityViewandeditorlayoutActionvisibilityExtensionpointfornewperspectivesEclipsePlatformincludesstandardperspectivesResource,Debug,…PerspectiveAPI視圖(View)ViewsprovideinformationonsomeobjectViewsaugmenteditorsExample:OutlineviewsummarizescontentViewsaugmentotherviewsExample:PropertiesviewdescribesselectionExtensionpointfornewtypesofviewsEclipsePlatformincludesmanystandardviewsResourceNavigator,Outline,Properties,Tasks,Bookmarks,Search,…ViewAPIandframeworkViewscanbeimplementedwithJFaceviewers編輯器(Editor)EditorsappearinworkbencheditorareaContributeactionstoworkbenchmenuandtoolbarsOpen,edit,save,closelifecycleOpeneditorsarestackedExtensionpointforcontributingnewtypesofeditorsExample:JDTprovidesJavasourcefileeditorEclipsePlatformincludessimpletextfileeditorWindowsonly:embedanyOLEdocumentaseditorExtensivetexteditorAPIandframework工作區(qū)(workspace):資源管理器Toolsoperateonfilesinuser’sworkspaceProjectsmaptodirectoriesinfilesystem{Files,Folders,Projects}termedresourcesWorkspaceholds1ormoretop-levelprojectsToolsread,create,modify,anddeleteresourcesinworkspacePlug-insaccessviaworkspaceandresourceAPIsTreeoffoldersandfilesEclipse平臺特點EclipsePlatformisthenucleusofIDEproductsPlug-ins,extensionpoints,extensionsOpen,extensiblearchitectureWorkspace,projects,files,foldersCommonplacetoorganize&storedevelopmentartifactsWorkbench,editors,views,perspectivesCommonuserpresentationandUIparadigmKeybuildingblocksandfacilitiesHelp,teamsupport,internationalization,…Eclipseisauniversalplatformfor

integratingdevelopmenttools第二章Eclipse編程工具中南大學信息科學與工程學院任勝兵Eclipse編程JDT(Eclipse自帶):編輯、編譯、運行和調試Java程序。CDT(插件):編輯、運行和調試C/C++程序。先下載C/C++編譯器,如:Cygwin,MinGW;再下載CDT插件2.1Java運行環(huán)境(JRE)進入:[Window]菜單下的[Preferences],選擇Java支,如圖。檢測已安裝的JRE;設置工作臺選項;設置新建項目選項;設置Java編輯器。2.2Java透視圖Java-centricviewoffilesinJavaprojectsJavaelementsmeaningfulforJavaprogrammersJava

projectpackageclassfieldmethodJava

editor2.3創(chuàng)建Java項目Java項目包含用于構建Java程序的源代碼和相關文件。新建Java項目的步驟:選擇[File]->[New]->[Project],從彈出的窗口中選[Java]->[JavaProject],單擊下一步;輸入項目名,并確定項目保存的文件目錄,單擊完成即可,在Java透視圖中的“資源管理器”中便可看到創(chuàng)建的項目。新建Java類選擇新建的項目;在工具欄中單擊“創(chuàng)建Java類”按鈕(帶有一個C標記);在彈出的窗口中輸入類名稱,并設置有關屬性(如選中publicstaticvoidmain(String[]args)),單擊完成,則Java編輯窗口會自動打開。2.4Java編輯器Eclipse可以對二進制的CLASS文件打開Java編輯器,顯示相應的源文件。Java編輯器功能:語法突出顯示;內容/代碼輔助;代碼格式化;導入輔助;快速修正;調試。語法突出顯示Java源程序中的不同種類的元素使用獨特的顏色顯示,包括:常規(guī)注釋;Javadoc注釋;關鍵字;字符串;…內容/代碼輔助有利于提高編程速度和代碼準確性。ListofplausiblemethodsDocformethod代碼格式化啟動代碼格式化:Ctrl+Shift+F;設置代碼格式化:[Windows]->[Preferences]->[Java]->[CodeFormatter]調試可在[Window]->[Preferences]->[Debug]中設置調試器首選項。如下圖示。2.5重構重構是面向對象軟件開發(fā)時在保持代碼外部行為不變的條件下,改變程序結構的行為。重構是極限編程(eXtremeProgramming)中的重要概念。重構使得軟件設計可以簡化,不需要過多因為軟件將來的變化而對設計提出過多限制,使設計復雜化。設計模式使重構成為熱門。重構舉例:換名重構Rename步驟:選擇要換名的元素,如Student類;執(zhí)行Rename重構;運行測試重構結果。2.6類測試:JunitJunit是一個開放源代碼的Java測試框架,最初由ErichGamma和KentBeck開發(fā)。Junit是極限編程和重構中被極力推薦的工具。2.6.1Junit框架測試斷言測試單個類測試多個類運行測試類測試結果2.6.2Junit框架使用junitMyClassTestCaseexercise1..*TestRunnerrun1..*MyClassTesttestMethod()…setUp()

tearDown()Method()TestCaseClassMyClassTestextendsTestCase{publicFooTest(Stringmethodname){super(methodname);}protectedvoidsetup(){//產生對象

varC=newMyClass(…);//…..}protectedvoidtearDown(){}//刪除對象

publicvoidtestMethod(){//測試驅動程序//……

assertEquals(varC.method(),…)}

PublicstaticTestsuite(){

TestSuitesuite=newTestSuite();suite.addTest(newMyClassTest(“testMethod”));returnsuite;}pub

溫馨提示

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

最新文檔

評論

0/150

提交評論