Chapter 1. Contributing to Eclipse user interface

Kermeta isn't dedicated to build user interface, however, you may embed your kermeta application in Eclipse user interface to make it simple to use for the end users. We present here some basic informations for those who which to build such user interface. For more details or for different integration in Eclipse, the reader should refer to the eclipse Platform Plug-in Developer Guide (available in the eclipse help or http://help.eclipse.org/help32/index.jsp .

1.1. Contributing a popup action to eclipse

This should be done from a valid plugin project.

  1. Open the META-INF/MANIFEST.MF file.

  2. Open the tab Extensions.

  3. Click on Add and select the Extension wizards tab.

  4. You'll follow the steps provided by the Popup Menu Wizard and give a meaninful name to your action.

  5. You can optionnally set the nameFilter wild card in order to restrict the popup to some file extesion only.

You now have a NewAction.java file that you can edit to perform the actions you wish, for example by calling kermeta interpreter like explained in Chapter 3, Launching a kermeta program in interpreted mode.

[Tip]Tip

Obviously, you can reuse this wizard on other kind of interface, for example to provide an Action set or an Help content.

1.2. Deploying a plugin with Kermeta code for interpreted mode

If you wish to deploy some kermeta code for your end users, you must take care of some rules :

It must be put into a bundle (or eclipse plugin). To do so, the project containing the kermeta code must be a valid Eclipse plugin project.

Make sure to deploy the kmt file in the distributes version. In the manifest.mf, in the Build tab, make sure that the files/folders you want to deploy are checked in the Build section. Otherwise, your plugin will work in development mode but will fail once deployed in your user platform.

1.3. Transforming a project into a plugin project

There are some simple steps that you can follow to obtain a valid Eclipse plugin project.

1.3.1. Use the new Plugin project wizard

This is the simpliest approach.

First, if your project already use the name of the plugin you want to create, rename it to another name.

Then, use the New plugin project wizard from Eclipse.

File > New  > Project...  > Plugin Project

Then, follow the wizard.

If this plugin is a user interface for one of your metamodel, you should consider adding the postfix .ui to your project name.

[Tip]Tip

Using this wizard, you can also create some template popup, action, help, etc as in Section 1.1, “Contributing a popup action to eclipse”

1.3.2. Manually add the missing elements

You can achieve more or less the same result by adding some data in the following files.

Add the java and plugin nature to your project and the associated buildCommand For this add something similar in the .project file at the root of your eclipse project.

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
	<name>your.plugin.name.ui</name>
	<comment></comment>
	<projects>
	</projects>
	<buildSpec>
		<buildCommand>
			<name>fr.irisa.triskell.kermeta.kpm.kpmBuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>org.eclipse.jdt.core.javabuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>org.eclipse.pde.ManifestBuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>org.eclipse.pde.SchemaBuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
	</buildSpec>
	<natures>
		<nature>org.eclipse.pde.PluginNature</nature>
		<nature>org.eclipse.jdt.core.javanature</nature>
	</natures>
</projectDescription>
[Tip]Tip

If you see the .project file, use the Navigator view that show all the files including the hidden ones.

Add a .classpath file like:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
	<classpathentry kind="src" path="src"/>
	<classpathentry kind="output" path="bin"/>
</classpath>
			

Add a META-INF/MANIFEST.MF file like:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Your Plug-in
Bundle-SymbolicName: your.plugin.name.ui
Bundle-Version: 1.0.0
Bundle-Activator: your.plugin.name.ui.Activator
Require-Bundle: org.eclipse.ui,
 org.eclipse.core.runtime
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6