Eclipse学习笔记

Eclipse基本概念:

1.         Eclipse是一个优秀的集成开发环境(IDE),可以用于管理多种开发任务,同时又是一个成熟的、精心设计的、可扩展的体系结构,Eclipse的核心就是可以动态发现插件的体系结构。

2.         Eclipse is an open source community whose projects are focused on providing a vendor-neutral open development platform and application frameworks for building software.

3.         平台运行时:负责管理插件注册表和插件,启动平台基体并动态发现插件。

4.         插件(plugin):结构化组件,使用plugin.xml向系统描述自己。

5.         工作区(workplace):用于管理Eclipse平台的资源(包括项目、文件、文件夹)。

6.         资源插件(org.eclipse.core.resources.*):提供服务以帮助访问用户正在使用的文件。

7.         资源更改机制:工作区资源更改以后,触发资源更改事件,通知侦听器。

8.         工作台(workbench):高级用户界面(UI)框架,包括SWTorg.eclipse.swt.*)和JFaceorg.eclipse.jface.*)。

9.         标记(Markers):连接工作台资源的一些对象。包括bookmarktaskproblemerrorwarning等。

10.     链接的资源:新建文件或文件夹时选择Advanced选项。

11.     .metadata目录:用来保存平台内部信息,一般不应该修改。

12.     JDTorg.eclipse.jdt.*):随Eclipse平台一起交付的java IDE

13.     方法断点:设置断点当执行到该方法的任意行时中断。

14.     命中计数:当执行第n此后遇到断点时,暂停执行。

15.     管理条件断点:满足启用条件是暂停执行。

16.     Java异常断点:抛出异常时暂停执行。

Eclipse主要特点:

17.     Eclipse本身不提供大量最终用户功能,而是通过插件来快速开发集成功能部件。

18.     Eclipse的主要特点:   开放的可扩展的IDE、成功的底层图形界面APISWT)、强大的插件加载功能、

19.     Eclipse/NetBeans: Eclipse use SWT and NetBeans use Swing. Eclipse runs noticeably faster than NetBeans. Eclipse’s graphical interface isn’t merely an imitation of your computer’s interface. Eclipse can use tools that are specific to each operating system. In theory, Eclipse isn’t as portable as NetBeans.

Eclipse体系结构及原理:

20.     EclipseEclipse project, Eclipse Tools project, Eclipse Technology project, Eclipse Web Tools project组成。

21.    

22.     Eclipse启动时,由“运行时”负责在plugin.xml文件中查找插件的声明,每个plugin.xml文件都在各插件的子目录中。这些子目录位于Eclipse的安装目录下名为plugins的公共目录中。根据这些文件,运行时在内存中构建一个全局注册表,称为插件注册表。根据这个注册表,给定的插件就可以在运行时确定其他哪些插件希望扩展它。希望被其他插件扩展的插件将声明一个扩展点,而其他插件可以通过对这个插件声明的扩展来利用这个插件。

Eclipse参考资料:

23.     Eclipse下载参考网站:http://www.eclipse.org

24.     Tomcat服务器插件:http://www.sysdeo.com/eclipse/tomcatPlugin.html

25.     Lomboz插件:http://www.objectlearn.com/

26.     Tanghan插件:http://forum.hibernate.org.cn/download/jlinux/

27.     EclipseUMLhttp://www.eclipseuml.com

28.     Eclipse插件下载参考网站:http://eclipse-plugins.2y.net

Eclipse安装:

29.     最新版本为 3.1.2 。下载完成以后只需要解压缩到任意目录下,然后启动Eclipse.exe即可。

30.     Eclipse插件的安装:Eclipse插件使用的目录结构如下所示:/eclipse/features/eclipse/plugins。安装有三种方法:直接安装、Manage ConfigurationLink安装。

       直接安装:将下载的pluginfeatures目录直接CopyEclipse安装目录相应目录中,重新启动即可。

       Manage Configuration:第一步:将各个插件单独防止在相应的插件目录中,目录可以在任何位置。例如d://eclipse-plugin//emf,这就是插件的根目录,在此目录下需要建立如下结构/eclipse/plugins/eclipse/features,与直接安装中目录结构相同,不过只是插件的目录。建立完成的目录结构为d://eclipse-plugin/emf/eclipse/pluginsfeatures。第二步:在eclipse目录下创建名为.eclipseextension的文件,并用记事本编辑内容如下:id=org.eclipse.emf name=EMF version= 2.2.0 。第三步:在Eclipse中运行Manage Configuration,方法:help->install and update->manage Configuration->选择eclipse sdk并右击,在右键菜单中选择add->extension location选择目录,例如d://eclipse-plugin//emf,确定以后系统会提示重新启动系统。注意emf的目录结构必须严格符合规定,主要emf具有子目录eclipsepluginsfeaturs目录都在eclipse目录下。

       Link安装法:前两步与Manage Configuration相同,第三步:在eclipse的安装目录,即最初的解压缩目录下创建子目录link,在其中建立*.link文件(文件名可以随意选择),编辑内容为path=d://eclipse-plugin//emf,其中可以建立多个link文件,每个文件分别代表不同的插件目录(注意每个.link文件只能包含一行即一个插件目录,否则只会加载最后一行代表的插件)。主要目录在window下要使用//。重新启动系统即可。

