code Generation [message #175295] |
Mon, 04 April 2005 10:30  |
Eclipse User |
|
|
|
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 #175545 is a reply to message #175295] |
Tue, 05 April 2005 08:54   |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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
>
|
|
|
Powered by
FUDForum. Page generated in 0.01873 seconds