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 3.4,代号为“Ganymede”,是该平台的一个重要版本,发布于2008年。在这个版本中,Eclipse 提供了众多改进和新特性,以提升开发者的体验和效率。 中文插件对于中国开发者来说至关重要,它使得Eclipse的用户...
Eclipse 3.4 Ganymede是Eclipse平台的一个里程碑版本,发布于2008年,引入了许多新的特性和改进,包括对Java EE6的支持,增强了JavaScript和Web开发工具等。而HibernateTools 3.2.4.CR2则在这个平台上提供了对最新...
Eclipse Ganymede 3.4 是一个历史悠久的版本,它是Eclipse IDE的其中一个迭代,主要面向Java开发者。Ganymede版本发布于2008年,它提供了丰富的开发工具集,支持多种编程语言和框架,包括Java、JavaScript、Web和...
Eclipse3.4版是其历史版本之一,发布于2008年,被誉为Ganymede版本,包含了多项改进和新特性。该版本旨在提供更好的性能、可扩展性和互操作性。 汉化包是为了方便非英语用户使用Eclipse而制作的本地化资源包。...
Eclipse 是一个很让人着迷的开发环境,它提供的核心框架和可扩展的插件机制给广大的程序员提供了无限的想象和创造空间。目前网上流传相当丰富且全面的开发工具方面的插件,但是Eclipse已经超越了开发环境的概念,...
Eclipse3.4,也称为Ganymede,是Eclipse平台的一个重要版本,发布于2008年,它引入了许多新特性和改进。汉化包则是为了方便中国用户使用而制作的,将原本英文界面翻译成中文,使操作更加便捷。 首先,Eclipse3.4的...
Eclipse 3.4 Ganymede 是一个流行的开源集成开发环境(IDE),它为Java开发者提供了丰富的功能。在这个版本中,Eclipse引入了许多改进和新特性,以提升开发者的生产力。"VE1.4" 插件是针对Eclipse3.4的一个重要补充...
#eclipse-jee-ganymede-SR2-win32 #官方最新中文语言包 #将文件解压到eclipse安装目录 更新日期: v20090308043402
Eclipse 3.4,代号为 Ganymede,是对这款流行开源集成开发环境的一次重大更新。这次更新带来了多项改进和新特性,显著提升了开发者的效率和代码质量。 首先,Ganymede 引入了面包屑导航,这是一个直观的路径指示器...
Eclipse 3.4,也被称为Ganymede,是Eclipse的一个重要里程碑,包含了多个改进,如增强的UI、更快的启动速度和更强的插件兼容性。Designer插件的兼容性确保了它能在Eclipse 3.4的环境中无缝运行,为开发者提供额外的...
本示例是对上一个资源“演示EJB3.0 + JPA + MySQL5.0 + C3P0连接池技术实战编程(Top-Down的XP开发方式)”的简化版本--主要是使用Eclipse 3.4 Ganymede版本来开发EJB3.0中间件与JPA持久层的实战应用。 使用步骤: ...
在本文中,我们将深入探讨如何在Eclipse 3.4版本中安装各种插件,包括VE、UML2 Tools、Subclipse、Spring IDE、Hibernate Tool和Proedit。这些插件对于提升开发者的效率和增强Eclipse的功能至关重要。 首先,我们...
Eclipse 3.4和3.5是其历史版本,分别被称为Ganymede和Galileo。这两个版本在当时引入了许多新特性,提升了开发效率和用户体验。 中文语言包是为了方便中国用户使用Eclipse而设计的,它提供了全中文的界面,使得...
Eclipse3.4,也称为Ganymede版本,是Eclipse在2008年发布的一个重要迭代,它带来了许多新特性与改进。对于全球化的开发者团队来说,支持多语言的国际化插件显得尤为重要,而"eclipse3.4 svn maven 国际化插件"正满足...
Eclipse 3.4,又被称为Ganymede,是Eclipse平台的一个重大更新,发布于2008年。这个版本引入了许多新特性,包括: 1. **改进的启动性能**:Eclipse 3.4通过优化启动过程,提高了IDE的启动速度,使得开发者能够更快...
Eclipse3.4,又称为Ganymede,是Eclipse项目的一个重要版本,发布于2008年。这个版本引入了许多新特性和改进,包括增强的插件系统、更好的性能以及对Java EE 5的支持。对于开发者来说,Eclipse 3.4提供了更完善的...
### Eclipse 3.4 使用与配置详解 #### Eclipse 3.4 概述 Eclipse 3.4 是一款非常流行的开源集成开发环境(IDE),主要用于Java开发,但通过插件扩展也支持其他编程语言。它提供了丰富的工具集,帮助开发者高效地进行...
VisualEditor 1.4是该插件的一个特定版本,可能包含了一些特定的改进和修复,以适应Eclipse 3.4(Ganymede)的平台。 在使用VisualEditor 1.4之前,用户需要注意的是,它依赖于两个其他重要的Eclipse插件:EMF( ...
Eclipse 3.4,也称为Ganymede,是Eclipse的一个重要版本,它在2008年发布,包含了多项改进和新特性,比如增强的JDT(Java Development Tools)和PDE(Plug-in Development Environment)。此版本对性能进行了优化,...