In-Code documentation xpt [message #145467] |
Mon, 06 August 2007 12:45  |
Eclipse User |
|
|
|
hi all,
I was wondering if it wouldn't help everybody to simply add the
name(+path) of the xpt-template in the generated code.
In the oAW documentation it is mentioned several times that the
generated code should include some documentation for the person modifing
this _code_. On the other hand, it would be very interesting for the
person modifying the _templates_ to know which template generated the code.
I would figure out 2 benefits:
* A better understanding how GMF-Tools work, including no more searching
around which template generated the code which I want to modify.
* Better overview which templates where executed at all. This is very
interesting in terms of aspects which xPand supports.
I would image something like this as an example:
public class UIContainerEditPart extends ShapeNodeEditPart {
/*
/xpt/diagram/editparts/NodeEditPart.xpt >>>
*/
/**
* @generated
*/
public static final int VISUAL_ID = 2001;
(...)
/* another template.path >>>*/
(...)
/* maybe some custom aspect path here >>> open*/
(...)
/* maybe some custom aspect path here <<< close*/
(...)
/* another template.path <<<*/
/*
/xpt/diagram/editparts/NodeEditPart.xpt <<<
*/
this wouldn't pollute the code too much since every GMF programmer will
use eclipse and could fold these comments away.
What do you think? Should I create a bug request for this?
-stefan
|
|
|
|
|
|
|
Re: In-Code documentation xpt [message #145584 is a reply to message #145576] |
Tue, 07 August 2007 09:45  |
Eclipse User |
|
|
|
Hi Stefan,
> > - in xml file generation (or any other non-java files);
> maybe this could be avoided by adding the aspect package sensitive.
Xpand is language-agnostic, it simply emits symbols and does not care
whether these symbols make up a Java file or a poem. Feeding it with
information that is strongly Java-specific does not seem a very good
idea to me.
> > - if a comment spans several template declarations (this could
> > happen in a real-life situation if one needed to temporarily disable
> > some parts of the generated code).
> I'm not sure if I got this right. The comment shouldn't span a template
> but add a comment before the exection of that template and afterwards.
What I mean is that the original templates may incorporate /* in one
template, and */ in another one that is executed afterwards. Although it
does not seem the most elegant idea possible, I can see how templates
can possibly evolve to contain such a mess.
The problem however is that this code will compile differently (or
compile vs. fail to compile) with the "trace" option turned on and off.
Best regards,
Boris
SKuhn wrote:
>
>
> -stefan
>
>
> Boris Blajer schrieb:
>> Hi Stefan,
>>
>> I doubt it is practical to let the framework do this automatically for
>> you. I can imagine at least two scenarios where this would lead to
>> undesired results:
>> - in xml file generation (or any other non-java files);
>> - if a comment spans several template declarations (this could
>> happen in a real-life situation if one needed to temporarily disable
>> some parts of the generated code).
>>
>>
>> Best regards,
>> Boris
>>
>>
>> SKuhn wrote:
>>> Looks like this it not possible. There's a feature request for this:
>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=171216
>>>
>>> SKuhn schrieb:
>>>> hmmm, thinking again about what I wrote I was wondering if xPand
>>>> offers an reflection-API which could enable to add these comments
>>>> via just one aspect? I'm gonna look for that at the end of the week.
>>>>
>>>> -stefan
>>>>
>>>>
>>>> SKuhn schrieb:
>>>>> hi all,
>>>>>
>>>>> I was wondering if it wouldn't help everybody to simply add the
>>>>> name(+path) of the xpt-template in the generated code.
>>>>>
>>>>> In the oAW documentation it is mentioned several times that the
>>>>> generated code should include some documentation for the person
>>>>> modifing this _code_. On the other hand, it would be very
>>>>> interesting for the person modifying the _templates_ to know which
>>>>> template generated the code.
>>>>>
>>>>> I would figure out 2 benefits:
>>>>> * A better understanding how GMF-Tools work, including no more
>>>>> searching around which template generated the code which I want to
>>>>> modify.
>>>>> * Better overview which templates where executed at all. This is
>>>>> very interesting in terms of aspects which xPand supports.
>>>>>
>>>>> I would image something like this as an example:
>>>>>
>>>>> public class UIContainerEditPart extends ShapeNodeEditPart {
>>>>>
>>>>> /*
>>>>> /xpt/diagram/editparts/NodeEditPart.xpt >>>
>>>>> */
>>>>> /**
>>>>> * @generated
>>>>> */
>>>>> public static final int VISUAL_ID = 2001;
>>>>> (...)
>>>>> /* another template.path >>>*/
>>>>> (...)
>>>>> /* maybe some custom aspect path here >>> open*/
>>>>> (...)
>>>>> /* maybe some custom aspect path here <<< close*/
>>>>> (...)
>>>>> /* another template.path <<<*/
>>>>>
>>>>> /*
>>>>> /xpt/diagram/editparts/NodeEditPart.xpt <<<
>>>>> */
>>>>>
>>>>> this wouldn't pollute the code too much since every GMF programmer
>>>>> will use eclipse and could fold these comments away.
>>>>>
>>>>> What do you think? Should I create a bug request for this?
>>>>>
>>>>> -stefan
|
|
|
Powered by
FUDForum. Page generated in 0.05128 seconds