Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Generation : Could not find any exported element of type 'CompilationUnit' -> Slot 'compilationUn
Generation : Could not find any exported element of type 'CompilationUnit' -> Slot 'compilationUn [message #548020] Tue, 20 July 2010 13:03 Go to next message
jeremie is currently offline jeremieFriend
Messages: 233
Registered: April 2010
Senior Member
Hello everybody.

I try to generate some javaCode from an instance of my language.

The root class of my language is CompilationUnit.
The workflow look like that.
module workflow.LanguageGenerator

import org.eclipse.emf.mwe.utils.*

var targetDir = "src-gen"
var fileEncoding = "MacRoman"
var modelPath = "src/model"

Workflow {


	bean = StandaloneSetup {
		registerGeneratedEPackage = "fr.irisa.cairn.graphAdapter.model.adapter.AdapterPackage"
		registerGeneratedEPackage = "fr.irisa.cairn.graphAdapter.model.adapter.expression.ExpressionPackage"
	}
	
	component = org.eclipse.xtext.mwe.Reader {
		// lookup all resources on the classpath
		// useJavaClassPath = true

		// or define search scope explicitly
		path = modelPath

		// this class will be generated by the xtext generator 
		register = fr.irisa.cairn.graphAdapter.LanguageStandaloneSetup {}
		load = {
			slot = "compilationUnits"
			type = "CompilationUnit"
		}
	}

	component = org.eclipse.xpand2.Generator {
		expand = "templates::Template::main FOREACH compilationUnits"
		outlet = {
			path = targetDir
		}
		fileEncoding = fileEncoding
	}
}



I have a a vile file that xtext can read in src/model.

but when I launch the workflow. it don't find any CompilatuinUnit :

0    [main] INFO  lipse.emf.mwe.utils.StandaloneSetup  - Adding generated EPackage 'fr.irisa.cairn.graphAdapter.model.adapter.AdapterPackage'
2    [main] INFO  lipse.emf.mwe.utils.StandaloneSetup  - Adding generated EPackage 'fr.irisa.cairn.graphAdapter.model.adapter.expression.ExpressionPackage'
214  [main] DEBUG        org.eclipse.xtext.mwe.Reader  - Resource Pathes : [src/model]
215  [main] INFO         org.eclipse.xpand2.Generator  - No meta models configured, using JavaBeans as default.
405  [main] WARN      org.eclipse.xtext.mwe.SlotEntry  - Could not find any exported element of type 'CompilationUnit' -> Slot 'compilationUnits' is empty.
444  [main] INFO  .emf.mwe2.runtime.workflow.Workflow  - Done.




I guess it missed one line in the workflow.
But what line ^^?
I supposed it is again because my model in in an other plugin.

Jérémie

Re: Generation : Could not find any exported element of type 'CompilationUnit' -> Slot 'compilati [message #548023 is a reply to message #548020] Tue, 20 July 2010 13:17 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hi, you CompilationUnit may have no name and so it will be filtered out by the reader - see http://www.eclipse.org/forums/index.php?t=msg&th=171975& amp;start=0&

