Thursday, April 10, 2008

An Automatic generation of EMF Editor Idea

I am quite busy right now, however I have an idea which does not allow me to focus on my task.

Could you please imagine, that you have generated your model and .edit code, and now you want to have nice editor...

EMF generates one, but I'd say its rather a good start point than real editor.

But please imagine that you can are able to metamark your model like on example:

@RootObject(cardinality="1", displayType="Shell Title", displayValue="getName")
//@RootObject(cardinality="*", displayType="list", canCreateNew="true", displayValue="getName")
public interface RootModelClass (){

public String getName();

@Edit(canCreateNew=true, asSubsection="true", value="getName")
public ChildModelClass getChildren();

@TabbedEdit(tabs="first, second")
public interface ChildModelClass (){
@Edit (Editor="Text" flags = "SWT.SINGLE" validator="ExemplaryValidator")
public getName();

@Edit(canCreateNew="true", Editor="RecursiveTree")
public ChildModelClass getChildren();


Generated editor for this example should put the name of the root object as a title of an application/itself, display a list of the children, and then, depending on the child selection, display a recursive tree with child children. On selection of the 2nd level child a new section could be displayed that would allow for edition.

I know this is a rough, incomplete and inconsistent idea, but I'd love to hear any feedback on this.


1 comment:

Ed Merks said...

It's of course a great idea. It is similar to what Michael Scharf did with Annotation driven EMF Editor. It's probably better to annotate the Ecore model rather than the generated Java code because then it could be applied even to dynamic models. E.g.,

@model annotation="uri key='value'"

Folks like Jim van Dam and Yves Yang are looking at an even more sophisticated approach using a separate model that describes the "intent" of the GUI, binds it to a particular rendering technology, like Eclipse, and the lets you style it (fonts, colors, layouts). Jim calls this Intentional UI Modeling.