Version 2.5
Copyright © 2009 - 2010 Lars Vogel
28.06.2010
| Revision History | ||
|---|---|---|
| Revision 0.1 - 0.6 | 23.05.2008 | Lars Vogel |
| Created Article | ||
| Revision 0.7 - 0.8 | 18.02.2009 | Lars Vogel |
| bugfixes and enhancements | ||
| Revision 0.9 | 29.05.2009 | Lars Vogel |
| Updated to Eclipse 3.5 | ||
| Revision 1.0 - 2.4 | 01.06.2009 | Lars Vogel |
| bugfixes and enhancements | ||
| Revision 2.5 | 28.06.2010 | Lars Vogel |
| Update to Eclipse 3.6 (Helios) | ||
Table of Contents
Developers are frequently advised to read high-quality code. 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. By reading the Eclipse source code you you can learn a lot. It also helps to understand the Eclipse source code to address certain problems.
The following describes how you can import Eclipse plugins from your Eclipse installation to review the code. The Eclipse distribution contains the source code for the core Eclipse projects, e.g. JDT. For other Eclipse projects you usually find a "SDK" bundle on the project update side which contains the source code.
To avoid "pollution" of your existing workspace, switch to a new workspace and select File -> Import. Select "Plug-ins and Fragments".

Make the following settings. Select "Binary projects". In Binary project you can read the source code but you cannot change it. They will also not be compiled therefore this setting will save memory and performance.

Add all plugins you would like to import and press "Finish".

You can you investigate the code of the imported plugins.
The Plugin Spy gives you easily information about the running UI. 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 plugin which is currently running.

Click on the active class or the contributing plugin to get to the class or the source code of the class.
Press "Alt + Shift + F2" and select a menu to see who is contributing this menu.

SWT spy for Eclipse is a tool that prints out information about the widget under the cursor. Currently, this includes style, layout and parent information. See SWT Tools for more information.
Use the shortcut "Ctrl+Shift+A" to search for an extension point. Definition and usage of an extension point use diffrent icons. For example to see which plugin defines the extension point "org.eclipse.menu.ui" enter it in the dialog and select the entry with the blue icon.

Plugin Search allow you to search for extension points Select from the menu Search -> Search and then the tab "Plug-in Search". For example the following will search for all declaration (defining an extension) to the extension point "org.eclipse.debug.core.launchConfigurationTypes".

Eclipse allows to trace a running Eclipse and to write information to the console. This can be used to identify which command is associated with a certain keybinding.
To use this create a runtime configuration which contains the Eclipse plugins you are interested in, e.g. include "org.eclipse.ui" and press add required plugins.
In the "Run Configuration" switch to the "Tracing" tab and set "Enable Tracing". Select the "org.eclipse.ui" plugin. Flag "debug".

Scroll down and select "trace/keybindings" and "trace/keybindings.verbose".

Make sure you have the -consoleLog flag maintained as an argument.

If you start now the Eclipse IDE then everytime you use a shortcut the calling Eclipse will display a trace which contains the commandId.

In your calling Eclipse you can now use Search (text) to find the handler / action which implements this command.
You can also debug the Eclipse IDE if you want to see how certain things are done. Use for example the Plugin Spy to find the class / plugin 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 plugins and run it.


If you now select Run -> Debug for your runtime configuration you can start debugging the interesting point.

Eclipse projects can use cvs and svn as version control system. Git support is in the making. The majority of the project still uses cvs.
To access the Eclipse CVS repositories open the "CVS Repositories" view via Window -> Show View -> Other -> CVS -> "CVS Repositories". Create a new entry in the view by right clicking and selecting "New" -> "Repository Location".

Copy the following string and paste it into the CVS view to create a new repository. You can validate the properties via right-mouse click on the entry -> Properties
:pserver:anonymous@dev.eclipse.org:/cvsroot/eclipse

Now can you browse the structure and check out code. Check out will create a local copy of the selected path into your workspace.

Not all Eclipse projects are in the same path. For example here are some connection strings.
Table 1. Access to some
| Project | Description |
|---|---|
| Eclipse Main | :pserver:anonymous@dev.eclipse.org:/cvsroot/eclipse |
| Eclipse PDE CVS repository | :pserver:anonymous@dev.eclipse.org:/cvsroot/eclipse then find the folder pde |
| Eclipse Equinox CVS repository | :pserver:anonymous@dev.eclipse.org:/cvsroot/rt |
More information about cvs access can be found Eclipse cvs access

The access of Eclipse code via svn is described in Eclipse svn access . For using svn with Eclipse you need the Eclipse subversive plugin. The installation of this plugin is described in Eclipse Subversive
.The Eclipse code is currently mainly maintained in cvs but this source code is mirrored into Git repositories. You find the Git url for all projects at http://dev.eclipse.org/git/

Please see Eclipse EGit Tutorial for details on how to use the EGit plugin for Eclipse or see Git Tutorial to learn how to use Git from the command line. .
All known Eclipse bugs and feature requests are stored in a Bugzilla database Eclipse Bugs
The following explains how you could use Mylyn to work on Bugs and store your content in the bugreport.
Mylyn is a task management system and allows to store the context (source files) in a task. This way you can work on a certain task, switch to another tasks and return to the same tasks and all the files you worked on are re-opened. See the Mylyn Tutorial for installation and basic usage.
Mylyn has build in support for the Eclipse bug database. Just right click in the "Task List" view and select New -> Query

Select "Eclipse" and press Next. Select "Create query" and if you know the bug already "Create query using form".

Lets assume you want to see all bugs for Eclipse 3.6 in PDE - UI then you could maintain the following query.

If you now activate a task you can use Mylyn to work on Eclipse bugs.

Thank you for practicing with this tutorial.
I maintain this tutorial in my private time. If you like the information please help me by using flattr or donating or by
|
Before posting questions, please see the vogella FAQ . If you have questions or find an error in this article please use the www.vogella.de Google Group . I have created a short list how to create good questions which might also help you. .