Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » XText 2.4.1 DomainmodelJvmModelInferrer
XText 2.4.1 DomainmodelJvmModelInferrer [message #1049231] Thu, 25 April 2013 14:39 Go to next message
michael m is currently offline michael mFriend
Messages: 17
Registered: March 2013
Junior Member

i have two questions. One is about XConstructorCall and the other one about Associations/Linking.

If i change the Operation method in the DomainmodelJvmModelInferrer to this:
Operation : {
  members += f.toMethod(, f.type ?: inferredType) [
    documentation = f.documentation
    for (p : f.params) {
      parameters += p.toParameter(, p.parameterType)
    body = [
      if (f.body instanceof XBlockExpression) {
        val block = f.body as XBlockExpression
        for (exp : block.expressions) {
          if (exp instanceof XAssignment) {
            val assign = exp as XAssignment
	    it.append(" = ")
	    if (assign.value instanceof XConstructorCall) {
              val xCon = assign.value as XConstructorCall
              // xCon.constructor

And given this model:
package com.domain.model {
  entity Test {
    id: String
    op setAutoId(): void {
      id = new String("Name");

Then how can i generate/append the content of "xCon.constructor"?
It basically contains just a URI Fragment (something like: JvmConstructor: (eProxyURI: platform:/resource/DomainModel/src/com/domain/model/test.dmodel#xtextLink_::
Which means that i have to resolve it somehow to get the JvmType?

The next point is that if i try to ctrl+click on id (where the new string is assigned) i don't jump to the definition. Which means i have to associate the id in XAssignment manually in the inferrer?

Re: XText 2.4.1 DomainmodelJvmModelInferrer [message #1049699 is a reply to message #1049231] Fri, 26 April 2013 07:05 Go to previous message
michael m is currently offline michael mFriend
Messages: 17
Registered: March 2013
Junior Member
To answer my own question about association.
I had to inject the IJvmModelAssociator
@Inject	private IJvmModelAssociator associator;

and call it right before the body part is created
associator.associateLogicalContainer(f.body, it);

I still have no clue how to append a XConstructorCall Sad

Just realized that it actually solved all problems Smile

[Updated on: Fri, 26 April 2013 07:18]

Report message to a moderator

Previous Topic:[Xtext] Problem with basic XBase tutorial
Next Topic:Help needed in Xtext
Goto Forum:

Current Time: Wed Jan 22 23:28:11 GMT 2020

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

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

Back to the top