Archive for the ‘Eclipse’ Category

Writing Eclipse plugins with Groovy

Thursday, January 17th, 2008

Writing plugins for Eclipse with other languages than Java is not officially supported, but there is a way to write an Eclipse plugin with Groovy only. As prerequisites you need Eclipse with a JDT and the Groovy Eclipse plugin.

Follow the following steps. The source code is also available.

1. Create a new Plugin-in project, do not use any templates.
2. Add the Groovy Nature to the project.
3. Create a Java package under src
4. Create a Groovy class HelloGroovyWorld with the following contents

package hellogroovyworld

import org.eclipse.jface.action.IAction
import org.eclipse.jface.viewers.ISelection
import org.eclipse.ui.IWorkbenchWindow
import org.eclipse.ui.IWorkbenchWindowActionDelegate
import org.eclipse.jface.dialogs.MessageDialog

class HelloGroovyWorld implements IWorkbenchWindowActionDelegate {

	private IWorkbenchWindow window

	void run(IAction action) {
		MessageDialog.openInformation(
			window.getShell(),
			"Hellogroovyworld Plug-in",
			"Hello, Groovy world")
	}

	void selectionChanged(IAction action, ISelection selection) {}

	void dispose() {}

	void init(IWorkbenchWindow window) {
		this.window = window
	}
}

5. Edit the plugin.xml file:

5a. On the Dependencies tab add org.eclipse.ui and org.eclipse.core.runtime.
and org.codehaus.groovy.

5b. On the Runtime tab add bin-groovy to the classpath

5c. On the Extensions tab add an org.eclipse.ui.actionSets extension, set visible to true.
Add a menu and an action (Left click the ActionSet, right click and choose “new, menu and action”) and
choose HelloGroovyWorld as the class for the action. The plugin.xml is shown below.

   <extension
         point="org.eclipse.ui.actionSets">
      <actionSet
            id="hellogroovyworld.actionSet1"
            label="Groovy ActionSet"
            visible="true">
         <menu
               id="groovyMenu"
               label="Groovy Menu">
         </menu>
         <action
               class="hellogroovyworld.HelloGroovyWorld"
               id="hellogroovyworld.action2"
               label="Groovy World"
               menubarPath="groovyMenu"
               toolbarPath="groovyMenu"
               tooltip="Hello Groovy World">
         </action>
      </actionSet>
   </extension>

Now run the project as an Eclipse Application.

Hello Groovy World

Editor for the Common Warehouse Metamodel (CWM)

Monday, October 1st, 2007

The Common Warehouse Metamodel (CWM) is a standard by the Object Management Group (OMG). The intention of CWM is to define a standard for metadata in Data Warehouses and Business Intelligence applications. CWM uses the Meta Object Facility (MOF) as the underlying framework. MOF is also used in other standards of the OMG, for example UML.

My intention was to learn about CWM and it is very difficult to learn a data model by studying the specifications on paper. I wanted an interactive editor. But i did not find an open source editor in the net. I found a MOF complient database, the Metadata Repository (MDR) , but it does not have an editor.

So i decided to transform the CWM/MOF model to EMF and generate an editor from it.


CWM Eclipse Editor


Copyright © 2007-2011 Jörn Dinkla. All rights reserved.

###ENDMATTER