Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [TEXO] overriding templates question
[TEXO] overriding templates question [message #551464] Fri, 06 August 2010 14:33 Go to next message
e1n is currently offline e1nFriend
Messages: 22
Registered: April 2010
Location: Poland
Junior Member

Hi !

I read about that Texo is not supporting emf's EOperation during code generation process.
I am wondering if it makes sens to override "entity_addition.xpt" template to generate code for my EOperations defined in my Ecore file which are not generated by Texo itself.

Texo documentations states that:
The template is called with model annotations as the main class. The model annotation enriches the domain model with code generation specific information (for example the java class). In addition you have access to the underlying model element (EPackage, etc.). There are model annotation for each of the main model elements (EPackage, EClass, EStructuralFeature, EReference, EAttribute, EDataType, EEnum). 


So I guess it is possible to get EClass and using EMF API's extract EOperation's and generate methods signatures ?

Did any one tried that ? Or maybe I have totally misunderstood the whole concept ?

With regards, e1n
Re: [TEXO] overriding templates question [message #551529 is a reply to message #551464] Fri, 06 August 2010 20:01 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Michal,
You understand it completely correct! The default entity_addition.xpt has this code:
«DEFINE root(ModelController modelController) FOR EClassModelGenAnnotation-»
«ENDDEFINE»

so the 'this' inside the DEFINE is an instance of the EClassModelGenAnnotation class. This expression can be used to get
to the eclass:
this.EClass

and from there you can find the eoperation.

Btw, I would like to add eoperation support to Texo (just to be complete..), so if you are interested and your
implementation is generic then contributions are always wellcomed!

gr. Martin

On 08/06/2010 04:33 PM, e1n wrote:
> Hi !
>
> I read about that Texo is not supporting emf's EOperation during code
> generation process.
> I am wondering if it makes sens to override "entity_addition.xpt"
> template to generate code for my EOperations defined in my Ecore file
> which are not generated by Texo itself.
>
> Texo documentations states that: The template is called with model
> annotations as the main class. The model annotation enriches the domain
> model with code generation specific information (for example the java
> class). In addition you have access to the underlying model element
> (EPackage, etc.). There are model annotation for each of the main model
> elements (EPackage, EClass, EStructuralFeature, EReference, EAttribute,
> EDataType, EEnum).
> So I guess it is possible to get EClass and using EMF API's extract
> EOperation's and generate methods signatures ?
>
> Did any one tried that ? Or maybe I have totally misunderstood the whole
> concept ?
>
> With regards, e1n
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [TEXO] overriding templates question [message #551563 is a reply to message #551529] Sat, 07 August 2010 06:59 Go to previous messageGo to next message
e1n is currently offline e1nFriend
Messages: 22
Registered: April 2010
Location: Poland
Junior Member

Hi Martin !

Today I want to implement this feature so i will try to write it as much generic as it could be and give You some feedback.


With regards, e1n
Re: [TEXO] overriding templates question [message #551626 is a reply to message #551529] Sun, 08 August 2010 13:01 Go to previous messageGo to next message
e1n is currently offline e1nFriend
Messages: 22
Registered: April 2010
Location: Poland
Junior Member

Hi Martin !

I have faced a problem during template overriding. I have copied all templates files from orignal plugin to my templates folder and placed them on correct path (templates/org.eclipse/emf/texo/modelgenerator/templates).

I tried to regenerate whole model code to ensure that every thing would work just fine but when I right clicked on my ecore file and selected "Generate Model Code" option. Nothing happened . Later i have found the cause of such behavior in my system console:

8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] Aug 8, 2010 2:53:07 PM org.eclipse.emf.mwe.core.WorkflowRunner prepare 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] INFO: -------------------------------------------------------------------------------------- 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] Aug 8, 2010 2:53:07 PM org.eclipse.emf.mwe.core.WorkflowRunner prepare 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] INFO: EMF Modeling Workflow Engine 0.7.2, Build v200908120417 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] Aug 8, 2010 2:53:07 PM org.eclipse.emf.mwe.core.WorkflowRunner prepare 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] INFO: (c) 2005-2009 openarchitectureware.org and contributors 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] Aug 8, 2010 2:53:07 PM org.eclipse.emf.mwe.core.WorkflowRunner prepare 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] INFO: -------------------------------------------------------------------------------------- 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] Aug 8, 2010 2:53:07 PM org.eclipse.emf.mwe.core.WorkflowRunner prepare 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] INFO: running workflow: /org/eclipse/emf/texo/generator/generate_model.oaw 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] Aug 8, 2010 2:53:07 PM org.eclipse.emf.mwe.core.WorkflowRunner prepare 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] INFO:  
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] Aug 8, 2010 2:53:07 PM org.eclipse.emf.mwe.core.container.CompositeComponent internalInvoke 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] INFO: ArtifactGenerator: generating 'org::eclipse::emf::texo::modelgenerator::templates::model::root(modelController) FOREACH modelController.EPackages' => [src, java:src] 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] java.lang.IllegalStateException: Exception loading resource org/eclipse/emf/texo/modelgenerator/templates/model.xpt 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271]  at org.eclipse.emf.texo.generator.TexoResourceManager.loadResource(TexoResourceManager.java:108) 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271]  at org.eclipse.xpand2.XpandExecutionContextImpl.findTemplate(XpandExecutionContextImpl.java:195) 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271]  at org.eclipse.xpand2.XpandExecutionContextImpl.findTemplate(XpandExecutionContextImpl.java:188) 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271]  at org.eclipse.xpand2.XpandExecutionContextImpl.findDefinition(XpandExecutionContextImpl.java:145) 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271]  at org.eclipse.internal.xpand2.ast.ExpandStatement.invokeDefinition(ExpandStatement.java:174) 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271]  at org.eclipse.internal.xpand2.ast.ExpandStatement.evaluateInternal(ExpandStatement.java:145) 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271]  at org.eclipse.internal.xpand2.ast.Statement.evaluate(Statement.java:39) 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271]  at org.eclipse.xpand2.Generator.invokeInternal2(Generator.java:334) 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271]  at org.eclipse.emf.texo.generator.ArtifactGenerator.invokeInternal2(ArtifactGenerator.java:88) 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271]  at org.eclipse.xtend.expression.AbstractExpressionsUsingWorkflowComponent.invokeInternal(AbstractExpressionsUsingWorkflowComponent.java:191) 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271]  at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invoke(AbstractWorkflowComponent.java:124) 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271]  at org.eclipse.emf.mwe.core.container.CompositeComponent.internalInvoke(CompositeComponent.java:101) 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271]  at org.eclipse.emf.mwe.core.container.CompositeComponent.invoke(CompositeComponent.java:86) 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271]  at org.eclipse.emf.mwe.core.WorkflowRunner.executeWorkflow(WorkflowRunner.java:412) 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271]  at org.eclipse.emf.texo.generator.WorkFlowStarter.runWorkFlow(WorkFlowStarter.java:169) 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271]  at org.eclipse.emf.texo.generator.WorkFlowStarter.runWorkFlow(WorkFlowStarter.java:123) 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271]  at org.eclipse.emf.texo.generator.WorkFlowStarter.generateModelCode(WorkFlowStarter.java:77) 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271]  at org.eclipse.emf.texo.eclipse.popup.actions.GenerateCode.generateFromUris(GenerateCode.java:55) 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271]  at org.eclipse.emf.texo.eclipse.popup.actions.BaseGenerateAction.generate(BaseGenerateAction.java:120) 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271]  at org.eclipse.emf.texo.eclipse.popup.actions.BaseGenerateAction.generate(BaseGenerateAction.java:99) 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271]  at org.eclipse.emf.texo.eclipse.popup.actions.BaseGenerateAction.access$0(BaseGenerateAction.java:81) 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271]  at org.eclipse.emf.texo.eclipse.popup.actions.BaseGenerateAction$1.execute(BaseGenerateAction.java:71) 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271]  at org.eclipse.ui.actions.WorkspaceModifyOperation$1.run(WorkspaceModifyOperation.java:106) 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271]  at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1800) 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271]  at org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:118) 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271]  at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121) 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] Caused by: org.eclipse.internal.xtend.xtend.parser.ParseException: no viable alternative at character '?' on line 1 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271]  at org.eclipse.internal.xpand2.parser.XpandParseFacade$3.handleError(XpandParseFacade.java:77) 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271]  at org.eclipse.internal.xpand2.parser.XpandParseFacade$1.reportError(XpandParseFacade.java:57) 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271]  at org.antlr.runtime.Lexer.nextToken(Lexer.java:119) 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271]  at org.antlr.runtime.CommonTokenStream.fillBuffer(CommonTokenStream.java:95) 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271]  at org.antlr.runtime.CommonTokenStream.LT(CommonTokenStream.java:238) 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271]  at org.eclipse.internal.xpand2.parser.XpandLocationAddingParser.start(XpandLocationAddingParser.java:43) 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271]  at org.eclipse.internal.xpand2.parser.XpandLocationAddingParser.template(XpandLocationAddingParser.java:289) 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271]  at org.eclipse.internal.xpand2.parser.XpandParseFacade.file(XpandParseFacade.java:44) 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271]  at org.eclipse.internal.xpand2.parser.XpandParseFacade.file(XpandParseFacade.java:31) 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271]  at org.eclipse.xpand2.XpandExecutionContextImpl$1.parse(XpandExecutionContextImpl.java:92) 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271]  at org.eclipse.emf.texo.generator.TexoResourceManager.loadResource(TexoResourceManager.java:103) 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271]  ... 25 more 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] Aug 8, 2010 2:53:07 PM org.eclipse.emf.mwe.core.WorkflowRunner executeWorkflow 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] INFO: workflow completed in 37ms! 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] Aug 8, 2010 2:53:07 PM org.eclipse.emf.mwe.core.WorkflowRunner logIssues 
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] SEVERE: [ERROR]: Exception loading resource org/eclipse/emf/texo/modelgenerator/templates/model.xpt(Element: EXPAND org::eclipse::emf::texo::modelgenerator::templates::model::root(modelController) FOREACH modelController.EPackages; Reported by: ArtifactGenerator: generating 'org::eclipse::emf::texo::modelgenerator::templates::model::root(modelController) FOREACH modelController.EPackages' => [/Users/michabartoszewski/Documents/workspace/MagisterkaTexo/src, java:/Users/michabartoszewski/Documents/workspace/MagisterkaTexo/src]) 
8/8/10 2:53:46 PM Spotlight[162] /SourceCache/Spotlight/Spotlight-398.26/menu/Application/../Models/MDQueryWorker.m -[MDQueryWorker startQuery:withFlags:] Can't execute query '(* = "termin*"cdw || kMDItemTextContent = "termin*"cdw)' 