31.     Eclipse有时会无法识别插件,可以采用三种方法进行处理:删除/eclipse/configuration/org.eclipse.update/目录并重启eclipse;在/configuration/config.ini文件中加入一行osgi.checkConfiguration=true;在启动时带上-clean参数,eclipse.exe –clean

Eclipse主要插件介绍:

32.     Platform: The Platform defines the set of frameworks and common services that collectively make up "integration-ware" required to support the use of Eclipse as a component model, as a rich client platform (RCP) and as a comprehensive tool integration platform. These services and frameworks include a standard workbench user interface model and portable native widget toolkit, a project model for managing resources, automatic resource delta management for incremental compilers and builders, language-independent debug infrastructure, and infrastructure for distributed multi-user versioned resource management.

33.     JDT: The JDT provides the tool plug-ins for the platform that implement a Java IDE for power-users, that supports the development of any Java application, including Eclipse plug-ins. The JDT adds the notion of Java projects and a Java perspective to the Eclipse platform, as well as a number of views, editors, wizards, builders, and code merging and refactoring tools. The JDT allows Eclipse to be a development environment for itself. The JDT plug-ins themselves can also be further extended by other tool builders.

34.     PDE: The PDE project provides a number of views and editors that make is easier to build plug-ins for Eclipse. Using the PDE, you can create your plug-in manifest file (plugin.xml), specify your plug-in runtime and other required plug-ins, define extension points, including their specific markup, associate XML Schema files with the extension point markup so extensions can be validated, create extensions on other plug-in extension points, etc. The PDE makes integrating plug-ins easy and fun.

35.     OSGI:The Equinox project provides the OSGi framework implementation and component model on which the Eclipse RCP and IDE platforms run. The project seeks to implement the latest OSGi framework specification as well as all optional services contained in the OSGi specification. Equinox team members also participate actively in the OSGi specification process. In addition to the standard services and mechanisms, Equinox includes some basic infrastructure such as the notion of plug-in (aka bundle), the Eclipse bootstrap and launching code and the Eclipse extension registry. The Equinox OSGi implementation is suitable for use in embedded, desktop and server scenarios.

36.     GEF: The Graphical Editor Framework (GEF) allows developers to take an existing application model and easily create a rich graphical editor. GEF allows a developer to quickly map any existing model to a graphical editing environment. The graphical environment is the SWT-based drawing plugin "draw2d" (which is part of the overall "GEF" component). The developer can take advantage of the many common operations provided in GEF and/or extend them for the specific domain. GEF is suitable for creating a wide variety of applications, including: flow builders, GUI builders, UML diagram editors (such as work-flow and class modeling diagrams), and even WYSIWYG text editors like HTML. GEF does not assume that you must build one of these applications and is application domain neutral.

37.     EMF-XSD-SDO: The EMF project is a modeling framework and code generation facility for building tools and other applications based on a structured data model. From a model specification described in XMI, EMF provides tools and runtime support to produce a set of Java classes for the model, along with a set of adapter classes that enable viewing and command-based editing of the model, and a basic editor. EMF includes the XML Schema Infoset Model (XSD) project and an EMF-based implementation of Service Data Objects (SDO). XSD provides a model and API for manipulating components of an XML Schema, with access to the underlying DOM representation of the schema document. SDO is a framework that simplifies and unifies data application development in a service-oriented architecture (SOA). It supports and integrates XML and incorporates J2EE patterns and best practices.

38.     VE: The Eclipse Visual Editor project is a framework for creating GUI builders for Eclipse. It will include reference implementations of Swing/JFC and SWT GUI builders, but intends to be useful for creating GUI builders for other languages such as C/C++ and alternate widget sets, including those that are not supported under Java.

39.     UML2: The UML2 project is an EMF-based implementation of the UML 2.0 metamodel for the Eclipse platform. The objectives of this project are to provide a useable implementation of the metamodel to support the development of modeling tools, a common XMI schema to facilitate interchange of semantic models, test cases as a means of validating the specification, and validation rules as a means of defining and enforcing levels of compliance.

40.     WST: The Web Standard Tools subproject aims to provide common infrastructure available to any Eclipse-based development environment targeting Web-enabled applications. Within scope will be tools for the development of three-tier (presentation, business and data logic) and server publication of corresponding system artifacts. Outside scope will be language or web framework specific technology, which will be left to other subprojects like the J2EE Web Tools subproject. Tools provided will include editors, validators and document generators for artifacts developed in a wide range of standard languages (for example, HTML/XHMTL, Web services, SQL, etc.) Supporting infrastructure will likely comprise a specialized workbench supporting actions such as publish, run, start and stop of Web application code across target server environments.

