NOW Hiring

Quick links

This Tutorial describes how to extend the Eclipse IDE with custom plugins.

1. Eclipse plug-ins and applications

1.1. Eclipse software components - Plug-ins

An Eclipse application consists of several Eclipse components. A software component in Eclipse is called a plug-in. The Eclipse platform allows the developer to extend Eclipse applications like the Eclipse IDE with additional functionalities via plug-ins.

Eclipse applications use a runtime based on a specification called OSGi. A software component in OSGi is called a bundle. An OSGi bundle is also always an Eclipse plug-in. Both terms can be used interchangeably.

For example, a new plug-in can create new menu entries or toolbar entries.

1.2. Advantages of developing Eclipse plug-ins

The Eclipse platform forms the basis of the most successful Java IDE and therefore is very stable and broadly used. It uses native user interface components which are fast and reliable. It has a strong modular approach based on the industry standard module system for Java (OSGi) that allows developers to design component based systems.

Companies such as IBM, SAP and Google use the Eclipse framework as a basis for their products and therefore need to ensure that Eclipse is flexible, fast and continues to evolve.

The Eclipse platform also fosters a large community of individuals which provide support, documentation and extensions to the Eclipse framework. Tapping into this ecosystem allows you to find required resources and information.

1.3. What is the Eclipse Rich Client Platform (Eclipse RCP)?

The Eclipse IDE version 2.0 started as a modular IDE application. In 2004 Eclipse version 3.0 was released. Eclipse 3.0 supported reusing components of the Eclipse platform to build stand-alone applications based on the same technology as the Eclipse IDE.

At this point, the term Eclipse RCP was coined. Eclipse RCP is short for Eclipse Rich Client Platform and indicates that the Eclipse platform is used as a basis to create feature-rich stand-alone applications.

The release of Eclipse in version 4.x simplified and unified the Eclipse programming model which is now based on state-of-the-art technologies, like dependency injection and declarative styling via CSS files.

Eclipse RCP applications benefit from the existing user interface and the internal framework, and can reuse existing plug-ins and features.

2. Extending the Eclipse IDE

The Eclipse IDE is basically an Eclipse RCP application to support development activities. Even core functionality of the Eclipse IDE is provided via a plug-in, for example the Java development or the C development tools are contributed as a set of plug-ins. Only if these plug-ins are present the Java or C development capabilities are available.

The Eclipse IDE functionality is heavily based on the concept of extensions and extension points. For example the Java Development Tools provide an extension point to register new code templates for the Java editor.

Via additional plug-ins you can contribute to an existing functionality, for example new menu entries, new toolbar entries or provide completely new functionality. But you can also create completely new programming environments.

3. Prerequisites

3.1. Development

This tutorial assumes that you are already familiar with standard Java development and with the Eclipse IDE.

3.2. Model spy

See Eclipse Model Spy to learn about the model spy.

4. Download the Eclipse SDK

If you plan to add functionalities to the Eclipse platform, you should download the latest Eclipse release. Official releases have stable APIs, therefore are a good foundation for adding your plug-ins and features.

The Eclipse IDE is provided in different flavors. While you can install the necessary tools in any Eclipse package, it is typically easier to download the Eclipse Standard distribution which contains all necessary tools for plug-in development. Other packages adds more tools which are not required for Eclipse plug-in development.

Browse to the Eclipse download site and download the Eclipse Standard package.

Download Eclipse Plug-in IDE
Eclipse 4.5 provides also a new Eclipse installer installer. The installer is useful if you want to download several flavors of Eclipse, as it uses a shared installation pool for common plug-ins.

5. Starting an Eclipse instance (Runtime Eclipse)

5.1. Starting the Eclipse IDE from Eclipse

During the development of plug-ins targeting the Eclipse IDE you frequently have to deploy your plug-ins into a new Eclipse IDE instance to test your development.

As this is a very common requirement, it is possible to start an instance of the Eclipse IDE from another Eclipse IDE instance. This is sometimes called a runtime Eclipse IDE. For this you specify the set of plug-ins which should be included in the Eclispe instance via a run Configuration.

5.2. Starting a new Eclipse instance

The easiest way to create a run configuration for an Eclipse IDE is by selecting Run As ▸ Eclipse Application from the context menu of an existing plug-in or your manifest file. By default, this takes all the plug-ins from the workspace and the target environment, and start an Eclipse IDE instance with these plug-ins. If a plug-in is available in the workspace and the target environment, the one from the workspace is used.

eclipseideplugin70

5.3. Debugging the Eclipse instance

You can debug the Eclipse IDE itself. Put a breakpoint in a line of the source code which you want to inspect, right-click your plug-in and select Debug As ▸ Eclipse Application. This creates a run configuration if it does not already exist.

When the flow will reach a statement marked with a breakpoint, the execution stops, and you are able to debug the related statement, and to inspect the current data.

6. Adding e4 commands, menus and toolbars to a 3.x API based applications

6.1. Adding e4 menu entries

Menus, handlers and commands can be contributed to an Eclipse application via model fragments. To do this, you only need to know the ID of the element to which you want to contribute. The ID of the Eclipse IDE and Eclipse 3.x RCP applications is hard coded to the org.eclipse.e4.legacy.ide.application value.

You can use the model spy from the e4 tools project to identify the ID of the element you want to contribute too. See [modelspyintroduction].

With the correct ID you can create model fragments that contribute to the corresponding application model element. The following screenshot demonstrate how to contribute to the menuContributions feature of the Eclipse IDE.

Contributing to the Eclipse menu

After you added a MenuContribution item you can contribute a menu. The Parent-ID must be the ID of the menu your are contributing to.

Contributing to the Eclipse menu
Contributing to the Eclipse menu

The model fragment must be registered in the plugin.xml file via an extension to the org.eclipse.e4.workbench.model extension point, as demonstrated in the following listing.

<?xml version="1.0" encoding="utf-8"?>
<plugin>
   <extension
         id="id1"
         point="org.eclipse.e4.workbench.model">
      <fragment
            apply="notexists"
            uri="fragment.e4xmi">
      </fragment>
   </extension>