Regards,
Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Generation : Could not find any exported element of type 'CompilationUnit' -> Slot 'compilati [message #548043 is a reply to message #548023] Tue, 20 July 2010 13:58 Go to previous messageGo to next message
jeremie is currently offline jeremieFriend
Messages: 233
Registered: April 2010
Senior Member
that(s right CompilationUnit has no atribute name.

it is just the root container.

So I add a attribute name.
Model returns adapt::CompilationUnit :
	'compilationUnit' name=ID
   // and some other stuff
;


but it still doesn't work.

Si I add this :
public class MyQualifiedNameProvider extends DefaultDeclarativeQualifiedNameProvider {
	public String getQualifiedName(CompilationUnit unit) {
		return unit.getName();
	}

}


But as I choose to call this attribute "name", I thought I didn't need to implement this method.


Jeremie






Re: Generation : Could not find any exported element of type 'CompilationUnit' -> Slot 'compilati [message #548073 is a reply to message #548043] Tue, 20 July 2010 15:12 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hi,

starting from scratch it works for me.

have you done other changes to the dsl worklflow? Out of the box org.eclipse.xtext.naming.SimpleNameProvider is used by the wizard.
Which works by just having an attribute "name".

Regards
Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Generation : Could not find any exported element of type 'CompilationUnit' -> Slot 'compilati [message #548088 is a reply to message #548073] Tue, 20 July 2010 15:39 Go to previous messageGo to next message
jeremie is currently offline jeremieFriend
Messages: 233
Registered: April 2010
Senior Member
hmm I just add the Epackage of my model :

Workflow {
	bean = StandaloneSetup {
		platformUri = "${runtimeProject}/.."
		registerGeneratedEPackage = "fr.irisa.cairn.graphAdapter.model.adapter.AdapterPackage"
		registerGeneratedEPackage = "fr.irisa.cairn.graphAdapter.model.adapter.expression.ExpressionPackage"
	}

	component = DirectoryCleaner {
		directory = "${runtimeProject}/src-gen"
	}

	component = DirectoryCleaner {
		directory = "${runtimeProject}.ui/src-gen"
	}

	component = Generator {
		pathRtProject = runtimeProject
		pathUiProject = "${runtimeProject}.ui"
		projectNameRt = projectName
		projectNameUi = "${projectName}.ui"
		language = {
			uri = grammarURI
			fileExtensions = file.extensions

			// Java API to access grammar elements (required by several other fragments)
			fragment = grammarAccess.GrammarAccessFragment {}

			// generates Java API for the generated EPackages
			// fragment = ecore.EcoreGeneratorFragment {
			// 		referencedGenModels = "platform:/resource/fr.irisa.cairn.graphAdapter.model/model/AdapterBase.genmodel"
			// }

			// the serialization component
			fragment = parseTreeConstructor.ParseTreeConstructorFragment {}

			// a custom ResourceFactory for use with EMF 
			fragment = resourceFactory.ResourceFactoryFragment {
				fileExtensions = file.extensions
			}

			// the Antlr parser
			fragment = parser.antlr.XtextAntlrGeneratorFragment {
				options = {
					backtrack = true classSplitting = true
				}
			}

			// the Ecore2Xtext specific terminal converter
			fragment = ecore2xtext.Ecore2XtextValueConverterServiceFragment {}

			// java-based API for validation 
			fragment = validation.JavaValidatorFragment {
			// composedCheck = "org.eclipse.xtext.validation.ImportUriValidator"
			// composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
				registerForImportedPackages = true
			}

			// scoping and exporting API
			fragment = scoping.ImportURIScopingFragment {}
			fragment = exporting.SimpleNamesFragment {}

			// scoping and exporting API 

//			 fragment = scoping.ImportNamespacesScopingFragment {}
//			 fragment = exporting.QualifiedNamesFragment {}


			// formatter API 
			fragment = ecore2xtext.FormatterFragment {}

			// labeling API 
			fragment = labeling.LabelProviderFragment {}

			// outline API 
			fragment = outline.TransformerFragment {}
			fragment = outline.OutlineNodeAdapterFactoryFragment {}

			// java-based API for content assistance 
			fragment = contentAssist.JavaBasedContentAssistFragment {}

			// antlr parser generator tailored for content assist 
			fragment = parser.antlr.XtextAntlrUiGeneratorFragment {
				options = {
					backtrack = true classSplitting = true
				}
			}

			fragment = builder.BuilderIntegrationFragment {}

			// project wizard (optional) 

			// fragment = projectWizard.SimpleProjectWizardFragment {
			//		generatorProjectName = "${projectName}.generator" 
			//		modelFileExtension = file.extensions
			// }

			// quickfix API 
			fragment = quickfix.QuickfixProviderFragment {}
		}
	}



Strange if it works for you. maybe I add différents this to do because my model come from an other plugin...

Jeremie
Re: Generation : Could not find any exported element of type 'CompilationUnit' -> Slot 'compilati [message #548116 is a reply to message #548088] Tue, 20 July 2010 17:16 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Strange. Could you try from scratch once more? Don't Know Why the declarativeqnameprovider is bound with this workflow

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Tue, 20 July 2010 17:19]

Report message to a moderator

Re: Generation : Could not find any exported element of type 'CompilationUnit' -> Slot 'compilati [message #548136 is a reply to message #548116] Tue, 20 July 2010 18:25 Go to previous messageGo to next message
jeremie is currently offline jeremieFriend
Messages: 233
Registered: April 2010
Senior Member
hmm what do you mean by "scratch" :$
Re: Generation : Could not find any exported element of type 'CompilationUnit' -> Slot 'compilati [message #548139 is a reply to message #548136] Tue, 20 July 2010 18:38 Go to previous messageGo to next message
jeremie is currently offline jeremieFriend
Messages: 233
Registered: April 2010
Senior Member
hmmm, on a simple exemple, it works, but not with this one. I am looking for differences between them.
Re: Generation : Could not find any exported element of type 'CompilationUnit' -> Slot 'compilati [message #548141 is a reply to message #548139] Tue, 20 July 2010 18:44 Go to previous messageGo to next message
jeremie is currently offline jeremieFriend
Messages: 233
Registered: April 2010
Senior Member
I find it!!!

ITwas because I commented these lines :

Injector ecoreInjector = Guice.createInjector(new EcoreRuntimeModule());

IResourceServiceProvider.Registry.INSTANCE.getExtensionToFac toryMap().put( "ecore",
ecoreInjector.getInstance(IResourceServiceProvider.class));

super.register(injector);

in the @Override
public void register(final Injector injector) method Smile

thanks,

jeremie
Re: Generation : Could not find any exported element of type 'CompilationUnit' -> Slot 'compilati [message #548864 is a reply to message #548043] Fri, 23 July 2010 10:43 Go to previous messageGo to next message
Steffen Klössel is currently offline Steffen KlösselFriend
Messages: 4
Registered: July 2009
Junior Member
Hi Jeremie,

you wrote:

public class MyQualifiedNameProvider extends DefaultDeclarativeQualifiedNameProvider {
	public String getQualifiedName(CompilationUnit unit) {
		return unit.getName();
	}

}


but you did'nt say where to add/register that "function"

I've the same problem - could you give me some hints?

thanks
Steffen
Re: Generation : Could not find any exported element of type 'CompilationUnit' -> Slot 'compilati [message #548867 is a reply to message #548864] Fri, 23 July 2010 10:48 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hi,

its done as it's always done with Xtext's Guice bindings: In the (Runtime)Module

public class MyDslRuntimeModule extends org.xtext.example.mydsl.AbstractMyDslRuntimeModule {
	
	@Override
	public Class<? extends IQualifiedNameProvider> bindIQualifiedNameProvider() {
		return MyQualifiedNameProvider.class;
	}

}


Regards,
Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Generation : Could not find any exported element of type 'CompilationUnit' -> Slot 'compilati [message #548876 is a reply to message #548867] Fri, 23 July 2010 11:12 Go to previous messageGo to next message
Steffen Klössel is currently offline Steffen KlösselFriend
Messages: 4
Registered: July 2009
Junior Member
Oh yes - thanks - this problem is history, but another one still exists. the Xpand workflow asserts to me, that there exists no definition for my DomainModel?!

0    [main] DEBUG        org.eclipse.xtext.mwe.Reader  - Resource Pathes : [src/model]
5    [main] INFO         org.eclipse.xpand2.Generator  - No meta models configured, using JavaBeans as default.
206  [main] DEBUG xt.validation.ResourceValidatorImpl  - Syntax check OK! Resource: file:/C:/Users/sk/workspace/darkmatter.core.generator/src/model/Example.core
571  [main] ERROR        org.eclipse.xpand2.Generator  - Error in Component  of type org.eclipse.xpand2.Generator: 
	EvaluationException : No Definition 'templates::Template::main for darkmatter::core::impl::DomainModelImpl' found!
	[23,49] on line 1 'EXPAND templates::Template::main FOREACH elements'


the xpand template looks like this:
«IMPORT darkmatter::Core»

«DEFINE main FOR core::DomainModel-»
«FILE "test.java"-»
/* 
 *	Test
 */ 
«ENDFILE-»
«ENDDEFINE»


The xpand workflow:

Workflow {
	
	component = org.eclipse.xtext.mwe.Reader {

[cut]

		register = darkmatter.CoreStandaloneSetup {}
		
		load = {
			slot = "elements"
			type = "DomainModel"
		}
	}

	component = org.eclipse.xpand2.Generator {
		expand = "templates::Template::main FOREACH elements"
		outlet = {
			path = targetDir
		}
		fileEncoding = fileEncoding
	}
}


The grammar:
grammar darkmatter.Core 
	with org.eclipse.xtext.common.Terminals

import ... [cut]

generate core "http://Core.darkmatter"

DomainModel:
	(elements+=Abstract)*;
	
Abstract:
  [cut]


What can we do?

Thanks in advance
Steffen
Re: Generation : Could not find any exported element of type 'CompilationUnit' -> Slot 'compilati [message #548880 is a reply to message #548876] Fri, 23 July 2010 11:24 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Xpand is casesensitive - the editor should mark the stuff read if you have the xpand/xtend nature added.

«IMPORT darkmatter::core»

«DEFINE main FOR DomainModel-»
«FILE "test.java"-»
/* 
 *	Test
 */ 
«ENDFILE-»
«ENDDEFINE»


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Generation : Could not find any exported element of type 'CompilationUnit' -> Slot 'compilati [message #548886 is a reply to message #548880] Fri, 23 July 2010 11:45 Go to previous messageGo to next message
Steffen Klössel is currently offline Steffen KlösselFriend
Messages: 4
Registered: July 2009
Junior Member
Hi Christian,

hmm - I supposed this - But I tried both variants.
Neither «IMPORT darkmatter::core» nor «IMPORT darkmatter::Core» works for me - in each case the editor gives me a warning
Namespace darkmatter::core is unknown or unused.
as expected

Nothing helps - I added (in desperation *g*) the xtext project to the build-/classpath of the depending xpand-generator project.

You have any other idea? Must the used/imported namespace be registered to the xpand-workflow?

Thanks again
Steffen

[Updated on: Fri, 23 July 2010 11:46]

Report message to a moderator

Re: Generation : Could not find any exported element of type 'CompilationUnit' -> Slot 'compilati [message #548888 is a reply to message #548886] Fri, 23 July 2010 11:47 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Have you enabled java beans metamodel in the projects xpand/xtend properties.? Is the error only in editor or when runnung the workflow too?
which is the package name of the DomainModel class?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Fri, 23 July 2010 11:49]

