Simple RCPML Plugin Example

Getting Started

The process of creating a RCPML plug-in is best demonstrated by implementing "Hello World" as a RCPML plug-in.

It is supposes that you already know how to create Eclipse plugin project. If you not, please refer to Eclipse Platform Developer Guide.

After you've created a project and package, you need to add dependency to org.rcpml.core plugin.

Hello World View

Create a new text file with xml extension.
It is useful to create new folder for all RCPML scripts.
Copy the contents below into the file you created:

<?xml version="1.0"?>
<ui:view xmlns="http://rcpml.org/swt" xmlns:ui="http://rcpml.org/ui">
	<label>Hello World</label>
</ui:view>

The Hello World manifests

Before we run the new view, we need to extend org.eclipse.ui.views extension point. To do it you can use manifest editor by double-clicking on plugin.xml or on META-INF/MANIFEST.MF. Also, you can simply paste selected part of code into plugin.xml file into the root of the project:

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<plugin>
   <extension
         point="org.eclipse.ui.views">
      <category
            id="rcpmlTest.category.helloworld"
            name="rcpml Hello World"/>
      <view
            category="rcpmlTest.category.helloworld"
            class="org.rcpml.core.RCPMLExtension:/scripts/helloworld.xml"
            id="rcpmlTest.view.helloworld"
            name="HelloWorld View"/>
   </extension>
</plugin>

The information about the view that we provided when we created the plug-in project was used to generate an entry in the plugin.xml file which defines our view extension. In the extension definition we define a category for the view including its name and id. Then we define the view itself, including its name and id, and associate it with the category using the id we have defined for our category.

When we implement native view we also specify the class that implements our view, but in RCPML we specify "org.rcpml.core.RCPMLExtension:/scripts/helloworld.xml" where RCPMLExtension is RCPML class which builds view from attribute /scripts/helloworld.xml

For more information about view extension-point please refer to Eclipse Platform Developer Guide.

Running the plug-in

When we run the plugin, we can see the following:

There it is, our first plug-in!

Labels

 
(None)