use of org.eclipse.xtext.resource.IResourceServiceProvider in project statecharts by Yakindu.
the class DirtyStateAwareDiagramDocumentEditor method createDirtyResource.
private void createDirtyResource(Resource resource) {
IResourceServiceProvider resourceServiceProvider = IResourceServiceProvider.Registry.INSTANCE.getResourceServiceProvider(resource.getURI());
if (resourceServiceProvider == null) {
return;
}
final DirtyResourceAdapter dirtyResource = new DirtyResourceAdapter(resource, resourceServiceProvider);
dirtyStateManager.manageDirtyState(dirtyResource);
uri2dirtyResource.put(resource.getURI(), dirtyResource);
if (EcoreUtil.getExistingAdapter(resource, DirtyResourceUpdater.class) == null)
resource.eAdapters().add(new DirtyResourceUpdater(dirtyResource));
}
use of org.eclipse.xtext.resource.IResourceServiceProvider in project gemoc-studio by eclipse.
the class DslStandaloneSetupGenerated method register.
public void register(Injector injector) {
if (!EPackage.Registry.INSTANCE.containsKey("http://www.eclipse.org/gemoc/Dsl")) {
EPackage.Registry.INSTANCE.put("http://www.eclipse.org/gemoc/Dsl", DslPackage.eINSTANCE);
}
IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class);
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("dsl", resourceFactory);
IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("dsl", serviceProvider);
}
use of org.eclipse.xtext.resource.IResourceServiceProvider in project dsl-devkit by dsldevkit.
the class CheckCfgUtil method getAllLanguages.
/**
* Gets the all languages available in the workbench.
*
* @return set of all languages
*/
public Set<String> getAllLanguages() {
Set<String> languages = new HashSet<String>();
for (String extension : Registry.INSTANCE.getExtensionToFactoryMap().keySet()) {
final URI dummyUri = URI.createURI("foo:/foo." + extension);
IResourceServiceProvider resourceServiceProvider = Registry.INSTANCE.getResourceServiceProvider(dummyUri);
// By checking that description manager is AbstractCachingResourceDescriptionManager we exclude technical languages of the framework
if (resourceServiceProvider != null && resourceServiceProvider.getResourceDescriptionManager() instanceof AbstractCachingResourceDescriptionManager) {
try {
IGrammarAccess grammarAccess = resourceServiceProvider.get(IGrammarAccess.class);
if (grammarAccess != null && grammarAccess.getGrammar() != null) {
languages.add(grammarAccess.getGrammar().getName());
}
} catch (ConfigurationException e) {
// Will happen if no binding for IGrammarAccess was present.
}
}
}
return languages;
}
use of org.eclipse.xtext.resource.IResourceServiceProvider in project xtext-core by eclipse.
the class BaseInheritanceTestLanguageStandaloneSetupGenerated method register.
public void register(Injector injector) {
IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class);
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("baseinheritancetestlanguage", resourceFactory);
IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("baseinheritancetestlanguage", serviceProvider);
if (!EPackage.Registry.INSTANCE.containsKey("http://www.eclipse.org/2009/tmf/xtext/BaseInheritanceTestLanguage")) {
EPackage.Registry.INSTANCE.put("http://www.eclipse.org/2009/tmf/xtext/BaseInheritanceTestLanguage", BaseInheritanceTestPackage.eINSTANCE);
}
}
use of org.eclipse.xtext.resource.IResourceServiceProvider in project xtext-core by eclipse.
the class InheritanceTestLanguageStandaloneSetupGenerated method register.
public void register(Injector injector) {
IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class);
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("inheritancetestlanguage", resourceFactory);
IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("inheritancetestlanguage", serviceProvider);
if (!EPackage.Registry.INSTANCE.containsKey("http://www.eclipse.org/2009/tmf/xtext/InheritanceTestLanguage")) {
EPackage.Registry.INSTANCE.put("http://www.eclipse.org/2009/tmf/xtext/InheritanceTestLanguage", InheritanceTestPackage.eINSTANCE);
}
}
Aggregations