Report message to a moderator

Re: Generation : Could not find any exported element of type 'CompilationUnit' -> Slot 'compilati [message #548891 is a reply to message #548888] Fri, 23 July 2010 11:55 Go to previous messageGo to next message
Steffen Klössel is currently offline Steffen KlösselFriend
Messages: 4
Registered: July 2009
Junior Member
My goodness :)

in this moment I g**gled for that warning and found some hints as your solution.

The import was corresponding to the generated EMF interfaces?!

Thank you - with beans metamodel it works.
Steffen

[Updated on: Fri, 23 July 2010 12:01]

Report message to a moderator

Re: Generation : Could not find any exported element of type 'CompilationUnit' -> Slot 'compilati [message #552848 is a reply to message #548891] Fri, 13 August 2010 18:51 Go to previous messageGo to next message
hachreak  is currently offline hachreak Friend
Messages: 11
Registered: December 2009
Junior Member
I have a similar problem but I haven't understand what you have do! Razz
Can you explain better how you fix the problem?

thanks Smile .hachreak,
Re: Generation : Could not find any exported element of type 'CompilationUnit' -> Slot 'compilati [message #552855 is a reply to message #552848] Fri, 13 August 2010 19:23 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
hello hachreak,

i answer you question in your post - just import the full qualified name of your Model Java Classes Package