</plugin>

6.2. Error analysis

In case of problems, check the source code of plugin.xml and validate that your model fragment is included. Verify the name of the referred model fragment and ensure all the defined ID are available in the running configuration.

6.3. Adding e4 toolbar entries to the appliation window

Similar to menus you can contribute toolbar contributions. This is demonstrated in [firstplugin_migratione4_toolbar].

This approach does currently not work for view toolbars.

7. Exercise: Add a e4 menu and toolbar to the Eclipse IDE

7.1. Target of this exercise

In this exercise you create a plug-in which contributes an e4 menu entry to a 3.x based application menu.

7.2. Creating a plug-in project

Create a new plug-in project called com.vogella.plugin.first via File ▸ New ▸ Project…​ ▸ Plug-in Development ▸ Plug-in Project

Enter the data as depicted in the following screenshots.

eclipseideplugin10

Press the Next button.

eclipseideplugin20

Press the Next button.

Select the Hello, World Command template and press the Next button. This template uses the 3.x API, which you convert to the e4 API in [firstplugin_migratione4].

eclipseideplugin30

In the last page of the wizard you can customize some suggested values. You can leave the default values and press the Finish button.

eclipseideplugin40

Eclipse may ask you if you want to switch to the plug-in development perspective. Answer Yes if you are prompted.

eclipseideplugin50

As a result the following project is created.

eclipseideplugin60

7.3. Starting an Eclipse runtime IDE with your plug-in

Start a new Eclipse IDE instance and validate that your menu and toolbar entry are available. See [runtimeeclipse_starting] for more information on how to start an instance of the Eclipse IDE with additional plug-ins.

After launching the Eclipse IDE instance, you see the sample menu, contributed by your plug-in. After clicking the menu entry, you see a message box.

eclipseideplugin80
eclipseideplugin90

7.4. Adding the plug-in dependencies for the e4 API

Add a dependency to the org.eclipse.e4.core.di plug-in in the manifest file of the newly created plug-in.

7.5. Creating the handler class

Create the following class based on the generated handler class.

package com.vogella.plugin.first.handlers;

import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Shell;

public class SampleE4Handler {

        @Execute
        public void execute(Shell shell) {
                MessageDialog.openInformation(shell, "First", "Hello, e4 API world");
        }
}

7.6. Creating a model contribution

Select New ▸ Other…​ ▸ Eclipse 4 ▸ Model ▸ New Model Fragment from the context menu of the plug-in project.

Create Model Fragment

Press the Finish button.

Create Model Fragment

Create three model fragment entries in your new file, all of them should be contributing to the org.eclipse.e4.legacy.ide.application element id.

Since Eclipse 4.5 (Mars) XPaths can be used to address certain elements in the application model. So instead of using org.eclipse.e4.legacy.ide.application as element id xpath:/ can be used. Using XPaths is the preferred way, because it provides more flexibility.

Use the following screenshots to define the new contribution.

Create Model Fragment
Create Model Fragment
Create Model Fragment
Create Model Fragment
migrategenerated70
migrategenerated80
migrategenerated90
migrategenerated92

7.7. Adding a toolbar contribution

Also add a toolbar contribution for the same command.

toolbarcontribution10
When this document was written, the model editor had a bug. If you enter a Parent-ID to the toolbar contribution, that information is not persisted in the xmi code. Therefore, ensure that your settings are actually reflected in the fragment file. You can do this by closing the file and opening it again. If you read this and the bug is still present, you have to enter the Parent-ID directly in the xmi. For this switch to the XMI tab of the editor and enter the parent ID directly. Use the org.eclipse.ui.main.toolbar value. The file is only saved, if you enter the information syntactically correct.
toolbarcontribution20
toolbarcontribution24

Add a toolbar and a handled tool item to your contribution.

toolbarcontribution30
toolbarcontribution40

7.8. Validating the presence of the menu and toolbar contribution

Start a new instance of the Eclipse IDE and validate that your menu and the toolbar are is contributed. If they are not visible in the window, check via the model spy for potential issues.

toolbarcontribution50

8. Local deployment of your plug-in

8.1. Options for installing a plug-in

You have several options to make your plug-in available in your Eclipse IDE. You can: * Install your plug-in directly into your current Eclipse installation, using your Eclipse IDE. This option is useful for a quick installation and a test during development.

  • Export your plug-in and copy it into the dropins folder of your Eclipse installation. This option is useful for a simple distribution scenario, where you only have to provide the exported plug-in to your users. On the other hand it is not very convenient for the end user as it requires manual file copying and provides no simple way to update the plug-in.

  • Create an update site and use the Eclipse update manager to install it from this site. This is the simplest approach for the end user. It also allows providing updates to all interested users.

8.2. Installing your plug-in from your Eclipse IDE

You can install your plug-in directly into your running Eclipse IDE.

The Eclipse plug-in export wizard has an option for this. Open the export wizard via File ▸ Export ▸ Plug-in Development ▸ Deployable plug-ins and fragments.

Export plug-in into host IDE

In the export wizard dialog select in this case Install into host. Repository. This is depicted in the following screenshot.

Export plug-in into host IDE

8.3. Export plug-in and put into dropins folder

If you export your plug-in locally, you can put it into the Eclipse dropins folder of your Eclipse installation. After a restart of your Eclipse your plug-in should be available and ready for use.

Open again the export wizard via File ▸ Export ▸ Plug-in Development ▸ Deployable plug-ins and fragments.

Select the plug-in you want to export and the folder to which this plug-in should get exported.

Export plug-in into host IDE

Press the Finish button. This creates a JAR file with the exported plug-in in the selected directory.

Copy this JAR file to the dropins directory in your Eclipse installation directory and restart your running Eclipse.

After this restart your new plug-in is available in your Eclipse installation and ready to be used.

8.4. Deployment using an update site

You can create an update site for your plug-in. An update site consists of static files, which can be placed on a file server or a web server. Other users can install Eclipse plug-in from this update site by providing them a link to the update site.

This requires that you create a feature project for the plug-in. You can export this feature project and use the Eclipse update manager to install the feature (with the plug-in).

By default, the Eclipse update manager shows only features included into a category. Therefore, you should always use a category for your exported feature to make it easy for the user to install your feature.

9. Exercise: Create a feature for your plug-in

9.1. Create a feature project

Create a feature project for your plug-in and add your plug-in to this feature. You create a feature project via File ▸ New ▸ Other…​ ▸ Plug-in Development ▸ Feature Project.

Create the feature project according to the following screenshots.

Creating a feature project for the plug-in export
Creating a feature project for the plug-in export

9.2. Create a category definition

In your feature project create a new category definition, via the menu entry File ▸ New ▸ Other…​ ▸ Plug-in development ▸ Category Definition.

categorydefinition10

Press the New Category button and create a category with a name which describes your functionality. Add your feature to this category.

categorydefinition20
categorydefinition30

10. Exercise: Create an update site your plug-in

10.1. Create an update site

You can create an update site for your feature in a local directory on your machine. For this, select File ▸ Export ▸ Deployable features

pluginfeatureexport10
pluginfeatureexport20

To use your category, switch to the Options tab and select the path to your category.xml file in the Categorize repository option.

pluginfeatureexport30

10.2. Install feature via the Eclipse update manager

Use the Eclipse update manager via Help ▸ Install New Software…​ to install this new feature into your Eclipse IDE.

Use the update manager to point to your local directory. Then select and install your feature. In case you don’t see your feature, try deselecting the Group items by category flag. In this case, you have forgotten to set your category during the export.

idepluginfeatureinstall10
idepluginfeatureinstall20
idepluginfeatureinstall30
If you put the resulting files on a webserver under a public accessible URL, your users could install your features from this URL.

10.3. Validate installation

Restart the Eclipse IDE after the installation. Ensure that your plug-in is available in your Eclipse installation and can be used.

idepluginfeatureinstall40

11. Adding Eclipse 4.x parts and perspectives to 3.x based applications

11.1. Adding Eclipse 4.x parts to Eclipse 3.x applications

As a reminder, the term POJO (Plan Old Java Object) is used to describe a Java class without inheritance of a framework class.

As of the Eclipse 4.4 release you can also use a POJO in an extension for the org.eclipse.ui.views extension point. Use the e4view entry in the context menu of the extension to archive this. The resulting object is created via dependency injection.

For such a kind of view the existing toolbar and view extension point contributions do not work. To add for example a toolbar to your e4view, get the MToolbar injected into its implementation and construct the entries in your source code.

11.2. Supporting part descriptors in an Eclipse 4.5 IDE

The Eclipse 4.5 IDE release will support the contribution of part descriptor model elements via fragments or processors.

If you use the org.eclipse.e4.legacy.ide.application ID to contribute your part descriptors, the views can be opened via the Window ▸ Show View ▸ Other…​ dialog or via the Quick Access. This requires that you add the View tag to such a part descriptor.

Eclipse 3.x API RCP applications running on top of a 4.5 or higher runtime can use the same approach.

11.3. Adding perspectives to the Eclipse IDE via model snippets

Your model fragment or processor can also contribute a perspective to an Eclipse 4.x IDE. For this add a perspective via a snippet. This snippet must again contribute to the application via the org.eclipse.e4.legacy.ide.application ID.

This approach can also be used to contribute a perspective to your Eclipse 3.x API based RCP application running on top of an Eclipse 4.x runtime but this depends on the specifics of your application.

12. Exercise: Adding e4view based parts to 3.x based applications

12.1. Target

In this exercise you create an Eclipse 3.x RCP application and add a POJO part to it based on the e4view element available to contribute an extension point based view.

12.2. Using e4part and the org.eclipse.ui.views extension point

Create an Eclipse 3.x RCP application based on the RCP application with a view template via File ▸ New ▸ Other…​ ▸ Plug-in Project. Call the project com.vogella.rcp.eclipse3x.e4view and select the options similar to the following screenshots.

eclipse3rcp e4viewexample10
eclipse3rcp e4viewexample20
eclipse3rcp e4viewexample30

Add org.eclipse.e4.ui.di as a dependency to the manifest of your new plug-in.

Create the following class.

package com.vogella.rcp.eclipse3x.e4view;

import javax.annotation.PostConstruct;

import org.eclipse.e4.ui.di.Focus;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;

public class ViewEclipse4x  {
        private TableViewer viewer;

        @PostConstruct
        public void createPartControl(Composite parent) {
                viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL
                                | SWT.V_SCROLL);
                viewer.setContentProvider(ArrayContentProvider.getInstance());
                viewer.setLabelProvider(new LabelProvider());
                viewer.setInput(new String[] {"One", "Two", "Three"});
        }

        @Focus
        public void setFocus() {
                viewer.getControl().setFocus();
        }
}

Afterwards add an e4view extension for the org.eclipse.ui.views extension point. For this use the Extensions tab of the plugin.xml editor.

Adding e4view entry
Eclipse 4.x based view

12.3. Add the view to a perspective extension

To be able to see the new view, add it to the existing perspective extension as depicted in the following screenshot.

Adding a view to an existing perspective

12.4. Validating

Start your Eclipse 3.x application and validate that the new part is displayed.

13. Exercise: Adding e4 part descriptors to 3.x based applications

13.1. Target

In this exercise you add a model based part contribution to an Eclipse 3.x RCP application.

13.2. Adding a part descriptor

Create a simple plug-in called com.vogella.plugin.partdescriptor.

Add the following dependencies to your manifest file.

  • org.eclipse.core.runtime

  • org.eclipse.jface

  • org.eclipse.e4.ui.model.workbench

  • org.eclipse.e4.ui.di

Create the following class

package com.vogella.plugin.partdescriptor;

import javax.annotation.PostConstruct;

import org.eclipse.e4.ui.di.Focus;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;

public class PartEclipse4x  {
        private TableViewer viewer;

        @PostConstruct
        public void createPartControl(Composite parent) {
                viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL
                                | SWT.V_SCROLL);
                viewer.setContentProvider(ArrayContentProvider.getInstance());
                viewer.setLabelProvider(new LabelProvider());
                viewer.setInput(new String[] {"One", "Two", "Three"});
        }

        @Focus
        public void setFocus() {
                viewer.getControl().setFocus();
        }
}

Add a new model fragment to this plug-in via File ▸ New ▸ Other…​ ▸ Eclipse 4 ▸ Model ▸ New Model Fragment.

Adding a part descriptor to the Eclipse IDE
Adding a part descriptor to the Eclipse IDE
Adding a part descriptor to the Eclipse IDE

13.3. Validating

Start an instance of the Eclipse IDE and validate that you can open the parts via the Quick Access box (shortcut CTRL+3).

NOTE:In Eclipse 4.4 the part descriptor can only be opened via the Quick Access box. In Eclipse 4.5 it is planned that it can also be opened via the Window ▸ Show View menu entry.

14. Adding model addons to 3.x based applications

Similar to [e4commandsin3x] you can add model add-ons to your Eclipse 3.x application. This allows you to register for the event service.

15. Contribute a menu to existing Part

15.1. Overview

In this example we will add a new context menu entry to the Package Explorer part. The context menu is displayed if the user selects a file in the package explorer via a right mouse click. We will offer the option to create a HTML page from a Java source file.

To contribute to an existing menu or toolbar, you need to know the corresponding ID. This ID can be found via the Menu Spy. To start the Menu Spy use ALT + Shift + F2 and click on the menu entry you are interested in.

15.2. Contribute to the Package Explorer

Create a new plug-in project called de.vogella.plugin.htmlconverter. Do not use a template.

Open the META-INF/MANIFEST.MF file. Select the Dependencies tab and add the following dependencies to your plug-in.

  • org.eclipse.jdt.core

  • org.eclipse.core.runtime

  • org.eclipse.core.resources

  • org.eclipse.core.expressions

Open the Extensions tab in your editor, or if the tab is not visible, click the Extensions link on the Overview tab. Add a command with the ID de.vogella.plugin.htmlconverter.convert and the default handler de.vogella.plugin.htmlconverter.handler.ConvertHandler to your plug-in.

Add this command to the menu via the extension point org.eclipse.ui.menus and use popup:org.eclipse.jdt.ui.PackageExplorer as the locationURI. Set the label to Create HTML for this contribution.

The resulting file plugin.xml should look like the following.

<?xml version="1.0" encoding="utf-8"?>
<?eclipse version="3.4"?>
<plugin>
        <extension point="org.eclipse.ui.menus">
                <menuContribution locationURI="popup:org.eclipse.jdt.ui.PackageExplorer">
                        <command commandId="de.vogella.plugin.htmlconverter.convert"
                                label="Create HTML" style="push">
                        </command>
                </menuContribution>
        </extension>
        <extension point="org.eclipse.ui.commands">
                <command defaultHandler="de.vogella.plugin.htmlconverter.handler.ConvertHandler"
                        id="de.vogella.plugin.htmlconverter.convert" name="Convert">
                </command>
        </extension>

</plugin>

Eclipse allows to save additional information for each file. You can use the IResource interface and the setPersistentProperty() and getPersistentProperty() methods. With these functions you can save Strings on files. We use these functions to save a directory for Java source files which were already exported via HTML.

Create the following ConvertHandler class.

package de.vogella.plugin.htmlconverter.handler;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.handlers.HandlerUtil;

public class ConvertHandler extends AbstractHandler {
        private QualifiedName path = new QualifiedName("html", "path");

        @Override
        public Object execute(ExecutionEvent event) throws ExecutionException {
                Shell shell = HandlerUtil.getActiveShell(event);
                ISelection sel = HandlerUtil.getActiveMenuSelection(event);
                IStructuredSelection selection = (IStructuredSelection) sel;

                Object firstElement = selection.getFirstElement();
                if (firstElement instanceof ICompilationUnit) {
                        createOutput(shell, firstElement);

                } else {
                        MessageDialog.openInformation(shell, "Info",
                                        "Please select a Java source file");
                }
                return null;
        }

        private void createOutput(Shell shell, Object firstElement) {
                String directory;
                ICompilationUnit cu = (ICompilationUnit) firstElement;
                IResource res = cu.getResource();
                boolean newDirectory = true;
                directory = getPersistentProperty(res, path);

                if (directory != null && directory.length() > 0) {
                        newDirectory = !(MessageDialog.openQuestion(shell, "Question",
                                        "Use the previous output directory?"));
                }
                if (newDirectory) {
                        DirectoryDialog fileDialog = new DirectoryDialog(shell);
                        directory = fileDialog.open();

                }
                if (directory != null && directory.length() > 0) {
                        setPersistentProperty(res, path, directory);
                        write(directory, cu);
                }
        }

        protected String getPersistentProperty(IResource res, QualifiedName qn) {
                try {
                        return res.getPersistentProperty(qn);
                } catch (CoreException e) {
                        return "";
                }
        }

        protected void setPersistentProperty(IResource res, QualifiedName qn,
                        String value) {
                try {
                        res.setPersistentProperty(qn, value);
                } catch (CoreException e) {
                        e.printStackTrace();
                }
        }

        private void write(String dir, ICompilationUnit cu) {
                try {
                        cu.getCorrespondingResource().getName();
                        String test = cu.getCorrespondingResource().getName();
                        // Need
                        String[] name = test.split("\\.");
                        String htmlFile = dir + "\\" + name[0] + ".html";
                        FileWriter output = new FileWriter(htmlFile);
                        BufferedWriter writer = new BufferedWriter(output);
                        writer.write("<html>");
                        writer.write("<head>");
                        writer.write("</head>");
                        writer.write("<body>");
                        writer.write("<pre>");
                        writer.write(cu.getSource());
                        writer.write("</pre>");
                        writer.write("</body>");
                        writer.write("</html>");
                        writer.flush();
                } catch (JavaModelException e) {
                } catch (IOException e) {
                        e.printStackTrace();
                }

        }
}

If you start this plug-in, you should be able to create HTML output from a Java source file.

html40

15.3. Restrict the extension - Visible When

Currently our context menu is displayed all the time. We would like to show it only if a source file is selected. For this we will use a "visible-when" definition.

Add the org.eclipse.core.expressions plug-in as dependency to your plug-in. Select your menu contribution. Using the right mouse add the condition to the command that it should only be visible if a file is selected which represents a ICompilationUnit from the org.eclipse.jdt.core package.

For this exercise you use the predefined variable activeMenuSelection which contains the selection in the menu and iterate over it. If the selection can get adapted to ICompilationUnit, then the contribution will be visible.

This will result in the following plugin.xml

<?xml version="1.0" encoding="utf-8"?>
<?eclipse version="3.4"?>
<plugin>
   <extension
         point="org.eclipse.ui.menus">
      <menuContribution
            locationURI="popup:org.eclipse.jdt.ui.PackageExplorer">
         <command
               commandId="de.vogella.plugin.htmlconverter.convert"
               label="Create HTML"
               style="push">
            <visibleWhen
                  checkEnabled="false">
               <with
                     variable="activeMenuSelection">
                  <iterate
                        ifEmpty="false"
                        operator="or">
                     <adapt
                           type="org.eclipse.jdt.core.ICompilationUnit">
                     </adapt>
                  </iterate>
               </with>
            </visibleWhen>
         </command>
      </menuContribution>
   </extension>
   <extension
         point="org.eclipse.ui.commands">
      <command
            defaultHandler="de.vogella.plugin.htmlconverter.handler.Convert"
            id="de.vogella.plugin.htmlconverter.convert"
            name="Convert">
      </command>
   </extension>

</plugin>

If you now start your plug-in, the menu entry should only be visible if at least one compilation unit has been selected.

16. Accessing the IEclipseContext from 3.x API

The Eclipse 4.x IDE uses the IEclipseContext data structure to store central information about the IDE. You can access this information also via the Eclipse 3.x API. This approach is demonstrated with the following snippets. These code snippets assume that you are familiar with the 3.x API, if that is not the case you can skip this section.

For example, to access the context from an Eclipse 3.x API view, you can use the following snippet.

// get the context of a part
IEclipseContext partContext =
        (IEclipseContext) getViewSite().getService(IEclipseContext.class);

// or access directly a value in the context based on its key
EModelService service =
        (EModelService) getViewSite().getService(EModelService.class);

This snippet demonstrates the access via an Eclipse 3.x API handler.

// the following example assumes you are in a handler

// get context from active window
IEclipseContext windowCtx =
        (IEclipseContext)
                HandlerUtil.getActiveWorkbenchWindow(event).
                        getService(IEclipseContext.class);

// get context from active part
IEclipseContext ctx =
        (IEclipseContext) HandlerUtil.getActivePart(event).
                getSite().getService(IEclipseContext.class);

17. The usage of run configurations

17.1. What are run configurations?

A run configuration defines the environment which will be used to execute a generic launch. For example, it defines arguments to the Java virtual machine (VM), plug-in (classpath) dependencies, etc.

If you start an Eclipse application the corresponding run configuration is automatically created or updated.

If you are starting an Eclipse runtime IDE for testing, and clear the workspace location the next run will prompt you to choose a workspace.

17.2. Reviewing run configurations

To review and edit your run configurations select Run ▸ Run Configurations…​ from the Eclipse menu.

On the Main tab in the field Location, you specify where the Eclipse IDE creates the files necessary to start your Eclipse based application.

Shows the run configuration

17.3. Defining arguments

The run configuration allows you to add additional start arguments for your application on the Arguments tab. By default Eclipse includes already several parameters, e.g. parameters for -os,-ws and -arch to specify the architecture on which the application is running.

-consoleLog in the run configuration

To pass system properties to your Eclipse application, you can add launch parameters using the -D switch. As example, if you add the argument -Dmy.product.loglevel=INFO, you can get the "INFO" value with System.getProperties("my.product.loglevel").

The following table lists several useful launch arguments.

Table 1. Launch parameters
Parameter Description

consoleLog

Error messages of the running Eclipse application are written to standard-out (System.out) which can be viewed in the Eclipse IDE Console view that started the RCP application.

nl

Specifies the locale used for your application. The locale defines the language specific settings, i.e., which translation is used and the number, date and currency formatting. For example -nl en starts your application using the English language. This is useful for testing translations.

console

Provides access to an OSGi console where you can check the status of your application.

noExit

Keeps the OSGi console open even if the application crashes. This allows to analyze the application dependencies even if the application crashes during startup.

clearPersistedState

Deletes cached runtime changes of the Eclipse 4 application model.

17.4. Launch configuration and Eclipse products

If you are developing Eclipse RCP applications, the launch configuration is created based on the product configuration file. The launch configuration is also updated every time you start your application via the product.

You can use the created run configuration directly for starting the application again. In this case changes in the product configuration file are not considered.

Using an existing run configuration is a common source of frustration and time consuming error analysis. To ensure that you use the latest configuration from your product, start your application via the product file.

18. Common launch problems

18.1. Checklist for common launch problems

Errors in the run configurations of Eclipse RCP application are frequently the source of problems. This chapter describes common problems related to the start of RCP applications. It can be used as a reference in case you face issues during the startup of your application. The following table lists potential problems and solutions.

Table 2. Run configuration problems
Problem Investigate

"Could not resolve module" message during start up.

Check that all required plug-ins are included in your product configuration. Make sure that your product defines dependencies to all required plug-ins or features. See [runconfiguration_mainproblem]

Bundles may also require a certain version of the Java virtual machine, e.g., a bundle may require Java 1.6 and will therefore not load in a Java 1.5 VM. Check the MANIFEST.MF file on the Overview tab in the Execution Environments section which Java version is required.

"java.lang.RuntimeException: No application id has been found." message during start up.

See "Could not resolve module" message during start up error. In most cases also triggered by a missing plug-in dependency.

Strange behavior but no error message.

Check if your run configuration includes the -consoleLog parameter. This option allows you to see errors from Eclipse based applications in the Console view of the Eclipse IDE.

Runtime configuration is frequently missing required plug-ins

Make sure that your product or your feature(s) includes all required dependencies.

A change in the product Dependencies tab is not reflected in the run configuration (e.g., a new plug-in is added but is not included in the run configuration)

A product updates an existing run configuration if you start the product directly from the product definition file. If you select the run configuration directly, it will not be updated.

Application model changes are not reflected in the Eclipse 4 application.

Eclipse 4 persists user changes in the application in a delta file which is restored at startup. During development this might lead to situations where model changes are not correctly applied to the runtime model, e.g., you define a new menu entry and this entry is not displayed in your application. Either set the Clear flag on the Main tab in your run configuration or add the clearPersistedState parameter for your product configuration file or run configuration.

Services, e.g., key bindings or the selection service, are not working in an Eclipse 4 application.

In Eclipse releases before 4.3 every part needed to implement a @Focus method which places the focus on an SWT control. This error does not occur anymore with Eclipse 4.3 or a higher release.

Menu entries are disabled in the Eclipse application.

Ensure that the HandlerProcessingAddon class in the package org.eclipse.e4.ui.internal.workbench.addons is registered as model add-on. The bundle symbolic name is org.eclipse.e4.ui.workbench.

Application "org.eclipse.ant.core.antRunner" could not be found in the registry or Application could not be found in the registry.

Ensure that you have pressed the New…​ button in the product configuration file and selected the E4Application as application to start. You can check the current setting in your plugin.xml file on the Extensions tab and in the details of the org.eclipse.core.runtime.products extension.

18.2. Finding missing plug-in dependencies during a product launch

The most common problem is that some required plug-ins are missing in your product. If you are using a feature based product configuration, you need to ensure that all plug-ins which are referred to in the MANIFEST.MF file are also included in your features. This error is reported in the Console view, typically it is one of the first error messages and you need to scroll up to see it.

The following listing shows how this message typically looks like (formating changed to make the text fit better).

org.osgi.framework.BundleException:
   Could not resolve module: com.example.e4.rcp.todo.services [9]
      Unresolved requirement:
         Require-Bundle: com.example.e4.rcp.todo.events;
            bundle-version="1.0.0"

After identifying the missing plug-ins ensure that you add them to your product (if the product is plug-in based) or to your features (if the product is feature based).

Eclipse can check for missing dependencies automatically before you run the Launch configuration. On the Plug-ins Tab press the Validate Plug-ins button or select the _Validate plug-ins automatically prior to launching option. This will check if you have all the required plug-ins in your run configuration.

Validating the runtime configuration

Avoid fixing problems with dependencies in the run configuration because the run configuration is created and updated based on the product configuration file. So always ensure that the product file is correctly configured instead of changing the derived information. The product configuration is used for the export of your product, hence an error in the product dependencies results in an exported application which cannot be started.

19. Resources and Marker

Eclipse represents Resources like Projects, Files, Folders, Packages as IResource.

Marker represent additional information for resources, e.g., an error marker. Every marker can have attributes (key / value combination). Markers can be displayed in the standard view, e.g., the Task, Bookmark or the Problems view. To be displayed in these views, you have to use predefined attributes.

The following will demonstrate how to create marker for a selected resource.

20. Exercise: Create Markers for resources

Create a plug-in project de.vogella.plugin.markers. Add the following dependencies:

  • javax.inject

  • org.eclipse.core.resources

  • org.eclipse.jface

  • org.eclipse.e4.ui.services

  • org.eclipse.e4.core.di

  • org.eclipse.e4.core.services

  • org.eclipse.e4.ui.services

Create the command de.vogella.plugin.markers.AddMarker with a handler AddMarkerHandler in the de.vogella.plugin.markers.handler class and add this command to the menu.

Create the following code.

package de.vogella.plugin.markers.handler;

import javax.inject.Named;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.core.services.adapter.Adapter;
import org.eclipse.e4.ui.services.IServiceConstants;
import org.eclipse.jface.viewers.IStructuredSelection;


public class AddMarker {

        @Execute
        public void execute(@Named(IServiceConstants.ACTIVE_SELECTION) IStructuredSelection selection, Adapter adapter) {

                if (selection == null || selection.isEmpty()) {
                        return;
                }

                Object firstElement = selection.getFirstElement();
                IResource resource = adapter.adapt(firstElement, IResource.class);

                if (resource != null) {
                        writeMarkers(resource);
                }

        }

        private void writeMarkers(IResource resource) {
                try {
                        IMarker marker = resource.createMarker(IMarker.TASK);
                        marker.setAttribute(IMarker.MESSAGE, "This is a task");
                        marker.setAttribute(IMarker.PRIORITY, IMarker.PRIORITY_HIGH);
                } catch (Exception e) {
                        e.printStackTrace();
                }
        }

}

If you run, you can create a marker in the TODO list if you select a Java project and click your menu entry.

marker40

21. Adapters

21.1. What are adapters?

Adapters help to display information about objects in view without having to adjust the existing views. In this example we will create a small view which allows to select objects and use the properties view to display them.

Adapters are used on several places, for example, you can use an adapter to display your data in the outline view. See Outline View Example for an example on how to do this.

22. Exercise - Adapters for the Properties view

We will simply use an adapter to show our data in the Properties view.

Create a new plug-in project de.vogella.plugin.adapter.

Add the following dependencies in the dependencies tab of the MANIFEST.MF file:

  • org.eclipse.core.runtime

  • org.eclipse.e4.ui.model.workbench

  • org.eclipse.e4.ui.services

  • org.eclipse.e4.ui.workbench

  • org.eclipse.ui

  • org.eclipse.ui.views

Create the following Todo class as data model.

package de.vogella.plugin.adapter.model;

public class Todo {

        private String summary;
        private String description;
        private boolean done;

        public String getSummary() {
                return summary;
        }

        public void setSummary(String summary) {
                this.summary = summary;
        }

        public String getDescription() {
                return description;
        }

        public void setDescription(String description) {
                this.description = description;
        }

        public boolean isDone() {
                return done;
        }

        public void setDone(boolean done) {
                this.done = done;
        }

}

Create a model fragment (fragment.e4xmi) and add a PartDescriptor called Sample View.

adapter todo descriptor

Create SampleView.java as part for the PartDescriptor implementation.

package de.vogella.plugin.adapter.views;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.PostConstruct;

import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;

import de.vogella.plugin.adapter.model.Todo;

public class SampleView {

        private TableViewer viewer;

        class ViewLabelProvider extends LabelProvider implements ITableLabelProvider {
                public String getColumnText(Object obj, int index) {
                        Todo todo = (Todo) obj;
                        return todo.getSummary();
                }

                public Image getColumnImage(Object obj, int index) {
                        return getImage(obj);
                }

                public Image getImage(Object obj) {
                        return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_ELEMENT);
                }
        }

        /**
         * This is a callback that will allow us to create the viewer and initialize
         * it.
         */
        @PostConstruct
        public void createPartControl(Composite parent, ESelectionService selectionService) {
                viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
                viewer.setContentProvider(new ArrayContentProvider());
                viewer.setLabelProvider(new ViewLabelProvider());
                viewer.addSelectionChangedListener(new ISelectionChangedListener() {

                        @Override
                        public void selectionChanged(SelectionChangedEvent event) {
                                selectionService.setSelection(event.getSelection());
                        }
                });

                viewer.setInput(getElements());
        }

        // Build up a simple data model
        private List<Todo> getElements() {
                List<Todo> todos = new ArrayList<>();
                Todo todo = new Todo();
                todo.setSummary("First Todo");
                todo.setDescription("A very good description");
                todo.setDone(true);
                todos.add(todo);
                todo = new Todo();
                todo.setSummary("Second Todo");
                todo.setDescription("Second super description");
                todos.add(todo);

                return todos;
        }
}

After this change, you should be able to run your project, open your view and see your to-do items.

To display the Todo values in the Properties view, add the extension point org.eclipse.core.runtime.adapters to your project.

The data of the extension point should be like the following:

<extension
         point="org.eclipse.core.runtime.adapters">
      <factory
            adaptableType="de.vogella.plugin.adapter.model.Todo"
            class="de.vogella.plugin.adapter.TodoAdapterFactory">
         <adapter
               type="org.eclipse.ui.views.properties.IPropertySource">
         </adapter>
      </factory>
</extension>

Implement the IPropertySource interface to provide it for the Properties view.

package de.vogella.plugin.adapter;

import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.IPropertySource;
import org.eclipse.ui.views.properties.TextPropertyDescriptor;

import de.vogella.plugin.adapter.model.Todo;

public class TodoPropertySource implements IPropertySource {

        private final Todo todo;

        public TodoPropertySource(Todo todo) {
                this.todo = todo;
        }


        @Override
        public boolean isPropertySet(Object id) {
                return false;
        }

        @Override
        public Object getEditableValue() {
                return this;
        }

        @Override
        public IPropertyDescriptor[] getPropertyDescriptors() {

                return new IPropertyDescriptor[] {
                                new TextPropertyDescriptor("summary", "Summary"),
                                new TextPropertyDescriptor("description", "Description") };
        }

        @Override
        public Object getPropertyValue(Object id) {
                if (id.equals("summary")) {
                        return todo.getSummary();
                }
                if (id.equals("description")) {
                        return todo.getDescription();
                }
                return null;
        }

        @Override
        public void resetPropertyValue(Object id) {

        }

        @Override
        public void setPropertyValue(Object id, Object value) {
                String s = (String) value;
                if (id.equals("summary")) {
                        todo.setSummary(s);
                }
                if (id.equals("description")) {
                        todo.setDescription(s);
                }
        }

}

Implement the factory and the new class TodoPropertySource which implements IPropertySource.

package de.vogella.plugin.adapter;

import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.ui.views.properties.IPropertySource;

import de.vogella.plugin.adapter.model.Todo;

public class TodoAdapterFactory implements IAdapterFactory {

        // use a static final field so that the adapterList is only instanciated once
        private static final Class<?>[] adapterList = new Class<?>[] { IPropertySource.class };

        @Override
        public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
                if (adapterType== IPropertySource.class && adaptableObject instanceof Todo){
                        return adapterType.cast(new TodoPropertySource((Todo) adaptableObject));
                }
                return null;
        }

        @Override
        public Class<?>[] getAdapterList() {
                return adapterList;
        }

}

If you run your workbench and open your view via Windows ▸ Show ▸ View ▸ Others ▸ Sample Category ▸ Sample View and you select a data element in your viewer you should see your data in the Properties view.

adapter40

23. Exercise - Adapters and the WorkbenchLabelProvider

The de.vogella.plugin.adapter plug-in from [adapters_propertyview_example] should be reused for this exercise.

Create another PartDescriptor called WorkbenchAdapter Sample, which also has the Sample Category category.

adapter todo workbenchadapter descriptor

Create SampleWorkbenchAdapterView.java as part for the PartDescriptor implementation. The only difference to the previous SampleView is that a DelegatingStyledCellLabelProvider is used as LabelProvider, which takes the WorkbenchLabelProvider as IStyledLabelProvider implementation.

package de.vogella.plugin.adapter.views;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.PostConstruct;

import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.model.WorkbenchLabelProvider;

import de.vogella.plugin.adapter.model.Todo;

public class SampleWorkbenchAdapterView {

        private TableViewer viewer;

