Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » code Generation
code Generation [message #175295] Mon, 04 April 2005 10:30 Go to next message
Eclipse UserFriend
Originally posted by: jdelgad.correo.ugr.es

Hi all,

I have a GEF based application which allows to create a graphical
diagram, like the logic example. Now I would like to generate java code
for a graphical diagrama, i.e. when you add a new figure to the diagram
some code must be added to a java file. How can I do this? Do you have
done something similar to it.

Thank you very much
Re: code Generation [message #175452 is a reply to message #175295] Mon, 04 April 2005 20:52 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
That is related to your model and not concerned with GEF. VE does that, so
you can see how they do that.

"Jose" <jdelgad@correo.ugr.es> wrote in message
news:74d314276d8ae819a3e9d2f20caa765d$1@www.eclipse.org...
> Hi all,
>
> I have a GEF based application which allows to create a graphical
> diagram, like the logic example. Now I would like to generate java code
> for a graphical diagrama, i.e. when you add a new figure to the diagram
> some code must be added to a java file. How can I do this? Do you have
> done something similar to it.
>
> Thank you very much
>
Re: code Generation [message #175545 is a reply to message #175295] Tue, 05 April 2005 08:54 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: kedar.thakur.gmail.com

Hi ther,

One way to think about it would be to create the file while persisting the
GEF model.
In this way any modifications to the GEF model will cause the Java file to
change.
So if you have a figure with 4 named squares say A,B,C,D that correspond to
4 Java classes, then while storing the GEF model, create
the file with say the following text

public class ####{
}

where the #### could be the class name.

Clearly you need a template of some sort for anything more complex.
for eg. the class might not have public access but package acess instead. in
that case the user might set a flag for each
class (A,true) (B,false)

the template becomess

%%%% class ####{
}

which would create 2 classes

public class A{
}

and
class B{
}


the template would make things more flexible.

i hope that was useful.

Kedar T



"Jose" <jdelgad@correo.ugr.es> wrote in message
news:74d314276d8ae819a3e9d2f20caa765d$1@www.eclipse.org...
> Hi all,
>
> I have a GEF based application which allows to create a graphical
> diagram, like the logic example. Now I would like to generate java code
> for a graphical diagrama, i.e. when you add a new figure to the diagram
> some code must be added to a java file. How can I do this? Do you have
> done something similar to it.
>
> Thank you very much
>
Re: code Generation [message #175759 is a reply to message #175295] Wed, 06 April 2005 07:46 Go to previous message
Eclipse UserFriend
Originally posted by: bartgolsteijn.hotmail.com

Have a look at the Java Emitter Templates (JET), part of EMF.

There are two articles on the Eclipse pages about JET:

JET Tutorial Part 1 (Introduction to JET)
http://www.eclipse.org/articles/Article-JET/jet_tutorial1.ht ml

JET Tutorial Part 2 (Write Code that Writes Code)
http://www.eclipse.org/articles/Article-JET2/jet_tutorial2.h tml

Hope that helps,

Bart Golsteijn


Jose wrote:
> Hi all,
>
> I have a GEF based application which allows to create a graphical
> diagram, like the logic example. Now I would like to generate java code
> for a graphical diagrama, i.e. when you add a new figure to the diagram
> some code must be added to a java file. How can I do this? Do you have
> done something similar to it.
>
> Thank you very much
>
Previous Topic:LineBorder, ConnectionAnchors and Zooming
Next Topic:Connections start flying when I zoom
Goto Forum:
  


Current Time: Wed Feb 08 07:15:43 GMT 2023

Powered by FUDForum. Page generated in 0.02447 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top