Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [xpand] Cannot weave GeneratorAdvice using MWE2
[xpand] Cannot weave GeneratorAdvice using MWE2 [message #549757] Tue, 27 July 2010 20:23 Go to next message
steven reinisch is currently offline steven reinischFriend
Messages: 33
Registered: July 2009
Member
hello,

I am trying to weave an advice into an existing generator using mwe2.

the workflow containing the generator component I am trying to weave into looks like this:

module workflow.ModulobGenerator

/* some imports & vars .. */

Workflow {

/* a reader ..*/

component = org.eclipse.xpand2.Generator { 
		
		id        = "generator"
		expand    = "templates::Template::main FOREACH modelElements"
		metaModel = org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel{}
		outlet = {
			path = targetDir
		}
		fileEncoding = fileEncoding
		
               /*
		 * the advice is woven if directly added,
		 * but that's not wanted
		 */
		//advice = "templates::Advices"
	}
}


the workflow that calls the advice looks like this:

module workflow.ReactionGenerator

Workflow {
	component = @workflow.ModulobGenerator  {} 
		
	component = org.eclipse.xpand2.GeneratorAdvice{
		adviceTarget = "generator"
		advice      = "templates::Advices" 
	}
}


The xpand documentation only describes a workflow configuration for MWE but not for MWE2. I was trying to adapt the MWE config to MWE2 but failed Sad.

Any hints where the error could be?

Thanks & regards,

steven
Re: [xpand] Cannot weave GeneratorAdvice using MWE2 [message #549784 is a reply to message #549757] Tue, 27 July 2010 23:02 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13321
Registered: July 2009
Senior Member
Hello Steven,

bad news - mwe is not advice-capable since mwe2 workflows do not inherit from org.eclipse.emf.mwe.core.container.CompositeComponent.
So you have to use good old mwe.

feels free to file an enhancement request into bugzilla.

Regards
Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [xpand] Cannot weave GeneratorAdvice using MWE2 [message #549856 is a reply to message #549784] Wed, 28 July 2010 09:02 Go to previous messageGo to next message
steven reinisch is currently offline steven reinischFriend
Messages: 33
Registered: July 2009
Member
hi christian,

how do I file an enhancement request?
Is it sufficient to enter a bug in bugzilla?


regards,

steven
Re: [xpand] Cannot weave GeneratorAdvice using MWE2 [message #549863 is a reply to message #549856] Wed, 28 July 2010 09:21 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13321
Registered: July 2009
Senior Member
Hi,

yes just enter a new bugzilla entry here: https://bugs.eclipse.org/bugs/enter_bug.cgi?product=TMF& format=guided and choose Xtext as Component (since there is not mwe2 component so far).

Of course it helps if you provide a patch Wink

Regards
Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Wed, 28 July 2010 09:21]

Report message to a moderator

Re: [xpand] Cannot weave GeneratorAdvice using MWE2 [message #556915 is a reply to message #549757] Fri, 03 September 2010 07:30 Go to previous message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
Am 7/27/10 10:23 PM, schrieb steven:
> module workflow.ModulobGenerator
>
> /* some imports & vars .. */
>
> Workflow {
>
> /* a reader ..*/
>
> component = org.eclipse.xpand2.Generator {
> id = "generator"
> expand = "templates::Template::main FOREACH modelElements"
> metaModel = org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel{}
> outlet = {
> path = targetDir
> }
> fileEncoding = fileEncoding
>
> /*
> * the advice is woven if directly added,
> * but that's not wanted
> */
> //advice = "templates::Advices"
> }
> }
>
>
> the workflow that calls the advice looks like this:
>
>
> module workflow.ReactionGenerator
>
> Workflow {
> component = @workflow.ModulobGenerator {}
> component = org.eclipse.xpand2.GeneratorAdvice{
> adviceTarget = "generator"
> advice = "templates::Advices" }
> }
>

you don't need AOP for this.
Just pass parameters to the module:


component = @workflow.ModulobGenerator {
advice = "templates::Advices"
}

And in the module declare a property like this:


module workflow.ModulobGenerator

var advice = "my::default"


Workflow {
...
component = org.eclipse.xpand2.Generator {
...
advice = advice
}
}

Using this technique you explicitly design for extension, which is much
nicer and less error-prone.

Sven

--
Need professional support for Xtext or other Eclipse Modeling technologies?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : http://blog.efftinge.de
Previous Topic:[xpand] how to refer to an external metamodel ?
Next Topic:[Xpand] Xpand editor error markers
Goto Forum:
  


Current Time: Tue Jan 28 12:33:59 GMT 2020

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

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

Back to the top