With regards, e1n
Re: [TEXO] overriding templates question [message #551633 is a reply to message #551626] Sun, 08 August 2010 14:30 Go to previous messageGo to next message
e1n is currently offline e1nFriend
Messages: 22
Registered: April 2010
Location: Poland
Junior Member

Ok i have figured out what was wrong. It was issue with encoding. Eclipse was using MacRoman encoding and Xpand uses those «,» characters which where surrounded with some additional control characters in my case.

I have changed encoding globally to UTF-8 and manual edited templates files. Now everything is ok.

With regards, e1n
Re: [TEXO] overriding templates question [message #551648 is a reply to message #551529] Sun, 08 August 2010 22:15 Go to previous messageGo to next message
e1n is currently offline e1nFriend
Messages: 22
Registered: April 2010
Location: Poland
Junior Member

Hi Martin,

I have programmed some support for EOperations generation.
But right now it is just draft of working implementation.

I was reading Texo code and studying it's ecore files etc.
But I couldn't managed to find piece of code which is responsible
for transformation of EMF basic types like EString, EBoolean etc. to Java types like String, Boolean etc.

Can you give me a hint where I could find it ?

With regards, e1n

Martin taal wrote on Fri, 06 August 2010 16:01
Hi Michal,
You understand it completely correct! The default entity_addition.xpt has this code:
«DEFINE root(ModelController modelController) FOR EClassModelGenAnnotation-»
«ENDDEFINE»

so the 'this' inside the DEFINE is an instance of the EClassModelGenAnnotation class. This expression can be used to get
to the eclass:
this.EClass

and from there you can find the eoperation.

Btw, I would like to add eoperation support to Texo (just to be complete..), so if you are interested and your
implementation is generic then contributions are always wellcomed!

gr. Martin

On 08/06/2010 04:33 PM, e1n wrote:
> Hi !
>
> I read about that Texo is not supporting emf's EOperation during code
> generation process.
> I am wondering if it makes sens to override "entity_addition.xpt"
> template to generate code for my EOperations defined in my Ecore file
> which are not generated by Texo itself.
>
> Texo documentations states that: The template is called with model
> annotations as the main class. The model annotation enriches the domain
> model with code generation specific information (for example the java
> class). In addition you have access to the underlying model element
> (EPackage, etc.). There are model annotation for each of the main model
> elements (EPackage, EClass, EStructuralFeature, EReference, EAttribute,
> EDataType, EEnum).
> So I guess it is possible to get EClass and using EMF API's extract
> EOperation's and generate methods signatures ?
>
> Did any one tried that ? Or maybe I have totally misunderstood the whole
> concept ?
>
> With regards, e1n
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org

Re: [TEXO] overriding templates question [message #551696 is a reply to message #551648] Mon, 09 August 2010 08:22 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Michal,
This is done in java through the GenUtils class:
org.eclipse.emf.texo.modelgenerator.annotator.GenUtils.getIn stanceClassName(eDataType)

But it is probably better to get the model annotation class for the edatatype. So if 'this' is the edatatype then this
call in xpand will give you the ModelEDataTypeAnnotation:
modelController.getAnnotation(this, ModelcodegeneratorPackage::eNS_URI)
on this instance you can call:
getInstanceClassName()
to get the type name to use in java

This do this call you need to have these imports in the top:
«IMPORT org::eclipse::emf::ecore»
«IMPORT org::eclipse::emf::texo::generator»
«IMPORT org::eclipse::emf::texo::modelgenerator::modelannotations»

gr. Martin

On 08/09/2010 12:15 AM, e1n wrote:
> Hi Martin,
>
> I have programmed some support for EOperations generation.
> But right now it is just draft of working implementation.
>
> I was reading Texo code and studying it's ecore files etc.
> But I couldn't managed to find piece of code which is responsible
> for transformation of EMF basic types like EString, EBoolean etc. to
> Java types like String, Boolean etc.
>
> Can you give me a hint where I could find it ?
>
> With regards, e1n
>
> Martin taal wrote on Fri, 06 August 2010 16:01
>> Hi Michal,
>> You understand it completely correct! The default entity_addition.xpt
>> has this code:
>> «DEFINE root(ModelController modelController) FOR
>> EClassModelGenAnnotation-»
>> «ENDDEFINE»
>>
>> so the 'this' inside the DEFINE is an instance of the
>> EClassModelGenAnnotation class. This expression can be used to get to
>> the eclass:
>> this.EClass
>>
>> and from there you can find the eoperation.
>>
>> Btw, I would like to add eoperation support to Texo (just to be
>> complete..), so if you are interested and your implementation is
>> generic then contributions are always wellcomed!
>>
>> gr. Martin
>>
>> On 08/06/2010 04:33 PM, e1n wrote:
>> > Hi !
>> >
>> > I read about that Texo is not supporting emf's EOperation during code
>> > generation process.
>> > I am wondering if it makes sens to override "entity_addition.xpt"
>> > template to generate code for my EOperations defined in my Ecore file
>> > which are not generated by Texo itself.
>> >
>> > Texo documentations states that: The template is called with model
>> > annotations as the main class. The model annotation enriches the domain
>> > model with code generation specific information (for example the java
>> > class). In addition you have access to the underlying model element
>> > (EPackage, etc.). There are model annotation for each of the main model
>> > elements (EPackage, EClass, EStructuralFeature, EReference, EAttribute,
>> > EDataType, EEnum).
>> > So I guess it is possible to get EClass and using EMF API's extract
>> > EOperation's and generate methods signatures ?
>> >
>> > Did any one tried that ? Or maybe I have totally misunderstood the
>> whole
>> > concept ?
>> >
>> > With regards, e1n
>> >
>>
>>
>> --
>>
>> With Regards, Martin Taal
>>
>> Springsite/Elver.org
>> Office: Hardwareweg 4, 3821 BV Amersfoort
>> Postal: Nassaulaan 7, 3941 EC Doorn
>> The Netherlands
>> Cell: +31 (0)6 288 48 943
>> Tel: +31 (0)84 420 2397
>> Fax: +31 (0)84 225 9307
>> Mail: mtaal@springsite.com - mtaal@elver.org
>> Web: www.springsite.com - www.elver.org
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [TEXO] overriding templates question [message #623127 is a reply to message #551529] Sat, 07 August 2010 06:59 Go to previous message
e1n is currently offline e1nFriend
Messages: 22
Registered: April 2010
Location: Poland
Junior Member

Hi Martin !

Today I want to implement this feature so i will try to write it as much generic as it could be and give You some feedback.


With regards, e1n
Re: [TEXO] overriding templates question [message #623128 is a reply to message #551529] Sun, 08 August 2010 13:01 Go to previous message
e1n is currently offline e1nFriend
Messages: 22
Registered: April 2010
Location: Poland
Junior Member

Hi Martin !

I have faced a problem during template overriding. I have copied all templates files from orignal plugin to my templates folder and placed them on correct path (templates/org.eclipse/emf/texo/modelgenerator/templates).

I tried to regenerate whole model code to ensure that every thing would work just fine but when I right clicked on my ecore file and selected "Generate Model Code" option. Nothing happened . Later i have found the cause of such behavior in my system console:

8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] Aug 8, 2010 2:53:07 PM org.eclipse.emf.mwe.core.WorkflowRunner prepare
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] INFO: ------------------------------------------------------------ --------------------------
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] Aug 8, 2010 2:53:07 PM org.eclipse.emf.mwe.core.WorkflowRunner prepare
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] INFO: EMF Modeling Workflow Engine 0.7.2, Build v200908120417
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] Aug 8, 2010 2:53:07 PM org.eclipse.emf.mwe.core.WorkflowRunner prepare
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] INFO: (c) 2005-2009 openarchitectureware.org and contributors
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] Aug 8, 2010 2:53:07 PM org.eclipse.emf.mwe.core.WorkflowRunner prepare
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] INFO: ------------------------------------------------------------ --------------------------
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] Aug 8, 2010 2:53:07 PM org.eclipse.emf.mwe.core.WorkflowRunner prepare
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] INFO: running workflow: /org/eclipse/emf/texo/generator/generate_model.oaw
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] Aug 8, 2010 2:53:07 PM org.eclipse.emf.mwe.core.WorkflowRunner prepare
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] INFO:
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] Aug 8, 2010 2:53:07 PM org.eclipse.emf.mwe.core.container.CompositeComponent internalInvoke
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] INFO: ArtifactGenerator: generating 'org::eclipse::emf::texo::modelgenerator::templates::model:: root(modelController) FOREACH modelController.EPackages' => [src, java:src]
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] java.lang.IllegalStateException: Exception loading resource org/eclipse/emf/texo/modelgenerator/templates/model.xpt
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] at org.eclipse.emf.texo.generator.TexoResourceManager.loadResou rce(TexoResourceManager.java:108)
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] at org.eclipse.xpand2.XpandExecutionContextImpl.findTemplate(Xp andExecutionContextImpl.java:195)
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] at org.eclipse.xpand2.XpandExecutionContextImpl.findTemplate(Xp andExecutionContextImpl.java:188)
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] at org.eclipse.xpand2.XpandExecutionContextImpl.findDefinition( XpandExecutionContextImpl.java:145)
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] at org.eclipse.internal.xpand2.ast.ExpandStatement.invokeDefini tion(ExpandStatement.java:174)
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] at org.eclipse.internal.xpand2.ast.ExpandStatement.evaluateInte rnal(ExpandStatement.java:145)
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] at org.eclipse.internal.xpand2.ast.Statement.evaluate(Statement .java:39)
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] at org.eclipse.xpand2.Generator.invokeInternal2(Generator.java: 334)
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] at org.eclipse.emf.texo.generator.ArtifactGenerator.invokeInter nal2(ArtifactGenerator.java:88)
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] at org.eclipse.xtend.expression.AbstractExpressionsUsingWorkflo wComponent.invokeInternal(AbstractExpressionsUsingWorkflowCo mponent.java:191)
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invok e(AbstractWorkflowComponent.java:124)
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] at org.eclipse.emf.mwe.core.container.CompositeComponent.intern alInvoke(CompositeComponent.java:101)
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] at org.eclipse.emf.mwe.core.container.CompositeComponent.invoke (CompositeComponent.java:86)
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] at org.eclipse.emf.mwe.core.WorkflowRunner.executeWorkflow(Work flowRunner.java:412)
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] at org.eclipse.emf.texo.generator.WorkFlowStarter.runWorkFlow(W orkFlowStarter.java:169)
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] at org.eclipse.emf.texo.generator.WorkFlowStarter.runWorkFlow(W orkFlowStarter.java:123)
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] at org.eclipse.emf.texo.generator.WorkFlowStarter.generateModel Code(WorkFlowStarter.java:77)
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] at org.eclipse.emf.texo.eclipse.popup.actions.GenerateCode.gene rateFromUris(GenerateCode.java:55)
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] at org.eclipse.emf.texo.eclipse.popup.actions.BaseGenerateActio n.generate(BaseGenerateAction.java:120)
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] at org.eclipse.emf.texo.eclipse.popup.actions.BaseGenerateActio n.generate(BaseGenerateAction.java:99)
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] at org.eclipse.emf.texo.eclipse.popup.actions.BaseGenerateActio n.access$0(BaseGenerateAction.java:81)
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] at org.eclipse.emf.texo.eclipse.popup.actions.BaseGenerateActio n$1.execute(BaseGenerateAction.java:71)
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] at org.eclipse.ui.actions.WorkspaceModifyOperation$1.run(Worksp aceModifyOperation.java:106)
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] at org.eclipse.core.internal.resources.Workspace.run(Workspace. java:1800)
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] at org.eclipse.ui.actions.WorkspaceModifyOperation.run(Workspac eModifyOperation.java:118)
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] at org.eclipse.jface.operation.ModalContext$ModalContextThread. run(ModalContext.java:121)
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] Caused by: org.eclipse.internal.xtend.xtend.parser.ParseException: no viable alternative at character '?' on line 1
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] at org.eclipse.internal.xpand2.parser.XpandParseFacade$3.handle Error(XpandParseFacade.java:77)
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] at org.eclipse.internal.xpand2.parser.XpandParseFacade$1.report Error(XpandParseFacade.java:57)
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] at org.antlr.runtime.Lexer.nextToken(Lexer.java:119)
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] at org.antlr.runtime.CommonTokenStream.fillBuffer(CommonTokenSt ream.java:95)
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] at org.antlr.runtime.CommonTokenStream.LT(CommonTokenStream.jav a:238)
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] at org.eclipse.internal.xpand2.parser.XpandLocationAddingParser .start(XpandLocationAddingParser.java:43)
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] at org.eclipse.internal.xpand2.parser.XpandLocationAddingParser .template(XpandLocationAddingParser.java:289)
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] at org.eclipse.internal.xpand2.parser.XpandParseFacade.file(Xpa ndParseFacade.java:44)
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] at org.eclipse.internal.xpand2.parser.XpandParseFacade.file(Xpa ndParseFacade.java:31)
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] at org.eclipse.xpand2.XpandExecutionContextImpl$1.parse(XpandEx ecutionContextImpl.java:92)
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] at org.eclipse.emf.texo.generator.TexoResourceManager.loadResou rce(TexoResourceManager.java:103)
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] ... 25 more
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] Aug 8, 2010 2:53:07 PM org.eclipse.emf.mwe.core.WorkflowRunner executeWorkflow
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] INFO: workflow completed in 37ms!
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] Aug 8, 2010 2:53:07 PM org.eclipse.emf.mwe.core.WorkflowRunner logIssues
8/8/10 2:53:07 PM [0x0-0x25025].org.eclipse.eclipse[271] SEVERE: [ERROR]: Exception loading resource org/eclipse/emf/texo/modelgenerator/templates/model.xpt(Elem ent: EXPAND org::eclipse::emf::texo::modelgenerator::templates::model::r oot(modelController) FOREACH modelController.EPackages; Reported by: ArtifactGenerator: generating 'org::eclipse::emf::texo::modelgenerator::templates::model:: root(modelController) FOREACH modelController.EPackages' => [/Users/michabartoszewski/Documents/workspace/MagisterkaTexo /src, java:/Users/michabartoszewski/Documents/workspace/Magisterka Texo/src])
8/8/10 2:53:46 PM Spotlight[162] /SourceCache/Spotlight/Spotlight-398.26/menu/Application/../ Models/MDQueryWorker.m -[MDQueryWorker startQuery:withFlags:] Can't execute query '(* = "termin*"cdw || kMDItemTextContent = "termin*"cdw)'

