Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Could not find unique type in ImportingTypesProposalProvider(Error: Could not find unique type in ImportingTypesProposalProvider)
Could not find unique type in ImportingTypesProposalProvider [message #1394517] Sat, 05 July 2014 12:18
Stephane Galland is currently offline Stephane GallandFriend
Messages: 122
Registered: July 2014
Location: Belfort, France
Senior Member
Dear all,

I'm writing an agent-oriented programming language based on Xbase.
In my grammar, I defined an Event type as:
Event: 'event' name=ValidID ('extends' superTypes+=JvmParameterizedTypeReference)?

I written a validator that is checking if the "supertypes" are subtypes of (a class defined in my API). It is working fine.

I defined a proposal provider on the "supertypes" that aims to propose only the types that are subtypes of The code is below. It is based on the version 2.7 of Xtext (which is fixing a bug in createSubTypeProposals).

The proposal provider permits to obtain the correct list of types.

BUT, then I validate/select of the types, I obtain the following error:
org.eclipse.xtext.xbase.ui.contentassist.ImportingTypesProposalProvider$FQNImporter - Could not find unique type named '' in scope

How to deal with this error? Have I missed to code something (a scope...)?

Note that the class "" is a Java class that is not defined inside the current Java project, but into one of the Java dependencies (jar file).

class SARLProposalProvider extends AbstractSARLProposalProvider {
  // extends ImportingTypesProposalProvider extends JdtTypesProposalProvider

  @Inject extension IQualifiedNameProvider
  @Inject private var IJvmTypeProvider.Factory jvmTypeProviderFactory
  @Inject private var ITypesProposalProvider typeProposalProvider
  @Inject private ILogicalContainerProvider logicalContainerProvider
	override completeEvent_SuperTypes(
		EObject model, Assignment assignment, 
		ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
		if (model instanceof Event) {
				"", context, 
				acceptor, SarlPackage.Literals::INHERITING_ELEMENT__SUPER_TYPES,

private def buildProposalsWithout(EObject event, String containerFullyQualifiedName, String superTypeName, ContentAssistContext context, ICompletionProposalAcceptor acceptor, EReference reference, int expectedType) {
		val jvmTypeProvider = jvmTypeProviderFactory.createTypeProvider(event.eResource.resourceSet)
		val interfaceToImplement = jvmTypeProvider.findTypeByName(superTypeName)
			new SARLProposalProvider.TypeFilter(
	private static class TypeFilter implements ITypesProposalProvider.Filter {
		private val int searchFor
		private val String[] typeNames
		new (int searchFor, String... typeNames) {
			this.searchFor = searchFor
			this.typeNames = typeNames
		override accept(int modifiers,
			char[] packageName, char[] simpleTypeName, 
			char[][] enclosingTypeNames, String path) {
			if (Flags::isFinal(modifiers)
				|| !Flags::isPublic(modifiers)
				|| (searchFor==IJavaSearchConstants::INTERFACE && !Flags::isInterface(modifiers))
				|| (searchFor==IJavaSearchConstants::CLASS &&
						(Flags::isInterface(modifiers) || Flags::isEnum(modifiers))
						 || Flags::isAnnotation(modifiers))) {
				return false
			var fqName = new StringBuilder(packageName.length + simpleTypeName.length + 1)
			if (packageName.length != 0) {
			for(char[] enclosingType: enclosingTypeNames) {
			var str = fqName.toString
			for(exception : this.typeNames) {
				if (str == exception) return false
			return true
		override getSearchFor() {

[Updated on: Sat, 05 July 2014 13:27]

Report message to a moderator

Previous Topic:Mac OS X very slow
Next Topic:Maven repository for 2.7.0-SNAPSHOT
Goto Forum:

Current Time: Mon Feb 17 10:56:56 GMT 2020

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

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

Back to the top