Regards
Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Generation : Could not find any exported element of type 'CompilationUnit' -> Slot 'compilati [message #669607 is a reply to message #552855] Tue, 10 May 2011 23:08 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 1
Registered: May 2011
Junior Member
Hello everyone
We are having some troubles in using code generation features
Our Xtext specification is as follows:

WSN:
	(nodes+=Node)*;

Node:
	'Node {
		id = ' id=INT
		'name = ' name= STRING
	sensor = Sensor
	transceiver = Transceiver
	battery = Battery
	buffer += Buffer '}';

Sensor :
	'sensorType = 'type = SensorType;

SensorType :
	'light' | 'temperature' | 'humidity';
	

Transceiver :
	'Transceiver {'
	transmitter = Transmitter
	receiver = Receiver '}';
	
Transmitter :
	'transmitterRange = ' range = INT;

Receiver :
	'receiverRange = ' range = INT;

Battery :
	'remainingBattery = ' remainingEnergy = INT;
	
Buffer :
	'Buffer {'
	(packets += Packet)* '}';

Packet:
	'Packet {'
		'sourceID = ' sourceID = INT
		'destID = ' destID = INT
		'pid = ' pid = INT
		'payload = ' payload = Payload '}';

Payload:
	rPayload=RoutingPayload | sPayload=SensorPayload;