With regards, e1n
Re: [TEXO] overriding templates question [message #623129 is a reply to message #623128] Sun, 08 August 2010 14:30 Go to previous message
e1n is currently offline e1nFriend
Messages: 22
Registered: April 2010
Location: Poland
Junior Member

Ok i have figured out what was wrong. It was issue with encoding. Eclipse was using MacRoman encoding and Xpand uses those «,» characters which where surrounded with some additional control characters in my case.

I have changed encoding globally to UTF-8 and manual edited templates files. Now everything is ok.

With regards, e1n
Re: [TEXO] overriding templates question [message #623130 is a reply to message #551529] Sun, 08 August 2010 22:15 Go to previous message
e1n is currently offline e1nFriend
Messages: 22
Registered: April 2010
Location: Poland
Junior Member

Hi Martin,

I have programmed some support for EOperations generation.
But right now it is just draft of working implementation.

I was reading Texo code and studying it's ecore files etc.
But I couldn't managed to find piece of code which is responsible
for transformation of EMF basic types like EString, EBoolean etc. to Java types like String, Boolean etc.

Can you give me a hint where I could find it ?

With regards, e1n

Martin taal wrote on Fri, 06 August 2010 16:01
> Hi Michal,
> You understand it completely correct! The default entity_addition.xpt has this code:
> «DEFINE root(ModelController modelController) FOR EClassModelGenAnnotation-»
> «ENDDEFINE»
>
> so the 'this' inside the DEFINE is an instance of the EClassModelGenAnnotation class. This expression can be used to get
> to the eclass:
> this.EClass
>
> and from there you can find the eoperation.
>
> Btw, I would like to add eoperation support to Texo (just to be complete..), so if you are interested and your
> implementation is generic then contributions are always wellcomed!
>
> gr. Martin
>
> On 08/06/2010 04:33 PM, e1n wrote:
> > Hi !
> >
> > I read about that Texo is not supporting emf's EOperation during code
> > generation process.
> > I am wondering if it makes sens to override "entity_addition.xpt"
> > template to generate code for my EOperations defined in my Ecore file
> > which are not generated by Texo itself.
> >
> > Texo documentations states that: The template is called with model
> > annotations as the main class. The model annotation enriches the domain
> > model with code generation specific information (for example the java
> > class). In addition you have access to the underlying model element
> > (EPackage, etc.). There are model annotation for each of the main model
> > elements (EPackage, EClass, EStructuralFeature, EReference, EAttribute,
> > EDataType, EEnum).
> > So I guess it is possible to get EClass and using EMF API's extract
> > EOperation's and generate methods signatures ?
> >
> > Did any one tried that ? Or maybe I have totally misunderstood the whole
> > concept ?
> >
> > With regards, e1n
> >
>
>
> --
>
> With Regards, Martin Taal
>
> Springsite/Elver.org
> Office: Hardwareweg 4, 3821 BV Amersfoort
> Postal: Nassaulaan 7, 3941 EC Doorn
> The Netherlands
> Cell: +31 (0)6 288 48 943
> Tel: +31 (0)84 420 2397
> Fax: +31 (0)84 225 9307
> Mail: mtaal@springsite.com - mtaal@elver.org
> Web: www.springsite.com - www.elver.org
Re: [TEXO] overriding templates question [message #623133 is a reply to message #623130] Mon, 09 August 2010 08:22 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Michal,
This is done in java through the GenUtils class:
org.eclipse.emf.texo.modelgenerator.annotator.GenUtils.getIn stanceClassName(eDataType)

But it is probably better to get the model annotation class for the edatatype. So if 'this' is the edatatype then this
call in xpand will give you the ModelEDataTypeAnnotation:
modelController.getAnnotation(this, ModelcodegeneratorPackage::eNS_URI)
on this instance you can call:
getInstanceClassName()
to get the type name to use in java

This do this call you need to have these imports in the top:
«IMPORT org::eclipse::emf::ecore»
«IMPORT org::eclipse::emf::texo::generator»
«IMPORT org::eclipse::emf::texo::modelgenerator::modelannotations»

gr. Martin

On 08/09/2010 12:15 AM, e1n wrote:
> Hi Martin,
>
> I have programmed some support for EOperations generation.
> But right now it is just draft of working implementation.
>
> I was reading Texo code and studying it's ecore files etc.
> But I couldn't managed to find piece of code which is responsible
> for transformation of EMF basic types like EString, EBoolean etc. to
> Java types like String, Boolean etc.
>
> Can you give me a hint where I could find it ?
>
> With regards, e1n
>
> Martin taal wrote on Fri, 06 August 2010 16:01
>> Hi Michal,
>> You understand it completely correct! The default entity_addition.xpt
>> has this code:
>> «DEFINE root(ModelController modelController) FOR
>> EClassModelGenAnnotation-»
>> «ENDDEFINE»
>>
>> so the 'this' inside the DEFINE is an instance of the
>> EClassModelGenAnnotation class. This expression can be used to get to
>> the eclass:
>> this.EClass
>>
>> and from there you can find the eoperation.
>>
>> Btw, I would like to add eoperation support to Texo (just to be
>> complete..), so if you are interested and your implementation is
>> generic then contributions are always wellcomed!
>>
>> gr. Martin
>>
>> On 08/06/2010 04:33 PM, e1n wrote:
>> > Hi !
>> >
>> > I read about that Texo is not supporting emf's EOperation during code
>> > generation process.
>> > I am wondering if it makes sens to override "entity_addition.xpt"
>> > template to generate code for my EOperations defined in my Ecore file
>> > which are not generated by Texo itself.
>> >
>> > Texo documentations states that: The template is called with model
>> > annotations as the main class. The model annotation enriches the domain
>> > model with code generation specific information (for example the java
>> > class). In addition you have access to the underlying model element
>> > (EPackage, etc.). There are model annotation for each of the main model
>> > elements (EPackage, EClass, EStructuralFeature, EReference, EAttribute,
>> > EDataType, EEnum).
>> > So I guess it is possible to get EClass and using EMF API's extract
>> > EOperation's and generate methods signatures ?
>> >
>> > Did any one tried that ? Or maybe I have totally misunderstood the
>> whole
>> > concept ?
>> >
>> > With regards, e1n
>> >
>>
>>
>> --
>>
>> With Regards, Martin Taal
>>
>> Springsite/Elver.org
>> Office: Hardwareweg 4, 3821 BV Amersfoort
>> Postal: Nassaulaan 7, 3941 EC Doorn
>> The Netherlands
>> Cell: +31 (0)6 288 48 943
>> Tel: +31 (0)84 420 2397
>> Fax: +31 (0)84 225 9307
>> Mail: mtaal@springsite.com - mtaal@elver.org
>> Web: www.springsite.com - www.elver.org
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Previous Topic:[EEF] Usage of view reference
Next Topic:Need a tool for generating intuitive UI for instantiating Ecore Model entities
Goto Forum:
  


Current Time: Thu Apr 18 04:46:12 GMT 2024

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

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

Back to the top