Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » "importURI" and qualified names(How to resolve same package from different files)
"importURI" and qualified names [message #1821952] Mon, 24 February 2020 12:40
Andrzej Polanski is currently offline Andrzej PolanskiFriend
Messages: 1
Registered: February 2020
Junior Member
Using ImportUriGlobalScopeProvider and SimpleLocalScopeProvider requires fully qualified names for all imported entities (even with same package). On the other hand CIDLImportedNamespaceAwareLocalScopeProvider does not have this inconvenience (name from different file defined in same package do not require full qualification) but it to be used with "importedNamespace" (and not "importURI").
Here is what I used for workaround:

class MyDSLRuntimeModule extends AbstractMyDSLRuntimeModule {
   override bindIGlobalScopeProvider() {

   override configureIScopeProviderDelegate(Binder binder) {

class MyDSLImportedNamespaceAwareLocalScopeProvider extends ImportedNamespaceAwareLocalScopeProvider {

   private QualifiedName rootImport

   override getResourceScope(Resource res, EReference reference) {
      val context = res.getContents().get(0) 
      if (context instanceof CModel)
         rootImport = qualifiedNameConverter.toQualifiedName(
      super.getResourceScope(res, reference)

   override getImplicitImports(boolean ignoreCase) {
      #[new ImportNormalizer(rootImport, true, ignoreCase)]

As I am new to Xtext world, please comment. Maybe this is already done somewhere else?
Previous Topic:CfP: 20th International Workshop on OCL and Textual Modeling (OCL'2020 @ STAF)
Next Topic:EMF Compare and LazyLinkingResource proxy URLs
Goto Forum:

Current Time: Sat Oct 31 03:05:58 GMT 2020

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

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

Back to the top