SensorPayload:
	sensorText=STRING;
	
RoutingPayload:
	routingText=STRING;



Also our workflow(mwe2) file within the xtext project is below
module workflow.DomainmodelGenerator

import org.eclipse.emf.mwe.utils.*

var targetDir = "src-gen"
var fileEncoding = "Cp1254"
//var modelPath = "src/model"

Workflow {

	component = org.eclipse.xtext.mwe.Reader {
		// lookup all resources on the classpath
		useJavaClassPath = true

		// or define search scope explicitly
		//path = modelPath

		// this class will be generated by the xtext generator 
		register = org.xtext.wsn.DomainmodelStandaloneSetup {}
		load = {
			slot = "nodes"
			type = "Node"
		}
	}

	component = org.eclipse.xpand2.Generator {
		expand = "templates::Template::nodes FOR nodes"
		outlet = {
			path = targetDir
		}
		fileEncoding = fileEncoding
	}
}


Finally our simplest .xpt file as below
«IMPORT domainmodel»

«DEFINE nodes FOR Node»
	«FILE name+".txt"»
	«name»
	«ENDFILE»
«ENDDEFINE»


We got the following error:
12   [main] INFO         org.eclipse.xpand2.Generator  - No meta models configured, using JavaBeans as default.
922  [main] DEBUG xt.validation.ResourceValidatorImpl  - Syntax check OK! Resource: file:/C:/Users/kadir/workspace/org.xtext.wsn.domainmodel.generator/bin/workflow/DomainmodelGenerator.mwe2
1521 [main] DEBUG xt.validation.ResourceValidatorImpl  - Syntax check OK! Resource: file:/C:/Users/kadir/workspace/org.xtext.wsn.domainmodel.generator/bin/model/Example.dmodel
1836 [main] DEBUG xt.validation.ResourceValidatorImpl  - Syntax check OK! Resource: archive:file:/C:/Users/kadir/Desktop/eclipse-modeling-galileo-SR1-incubation-win32/eclipse/plugins/org.eclipse.xtext.generator_1.0.2.v201102150722.jar!/org/eclipse/xtext/generator/StandardRuntimeFragments.mwe2
2251 [main] DEBUG xt.validation.ResourceValidatorImpl  - Syntax check OK! Resource: archive:file:/C:/Users/kadir/Desktop/eclipse-modeling-galileo-SR1-incubation-win32/eclipse/plugins/org.eclipse.emf.mwe2.language_1.0.2.v201102151014.jar!/org/eclipse/emf/mwe2/language/GenerateMwe2.mwe2
2405 [main] DEBUG xt.validation.ResourceValidatorImpl  - Syntax check OK! Resource: archive:file:/C:/Users/kadir/Desktop/eclipse-modeling-galileo-SR1-incubation-win32/eclipse/plugins/org.eclipse.xtext.generator_1.0.2.v201102150722.jar!/org/eclipse/xtext/generator/parser/antlr/splitting/SimpleExpressions.mwe2
2607 [main] DEBUG xt.validation.ResourceValidatorImpl  - Syntax check OK! Resource: file:/C:/Users/kadir/workspace/org.xtext.wsn.domainmodel/bin/org/xtext/wsn/GenerateDomainmodel.mwe2
2632 [main] WARN  eclipse.emf.mwe.core.lib.Mwe2Bridge  - [WARNING]: The var 'genmodels' is never read locally.(Element: WARNING:The var 'genmodels' is never read locally. (archive:file:/C:/Users/kadir/Desktop/eclipse-modeling-galileo-SR1-incubation-win32/eclipse/plugins/org.eclipse.xtext.generator_1.0.2.v201102150722.jar!/org/eclipse/xtext/generator/StandardRuntimeFragments.mwe2 line : 12); Reported by: -UNKNOWN-)
3080 [main] ERROR        org.eclipse.xpand2.Generator  - Error in Component  of type org.eclipse.xpand2.Generator: 
	EvaluationException : No Definition 'templates::Template::nodes for List' found!
	[23,43] on line 1 'EXPAND templates::Template::nodes FOR nodes'


