Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » xbase generation exception
xbase generation exception [message #895566] Fri, 13 July 2012 15:06
Frantisek Kocun is currently offline Frantisek KocunFriend
Messages: 16
Registered: July 2009
Junior Member
Hi, I got exception when I try to generate XExpression
Caused by: java.lang.ClassCastException: org.eclipse.xtext.common.types.access.jdt.JdtTypeProvider cannot be cast to org.eclipse.xtext.common.types.access.impl.ClasspathTypeProvider
	at org.eclipse.xtext.common.types.access.ClasspathTypeProviderFactory.findTypeProvider(ClasspathTypeProviderFactory.java:49)
	at org.eclipse.xtext.common.types.access.ClasspathTypeProviderFactory.findTypeProvider(ClasspathTypeProviderFactory.java:1)
	at org.eclipse.xtext.common.types.access.AbstractTypeProviderFactory.findOrCreateTypeProvider(AbstractTypeProviderFactory.java:38)
	at org.eclipse.xtext.common.types.util.TypeReferences.findDeclaredType(TypeReferences.java:188)


Generating XExpression in tutorial "Five simple steps to your JVM language" works like the a charm. I did it this way:
xbaseCompiler.toJavaStatement(xExpression, res, false)


But we don't have the same setup as in tutorial. We start generator on a click on button in Eclipse (because we have more generators to choose from) when element in xtext file is selected. To generate we load resources like this (our model can be split in several files):
	protected ResourceSet loadResourceSet(IProject project)
	{
		// creates empty ResourceSet based on the given project
		XtextResourceSet  resourceSet = (XtextResourceSet) resourceSetProvider.get(project);

		// get Xtext index
		IResourceDescriptions index = resourceDescriptionsProvider.createResourceDescriptions();
		resourceSet.addLoadOption(XtextResource.OPTION_RESOLVE_ALL, Boolean.TRUE);

		// iterate over every resource descriptor (each describes exactly 1 file)
		for (IResourceDescription rd : index.getAllResourceDescriptions())
		{
			// load eagerly iterated Resource to ResourceSet
			if(rd.getURI().toString().contains("zoro.pn") || rd.getURI().toString().contains("export.pn"))
			resourceSet.getResource(rd.getURI(), true);
		}

		return resourceSet;
	}


Does anyone know where the problem is?
And we use xtext version 2.2.1.v201112130541.

Thanks

Fero

[Updated on: Fri, 13 July 2012 15:17]

Report message to a moderator

Previous Topic:xbase API stability?
Next Topic:Xcore validation
Goto Forum:
  


Current Time: Fri Aug 14 08:18:47 GMT 2020

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

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

Back to the top