Uli Merkel's Profile

GitHub User: UliMerkel

Site: www.uli-merkel.de

Comments by Uli Merkel

Avatar

this is an example to limit scope to the active DSL file only
(based on the standard XTEXT project)
with a lot of help from the forum:
"reducing cross reference to current DSL file" http://www.eclipse.org/forums/index.php/t/635607/

Greetings from Frankfurt/Germany
Uli

P.S. @Boris: your screencasts are a great support for XTEXT newbies like me

NullGlobalScopeProvider.java
// ##### our new ScopeProvider (NullGlobalScopeProvider.java)
package org.xtext.example.mydsl;

import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.xtext.resource.IEObjectDescription;
import org.eclipse.xtext.scoping.IGlobalScopeProvider;
import org.eclipse.xtext.scoping.IScope;
import com.google.common.base.Predicate;

public class NullGlobalScopeProvider implements IGlobalScopeProvider {

  @Override
  public IScope getScope(Resource context, EReference reference,
                Predicate<IEObjectDescription> filter) {
    return IScope.NULLSCOPE;
  }
}
MyDslRuntimeModule.java
// ##### binding it in MyDslRuntimeModule.java
package org.xtext.example.mydsl;

import org.eclipse.xtext.scoping.IGlobalScopeProvider;

public class MyDslRuntimeModule 
  extends org.xtext.example.mydsl.AbstractMyDslRuntimeModule {
  @Override
  public Class<? extends IGlobalScopeProvider> bindIGlobalScopeProvider() {
    return NullGlobalScopeProvider.class;
  }
}