Could you please make any suggestions on these?
Re: Generation : Could not find any exported element of type 'CompilationUnit' -> Slot 'compilati [message #669671 is a reply to message #669607] Wed, 11 May 2011 06:32 Go to previous messageGo to next message
Alexander Nittka is currently offline Alexander NittkaFriend
Messages: 1193
Registered: July 2009
Senior Member
Hi,

in the workflow it should be

expand = "templates::Template::nodes FOREACH nodes"

as the slot contains a list of nodes your template definition is only for a single node. The above template code ensures that the template is called for each single node rather than for the entire list at once.

Regarding your grammar, a lot of your keywords (anything enclosed in quotes) contain white spaces, which is bad design (and causes heaps of errors and unintended editor behaviour).

'Node {
		id = ' ...


should be

'Node' '{' 'id' '='...


Alex
Re: Generation : Could not find any exported element of type 'CompilationUnit' -> Slot 'compilati [message #670972 is a reply to message #552855] Mon, 16 May 2011 12:43 Go to previous messageGo to next message
Nikola  is currently offline Nikola Friend
Messages: 13
Registered: May 2011
Junior Member
Hi Christian,

I have the same problem with no definition found, and I'm wondering about the location for importing the Model Java Classes Package, as you said. Is it the workflow file ? or anywhere else?
Btw, I was following the entire discussion, and I've enabled java beans metamodel in the projects xpand/xtend properties, and the mistake that appears is not when I'm editing the template, but only when I'm running the workflow.

Any suggestions?

Thanks in advance
Nikola
Re: Generation : Could not find any exported element of type 'CompilationUnit' -> Slot 'compilati [message #670981 is a reply to message #552855] Mon, 16 May 2011 12:51 Go to previous messageGo to next message
Nikola  is currently offline Nikola Friend
Messages: 13
Registered: May 2011
Junior Member
Hi Christian,

