Java Code Examples for org.eclipse.xtext.scoping.Scopes#scopedElementsFor()

The following examples show how to use org.eclipse.xtext.scoping.Scopes#scopedElementsFor() . 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: AbstractMemberScope.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Iterable<IEObjectDescription> getAllLocalElements() {
	Iterable<? extends TMember> iMembers = Iterables.filter(getMembers(), new Predicate<TMember>() {

		@Override
		public boolean apply(TMember input) {
			return input.isStatic() == staticAccess;
		}
	});
	return Scopes.scopedElementsFor(iMembers);
}
 
Example 2
Source File: TypeSystemAwareScope.java    From solidity-ide with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Iterable<IEObjectDescription> getAllLocalElements() {
	List<IEObjectDescription> result = Lists.newArrayList();
	Iterable<IEObjectDescription> iterable = Scopes.scopedElementsFor(
			EcoreUtil2.<EObject> getObjectsByType(typeSystem.getConcreteTypes(), eClass), qualifiedNameProvider);
	Iterables.addAll(result, iterable);
	return result;
}
 
Example 3
Source File: ElementReferenceScope.java    From solidity-ide with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Iterable<IEObjectDescription> getAllLocalElements() {
	List<EObject> result = Lists.newArrayList();
	result.addAll(functionMembers());
	result.addAll(contractMembers());
	return Scopes.scopedElementsFor(result);
}
 
Example 4
Source File: XbaseImportedNamespaceScopeProvider.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
protected ISelectable internalGetAllDescriptions(final Resource resource) {
	Iterable<EObject> allContents = new Iterable<EObject>(){
		@Override
		public Iterator<EObject> iterator() {
			return EcoreUtil.getAllContents(resource, false);
		}
	}; 
	Iterable<IEObjectDescription> allDescriptions = Scopes.scopedElementsFor(allContents, qualifiedNameProvider);
	return new MultimapBasedSelectable(allDescriptions);
}
 
Example 5
Source File: XImportSectionNamespaceScopeProvider.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
protected ISelectable internalGetAllDescriptions(final Resource resource) {
	Iterable<EObject> allContents = new Iterable<EObject>(){
		@Override
		public Iterator<EObject> iterator() {
			return EcoreUtil.getAllContents(resource, false);
		}
	}; 
	Iterable<IEObjectDescription> allDescriptions = Scopes.scopedElementsFor(allContents, qualifiedNameProvider);
	return new MultimapBasedSelectable(allDescriptions);
}
 
Example 6
Source File: SimpleLocalScopeProvider.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
protected ISelectable getAllDescriptions(final Resource resource) {
	Iterable<EObject> allContents = new Iterable<EObject>(){
		@Override
		public Iterator<EObject> iterator() {
			return resource.getAllContents();
		}
	}; 
	Iterable<IEObjectDescription> allDescriptions = Scopes.scopedElementsFor(allContents, qualifiedNameProvider);
	return new MultimapBasedSelectable(allDescriptions);
}
 
Example 7
Source File: ImportedNamespaceAwareLocalScopeProvider.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
protected ISelectable internalGetAllDescriptions(final Resource resource) {
	Iterable<EObject> allContents = new Iterable<EObject>(){
		@Override
		public Iterator<EObject> iterator() {
			return EcoreUtil.getAllContents(resource, false);
		}
	}; 
	Iterable<IEObjectDescription> allDescriptions = Scopes.scopedElementsFor(allContents, qualifiedNameProvider);
	return new MultimapBasedSelectable(allDescriptions);
}
 
Example 8
Source File: CatalogFromExtensionPointScope.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Iterable<IEObjectDescription> getAllLocalElements() {
  loadDefinitions();

  if (loadedModel == null) {
    return ImmutableList.of();
  }
  XtextResource resource = (XtextResource) loadedModel.eResource();
  IQualifiedNameProvider nameProvider = resource.getResourceServiceProvider().get(IQualifiedNameProvider.class);
  return Scopes.scopedElementsFor(ImmutableList.of(loadedModel), nameProvider);
}
 
Example 9
Source File: TypeSystemAwareScope.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Iterable<IEObjectDescription> getAllLocalElements() {
	List<IEObjectDescription> result = Lists.newArrayList();
	Iterable<IEObjectDescription> iterable = Scopes.scopedElementsFor(
			EcoreUtil2.<EObject> getObjectsByType(typeSystem.getConcreteTypes(), eClass),
			qualifiedNameProvider);
	Iterables.addAll(result, iterable);
	return result;
}