Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Visual Editor (VE) » Code generating
Code generating [message #87349] Sun, 17 April 2005 15:23 Go to next message
Eclipse UserFriend
Originally posted by: danijel_zecevic.hotmail.com

Hello,

I'm trying to extend VE and make a GUI builder for a framework we use on my
job. For now I made a component that can be chosen in new visual class
wizard and I made a javajet file that generates the code for a component,
that looks like that:

public class MyClass extends MyComponent{

public MyComponent()
{
buildUI();
}
private void buildUi()
{
buildComponents();
buildLayout();
}
private void buildComponents()
{
}
private void buildLayout()
{
GridBagLayoutHelper helper = new GridBagLayoutHelper(this);
}
}

But now I would like three things to hapen when i add new component to
MyComponent:

1.create new private variable of added component,
2. add line in buildComponents() that looks like this: newComponent =
MafFactory.createNewComponent();
3. add a line in buildLayout() that uses helper class and looks like that:
helper.add(newComponent);

For now as much as I understand extending VE this means it has to be done by
making a decoder and decoder helper which use AST as it was mentioned in
"Enabling support for custom widget" tutorial.

The problem is that I dont understand how can i get AST in method generate()
that is implemented in AbstractExpressionDecoder. So I wonder, is it right
for me to extend AbstractExpressionDecoder and SimpleAttributeDecoderHelper
to get the wanted result or is there some other way to achive that.

Also I would like to know when will you write a code generation tutorial?

Thank you,
Danijel
Re: Code generating [message #87718 is a reply to message #87349] Tue, 19 April 2005 17:48 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: danijel_zecevic.hotmail.com

Please anyone....



"ddd" <danijel_zecevic@hotmail.com> wrote in message
news:d3tv6u$m9l$1@news.eclipse.org...
> Hello,
>
> I'm trying to extend VE and make a GUI builder for a framework we use on
my
> job. For now I made a component that can be chosen in new visual class
> wizard and I made a javajet file that generates the code for a component,
> that looks like that:
>
> public class MyClass extends MyComponent{
>
> public MyComponent()
> {
> buildUI();
> }
> private void buildUi()
> {
> buildComponents();
> buildLayout();
> }
> private void buildComponents()
> {
> }
> private void buildLayout()
> {
> GridBagLayoutHelper helper = new GridBagLayoutHelper(this);
> }
> }
>
> But now I would like three things to hapen when i add new component to
> MyComponent:
>
> 1.create new private variable of added component,
> 2. add line in buildComponents() that looks like this: newComponent =
> MafFactory.createNewComponent();
> 3. add a line in buildLayout() that uses helper class and looks like that:
> helper.add(newComponent);
>
> For now as much as I understand extending VE this means it has to be done
by
> making a decoder and decoder helper which use AST as it was mentioned in
> "Enabling support for custom widget" tutorial.
>
> The problem is that I dont understand how can i get AST in method
generate()
> that is implemented in AbstractExpressionDecoder. So I wonder, is it right
> for me to extend AbstractExpressionDecoder and
SimpleAttributeDecoderHelper
> to get the wanted result or is there some other way to achive that.
>
> Also I would like to know when will you write a code generation tutorial?
>
> Thank you,
> Danijel
>
>
>
>
Re: Code generating [message #87846 is a reply to message #87349] Wed, 20 April 2005 14:05 Go to previous messageGo to next message
Srimanth  is currently offline Srimanth Friend
Messages: 225
Registered: July 2009
Senior Member
Hi Danijel,
Sorry for the late response. We were in the middle of a testpass.
Generally we add the dropped component as a child of the component on
which we drop. In your case, the added component should be a child of
some property bean (layout helper). I think this would require some GEF
edit policies on the component on which you are dropping, to basically
generate commands which make necessary changes to the model. Once the
changes are made to the model, codegen would be invoked to generate
appropriate statements in the methods.
By default VE has a code pattern where there is an 'initialize()'
method ['buildUI()' in your case], which adds all the child components
in Swing. However there is no helper class which adds the children
acoording to some layout.
Regards,
Sri.


ddd wrote:
> Hello,
>
> I'm trying to extend VE and make a GUI builder for a framework we use on my
> job. For now I made a component that can be chosen in new visual class
> wizard and I made a javajet file that generates the code for a component,
> that looks like that:
>
> public class MyClass extends MyComponent{
>
> public MyComponent()
> {
> buildUI();
> }
> private void buildUi()
> {
> buildComponents();
> buildLayout();
> }
> private void buildComponents()
> {
> }
> private void buildLayout()
> {
> GridBagLayoutHelper helper = new GridBagLayoutHelper(this);
> }
> }
>
> But now I would like three things to hapen when i add new component to
> MyComponent:
>
> 1.create new private variable of added component,
> 2. add line in buildComponents() that looks like this: newComponent =
> MafFactory.createNewComponent();
> 3. add a line in buildLayout() that uses helper class and looks like that:
> helper.add(newComponent);
>
> For now as much as I understand extending VE this means it has to be done by
> making a decoder and decoder helper which use AST as it was mentioned in
> "Enabling support for custom widget" tutorial.
>
> The problem is that I dont understand how can i get AST in method generate()
> that is implemented in AbstractExpressionDecoder. So I wonder, is it right
> for me to extend AbstractExpressionDecoder and SimpleAttributeDecoderHelper
> to get the wanted result or is there some other way to achive that.
>
> Also I would like to know when will you write a code generation tutorial?
>
> Thank you,
> Danijel
>
>
>
>
Re: Code generating [message #87903 is a reply to message #87846] Wed, 20 April 2005 19:13 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: danijel_zecevic.hotmail.com

Thanks Sri for reply,

but still, is there any way for me to get AST. I sopose there is some part
VE that deals with AST.

Thank you,
Danijel


"Sri Gunturi" <sgunturi@us.ibm.com> wrote in message
news:d45nll$54k$1@news.eclipse.org...
> Hi Danijel,
> Sorry for the late response. We were in the middle of a testpass.
> Generally we add the dropped component as a child of the component on
> which we drop. In your case, the added component should be a child of
> some property bean (layout helper). I think this would require some GEF
> edit policies on the component on which you are dropping, to basically
> generate commands which make necessary changes to the model. Once the
> changes are made to the model, codegen would be invoked to generate
> appropriate statements in the methods.
> By default VE has a code pattern where there is an 'initialize()'
> method ['buildUI()' in your case], which adds all the child components
> in Swing. However there is no helper class which adds the children
> acoording to some layout.
> Regards,
> Sri.
>
>
> ddd wrote:
> > Hello,
> >
> > I'm trying to extend VE and make a GUI builder for a framework we use on
my
> > job. For now I made a component that can be chosen in new visual class
> > wizard and I made a javajet file that generates the code for a
component,
> > that looks like that:
> >
> > public class MyClass extends MyComponent{
> >
> > public MyComponent()
> > {
> > buildUI();
> > }
> > private void buildUi()
> > {
> > buildComponents();
> > buildLayout();
> > }
> > private void buildComponents()
> > {
> > }
> > private void buildLayout()
> > {
> > GridBagLayoutHelper helper = new GridBagLayoutHelper(this);
> > }
> > }
> >
> > But now I would like three things to hapen when i add new component to
> > MyComponent:
> >
> > 1.create new private variable of added component,
> > 2. add line in buildComponents() that looks like this: newComponent =
> > MafFactory.createNewComponent();
> > 3. add a line in buildLayout() that uses helper class and looks like
that:
> > helper.add(newComponent);
> >
> > For now as much as I understand extending VE this means it has to be
done by
> > making a decoder and decoder helper which use AST as it was mentioned in
> > "Enabling support for custom widget" tutorial.
> >
> > The problem is that I dont understand how can i get AST in method
generate()
> > that is implemented in AbstractExpressionDecoder. So I wonder, is it
right
> > for me to extend AbstractExpressionDecoder and
SimpleAttributeDecoderHelper
> > to get the wanted result or is there some other way to achive that.
> >
> > Also I would like to know when will you write a code generation
tutorial?
> >
> > Thank you,
> > Danijel
> >
> >
> >
> >
Re: Code generating [message #87932 is a reply to message #87903] Wed, 20 April 2005 21:49 Go to previous messageGo to next message
Dave Orme is currently offline Dave OrmeFriend
Messages: 424
Registered: July 2009
Senior Member
ddd wrote:
> Thanks Sri for reply,
>
> but still, is there any way for me to get AST. I sopose there is some part
> VE that deals with AST.

I don't have time for a full answer at the moment, but this should get
you started:

You need to get the ICompilationUnit from the VE CompilationUnitEditor.
Then you call JavaCore.parseCompilationUnit to get an AST.


Best regards,


Dave Orme

--
Visual Editor Project lead
http://www.db4o.com -- The Open-source Java Object Database
http://xswt.sf.net -- XML-based SWT page description language
Re: Code generating [message #87947 is a reply to message #87932] Wed, 20 April 2005 22:00 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: danijel_zecevic.hotmail.com

That was ok.

thanks,
Danijel




"David J. Orme" <djo@coconut-palm-software.com> wrote in message
news:d46iqm$hqa$1@news.eclipse.org...
> ddd wrote:
> > Thanks Sri for reply,
> >
> > but still, is there any way for me to get AST. I sopose there is some
part
> > VE that deals with AST.
>
> I don't have time for a full answer at the moment, but this should get
> you started:
>
> You need to get the ICompilationUnit from the VE CompilationUnitEditor.
> Then you call JavaCore.parseCompilationUnit to get an AST.
>
>
> Best regards,
>
>
> Dave Orme
>
> --
> Visual Editor Project lead
> http://www.db4o.com -- The Open-source Java Object Database
> http://xswt.sf.net -- XML-based SWT page description language
Re: Code generating [message #88150 is a reply to message #87947] Thu, 21 April 2005 18:36 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: danijel_zecevic.hotmail.com

Hello,
it looks like I dont hav any idea how to get CompilationUnitEditor after
all.

I'm staring in ObjectDecoder and somhow I thot that the method generate
would lead me to CompilationUnitEditor, but no.

Please can you tell me in feu steps how would you do the thing I want to do
in few stwps.

Would you use ObjectDecoder and ExpressionDecoderHelper or would you do it
in a different way (if so, how)?

Thank you,
Danijel


"ddd" <danijel_zecevic@hotmail.com> wrote in message
news:d46j88$idn$1@news.eclipse.org...
> That was ok.
>
> thanks,
> Danijel
>
>
>
>
> "David J. Orme" <djo@coconut-palm-software.com> wrote in message
> news:d46iqm$hqa$1@news.eclipse.org...
> > ddd wrote:
> > > Thanks Sri for reply,
> > >
> > > but still, is there any way for me to get AST. I sopose there is some
> part
> > > VE that deals with AST.
> >
> > I don't have time for a full answer at the moment, but this should get
> > you started:
> >
> > You need to get the ICompilationUnit from the VE CompilationUnitEditor.
> > Then you call JavaCore.parseCompilationUnit to get an AST.
> >
> >
> > Best regards,
> >
> >
> > Dave Orme
> >
> > --
> > Visual Editor Project lead
> > http://www.db4o.com -- The Open-source Java Object Database
> > http://xswt.sf.net -- XML-based SWT page description language
>
>
Re: Code generating [message #88331 is a reply to message #88150] Sun, 24 April 2005 17:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: danijel_zecevic.hotmail.com

Hello,

I would really nead to know if there is any starting point for custom code
generating without using swt code generator. I somehow beleave that there
must be some basic methods generate() and decode() that is called when a
component is dropped on some other component and does not depend on java
coding style. Is it a must to use ObjectDecoder and ExpressionDecoderHelper
(or classes that implement IExpressionDecoder and IExpressionDecoderHelper)?
If so, how would direct me to build a Delphi GUI builder?

Please do some tutorials, we are waiting long enough. This is sily alredy,
you are making new features but noone has even understanding old ones. I'm
shure that there is lots of people looking at your homepage every day for
months, waitng to get some tutorials. You dont need to do prety tutorials
with lots of pictures just do case studyes in 10-20 centances (if you want
to do this you should start with this and uste that...) and all those fancy
tutorials will be made by others.

I hope you wont take this as a critique, becouse this is just a post from
desperate person looking day by day in your code with no progress.

Thank you,
Danijel


"ddd" <danijel_zecevic@hotmail.com> wrote in message
news:d48rku$hr$1@news.eclipse.org...
> Hello,
> it looks like I dont hav any idea how to get CompilationUnitEditor after
> all.
>
> I'm staring in ObjectDecoder and somhow I thot that the method generate
> would lead me to CompilationUnitEditor, but no.
>
> Please can you tell me in feu steps how would you do the thing I want to
do
> in few stwps.
>
> Would you use ObjectDecoder and ExpressionDecoderHelper or would you do it
> in a different way (if so, how)?
>
> Thank you,
> Danijel
>
>
> "ddd" <danijel_zecevic@hotmail.com> wrote in message
> news:d46j88$idn$1@news.eclipse.org...
> > That was ok.
> >
> > thanks,
> > Danijel
> >
> >
> >
> >
> > "David J. Orme" <djo@coconut-palm-software.com> wrote in message
> > news:d46iqm$hqa$1@news.eclipse.org...
> > > ddd wrote:
> > > > Thanks Sri for reply,
> > > >
> > > > but still, is there any way for me to get AST. I sopose there is
some
> > part
> > > > VE that deals with AST.
> > >
> > > I don't have time for a full answer at the moment, but this should get
> > > you started:
> > >
> > > You need to get the ICompilationUnit from the VE
CompilationUnitEditor.
> > > Then you call JavaCore.parseCompilationUnit to get an AST.
> > >
> > >
> > > Best regards,
> > >
> > >
> > > Dave Orme
> > >
> > > --
> > > Visual Editor Project lead
> > > http://www.db4o.com -- The Open-source Java Object Database
> > > http://xswt.sf.net -- XML-based SWT page description language
> >
> >
>
>
Re: Code generating [message #88599 is a reply to message #88150] Mon, 25 April 2005 20:17 Go to previous messageGo to next message
Srimanth  is currently offline Srimanth Friend
Messages: 225
Registered: July 2009
Senior Member
Hi Danijel,
Apologies once again for the late response. We have been working heads
down with the VE 1.1 M1 effort. I was wondering as to why you would need
the CompilationUnitEditor? When a generate() is called we put the code
into the CompilationUnit - is that what you are looking for? The
ICompilationUnit can be got from IBeanDeclModel.getCompilationUnit().
The IBeanDeclModel is basically codegen's model containing references to
all the methods, beans, expressions etc.
If you would like to insert the content of an expression into a method,
please look at CodeExpressionRef.insertContentToDocument(). All the
decoders insert expressions via this API.
Regards,
Sri.


ddd wrote:
> Hello,
> it looks like I dont hav any idea how to get CompilationUnitEditor after
> all.
>
> I'm staring in ObjectDecoder and somhow I thot that the method generate
> would lead me to CompilationUnitEditor, but no.
>
> Please can you tell me in feu steps how would you do the thing I want to do
> in few stwps.
>
> Would you use ObjectDecoder and ExpressionDecoderHelper or would you do it
> in a different way (if so, how)?
>
> Thank you,
> Danijel
>
>
> "ddd" <danijel_zecevic@hotmail.com> wrote in message
> news:d46j88$idn$1@news.eclipse.org...
>
>>That was ok.
>>
>>thanks,
>>Danijel
>>
>>
>>
>>
>>"David J. Orme" <djo@coconut-palm-software.com> wrote in message
>>news:d46iqm$hqa$1@news.eclipse.org...
>>
>>>ddd wrote:
>>>
>>>>Thanks Sri for reply,
>>>>
>>>>but still, is there any way for me to get AST. I sopose there is some
>>
>>part
>>
>>>>VE that deals with AST.
>>>
>>>I don't have time for a full answer at the moment, but this should get
>>>you started:
>>>
>>>You need to get the ICompilationUnit from the VE CompilationUnitEditor.
>>>Then you call JavaCore.parseCompilationUnit to get an AST.
>>>
>>>
>>>Best regards,
>>>
>>>
>>>Dave Orme
>>>
>>>--
>>>Visual Editor Project lead
>>>http://www.db4o.com -- The Open-source Java Object Database
>>>http://xswt.sf.net -- XML-based SWT page description language
>>
>>
>
>
Re: Code generating [message #88679 is a reply to message #88331] Tue, 26 April 2005 13:44 Go to previous messageGo to next message
Gili Mendel is currently offline Gili MendelFriend
Messages: 338
Registered: July 2009
Senior Member
ddd wrote:
> Hello,
>
> I would really nead to know if there is any starting point for custom code
> generating without using swt code generator. I somehow beleave that there
> must be some basic methods generate() and decode() that is called when a

When you drop an object, the source/target policies generate a command to insert the object into the VE's (EMF) model.
The commands will determine (generally) the following:
o What object to drop, and how to construct it ('allocation' feature)
o What is the scope of this object (is it an instance variable, vs. local and such)
o What to name this object
o Set (if needed) properties/events

The CodeGeneration in VE listens to changes in the model:

o When a new object is dropped, it will pick up a Decoder for it. You can
use the override files to specify a decoder for a particular class.
see the VE tutorial for more detail of specifying decoders
http://dev.eclipse.org/viewcvs/indextools.cgi/%7Echeckout%7E /org.eclipse.ve.examples/org.eclipse.ve.example.customwidget /WebContent/index.html#Overriding_an_Expression_Decoder
A single decoder will be used for a particular property (source expression).
A decoder has a decode()/generate() methods, see SWTControlDecoder() as an example,
and put a breakpoint in any of these methods


btw. you can get at a CU from a decoder by doing the following:
Decoders typically have access to a IBeanDeclModel as an instance variable.
IBeanDeclModel.getCompilationUnit() will give you the CU.

> component is dropped on some other component and does not depend on java
> coding style. Is it a must to use ObjectDecoder and ExpressionDecoderHelper
> (or classes that implement IExpressionDecoder and IExpressionDecoderHelper)?
> If so, how would direct me to build a Delphi GUI builder?
>

You are not required to used an ObjectDecoder, but it does performs many of the basic tasks, and extending it will make
your life easier.

I do not have much experience with Delphi GUI builder. What is exactly that the current decoders can not do for you?


> Please do some tutorials, we are waiting long enough. This is sily alredy,
> you are making new features but noone has even understanding old ones. I'm
> shure that there is lots of people looking at your homepage every day for
> months, waitng to get some tutorials. You dont need to do prety tutorials
> with lots of pictures just do case studyes in 10-20 centances (if you want
> to do this you should start with this and uste that...) and all those fancy
> tutorials will be made by others.
>
> I hope you wont take this as a critique, becouse this is just a post from
> desperate person looking day by day in your code with no progress.
>

Not at all. There is a tutorial (noted above), but it may not be deep enough for what you need for codegen.

Note that in general, VE's code gen assume a single method to have all the settings that are associated with a given
bean; it is called the init method, and it is the method that constructs the bean (constructor, or factory).
For a factory construction, VE at this point will only parse a Static method as to eliminate reverse parsing of dynamic
logic that is not modeled.
Re: Code generating [message #92370 is a reply to message #87349] Mon, 30 May 2005 13:51 Go to previous message
Eclipse UserFriend
Originally posted by: user.domain.invalid

ddd wrote:
> Hello,
>
> I'm trying to extend VE and make a GUI builder for a framework we use on my
> job. For now I made a component that can be chosen in new visual class
> wizard and I made a javajet file that generates the code for a component,
> that looks like that:
>
> public class MyClass extends MyComponent{
>
> public MyComponent()
> {
> buildUI();
> }
> private void buildUi()
> {
> buildComponents();
> buildLayout();
> }
> private void buildComponents()
> {
> }
> private void buildLayout()
> {
> GridBagLayoutHelper helper = new GridBagLayoutHelper(this);
> }
> }
>
> But now I would like three things to hapen when i add new component to
> MyComponent:
>
> 1.create new private variable of added component,
> 2. add line in buildComponents() that looks like this: newComponent =
> MafFactory.createNewComponent();
> 3. add a line in buildLayout() that uses helper class and looks like that:
> helper.add(newComponent);
>
> For now as much as I understand extending VE this means it has to be done by
> making a decoder and decoder helper which use AST as it was mentioned in
> "Enabling support for custom widget" tutorial.
>
> The problem is that I dont understand how can i get AST in method generate()
> that is implemented in AbstractExpressionDecoder. So I wonder, is it right
> for me to extend AbstractExpressionDecoder and SimpleAttributeDecoderHelper
> to get the wanted result or is there some other way to achive that.
>
> Also I would like to know when will you write a code generation tutorial?
>
> Thank you,
> Danijel
>
>
>
>

Hi Denijel, I'm trying to extend VE to use Thinlets. I'm a fresh plugin
developer, could you please send me your project as it is? just for
understand a litle more about ve extensions.

Thanks and sorry for can not help you now.
Re: Code generating [message #607182 is a reply to message #87349] Tue, 19 April 2005 17:48 Go to previous message
ddd is currently offline dddFriend
Messages: 33
Registered: July 2009
Member
Please anyone....



"ddd" <danijel_zecevic@hotmail.com> wrote in message
news:d3tv6u$m9l$1@news.eclipse.org...
> Hello,
>
> I'm trying to extend VE and make a GUI builder for a framework we use on
my
> job. For now I made a component that can be chosen in new visual class
> wizard and I made a javajet file that generates the code for a component,
> that looks like that:
>
> public class MyClass extends MyComponent{
>
> public MyComponent()
> {
> buildUI();
> }
> private void buildUi()
> {
> buildComponents();
> buildLayout();
> }
> private void buildComponents()
> {
> }
> private void buildLayout()
> {
> GridBagLayoutHelper helper = new GridBagLayoutHelper(this);
> }
> }
>
> But now I would like three things to hapen when i add new component to
> MyComponent:
>
> 1.create new private variable of added component,
> 2. add line in buildComponents() that looks like this: newComponent =
> MafFactory.createNewComponent();
> 3. add a line in buildLayout() that uses helper class and looks like that:
> helper.add(newComponent);
>
> For now as much as I understand extending VE this means it has to be done
by
> making a decoder and decoder helper which use AST as it was mentioned in
> "Enabling support for custom widget" tutorial.
>
> The problem is that I dont understand how can i get AST in method
generate()
> that is implemented in AbstractExpressionDecoder. So I wonder, is it right
> for me to extend AbstractExpressionDecoder and
SimpleAttributeDecoderHelper
> to get the wanted result or is there some other way to achive that.
>
> Also I would like to know when will you write a code generation tutorial?
>
> Thank you,
> Danijel
>
>
>
>
Re: Code generating [message #607192 is a reply to message #87349] Wed, 20 April 2005 14:05 Go to previous message
Srimanth  is currently offline Srimanth Friend
Messages: 225
Registered: July 2009
Senior Member
Hi Danijel,
Sorry for the late response. We were in the middle of a testpass.
Generally we add the dropped component as a child of the component on
which we drop. In your case, the added component should be a child of
some property bean (layout helper). I think this would require some GEF
edit policies on the component on which you are dropping, to basically
generate commands which make necessary changes to the model. Once the
changes are made to the model, codegen would be invoked to generate
appropriate statements in the methods.
By default VE has a code pattern where there is an 'initialize()'
method ['buildUI()' in your case], which adds all the child components
in Swing. However there is no helper class which adds the children
acoording to some layout.
Regards,
Sri.


ddd wrote:
> Hello,
>
> I'm trying to extend VE and make a GUI builder for a framework we use on my
> job. For now I made a component that can be chosen in new visual class
> wizard and I made a javajet file that generates the code for a component,
> that looks like that:
>
> public class MyClass extends MyComponent{
>
> public MyComponent()
> {
> buildUI();
> }
> private void buildUi()
> {
> buildComponents();
> buildLayout();
> }
> private void buildComponents()
> {
> }
> private void buildLayout()
> {
> GridBagLayoutHelper helper = new GridBagLayoutHelper(this);
> }
> }
>
> But now I would like three things to hapen when i add new component to
> MyComponent:
>
> 1.create new private variable of added component,
> 2. add line in buildComponents() that looks like this: newComponent =
> MafFactory.createNewComponent();
> 3. add a line in buildLayout() that uses helper class and looks like that:
> helper.add(newComponent);
>
> For now as much as I understand extending VE this means it has to be done by
> making a decoder and decoder helper which use AST as it was mentioned in
> "Enabling support for custom widget" tutorial.
>
> The problem is that I dont understand how can i get AST in method generate()
> that is implemented in AbstractExpressionDecoder. So I wonder, is it right
> for me to extend AbstractExpressionDecoder and SimpleAttributeDecoderHelper
> to get the wanted result or is there some other way to achive that.
>
> Also I would like to know when will you write a code generation tutorial?
>
> Thank you,
> Danijel
>
>
>
>
Re: Code generating [message #607196 is a reply to message #87846] Wed, 20 April 2005 19:13 Go to previous message
ddd is currently offline dddFriend
Messages: 33
Registered: July 2009
Member
Thanks Sri for reply,

but still, is there any way for me to get AST. I sopose there is some part
VE that deals with AST.

Thank you,
Danijel


"Sri Gunturi" <sgunturi@us.ibm.com> wrote in message
news:d45nll$54k$1@news.eclipse.org...
> Hi Danijel,
> Sorry for the late response. We were in the middle of a testpass.
> Generally we add the dropped component as a child of the component on
> which we drop. In your case, the added component should be a child of
> some property bean (layout helper). I think this would require some GEF
> edit policies on the component on which you are dropping, to basically
> generate commands which make necessary changes to the model. Once the
> changes are made to the model, codegen would be invoked to generate
> appropriate statements in the methods.
> By default VE has a code pattern where there is an 'initialize()'
> method ['buildUI()' in your case], which adds all the child components
> in Swing. However there is no helper class which adds the children
> acoording to some layout.
> Regards,
> Sri.
>
>
> ddd wrote:
> > Hello,
> >
> > I'm trying to extend VE and make a GUI builder for a framework we use on
my
> > job. For now I made a component that can be chosen in new visual class
> > wizard and I made a javajet file that generates the code for a
component,
> > that looks like that:
> >
> > public class MyClass extends MyComponent{
> >
> > public MyComponent()
> > {
> > buildUI();
> > }
> > private void buildUi()
> > {
> > buildComponents();
> > buildLayout();
> > }
> > private void buildComponents()
> > {
> > }
> > private void buildLayout()
> > {
> > GridBagLayoutHelper helper = new GridBagLayoutHelper(this);
> > }
> > }
> >
> > But now I would like three things to hapen when i add new component to
> > MyComponent:
> >
> > 1.create new private variable of added component,
> > 2. add line in buildComponents() that looks like this: newComponent =
> > MafFactory.createNewComponent();
> > 3. add a line in buildLayout() that uses helper class and looks like
that:
> > helper.add(newComponent);
> >
> > For now as much as I understand extending VE this means it has to be
done by
> > making a decoder and decoder helper which use AST as it was mentioned in
> > "Enabling support for custom widget" tutorial.
> >
> > The problem is that I dont understand how can i get AST in method
generate()
> > that is implemented in AbstractExpressionDecoder. So I wonder, is it
right
> > for me to extend AbstractExpressionDecoder and
SimpleAttributeDecoderHelper
> > to get the wanted result or is there some other way to achive that.
> >
> > Also I would like to know when will you write a code generation
tutorial?
> >
> > Thank you,
> > Danijel
> >
> >
> >
> >
Re: Code generating [message #607198 is a reply to message #87903] Wed, 20 April 2005 21:49 Go to previous message
Dave Orme is currently offline Dave OrmeFriend
Messages: 424
Registered: July 2009
Senior Member
ddd wrote:
> Thanks Sri for reply,
>
> but still, is there any way for me to get AST. I sopose there is some part
> VE that deals with AST.

I don't have time for a full answer at the moment, but this should get
you started:

You need to get the ICompilationUnit from the VE CompilationUnitEditor.
Then you call JavaCore.parseCompilationUnit to get an AST.


Best regards,


Dave Orme

--
Visual Editor Project lead
http://www.db4o.com -- The Open-source Java Object Database
http://xswt.sf.net -- XML-based SWT page description language
Re: Code generating [message #607199 is a reply to message #87932] Wed, 20 April 2005 22:00 Go to previous message
ddd is currently offline dddFriend
Messages: 33
Registered: July 2009
Member
That was ok.

thanks,
Danijel




"David J. Orme" <djo@coconut-palm-software.com> wrote in message
news:d46iqm$hqa$1@news.eclipse.org...
> ddd wrote:
> > Thanks Sri for reply,
> >
> > but still, is there any way for me to get AST. I sopose there is some
part
> > VE that deals with AST.
>
> I don't have time for a full answer at the moment, but this should get
> you started:
>
> You need to get the ICompilationUnit from the VE CompilationUnitEditor.
> Then you call JavaCore.parseCompilationUnit to get an AST.
>
>
> Best regards,
>
>
> Dave Orme
>
> --
> Visual Editor Project lead
> http://www.db4o.com -- The Open-source Java Object Database
> http://xswt.sf.net -- XML-based SWT page description language
Re: Code generating [message #607213 is a reply to message #87947] Thu, 21 April 2005 18:36 Go to previous message
ddd is currently offline dddFriend
Messages: 33
Registered: July 2009
Member
Hello,
it looks like I dont hav any idea how to get CompilationUnitEditor after
all.

I'm staring in ObjectDecoder and somhow I thot that the method generate
would lead me to CompilationUnitEditor, but no.

Please can you tell me in feu steps how would you do the thing I want to do
in few stwps.

Would you use ObjectDecoder and ExpressionDecoderHelper or would you do it
in a different way (if so, how)?

Thank you,
Danijel


"ddd" <danijel_zecevic@hotmail.com> wrote in message
news:d46j88$idn$1@news.eclipse.org...
> That was ok.
>
> thanks,
> Danijel
>
>
>
>
> "David J. Orme" <djo@coconut-palm-software.com> wrote in message
> news:d46iqm$hqa$1@news.eclipse.org...
> > ddd wrote:
> > > Thanks Sri for reply,
> > >
> > > but still, is there any way for me to get AST. I sopose there is some
> part
> > > VE that deals with AST.
> >
> > I don't have time for a full answer at the moment, but this should get
> > you started:
> >
> > You need to get the ICompilationUnit from the VE CompilationUnitEditor.
> > Then you call JavaCore.parseCompilationUnit to get an AST.
> >
> >
> > Best regards,
> >
> >
> > Dave Orme
> >
> > --
> > Visual Editor Project lead
> > http://www.db4o.com -- The Open-source Java Object Database
> > http://xswt.sf.net -- XML-based SWT page description language
>
>
Re: Code generating [message #607225 is a reply to message #88150] Sun, 24 April 2005 17:32 Go to previous message
ddd is currently offline dddFriend
Messages: 33
Registered: July 2009
Member
Hello,

I would really nead to know if there is any starting point for custom code
generating without using swt code generator. I somehow beleave that there
must be some basic methods generate() and decode() that is called when a
component is dropped on some other component and does not depend on java
coding style. Is it a must to use ObjectDecoder and ExpressionDecoderHelper
(or classes that implement IExpressionDecoder and IExpressionDecoderHelper)?
If so, how would direct me to build a Delphi GUI builder?

Please do some tutorials, we are waiting long enough. This is sily alredy,
you are making new features but noone has even understanding old ones. I'm
shure that there is lots of people looking at your homepage every day for
months, waitng to get some tutorials. You dont need to do prety tutorials
with lots of pictures just do case studyes in 10-20 centances (if you want
to do this you should start with this and uste that...) and all those fancy
tutorials will be made by others.

I hope you wont take this as a critique, becouse this is just a post from
desperate person looking day by day in your code with no progress.

Thank you,
Danijel


"ddd" <danijel_zecevic@hotmail.com> wrote in message
news:d48rku$hr$1@news.eclipse.org...
> Hello,
> it looks like I dont hav any idea how to get CompilationUnitEditor after
> all.
>
> I'm staring in ObjectDecoder and somhow I thot that the method generate
> would lead me to CompilationUnitEditor, but no.
>
> Please can you tell me in feu steps how would you do the thing I want to
do
> in few stwps.
>
> Would you use ObjectDecoder and ExpressionDecoderHelper or would you do it
> in a different way (if so, how)?
>
> Thank you,
> Danijel
>
>
> "ddd" <danijel_zecevic@hotmail.com> wrote in message
> news:d46j88$idn$1@news.eclipse.org...
> > That was ok.
> >
> > thanks,
> > Danijel
> >
> >
> >
> >
> > "David J. Orme" <djo@coconut-palm-software.com> wrote in message
> > news:d46iqm$hqa$1@news.eclipse.org...
> > > ddd wrote:
> > > > Thanks Sri for reply,
> > > >
> > > > but still, is there any way for me to get AST. I sopose there is
some
> > part
> > > > VE that deals with AST.
> > >
> > > I don't have time for a full answer at the moment, but this should get
> > > you started:
> > >
> > > You need to get the ICompilationUnit from the VE
CompilationUnitEditor.
> > > Then you call JavaCore.parseCompilationUnit to get an AST.
> > >
> > >
> > > Best regards,
> > >
> > >
> > > Dave Orme
> > >
> > > --
> > > Visual Editor Project lead
> > > http://www.db4o.com -- The Open-source Java Object Database
> > > http://xswt.sf.net -- XML-based SWT page description language
> >
> >
>
>
Re: Code generating [message #607243 is a reply to message #88150] Mon, 25 April 2005 20:17 Go to previous message
Srimanth  is currently offline Srimanth Friend
Messages: 225
Registered: July 2009
Senior Member
Hi Danijel,
Apologies once again for the late response. We have been working heads
down with the VE 1.1 M1 effort. I was wondering as to why you would need
the CompilationUnitEditor? When a generate() is called we put the code
into the CompilationUnit - is that what you are looking for? The
ICompilationUnit can be got from IBeanDeclModel.getCompilationUnit().
The IBeanDeclModel is basically codegen's model containing references to
all the methods, beans, expressions etc.
If you would like to insert the content of an expression into a method,
please look at CodeExpressionRef.insertContentToDocument(). All the
decoders insert expressions via this API.
Regards,
Sri.


ddd wrote:
> Hello,
> it looks like I dont hav any idea how to get CompilationUnitEditor after
> all.
>
> I'm staring in ObjectDecoder and somhow I thot that the method generate
> would lead me to CompilationUnitEditor, but no.
>
> Please can you tell me in feu steps how would you do the thing I want to do
> in few stwps.
>
> Would you use ObjectDecoder and ExpressionDecoderHelper or would you do it
> in a different way (if so, how)?
>
> Thank you,
> Danijel
>
>
> "ddd" <danijel_zecevic@hotmail.com> wrote in message
> news:d46j88$idn$1@news.eclipse.org...
>
>>That was ok.
>>
>>thanks,
>>Danijel
>>
>>
>>
>>
>>"David J. Orme" <djo@coconut-palm-software.com> wrote in message
>>news:d46iqm$hqa$1@news.eclipse.org...
>>
>>>ddd wrote:
>>>
>>>>Thanks Sri for reply,
>>>>
>>>>but still, is there any way for me to get AST. I sopose there is some
>>
>>part
>>
>>>>VE that deals with AST.
>>>
>>>I don't have time for a full answer at the moment, but this should get
>>>you started:
>>>
>>>You need to get the ICompilationUnit from the VE CompilationUnitEditor.
>>>Then you call JavaCore.parseCompilationUnit to get an AST.
>>>
>>>
>>>Best regards,
>>>
>>>
>>>Dave Orme
>>>
>>>--
>>>Visual Editor Project lead
>>>http://www.db4o.com -- The Open-source Java Object Database
>>>http://xswt.sf.net -- XML-based SWT page description language
>>
>>
>
>
Re: Code generating [message #607248 is a reply to message #88331] Tue, 26 April 2005 13:44 Go to previous message
Gili Mendel is currently offline Gili MendelFriend
Messages: 338
Registered: July 2009
Senior Member
ddd wrote:
> Hello,
>
> I would really nead to know if there is any starting point for custom code
> generating without using swt code generator. I somehow beleave that there
> must be some basic methods generate() and decode() that is called when a

When you drop an object, the source/target policies generate a command to insert the object into the VE's (EMF) model.
The commands will determine (generally) the following:
o What object to drop, and how to construct it ('allocation' feature)
o What is the scope of this object (is it an instance variable, vs. local and such)
o What to name this object
o Set (if needed) properties/events

The CodeGeneration in VE listens to changes in the model:

o When a new object is dropped, it will pick up a Decoder for it. You can
use the override files to specify a decoder for a particular class.
see the VE tutorial for more detail of specifying decoders
http://dev.eclipse.org/viewcvs/indextools.cgi/%7Echeckout%7E /org.eclipse.ve.examples/org.eclipse.ve.example.customwidget /WebContent/index.html#Overriding_an_Expression_Decoder
A single decoder will be used for a particular property (source expression).
A decoder has a decode()/generate() methods, see SWTControlDecoder() as an example,
and put a breakpoint in any of these methods


btw. you can get at a CU from a decoder by doing the following:
Decoders typically have access to a IBeanDeclModel as an instance variable.
IBeanDeclModel.getCompilationUnit() will give you the CU.

> component is dropped on some other component and does not depend on java
> coding style. Is it a must to use ObjectDecoder and ExpressionDecoderHelper
> (or classes that implement IExpressionDecoder and IExpressionDecoderHelper)?
> If so, how would direct me to build a Delphi GUI builder?
>

You are not required to used an ObjectDecoder, but it does performs many of the basic tasks, and extending it will make
your life easier.

I do not have much experience with Delphi GUI builder. What is exactly that the current decoders can not do for you?


> Please do some tutorials, we are waiting long enough. This is sily alredy,
> you are making new features but noone has even understanding old ones. I'm
> shure that there is lots of people looking at your homepage every day for
> months, waitng to get some tutorials. You dont need to do prety tutorials
> with lots of pictures just do case studyes in 10-20 centances (if you want
> to do this you should start with this and uste that...) and all those fancy
> tutorials will be made by others.
>
> I hope you wont take this as a critique, becouse this is just a post from
> desperate person looking day by day in your code with no progress.
>

Not at all. There is a tutorial (noted above), but it may not be deep enough for what you need for codegen.

Note that in general, VE's code gen assume a single method to have all the settings that are associated with a given
bean; it is called the init method, and it is the method that constructs the bean (constructor, or factory).
For a factory construction, VE at this point will only parse a Static method as to eliminate reverse parsing of dynamic
logic that is not modeled.
Re: Code generating [message #607845 is a reply to message #87349] Mon, 30 May 2005 13:51 Go to previous message
user is currently offline userFriend
Messages: 296
Registered: July 2009
Senior Member
ddd wrote:
> Hello,
>
> I'm trying to extend VE and make a GUI builder for a framework we use on my
> job. For now I made a component that can be chosen in new visual class
> wizard and I made a javajet file that generates the code for a component,
> that looks like that:
>
> public class MyClass extends MyComponent{
>
> public MyComponent()
> {
> buildUI();
> }
> private void buildUi()
> {
> buildComponents();
> buildLayout();
> }
> private void buildComponents()
> {
> }
> private void buildLayout()
> {
> GridBagLayoutHelper helper = new GridBagLayoutHelper(this);
> }
> }
>
> But now I would like three things to hapen when i add new component to
> MyComponent:
>
> 1.create new private variable of added component,
> 2. add line in buildComponents() that looks like this: newComponent =
> MafFactory.createNewComponent();
> 3. add a line in buildLayout() that uses helper class and looks like that:
> helper.add(newComponent);
>
> For now as much as I understand extending VE this means it has to be done by
> making a decoder and decoder helper which use AST as it was mentioned in
> "Enabling support for custom widget" tutorial.
>
> The problem is that I dont understand how can i get AST in method generate()
> that is implemented in AbstractExpressionDecoder. So I wonder, is it right
> for me to extend AbstractExpressionDecoder and SimpleAttributeDecoderHelper
> to get the wanted result or is there some other way to achive that.
>
> Also I would like to know when will you write a code generation tutorial?
>
> Thank you,
> Danijel
>
>
>
>

Hi Denijel, I'm trying to extend VE to use Thinlets. I'm a fresh plugin
developer, could you please send me your project as it is? just for
understand a litle more about ve extensions.

Thanks and sorry for can not help you now.
Previous Topic:Visual Editor update site
Next Topic:VE dinner example
Goto Forum:
  


Current Time: Fri Apr 26 06:41:10 GMT 2024

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

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

Back to the top