I have the same problem with no definition found, and I'm wondering about the location for importing the Model Java Classes Package, as you said. Is it the workflow file ? or anywhere else?
Btw, I was following the entire discussion, and I've enabled java beans metamodel in the projects xpand/xtend properties, and the mistake that appears is not when I'm editing the template, but only when I'm running the workflow.

Any suggestions?

Thanks in advance
Nikola
Re: Generation : Could not find any exported element of type 'CompilationUnit' -> Slot 'compilati [message #671014 is a reply to message #670981] Mon, 16 May 2011 14:37 Go to previous messageGo to next message
Nikola  is currently offline Nikola Friend
Messages: 13
Registered: May 2011
Junior Member
Actually
I'm using the full qualified name of the model java classes package. But still the same error appears. This is what actually appears as an error:
EvaluationException : No Definition 'templates::Template::main for bdl::BDL' found!
	[23,41] on line 1 'EXPAND templates::Template::main FOR bdls'


the slot/type definition looks as follows:

 load = {
		 
		 	firstOnly = true
		 	slot = "bdls"
		 	type = "BDL"
 
 		 }


The expand command looks as follows:
 
expand = "templates::Template::main FOR bdls"


Any suggestions?

Thanks
Nikola
Re: Generation : Could not find any exported element of type 'CompilationUnit' -> Slot 'compilati [message #671019 is a reply to message #671014] Mon, 16 May 2011 14:49 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hi,

there a 2 total different problems and you seem to mix them Wink

(1) No Elements Exported

by default only elements that have an attribute "name" or get a name by a QualifiedNameProvider are exported and thereby callable by the generator.

(2) Template not found

Your Generator workflow seems to use the EMFMetamodel but maybe your templates use the JavaBeansMetamodel. have a look if you use "bdl" in your template and not "f::q::package::name::of::bdl::java::classes" for imports

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Generation : Could not find any exported element of type 'CompilationUnit' -> Slot 'compilati [message #671027 is a reply to message #671019] Mon, 16 May 2011 15:07 Go to previous messageGo to next message
Nikola  is currently offline Nikola Friend
Messages: 13
Registered: May 2011
Junior Member
Hi Christian
first of all, thanks for the answer !
So the first thing I've already read about that in other posts. About the second thing, if I change IMPORT to only bdl and not the qualified name (as is now) I got errors in the template, so what should I do to make them (I mean the generator and the template) use the same type of metamodel?
Thanks
Nikola
Re: Generation : Could not find any exported element of type 'CompilationUnit' -> Slot 'compilati [message #671029 is a reply to message #671027] Mon, 16 May 2011 15:09 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
hi,

you can change the metamodel(s) of the workflow of course in the workflow itself Wink
you can change the metamodel(s) of the editor in your generator projects properties in the Xtend/Xpand section

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Generation : Could not find any exported element of type 'CompilationUnit' -> Slot 'compilati [message #671033 is a reply to message #671029] Mon, 16 May 2011 15:29 Go to previous message
Nikola  is currently offline Nikola Friend
Messages: 13
Registered: May 2011
Junior Member
Thanks Christian !
The problem has been solved ! I went to properties of the .generator project and I only checked the EMFMetamodel, not JavaBeansMetamodel. Now it works ! Very Happy
Thanks a lot again !
However, I have one questions more for here:
What materials do you recommend for learning the EMF, Xtext Xpand etc. ? Books to buy, articles to read on Internet?
There is another question, but that one I'll post on the post that I sent last week.
Thanks again.
Nikola


Previous Topic:xtext problem for definition terminal string
Next Topic:XText-generated Editor as a MultiPageEditor?
Goto Forum:
  


Current Time: Fri Mar 29 15:37:00 GMT 2024

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

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

Back to the top