This is somewhat related to XText, but I assume that the problem is
really in the Xpand part of the system.

I am working on my first XText project.
My first try failed because I have to use two languages and tried to fit
them into the projects generated by Eclipse. Didn't work for several
reasons.

On my second try I created another XText project. I copied the main and
ui projects for the second language and adjusted everything I could
find.
I exported all four projects and it works. Good so far.

Then I renamed the generator project into "common" and intend to use it
as main project for further programming. Sources from models defined by
both languages should be generated here.

So I used the Eclipse-generated workflow and modified it only a little.
I point the modelFile property to my new Xtext model and I add an
outputSlot for the registered Xtext model.
Then I use this model slot in the expand statement. Everything else
stays the same. From what I know, I think that all that project renaming
of the Xtext projects should not affect the Xpand code generation.

But it doesn't work.
I get this exception:
No Definition 'templates::Template::main for visagestructure::Model' found!

My first thought was that he could not read the model or that the slot
wasn't identical. But when I rename that slot in the expand statement, I
get a different exception, so I assume that the model was correctly
read.

I then tried to debug. Eclipse doesn't seem to be able to debug a
workflow, even if I start it as "Debug as ... MWE Workflow".
So I made a Java program that allows me to run that workflow
programmatically. I get exactly the same exception, but now I can debug.
Through debugging I found out in debug mode that the
AbstractResourceLoader manages to find and open the template file, this
is guaranteed.
But I still get the same exception.

The Xpand file itself is almost exactly like Eclipse generated it for
me. I just removed the lines that wouldn't work with my model.
So IMO the line "

On 2010-07-07, Christian Dietrich <christian.dietrich@itemis.de> wrote:
> Hello,
>
> do you have a file Template.xpt within the package templates and a definition like
>
><<DEFINE main FOR visagestructure::Model>>
><<ENDDEFINE>>
>
> if so it should work.
> Can you post your complete workflow. Maybe there is a configuration error.

I didn't know that the board doesn't accept that xpand characters.
I corrected them.

Here is the rest of my post:

So IMO the line "<<DEFINE main FOR Model->>" should be valid. Every XText
Metamodel has the Model class defined. So I have no idea why it does not work.
Another Eclipse-generated XText project works, even though I can't see
any difference to this project.

BTW: The generator.setSrcPath and .setGenPath are marked as deprecated.
I should use outlets instead.
But how do I use Outlets? I can give an Outlet a path in the
constructor, but how does the system know whether it is the SrcPath or
the GenPath?
I assume i have to use setName, but how do I find out which names?

No Definition 'templates::Template::main for visagestructure::Model' found!

Quote:

<<IMPORT visageStructure>>;

visagestructure != visageStructure

I tried this with a sample dsl and workflow and can reproduce the problem. this is a bug in xpand (generator and/or editor) since you do not get an error marker
This bugs seems to occur only with Xtext / Xpand 0.7.2 and is fixed with Xtext / Xpand 1.0.0

I debugged deep into EMF and have located the problem.
It seems there is no valid Metamodel registered.
There are only
- BuiltinMetaModel
- XtendMetaModel
- XpandTypesMetaModel
- EmfMetaModel

None of these have a definition for "Model".
What I don't understand is why the standard XText project manages to
find the correct metamodel.
It must be the line
<metaModel
class="org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel "/>
but I have no idea what it does and how it locates the correct MM.

Anyway, since it obviously doesn't work, I now try to register the
correct Metamodel.
In my Java file I added the lines:
EmfMetaModel emfMetaModel = new
org.eclipse.xtend.typesystem.emf.EmfMetaModel();
emfMetaModel.setMetaModelPackage("com.lm.model.visage.visagestructure.VisagestructurePackage ");

And then:
generator.addMetaModel(emfMetaModel);

But that doesn't work yet.
Still, I seem to have a lead and will try more tomorrow.

I see. This was indeed the problem.
It was a leftover from a renaming of the package. I didn't see this.
Thank you!

I am, however, a little confused where EMF knows where to get the
Metamodel. It seems like I overlooked something while debugging.
No matter.

> I tried this with a sample dsl and workflow and can reproduce the problem.
> this is a bug in xpand (generator and/or editor) since you do not get an error marker
> This bugs seems to occur only with Xtext / Xpand 0.7.2 and is fixed with Xtext / Xpand 1.0.0