Java Code Examples for org.eclipse.xtext.resource.IResourceServiceProvider#Registry
The following examples show how to use
org.eclipse.xtext.resource.IResourceServiceProvider#Registry .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SourceLevelURICache.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
public boolean getOrComputeIsSource(URI uri, IResourceServiceProvider.Registry resourceServiceProviderRegistry) { if (archives.contains(uri)) { return false; } if (sources.contains(uri)) { return true; } IResourceServiceProvider provider = resourceServiceProviderRegistry.getResourceServiceProvider(uri); if (provider instanceof IResourceServiceProviderExtension) { if (!((IResourceServiceProviderExtension) provider).isSource(uri)) { archives.add(uri); return false; } } sources.add(uri); return true; }
Example 2
Source File: CheckResourceUtil.java From dsl-devkit with Eclipse Public License 1.0 | 6 votes |
/** * Gets all grammars in the resource service provider registry. * <p> * The result contains no null entries. * </p> * * @return an iterable over all grammars in the resource service provider registry */ public Iterable<Grammar> allGrammarsFromRegistry() { final IResourceServiceProvider.Registry reg = IResourceServiceProvider.Registry.INSTANCE; Map<String, Object> extensionToFactoryMap = reg.getExtensionToFactoryMap(); Set<String> keySet = extensionToFactoryMap.keySet(); Function<String, Grammar> function = new Function<String, Grammar>() { @Override public Grammar apply(final String from) { URI dummyUri = URI.createURI("foo:/foo." + from); //$NON-NLS-1$ try { return reg.getResourceServiceProvider(dummyUri).get(IGrammarAccess.class).getGrammar(); // CHECKSTYLE:OFF } catch (Exception e) { // CHECKSTYLE:ON } return null; } }; return Iterables.filter(Iterables.transform(keySet, function), Predicates.notNull()); }
Example 3
Source File: RegistryProvider.java From smarthome with Eclipse Public License 2.0 | 5 votes |
private Registry createRegistry() { registerDefaultFactories(); IResourceServiceProvider.Registry registry = new ResourceServiceProviderRegistryImpl(); register(registry, new ItemsIdeSetup().createInjector()); register(registry, new PersistenceIdeSetup().createInjector()); register(registry, new RulesIdeSetup().setScriptServiceUtil(scriptServiceUtil).setScriptEngine(scriptEngine) .createInjector()); register(registry, new ScriptIdeSetup().setScriptServiceUtil(scriptServiceUtil).setScriptEngine(scriptEngine) .createInjector()); register(registry, new SitemapIdeSetup().createInjector()); register(registry, new ThingIdeSetup().createInjector()); return registry; }
Example 4
Source File: ChangeConverter2.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
protected ChangeConverter2(IResourceServiceProvider.Registry registry, WorkspaceEdit edit, ILanguageServerAccess access, UriExtensions uriExtensions) { this.registry = registry; this.uriExtensions = uriExtensions; this.edit = edit; this.access = access; Boolean documentChanges = null; if (access != null) { InitializeParams initializeParams = access.getInitializeParams(); if (initializeParams != null) { ClientCapabilities clientCapabilities = initializeParams.getCapabilities(); if (clientCapabilities != null) { WorkspaceClientCapabilities workspaceClientCapabilities = clientCapabilities.getWorkspace(); if (workspaceClientCapabilities != null) { WorkspaceEditCapabilities workspaceEditCapabilities = workspaceClientCapabilities .getWorkspaceEdit(); if (workspaceEditCapabilities != null) { documentChanges = workspaceEditCapabilities.getDocumentChanges(); } } } } } this.useDocumentChanges = documentChanges == Boolean.TRUE; if (this.useDocumentChanges) { this.edit.setDocumentChanges(new ArrayList<>()); } else { this.edit.setChanges(new LinkedHashMap<>()); } }
Example 5
Source File: RegistryProvider.java From openhab-core with Eclipse Public License 2.0 | 5 votes |
@Override public synchronized IResourceServiceProvider.Registry get() { if (registry == null) { registry = createRegistry(); } return registry; }
Example 6
Source File: DefaultReferenceFinder.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
public DefaultReferenceFinder(IResourceDescriptions indexData, IResourceServiceProvider.Registry serviceProviderRegistry, TargetURIConverter converter) { super(serviceProviderRegistry); this.indexData = indexData; this.converter = converter; }
Example 7
Source File: XtextTestSourceFactory.java From dsl-devkit with Eclipse Public License 1.0 | 5 votes |
@Inject public XtextTestSourceFactory(final IResourceServiceProvider.Registry resourceServiceProviderRegistry, final ResourceSet resourceSet) { final List<String> extensions = Lists.newArrayList(resourceServiceProviderRegistry.getExtensionToFactoryMap().keySet()); this.xtextExtensions = Lists.transform(extensions, new Function<String, String>() { public String apply(final String from) { return URI.decode(from); } }); this.resourceSet = resourceSet; }
Example 8
Source File: XLanguageServerImpl.java From n4js with Eclipse Public License 1.0 | 4 votes |
/** * @since 2.16 */ protected IResourceServiceProvider.Registry getLanguagesRegistry() { return languagesRegistry; }
Example 9
Source File: NamesAreUniqueValidator.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
/** * @deprecated locally unused since 2.22 */ @Deprecated public IResourceServiceProvider.Registry getResourceServiceProviderRegistry() { return resourceServiceProviderRegistry; }
Example 10
Source File: XtendIncrementalBuilderTest.java From xtext-xtend with Eclipse Public License 2.0 | 4 votes |
@Override public IResourceServiceProvider.Registry getLanguages() { return this.registry; }
Example 11
Source File: ResourceSetBasedResourceDescriptions.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
public void setRegistry(IResourceServiceProvider.Registry registry) { this.registry = registry; }
Example 12
Source File: ReferenceFinder.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
protected ReferenceFinder(IResourceServiceProvider.Registry serviceProviderRegistry) { this.serviceProviderRegistry = serviceProviderRegistry; }
Example 13
Source File: AbstractHierarchyBuilder.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
protected IResourceServiceProvider.Registry getResourceServiceProviderRegistry() { return resourceServiceProviderRegistry; }
Example 14
Source File: ReferenceAcceptor.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
protected ReferenceAcceptor(IAcceptor<IReferenceDescription> delegate, IResourceServiceProvider.Registry resourceServiceProviderRegistry) { super(resourceServiceProviderRegistry, delegate); }
Example 15
Source File: DefaultReferenceFinder.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
protected MyReferenceAcceptor(IAcceptor<IReferenceDescription> delegate, IResourceServiceProvider.Registry serviceProviderRegistry) { super(delegate, serviceProviderRegistry); }
Example 16
Source File: EcoreSupportTest.java From xtext-extras with Eclipse Public License 2.0 | 4 votes |
public IResourceServiceProvider.Registry bindRSPRegistry() { return registry; }
Example 17
Source File: IncrementalBuilderTest.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
@Override public IResourceServiceProvider.Registry getLanguages() { return this.resourceServiceProviderFactory; }
Example 18
Source File: EagerResourceSetBasedResourceDescriptions.java From n4js with Eclipse Public License 1.0 | 4 votes |
@Override public void setRegistry(IResourceServiceProvider.Registry registry) { this.registry = registry; }
Example 19
Source File: DirtyStateEditorSupport.java From xtext-eclipse with Eclipse Public License 2.0 | 2 votes |
/** * Only for testing * @noreference This method is not intended to be referenced by clients. * @since 2.7 */ public void setResourceServiceProviderRegistry(IResourceServiceProvider.Registry resourceServiceProviderRegistry) { this.resourceServiceProviderRegistry = resourceServiceProviderRegistry; }
Example 20
Source File: DelegatingReferenceFinder.java From xtext-eclipse with Eclipse Public License 2.0 | 2 votes |
/** * Public for testing purpose. * @noreference This method is not intended to be referenced by clients. */ public IResourceServiceProvider.Registry getResourceServiceProviderRegistry() { return resourceServiceProviderRegistry; }