41.     JST: The initial scope of the J2EE Standard Tools subproject will be to provide a basic Eclipse plug-in for developing applications based on J2EE 1.4 targeting J2EE-compliant application servers, as well as a generic J2EE tooling infrastructure for other Eclipse-based development products. Within scope will be a workbench providing a framework for developing, deploying, testing and debugging J2EE applications on JCP-compliant server environments, as well as an exemplary implementation of a plug-in for at least one JSR-88 compliant J2EE Server. Included will be a range of tools simplifying development with J2EE APIs including EJB, Servlet, JSP, JCA, JDBC, JTA, JMS, JMX, JNDI, and Web Services. This infrastructure will be architected for extensibility for higher-level development constructs providing architectural separations of concern and technical abstraction above the level of the J2EE specifications. The integrated workbench to be delivered would support use cases such as - Develop a JSP page, Enhance the "PetStore" blue-print application, Expose a Session Bean as a Web Service.

42.     JSF: The JavaServer Faces Tools project will provide tools and APIs for JSR 127 which is part of Java EE 5. The project will operate as an incubator during the WTP 1.0 development cycle and become a component of the JST subproject in WTP 1.5.

Eclipse操作知识:

43.     Eclipse可以建立多个工作区,每个工作区是一个文件目录,所有的相关文件都存放在这个目录下,在启动时会有对话框提示选择工作区。启动以后看到的就是工作台,工作台包含多个透视图,每个透视图又包含多个不同的窗口。

44.     Eclipse可以设置文件的关联打开程序,操作方法:Window->Preferences->General->Editors->File Associations.

45.     Eclipse可以以方法为独立的编辑单位和以类为编辑单位之间进行切换,操作方法:点击按钮[show source of selected Element only]

46.     Eclipse的窗口可以通过点击右上角的标签大小化、恢复的操作,类似于Window的操作。

47.     Eclipse中可以实现目录折叠恢复功能,操作方法:点击视图上方的折叠、恢复标签。

48.     Eclipse提供了自动刷新功能以避免每次在Eclipse以外更改文件后手工刷新,操作方法:window->Preferences->General->Workspace->选中Refresh automatically

49.     Eclipse中打开一个Java文件,鼠标点击一个元素(类、方法),会在Declarition窗口中直接显示这个元素的源代码,类似于以前的Open Declarition功能(通过Ctrl+鼠标左键)。另外还可以在Javadoc视图中显示这个元素的javadoc

50.     Eclipse中可以显示行号,操作方法:Window->Preference->General->Editors->Text Editors->选中show line numbers

51.     Eclipse提供了强大的Java代码格式化功能,配置方法:Window-Preference->Java->Code Style->Formatter

52.     Eclipse提供了注释隐藏功能,可以通过Window-Preference->Java->Editor->Folding->选中Enable folding配置,但是当隐藏后,调试代码时会出现代码行不一致的情况,所以还是建议不要使用此功能。

53.     Eclipse提供了所选元素动态高亮显示功能,选中一个元素以后编辑器中的该元素的所有调用被高亮显示,配置方法:Window-Preference->Java->Editor->Mark Occurrences

54.     Eclipse中浏览窗口主要包括:NavigatorPackage ExplorerProject ExplorerHierarchy

55.     Eclipse中常用的快捷键:Alt+Arrow Up(Down)Ctrl+Shift+X(Y)

56.     Eclipse中调试时可以直接在想要显示结果的变量上右击鼠标,在弹出的下拉菜单中进行相应操作,不需要到相应的窗口在进行操作。

57.     Eclipse中调试时可以选择系统线程过滤器将系统线程从调试视图中过滤掉。

58.     Eclipse调试中可以直接在变量视图中修改变量的值,保存后即可生效。

59.     Eclipse中可以比较两个文件,方法是选择两个文件,右击鼠标,选择compare->each other

60.     Alt+/: a list of possible code completions appears.

SWT开发知识:

61.     由于运行SWT的程序用到本地库,因此拷贝 D:/eclipse/plugins/org.eclipse.swt.win32_ 3.0.1 /os/win32/x86 下的 *.dll 拷贝到 jdk路径下的 /bin 目录, 运行程序可以自动找到

62.     AWT/Swing/Swt: The AWT uses something called peers. It’s an extra layer between the AWT and a particular operating system’s graphical interface code. The AWT can’t do anything that’s not similar across all operating systems. Swing is “pure java”, Swing draws everything on your screen from scratch. Swing applications tend to run slowly. SWT is very fast and efficient. SWT isn’t pure java but has no peer layer.

 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值