Abstract
Developers are frequently advised to read existing high-quality code. Having easy access to the Eclipse sources can be extremely helpful in familiarizing yourself with the coding patterns inherent in Eclipse.
This article describes how to access the Eclipse source code, how to use the Plug-in Spy to identify a plug-in which is responsible for a certain part of the user interface and how to debug Eclipse. It also give a few examples how to search for code.
The Eclipse code base is stored in a cvs version control system. It will also be described how to access the source code for this.
Eclipse is a powerful, extensible IDE for building general purpose applications. Some of the key player in creating Eclipse are also well known for their software architecture skills.
This article assumes that you are already familiar with using the Eclipse IDE.
Create a new workspace, e.g. "EclipseSource".
Tip1
It is highly recommended to test this with a new workspace as the plug-ins will be copied into this workspace, hence you will "pollute" an existing workspace. If later you decided that you would like to have access to the sources in your normal workspace you can do this again and use a filter to hide them.
Tip2
The Eclipse distribution usually contains already the source code for some Eclipse projects, e.g. Eclipse Platform, JDT, PDE, etc. For other Eclipse projects you usually find a "SDK" bundle on the project update side which contains the source code.
Eclipse has the option to import binary project. This will tell Eclipse that you want to read the source code of the plug-ins but that you do not want to change / compile the source code. As the Eclipse source code is very large this setting will save memory and will allow so search the code quickly.
Select File -> Import. Select "Plug-ins and Fragments".
Make the following settings. Very important is the setting "Binary projects".
From the displayed list select all plugs-ins which are of interest for you (if in doubt, select all) and press the "Add" button.
Press finish to import all into your workspace. The copying process may run a while.
Now that you have the code you should start digging around in the code. Eclipse allows several ways of doing this. The following chapter will give examples how to do this.
2. Working with Extensions
2.1. Search Extension Points
You can search for the declaration / usage of an extension point. The following will search for the declaration of an extension point "org.eclipse.ui.commands".
The result should be displayed in the search view. Double-click on the result to go to the plug-in.
You find the Eclipse Platform extension points documented in the Help under Platform Plug-in Developer Guide -> Reference -> Extension Point Reference
Eclipse Ganymede introduced a very useful tool, the Plug-in Spy. Press Alt+Shift+F1 to get information about the current running Eclipse plugin / data types / screen. This way you can get immediately access to the plug-in which is currently running.
Click on the active class or the contributing plug-in to get to the class or the source code of the class.
4.1. Example: Create Initial Layout
Lets assume you writing a Rich Client Platform application and you are wondering how the layout in Perspective.java can be handled. In an Eclipse RCP application the method createInitialLayout in Perspective.java is responsible for setting up the layout.
Select Search -> Java
Search for method createInitialLayout
The system will show you all the occurrence of this method. Select any of the implementations to see how the Layout is defined.
4.2. Example: Finding standard menu definition
Lets assume you want to find the Eclipse creation of the menus. From your RCP application experience you know that Eclipse creates the menus in the method fillMenuBar.
Open Search -> Java and search for fillMenuBar. Browse through the hit list to see how Eclipse is handling the creation of the menu.
You can also debug the Eclipse IDE if you want to see how certain things are done. Use for example the Plug-in Spy to find the class / plug-in which you would like to invest. Put a breakpoint into the coding, for example in the constructor of the class or if the class shows UI elements "createPartControl". Create a Run Configuration which includes all Eclipse IDE plug-ins and run it.
If you now select Run -> Debug for your runtime configuration you can start debugging the interesting point.
6. Getting the Eclipse source code from cvs
The Eclipse source code is stored in cvs. To checkout the source code open the "CVS Repository" view.
Maintain the folloiwng.
Now can you browse the structure and check out code. Check out will create a local copy of the selected path into your workspace.
7. Questions and Discussion
For questions and discussion around this article please use the http://groups.google.com/group/vogella. Also if you note an error in this article please post the error and if possible the correction to the Group.
I believe the following is a very good guideline for asking questions in general and also for the Google group How To Ask Questions The Smart Way.
分享到:
相关推荐
汉化包-Eclipse3.4-ganymede 汉化方式:将features和plugins中的文件覆盖到要汉化的Eclipse中。 下载自:http://download.eclipse.org/technology/babel/babel_language_packs/
Eclipse Ganymede 3.4 Tomcat 插件,直接解压后放到 Eclipse的plugins目录后,重启即可。
Eclipse 是一个很让人着迷的开发环境,它提供的核心框架和可扩展的插件机制给广大的程序员提供了无限的想象和创造空间。目前网上流传相当丰富且全面的开发工具方面的插件,但是Eclipse已经超越了开发环境的概念,...
#eclipse-jee-ganymede-SR2-win32 #官方最新中文语言包 #将文件解压到eclipse安装目录 更新日期: v20090308043402
本示例是对上一个资源“演示EJB3.0 + JPA + MySQL5.0 + C3P0连接池技术实战编程(Top-Down的XP开发方式)”的简化版本--主要是使用Eclipse 3.4 Ganymede版本来开发EJB3.0中间件与JPA持久层的实战应用。 使用步骤: ...
这个插件是可在Eclipse3.4下使用的awt、swing和swt设计插件,需要EMF2.4. 注意Eclipse3.4 Classic版不带EMF,Java版有一部分,JEE版有完整的EMF。
我还发了另一个ve1.4的资源,在Eclipse3.4 Jee和MyEclipse 7下试了可以用,只有5M多。这个是在Eclipse3.4 Classic下update,然后用目录比较工具提出来的,但是有11M多,用Classic版和Java版的可以试试这个。
eclipse j2ee ganymede32位,这个应该只有32位,没有64位的。这个是windows下的版本,如果需要其他操作系统版本,可以到官网下载:https://www.eclipse.org/downloads/packages/all
2009.03.22日的中文语音包 eclipse3.4(ganymede)中文包 v20090322043401版
免费的Hibernate工具,用起来还可以,支持最新的eclipse
Eclipse32位3.4木卫三版eclipse-jee-ganymede-win32.zip支持jdk1.5 Eclipse 支持jdk1.5 32位 ganymede 木卫三版 eclipse-jee-ganymede-win32.zip 更多eclipse版本可看查看我的系列,欢迎下载~
免费的spring ide,因为大了点,所以分2部分发布,这是第一个部分
免费的spring ide,因为大了点,所以分2部分发布,这是第二个部分
VE for eclipse4 Ganymede
eclipse-jee-ganymede-SR2-win32.zip
最新版Eclipse Ganymede搭建J2ME开发平台的过程
Notably, this release includes support for the new Eclipse 3.4/Ganymede platform, advances in JavaScript tooling, a professional implimentation of JSDT, enhancements to MyEclipse Reports tooling ...
Eclipse32位3.4.1木卫三版eclipse-jee-ganymede-SR1-win32.zip支持jdk1.5 Eclipse 支持jdk1.5 32位 ganymede 木卫三版 eclipse-jee-ganymede-SR1-win32.zip 更多eclipse版本可看查看我的系列,欢迎下载~
eclipse-cpp-ganymede-SR2-win32 基于eclipse的C/C++开发环境
Eclipse Ganymede and Google Android UserGuid