mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-16 16:58:56 +00:00
moved IServiceScope singleton from <Language>StandaloneSetup to I<Language>
This commit is contained in:
parent
54857e60be
commit
c59f92fa20
4 changed files with 14 additions and 19 deletions
|
@ -1,5 +1,8 @@
|
|||
package org.eclipse.xtext.builtin;
|
||||
|
||||
import org.eclipse.xtext.service.IServiceScope;
|
||||
import org.eclipse.xtext.service.ServiceScopeFactory;
|
||||
|
||||
public interface IXtextBuiltin {
|
||||
/**
|
||||
* the unique identifier of this language.
|
||||
|
@ -10,4 +13,5 @@ public interface IXtextBuiltin {
|
|||
public static final String ID = "org.eclipse.xtext.builtin.XtextBuiltin";
|
||||
public static final String NAME = "Xtext Builtin";
|
||||
public static final String NAMESPACE = "org.eclipse.xtext.builtin";
|
||||
public static final IServiceScope SCOPE = ServiceScopeFactory.createScope(ID, null);
|
||||
}
|
||||
|
|
|
@ -15,9 +15,7 @@ import org.eclipse.xtext.crossref.impl.DefaultRuntimeURIChecker;
|
|||
import org.eclipse.xtext.crossref.impl.XtextBuiltinFragmentProvider;
|
||||
import org.eclipse.xtext.crossref.impl.XtextBuiltinLinkProvider;
|
||||
import org.eclipse.xtext.crossref.internal.Linker;
|
||||
import org.eclipse.xtext.service.IServiceScope;
|
||||
import org.eclipse.xtext.service.ServiceRegistry;
|
||||
import org.eclipse.xtext.service.ServiceScopeFactory;
|
||||
|
||||
public class XtextBuiltinStandaloneSetup {
|
||||
|
||||
|
@ -29,24 +27,15 @@ public class XtextBuiltinStandaloneSetup {
|
|||
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("xmi", new XMIResourceFactoryImpl());
|
||||
EPackage.Registry.INSTANCE.put(XtextPackage.eNS_URI,XtextPackage.eINSTANCE);
|
||||
|
||||
IServiceScope serviceScope = ServiceScopeFactory.createScope(IXtextBuiltin.ID, null);
|
||||
|
||||
ServiceRegistry.registerService(serviceScope, IGrammarAccess.class, XtextBuiltinGrammarAccess.class);
|
||||
ServiceRegistry.registerService(serviceScope, IValueConverterService.class, XtextBuiltInConverters.class);
|
||||
ServiceRegistry.registerService(serviceScope, ILinker.class, Linker.class);
|
||||
ServiceRegistry.registerService(serviceScope, ILinkProvider.class, XtextBuiltinLinkProvider.class);
|
||||
ServiceRegistry.registerService(serviceScope, IURIChecker.class, DefaultRuntimeURIChecker.class);
|
||||
ServiceRegistry.registerService(serviceScope, IFragmentProvider.class, XtextBuiltinFragmentProvider.class);
|
||||
|
||||
ServiceRegistry.registerService(IXtextBuiltin.SCOPE, IGrammarAccess.class, XtextBuiltinGrammarAccess.class);
|
||||
ServiceRegistry.registerService(IXtextBuiltin.SCOPE, IValueConverterService.class, XtextBuiltInConverters.class);
|
||||
ServiceRegistry.registerService(IXtextBuiltin.SCOPE, ILinker.class, Linker.class);
|
||||
ServiceRegistry.registerService(IXtextBuiltin.SCOPE, ILinkProvider.class, XtextBuiltinLinkProvider.class);
|
||||
ServiceRegistry.registerService(IXtextBuiltin.SCOPE, IURIChecker.class, DefaultRuntimeURIChecker.class);
|
||||
ServiceRegistry.registerService(IXtextBuiltin.SCOPE, IFragmentProvider.class, XtextBuiltinFragmentProvider.class);
|
||||
|
||||
isInitialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized static IServiceScope getServiceScope() {
|
||||
if (!isInitialized) {
|
||||
doSetup();
|
||||
}
|
||||
return ServiceScopeFactory.get(IXtextBuiltin.ID);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import org.eclipse.xtext.tests.AbstractGeneratorTest;
|
|||
|
||||
public class InheritanceTest extends AbstractGeneratorTest {
|
||||
static {
|
||||
ServiceRegistry.registerService(AbstractTestLanguageStandaloneSetup.getServiceScope(),
|
||||
ServiceRegistry.registerService(IAbstractTestLanguage.SCOPE,
|
||||
IValueConverterService.class, AbstractTestLanguageValueConverters.class);
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,9 @@ import org.eclipse.emf.ecore.EReference;
|
|||
import org.eclipse.emf.ecore.EStructuralFeature;
|
||||
import org.eclipse.xtext.IMetamodelAccess;
|
||||
import org.eclipse.xtext.service.ServiceRegistry;
|
||||
import org.eclipse.xtext.testlanguages.ActionTestLanguage;
|
||||
import org.eclipse.xtext.testlanguages.ActionTestLanguageStandaloneSetup;
|
||||
import org.eclipse.xtext.testlanguages.IActionTestLanguage;
|
||||
import org.eclipse.xtext.tests.AbstractGeneratorTest;
|
||||
|
||||
/**
|
||||
|
@ -40,7 +42,7 @@ public class ActionTest extends AbstractGeneratorTest {
|
|||
}
|
||||
|
||||
private EPackage getActionLangEPackage() {
|
||||
IMetamodelAccess metaModelAccess = ServiceRegistry.getService(ActionTestLanguageStandaloneSetup.getServiceScope(), IMetamodelAccess.class);
|
||||
IMetamodelAccess metaModelAccess = ServiceRegistry.getService(IActionTestLanguage.SCOPE, IMetamodelAccess.class);
|
||||
EPackage actionLangEPackage = metaModelAccess.getGeneratedEPackages()[0];
|
||||
return actionLangEPackage;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue