A minimal plug-in

We all know what "Hello World" looks like in plain old Java without using any user interface frameworks or other specialized libraries.

   public class HelloWorld {
      public static void main(String[] args) {
         System.out.println("Hello World");

What happens to this old standard in the context of the Eclipse platform? Instead of thinking of Hello World as a self-contained program, we recast it as an extension of the platform. Since we want to say hello to the world, we need to figure out how to extend the workbench to include our greeting.

When we get deeper into the platform user interface components, we'll do an exhaustive review of the ways that you can extend and customize the workbench UI. For now, let's start with one of the simplest workbench extensions - a view. 

You can think of the workbench window as a frame that presents various visual parts. These parts fall into two major categories: views and editors.  We will look at editors later.  Views provide information about some object that the user is working with in the workbench. Views often change their content as the user selects different objects in the workbench.

Hello world view

For our hello world plug-in, we will implement our own view to greet the user with "Hello World."

The plug-in org.eclipse.ui.workbench defines most of the public interfaces that make up the workbench API. These interfaces can be found in the package org.eclipse.ui and its sub packages. Many of these interfaces have default implementation classes that you can extend to provide simple modifications to the system. In our hello world example, we will extend a workbench view to provide a label that says hello.

The interface of interest is IViewPart, which defines the methods that must be implemented to contribute a view to the workbench. The class ViewPart provides a default implementation of this interface. In a nutshell, a view part is responsible for creating the widgets needed to show the view.

The standard views in the workbench often display some information about an object that the user has selected or is navigating. Views update their contents based on actions that occur in the workbench. In our case, we are just saying hello, so our view implementation will be quite simple.

Before jumping into the code, we need to make sure our environment is set up for plug-in development...