Support free tutorials:

vogella training Training Books

Eclipse Source Code - Tutorial

Lars Vogel

Version 3.5


Revision History
Revision 0.1 - 3.5 23.05.2008 - 15.07.2013 Lars
created, bugfixes and enhancements

Eclipse source code tutorial

This tutorial explains how to work with the Eclipse source code. It assumes that you are already familiar with using the Eclipse IDE and is based on Eclipse 4.4 (Eclipse Luna).

Table of Contents

1. Eclipse Source Code
2. Binary import of plug-ins
3. Identifying who contributes user interface components
3.1. Plug-in Spy for UI parts
3.2. Plug-in spy for menus
3.3. SWT spy
4. Enable access to plug-ins
4.1. Java tools filter
4.2. Include all plug-ins in Java search
5. Find plug-in for a certain class
6. Finding classes and plug-ins
6.1. Open Plugin Artifact
6.2. Plug-in Search
7. Finding commands for key bindings
8. Debugging Eclipse
9. Feature patch projects
10. Support free vogella tutorials
10.1. Thank you
10.2. Questions and Discussion
11. Links and Literature
11.1. Source Code
11.2. Eclipse Resources
11.3. vogella Resources

1. Eclipse Source Code

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 can learn a lot. It also helps to understand the Eclipse source code to address certain problems.

Especially if you develop custom Eclipse Plug-insor Eclipse RCP applications, looking at the Eclipse source code is useful. This description helps you to access this source code.

2. Binary import of plug-ins

The following describes how you can import the source code of Eclipse plug-ins from your Eclipse installation to review the code. The Eclipse standard distribution contains the source code for the core Eclipse project. For other Eclipse projects you usually find an "SDK" bundle on the project update site which contains the source code.

To avoid "pollution" of your existing workspace, switch to a new workspace and select FileImport. 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 plug-ins you would like to import and press Finish.

You can you investigate the code of the imported plug-ins.

3. Identifying who contributes user interface components

3.1. Plug-in Spy for UI parts

The Plugin Spy gives you easily information about the running UI. Press Alt+Shift+F1 to get information about the currently selected user interface component in your Eclipse IDE. 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.

3.2. Plug-in spy for menus

Press Alt+Shift+F2 and select a menu to see who is contributing this menu.


To use the Eclipse Plugin Spy in your Eclipse RCP application include the plug-in "org.eclipse.pde.runtime" into your application.

3.3. SWT spy

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.

4. Enable access to plug-ins

4.1. Java tools filter

By default the Java tools of the Eclipse IDE consider only Java components, e.g. classes or interfaces, from the standard Java libraries and from projects and their dependencies in the workspace as relevant for search operations.

For example, the Ctrl+Shift+T (Open Type) shortcut will not find the ISources interface if it is not referred to in the current workspace. As plug-in developer you want to have access to all classes in your current target platform.

The target platform is the set of plug-ins against which you develop. The default is the Eclipse IDE installation.

4.2. Include all plug-ins in Java search

You can add all classes from the current target platform to be relevant for the Eclipse Java tools via the following setting: WindowPreferencesPlug-in DevelopmentInclude all plug-ins from target in Java search .

How to add all Java classes from the Eclipse target platform to the Java search

5. Find plug-in for a certain class

You frequently have to find the plug-in / bundle for a given class. The Eclipse IDE makes it easy to find the plug-in for a class. After making the Include all plug-ins from target into Java Search setting in the Eclipse IDE preferences you can use the Open Type dialog (Ctrl+Shift+T) to find the plug-in for a class. The JAR file is shown in this dialog and the prefix of the JAR file is typically the plug-in which contains this class.

Open Type Dialog

Plug-in for an Java class

6. Finding classes and plug-ins

6.1. Open Plugin Artifact

Use the Ctrl+Alt+A shortcut to search for an extension point. Definition and usage of an extension point use different icons. For example to see which plug-in defines the extension point, enter it in the dialog and select the entry with the blue icon.

6.2. Plug-in Search

Plug-in Search allows you to perform a detailed search for extension points. Select the SearchSearchPlug-in Search menu. You can select what your are searchnig for as demonstrates in the following screenshot.

7. Finding commands for key bindings

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 key binding. To use tracing modify your runtime configuration on the "Tracing" tab and set "Enable Tracing". For trace for example the keybindings of "org.eclipse.ui" plug-in select it and 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 and 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.

8. Debugging Eclipse

You can also debug the Eclipse IDE if you want to see how certain things are done. Use for example use the plug-in spy to find the class which you would like to review. 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.

Once you have configured your runtime configuration, you select RunDebug for your runtime configuration you can start debugging the interesting point.

9. Feature patch projects

If you want to modify standard Eclipse plug-ins you can use Feature Patch Projects. A Feature Patch Project can contain plug-ins which replaces existing plug-ins. This would allow you to create update site for this feature and users can use your version of the modified code.

A feature project can get created via FileNewOther...Plug-in DevelopmentFeature Patch.

In this dialog select the feature which you want to patch. Add every modified plug-in to your new Feature Patch Projects and export is as p2 update site.

Every feature can only be patched once.

10. Support free vogella tutorials

Maintaining high quality free online tutorials is a lot of work. Please support free tutorials by donating or by reporting typos and factual errors.

10.1. Thank you

Please consider a contribution if this article helped you.

Flattr this

10.2. Questions and Discussion

If you find errors in this tutorial, please notify me (see the top of the page). Please note that due to the high volume of feedback I receive, I cannot answer questions to your implementation. Ensure you have read the vogella FAQ as I don't respond to questions already answered there.

11. Links and Literature

11.1. Source Code

Source Code of Examples

11.2. Eclipse Resources

11.2.1. Eclipse Source Code

Setting up your ssh key for

11.3. vogella Resources

vogella Training Android and Eclipse Training from the vogella team

Android Tutorial Introduction to Android Programming

GWT Tutorial Program in Java, compile to JavaScript and HTML

Eclipse RCP Tutorial Create native applications in Java

JUnit Tutorial Test your application

Git Tutorial Put all your files in a distributed version control system