|
Re: [acceleo] Can we know the Generated List file of mainFile [message #543667 is a reply to message #543649] |
Wed, 30 June 2010 08:59 |
|
This is a multi-part message in MIME format.
--------------040908040803030307070602
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Hi,
The "doGenerate" method doesn't allow it, yet if you look at its
implementation, you'll realize that it simply delegates to "generate"
which does return the list of generated files. You can change your
We didn't add it directly to doGenerate() because of API compatibility
issues. You can call "generate()" directly if you wish to retrieve this
list.
Laurent
poltrox wrote:
> Hi
>
> I use a main file acceleo with condition on generation of template.
>
> Is it possible to know the generated file List of doGenerate call ?
> Thanks.
--------------040908040803030307070602
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"
YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------040908040803030307070602--
|
|
|
|
|
|
Re: [acceleo] Can we know the Generated List file of mainFile [message #543721 is a reply to message #543693] |
Wed, 30 June 2010 11:51 |
|
This is a multi-part message in MIME format.
--------------010600070503030007070609
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
The "getGenerationListeners()" method will only be called once for each
generation, thus returning a new list is the easiest.
As for the "generate" call returning an empty map, this is due to the
generation strategy you use (see method getGenerationStrategy) : the
default strategy will create the files on the fly, and it doesn't keep
track of the files it generated.
If you use the PreviewStrategy instead, "generate()" will return a Map
which key=value pairs such as : filename = file contents... but the
PreviewStrategy doesn't generate files :p.
Feel free to fill in an enhancement request for this, the default
strategy simply doesn't keep track of them because this functionality
has been added later.
Laurent Goubet
Obeo
poltrox wrote:
> I find a solution , but i don't understand why you return a new list of
> Listener at each call of getListeners ()
>
> I must move to global attribute List<IAcceleoTextGenerationListener>
> listeners = super.getGenerationListeners(); in each mainfile generated.
>
> I can add my listener after this change :
> dataAcceleoGenerator.getGenerationListeners().add(this);
>
> Why you don't create this list in the abstract method as attribut
> instead to create a new list for each call ?
>
--------------010600070503030007070609
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"
YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------010600070503030007070609--
|
|
|
|
Re: [acceleo] Can we know the Generated List file of mainFile [message #543744 is a reply to message #543737] |
Wed, 30 June 2010 13:02 |
|
This is a multi-part message in MIME format.
--------------000501030501080803070507
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
The intended way of doing it is to use the "getGenerationListeners"
method, not the "addListener" one.
As mentionned in the "getGenerationListeners" code :
// TODO if you need to listen to generation event, add listeners to the
list here
which means you simply have to change it so that it looks like :
public List<IAcceleoTextGenerationListener> getGenerationListeners() {
List<IAcceleoTextGenerationListener> listeners =
super.getGenerationListeners();
listeners.add(new MyGenerationListener());
return listeners;
}
poltrox wrote:
> How can I add one class like a listener of my generator if I don't used
> The "getGenerationListeners()" method ?
>
> the function addListener is deprecated in abstract class and i don't
> find another solution as modify each generator
--------------000501030501080803070507
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"
YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------000501030501080803070507--
|
|
|
Powered by
FUDForum. Page generated in 0.13012 seconds