Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




Eclipse Plug-in Developer Guide
Previous Page Home Next Page

Running the plug-in

We have all the pieces needed to run our new plug-in. Now we need to build the plug-in. If your Eclipse workbench is set up to build automatically, then your new view class should have compiled as soon as you saved the new content. If not, then select your new project and choose Project > Build Project . The class should compile without error.

There are two ways to run a plug-in once it has been built.

  1. The plug-in's manifest files and jar file can be installed in the eclipse/plugins directory. When the workbench is restarted, it will find the new plug-in.
  2. The PDE tool can be used to run another workbench from within your current workbench. This runtime workbench is handy for testing new plug-ins immediately as you develop them from your workbench. (For more information about how a runtime workbench works, check the PDE guide.)

For simplicity, we'll run the new plug-in from within the Eclipse workbench.

Launching the workbench

To launch a runtime workbench, choose Run > Run... . This dialog will show you all the different kinds of ways you can launch a program. Choose Eclipse Application, click New and accept all of the default settings. This will cause another instance of the Eclipse workbench, the runtime workbench, to start.

Running Hello World

So where is our new view? We can see all of the views that have been contributed by plug-ins using the Window > Show View menu.

This menu shows us what views are available for the current perspective. You can see all of the views that are contributed to the platform (regardless of perspective) by selecting Other.... This will display a list of view categories and the views available under each category.

The workbench creates the full list of views by using the extension registry to find all the plug-ins that have provided extensions for the org.eclipse.ui.views extension point.

Show View dialog with Hello entry

There we are! The view called "Hello View" has been added to the Show View window underneath our category "Hello Category." The labels for our category and view were obtained from the extension point configuration markup in the plugin.xml.

Up to this point, we still have not run our plug-in code!  The declarations we made in the plugin.xml (which can be seen by other plug-ins using the extension registry) are enough for the workbench to find out that there is a view called "Hello View" available in the "Hello" category. It even knows what class implements the view. But none of our code will be run until we decide to show the view.

If we choose the "Hello View" view from the Show View list, the workbench will activate our plug-in, instantiate and initialize our view class, and show the new view in the workbench along with all of the other views. Now our code is running. 

Workbench with Hello World view

There it is, our first plug-in! We'll cover more specifics about UI classes and extension points later on.

  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire