文库发布:eclipse简介_第1页
文库发布:eclipse简介_第2页
文库发布:eclipse简介_第3页
文库发布:eclipse简介_第4页
文库发布:eclipse简介_第5页
已阅读5页,还剩35页未读 继续免费阅读

付费下载

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

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来向系统描述自己。Workspace:管理Eclipse平台中的资源,包括项目、文件和文件夹。Workbench:高级用户界面框架,用于构建由插件构建的复杂用户界面的产品。SWT:与本机底层窗口系统紧密集成的小窗口工具箱和图形库;Jface:使用SWT实现的用户界面工具箱。Team:定义附加API,允许插件集成版本和配置管理资源库的功能等。Help:允许用户浏览、搜索和打印系统帮助文档。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工作区(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运行环境(JRE)进入:[Window]菜单下的[Preferences],选择Java支,如图。检测已安装的JRE;设置工作台选项;设置新建项目选项;设置Java编辑器。2.2Java透视图Java-centricviewoffilesinJavaprojectsJavaelementsmeaningfulforJavaprogrammersJava

projectpackageclassfieldmethodJava

editor2.3创建Java项目Java项目包含用于构建Java程序的源代码和相关文件。新建Java项目的步骤:选择[File]->[New]->[Project],从弹出的窗口中选[Java]->[JavaProject],单击下一步;输入项目名,并确定项目保存的文件目录,单击完成即可,在Java透视图中的“资源管理器”中便可看到创建的项目。新建Java类选择新建的项目;在工具栏中单击“创建Java类”按钮(带有一个C标记);在弹出的窗口中输入类名称,并设置有关属性(如选中publicstaticvoidmain(String[]args)),单击完成,则Java编辑窗口会自动打开。2.4Java编辑器Eclipse可以对二进制的CLASS文件打开Java编辑器,显示相应的源文件。Java编辑器功能:语法突出显示;内容/代码辅助;代码格式化;导入辅助;快速修正;调试。语法突出显示Java源程序中的不同种类的元素使用独特的颜色显示,包括:常规注释;Javadoc注释;关键字;字符串;…内容/代码辅助有利于提高编程速度和代码准确性。ListofplausiblemethodsDocformethod代码格式化启动代码格式化:Ctrl+Shift+F;设置代码格式化:[Windows]->[Preferences]->[Java]->[CodeFormatter]调试可在[Window]->[Preferences]->[Debug]中设置调试器首选项。如下图示。2.5重构重构是面向对象软件开发时在保持代码外部行为不变的条件下,改变程序结构的行为。重构是极限编程(eXtremeProgramming)中的重要概念。重构使得软件设计可以简化,不需要过多因为软件将来的变化而对设计提出过多限制,使设计复杂化。设计模式使重构成为热门。重构举例:换名重构Rename步骤:选择要换名的元素,如Student类;执行Rename重构;运行测试重构结果。2.6类测试:JunitJunit是一个开放源代码的Java测试框架,最初由ErichGamma和KentBeck开发。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. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论