        /**
         * This is a callback that will allow us to create the viewer and initialize
         * it.
         */
        @PostConstruct
        public void createPartControl(Composite parent, ESelectionService selectionService) {
                viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
                viewer.setContentProvider(new ArrayContentProvider());

                // make use of the DelegatingStyledCellLabelProvider with the WorkbenchLabelProvider as IStyledLabelProvider implementation
                viewer.setLabelProvider(new DelegatingStyledCellLabelProvider(new WorkbenchLabelProvider()));
                viewer.addSelectionChangedListener(new ISelectionChangedListener() {

                        @Override
                        public void selectionChanged(SelectionChangedEvent event) {
                                selectionService.setSelection(event.getSelection());
                        }
                });

                viewer.setInput(getElements());
        }

        // Build up a simple data model
        private List<Todo> getElements() {
                List<Todo> todos = new ArrayList<>();
                Todo todo = new Todo();
                todo.setSummary("First Todo");
                todo.setDescription("A very good description");
                todo.setDone(true);
                todos.add(todo);
                todo = new Todo();
                todo.setSummary("Second Todo");
                todo.setDescription("Second super description");
                todos.add(todo);

                return todos;
        }
}

When using a WorkbenchLabelProvider the objects, which are supposed to be shown in the Viewer should provide an adapter for the IWorkbenchAdapter, IWorkbenchAdapter2 and IWorkbenchAdapter3 interface, but at least for the the IWorkbenchAdapter. These interfaces can be used by the WorkbenchLabelProvider in order to determine how the objects should be visualized.

To provide these adapters for the WorkbenchLabelProvider a TodoWorkbenchAdapter is created. It derives from WorkbenchAdapter, which is an abstract class that implements all three interfaces.

package de.vogella.plugin.adapter;

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.StyledString;
import org.eclipse.jface.viewers.StyledString.Styler;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.TextStyle;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.model.WorkbenchAdapter;

import de.vogella.plugin.adapter.model.Todo;

public class TodoWorkbenchAdapter extends WorkbenchAdapter {

        @Override
        public ImageDescriptor getImageDescriptor(Object object) {
                return PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJ_ELEMENT);
        }

        @Override
        public StyledString getStyledText(Object object) {
                if (object instanceof Todo) {
                        Todo todo = (Todo) object;
                        StyledString styledString = new StyledString(todo.getSummary());
                        if (todo.isDone()) {
                                Styler styler = new Styler() {

                                        @Override
                                        public void applyStyles(TextStyle textStyle) {
                                                // Todos, which are done should have a green background
                                                textStyle.background = Display.getCurrent().getSystemColor(SWT.COLOR_GREEN);
                                        }
                                };
                                styledString.setStyle(0, todo.getSummary().length(), styler);

                        }
                        return styledString;
                }
                return super.getStyledText(object);
        }

}

Now the TodoAdapterFactory has to be extended to also provide the TodoWorkbenchAdapter.

package de.vogella.plugin.adapter;

import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.ui.model.WorkbenchAdapter;
import org.eclipse.ui.views.properties.IPropertySource;

import de.vogella.plugin.adapter.model.Todo;

public class TodoAdapterFactory implements IAdapterFactory {

        // use a static final field so that the adapterList is only instanciated once
        private static final Class<?>[] adapterList = new Class<?>[] { IPropertySource.class, WorkbenchAdapter.class };

        @Override
        public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
                if (adapterType== IPropertySource.class && adaptableObject instanceof Todo){
                        return adapterType.cast(new TodoPropertySource((Todo) adaptableObject));
                } else if (adapterType.isAssignableFrom(WorkbenchAdapter.class) && adaptableObject instanceof Todo) {
                        return adapterType.cast(new TodoWorkbenchAdapter());
                }
                return null;
        }

        @Override
        public Class<?>[] getAdapterList() {
                return adapterList;
        }

}

Now that the TodoAdapterFactory can also return WorkbenchAdapter objects, it also has to be specified in the org.eclipse.core.runtime.adapters extension point.

adapter workbenchadapter extension point

The result should look similar this:

adapter todo workbenchadapter view

24. Eclipse Resources

You can register IResourceChangeListener on resources in Eclipse. For example, if you have a project, you can add or remove a resource listener to or from it.

// add listener
project.getWorkspace().addResourceChangeListener(listener);

// Remove listener
project.getWorkspace().removeResourceChangeListener(listener);

// Example resource listener
private IResourceChangeListener listener = new IResourceChangeListener() {
                public void resourceChanged(IResourceChangeEvent event) {

                if (event.getType() == IResourceChangeEvent.PRE_CLOSE || event.getType() == IResourceChangeEvent.PRE_DELETE) {
                                if (event.getResource().equals(project)) {
                                        // Project deleted or closed
                                        // do something
                                }
                                return;
                        }

                        if (resource == null)
                                return;

                        IResourceDelta delta = event.getDelta().findMember(new Path(resource.getURI().toPlatformString(false)));
                        if (delta == null) {
                                return;
                        }

                        if (delta.getKind() == IResourceDelta.REMOVED) {
                                // Resource delete
                                // do something
                        }
                }

        };

25. Early startup actions

The Eclipse platform provides the org.eclipse.ui.startup extension point via the org.eclipse.ui plug-in. NOTE: This extension point is not used for Eclipse 4 RCP applications, use a life cycle hook or model add-on to archive similar behavior.

To implement an extension to this extension point, select Add…​ on the Extensions tab of the plugin.xml editor and point to a class implementing the IStartup interface.

26. About this website

27. Eclipse plug-in development resources

27.1. vogella GmbH training and consulting support

TRAINING SERVICE & SUPPORT

The vogella company provides comprehensive training and education services from experts in the areas of Eclipse RCP, Android, Git, Java, Gradle and Spring. We offer both public and inhouse training. Whichever course you decide to take, you are guaranteed to experience what many before you refer to as “The best IT class I have ever attended”.

The vogella company offers expert consulting services, development support and coaching. Our customers range from Fortune 100 corporations to individual developers.

Copyright © 2012-2016 vogella GmbH. Free use of the software examples is granted under the terms of the EPL License. This tutorial is published under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Germany license.

See Licence.

Unresolved directive in - include::./web/vgwort/EclipsePlugin.adoc[]