Developing the First Plug-in
This section helps you to get familiar with Eclipse plug-in development by walking you through how to develop the Eclipse Hello World plug-in and how you can integrate it with the Eclipse Workbench.
Installing Eclipse IDE
Download the Eclipse Luna distribution from the Eclipse downloads page.
The scope of this documentation is for WSO2 plug-in development on top of WSO2 Developer Studio Kernel 4.0.0, which is based on the Eclipse Luna release. Hence, starting with Luna will assist you in future steps. However, the Hello World plug-in can be developed on any Eclipse release.- Unpack the downloaded Eclipse distribution to a local directory.
After extracting the compressed file, start Eclipse using the commands shown below. No additional installation procedure is required.
Linux:./eclipse
Windows:
eclipse.exe
Â- On startup, you are prompted to define a workspace. You can change the default workspace and define your own. This workspace is where all the projects you create are saved.
Developing the Eclipse Hello World Plug-in
For the Eclipse Hello World plug-in, let's start out with a simple design. We're going to add a button to the Workbench toolbar where when the button is pressed, an information dialog box appears containing the string Hello World
. Pressing OKÂ will dismiss the dialog box.
- Click File > New > Project to open the new project wizard.
- Select Plug-in Project in the Plug-in Development category and click Next.
- Give the project name as
com.example.helloworld
and leave the default settings as shown below. Click Next. - Select Hello, World as the template and click Next.
- You can customise the action set values according to your preference or leave the default values. Click Finish.
- On the message that appears, click Yes to switch to the plug-in development perspective.
- The project is created, as shown below.
Â
Testing the plug-inÂ
The best way to test the plug-in is to use two Eclipse workbenches; one for plug-in development and another for testing and debugging.Â
- Right click the project and click Run As > Eclipse Application. Â
Eclipse automatically starts executing in a second workbench. This acts as the testing workbench.
This may appear to take a long time; when a second workbench opens, the operation is complete.- After launching the Eclipse instance, you see the Sample menu, which was contributed by your plug-in.
- Click the Sample menu and you see the Sample Action sub-menu.
 - Once you click Sample Action, the dialog box you created above appears.