org.eclipse.xtext.scoping.impl.SelectableBasedScope Java Examples
The following examples show how to use
org.eclipse.xtext.scoping.impl.SelectableBasedScope.
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: AbstractLibraryGlobalScopeProvider.java From statecharts with Eclipse Public License 1.0 | 6 votes |
@Override public IScope getScope(Resource context, EReference reference, Predicate<IEObjectDescription> filter) { List<IEObjectDescription> descriptions = Lists.newArrayList(); for (URI uri : getValidLibraries(context)) { try { Iterables.addAll(descriptions, libraryCache.get(uri, new Callable<Iterable<IEObjectDescription>>() { @Override public Iterable<IEObjectDescription> call() throws Exception { return getDescriptions(context, uri); } })); } catch (Exception e) { e.printStackTrace(); } } return SelectableBasedScope.createScope(IScope.NULLSCOPE, new EObjectDescriptionLookUp(descriptions), reference.getEReferenceType(), isIgnoreCase(reference)); }
Example #2
Source File: STextGlobalScopeProvider.java From statecharts with Eclipse Public License 1.0 | 5 votes |
@Override protected IScope createLazyResourceScope(IScope parent, URI uri, IResourceDescriptions descriptions, EClass type, Predicate<IEObjectDescription> filter, boolean ignoreCase) { IResourceDescription description = resourceDescriptionCache.get(uri); if (description == null) return IScope.NULLSCOPE; return SelectableBasedScope.createScope(parent, description, filter, type, ignoreCase); }
Example #3
Source File: BuiltinGlobalScopeProvider.java From gama with GNU General Public License v3.0 | 5 votes |
@Override protected IScope getScope(final Resource resource, final boolean ignoreCase, final EClass type, final Predicate<IEObjectDescription> filter) { IScope scope = getGlobalScope(type); final Collection<URI> uniqueImportURIs = getAllImportedURIs(resource, resource.getResourceSet()).keySet(); if (uniqueImportURIs.size() == 1) { return scope; } final List<URI> urisAsList = Lists.newArrayList(uniqueImportURIs); urisAsList.remove(resource.getURI()); Collections.reverse(urisAsList); final IResourceDescriptions descriptions = getResourceDescriptions(resource, urisAsList); scope = SelectableBasedScope.createScope(scope, descriptions, filter, type, false); return scope; }
Example #4
Source File: XbaseImportedNamespaceScopeProvider.java From xtext-extras with Eclipse Public License 2.0 | 4 votes |
@Override protected IScope getGlobalScope(final Resource context, final EReference reference) { IScope globalScope = super.getGlobalScope(context, reference, null); return SelectableBasedScope.createScope(globalScope, getAllDescriptions(context), reference.getEReferenceType(), isIgnoreCase(reference)); }
Example #5
Source File: XImportSectionNamespaceScopeProvider.java From xtext-extras with Eclipse Public License 2.0 | 4 votes |
@Override protected IScope getGlobalScope(final Resource context, final EReference reference) { IScope globalScope = super.getGlobalScope(context, reference, null); return SelectableBasedScope.createScope(globalScope, getAllDescriptions(context), reference.getEReferenceType(), isIgnoreCase(reference)); }
Example #6
Source File: XtextScopeProvider.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
protected IScope doCreateScope(final Grammar grammar, final EClass type, IScope parent) { final IResourceDescription resourceDescription = resourceDescriptionManager.getResourceDescription(grammar.eResource()); return SelectableBasedScope.createScope(parent, resourceDescription, type, false); }