Java Code Examples for org.eclipse.xtext.xbase.lib.CollectionLiterals#emptyList()

The following examples show how to use org.eclipse.xtext.xbase.lib.CollectionLiterals#emptyList() . 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: EclipseFileSystemSupportImpl.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Iterable<? extends Path> getChildren(final URI uri, final Path path) {
  final IResource resource = this.findMember(uri);
  if ((resource instanceof IContainer)) {
    try {
      final Function1<IResource, Path> _function = (IResource it) -> {
        String _string = it.getFullPath().toString();
        return new Path(_string);
      };
      return ListExtensions.<IResource, Path>map(((List<IResource>)Conversions.doWrapArray(((IContainer)resource).members())), _function);
    } catch (final Throwable _t) {
      if (_t instanceof CoreException) {
        final CoreException exc = (CoreException)_t;
        String _message = exc.getMessage();
        throw new IllegalArgumentException(_message, exc);
      } else {
        throw Exceptions.sneakyThrow(_t);
      }
    }
  }
  return CollectionLiterals.<Path>emptyList();
}
 
Example 2
Source File: GrammarAccessExtensions.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
public List<String> initialHiddenTokens(final Grammar it) {
  List<String> _xblockexpression = null;
  {
    boolean _isDefinesHiddenTokens = it.isDefinesHiddenTokens();
    if (_isDefinesHiddenTokens) {
      final Function1<AbstractRule, String> _function = (AbstractRule it_1) -> {
        return this.ruleName(it_1);
      };
      return IterableExtensions.<String>toList(ListExtensions.<AbstractRule, String>map(it.getHiddenTokens(), _function));
    }
    int _size = it.getUsedGrammars().size();
    boolean _equals = (_size == 1);
    if (_equals) {
      return this.initialHiddenTokens(IterableExtensions.<Grammar>head(it.getUsedGrammars()));
    }
    _xblockexpression = CollectionLiterals.<String>emptyList();
  }
  return _xblockexpression;
}
 
Example 3
Source File: Ecore2XtextExtensions.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
public static Iterable<EClass> subClasses(final EClass it) {
  Iterable<EClass> _xifexpression = null;
  EPackage _ePackage = it.getEPackage();
  boolean _tripleEquals = (_ePackage == null);
  if (_tripleEquals) {
    _xifexpression = CollectionLiterals.<EClass>emptyList();
  } else {
    final Function1<EClass, Boolean> _function = (EClass c) -> {
      return Boolean.valueOf(c.getEAllSuperTypes().contains(it));
    };
    _xifexpression = IterableExtensions.<EClass>filter(Iterables.<EClass>filter(it.getEPackage().getEClassifiers(), EClass.class), _function);
  }
  return _xifexpression;
}
 
Example 4
Source File: FormattingDataFactory.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
public Function1<? super FormattableDocument, ? extends Iterable<FormattingData>> surround(final INode node, final Procedure1<? super FormattingDataInit> init) {
  final Function1<FormattableDocument, Iterable<FormattingData>> _function = (FormattableDocument doc) -> {
    ArrayList<FormattingData> _xblockexpression = null;
    {
      final ArrayList<FormattingData> result = CollectionLiterals.<FormattingData>newArrayList();
      if ((node != null)) {
        Iterable<FormattingData> _elvis = null;
        Function1<? super FormattableDocument, ? extends Iterable<FormattingData>> _newFormattingData = this.newFormattingData(this._hiddenLeafAccess.getHiddenLeafsBefore(node), init);
        Iterable<FormattingData> _apply = null;
        if (_newFormattingData!=null) {
          _apply=_newFormattingData.apply(doc);
        }
        if (_apply != null) {
          _elvis = _apply;
        } else {
          List<FormattingData> _emptyList = CollectionLiterals.<FormattingData>emptyList();
          _elvis = _emptyList;
        }
        Iterables.<FormattingData>addAll(result, _elvis);
        Iterable<FormattingData> _elvis_1 = null;
        Function1<? super FormattableDocument, ? extends Iterable<FormattingData>> _newFormattingData_1 = this.newFormattingData(this._hiddenLeafAccess.getHiddenLeafsAfter(node), init);
        Iterable<FormattingData> _apply_1 = null;
        if (_newFormattingData_1!=null) {
          _apply_1=_newFormattingData_1.apply(doc);
        }
        if (_apply_1 != null) {
          _elvis_1 = _apply_1;
        } else {
          List<FormattingData> _emptyList_1 = CollectionLiterals.<FormattingData>emptyList();
          _elvis_1 = _emptyList_1;
        }
        Iterables.<FormattingData>addAll(result, _elvis_1);
      }
      _xblockexpression = result;
    }
    return _xblockexpression;
  };
  return _function;
}
 
Example 5
Source File: FormattingDataFactory.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
public Function1<? super FormattableDocument, ? extends Iterable<FormattingData>> surround(final INode node, final Procedure1<? super FormattingDataInit> before, final Procedure1<? super FormattingDataInit> after) {
  final Function1<FormattableDocument, Iterable<FormattingData>> _function = (FormattableDocument doc) -> {
    ArrayList<FormattingData> _xblockexpression = null;
    {
      final ArrayList<FormattingData> result = CollectionLiterals.<FormattingData>newArrayList();
      if ((node != null)) {
        Iterable<FormattingData> _elvis = null;
        Function1<? super FormattableDocument, ? extends Iterable<FormattingData>> _newFormattingData = this.newFormattingData(this._hiddenLeafAccess.getHiddenLeafsBefore(node), before);
        Iterable<FormattingData> _apply = null;
        if (_newFormattingData!=null) {
          _apply=_newFormattingData.apply(doc);
        }
        if (_apply != null) {
          _elvis = _apply;
        } else {
          List<FormattingData> _emptyList = CollectionLiterals.<FormattingData>emptyList();
          _elvis = _emptyList;
        }
        Iterables.<FormattingData>addAll(result, _elvis);
        Iterable<FormattingData> _elvis_1 = null;
        Function1<? super FormattableDocument, ? extends Iterable<FormattingData>> _newFormattingData_1 = this.newFormattingData(this._hiddenLeafAccess.getHiddenLeafsAfter(node), after);
        Iterable<FormattingData> _apply_1 = null;
        if (_newFormattingData_1!=null) {
          _apply_1=_newFormattingData_1.apply(doc);
        }
        if (_apply_1 != null) {
          _elvis_1 = _apply_1;
        } else {
          List<FormattingData> _emptyList_1 = CollectionLiterals.<FormattingData>emptyList();
          _elvis_1 = _emptyList_1;
        }
        Iterables.<FormattingData>addAll(result, _elvis_1);
      }
      _xblockexpression = result;
    }
    return _xblockexpression;
  };
  return _function;
}
 
Example 6
Source File: XtendDocumentationProvider.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public List<INode> getDocumentationNodes(final EObject o) {
  List<INode> _xblockexpression = null;
  {
    boolean _shouldBeHandled = this.shouldBeHandled(o);
    boolean _not = (!_shouldBeHandled);
    if (_not) {
      return CollectionLiterals.<INode>emptyList();
    }
    _xblockexpression = super.getDocumentationNodes(o);
  }
  return _xblockexpression;
}
 
Example 7
Source File: AbstractFileSystemSupport.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public Iterable<? extends Path> getChildren(final Path path) {
  boolean _equals = Objects.equal(path, Path.ROOT);
  if (_equals) {
    Path _absolutePath = path.getAbsolutePath(this.projectConfigProvider.getProjectConfig(this.context).getName());
    return Collections.<Path>unmodifiableList(CollectionLiterals.<Path>newArrayList(_absolutePath));
  }
  final URI uri = this.getURI(path);
  if ((((uri == null) || (!this.exists(uri))) || (!(this.isFolder(uri)).booleanValue()))) {
    return CollectionLiterals.<Path>emptyList();
  }
  return this.getChildren(uri, path);
}
 
Example 8
Source File: XtendMethodDeclarationImpl.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public Iterable<? extends MethodDeclaration> getOverriddenOrImplementedMethods() {
  boolean _isOverride = this.getDelegate().isOverride();
  if (_isOverride) {
    final JvmOperation jvmOperation = this.getCompilationUnit().getJvmModelAssociations().getDirectlyInferredOperation(this.getDelegate());
    final ResolvedFeatures resolvedFeatures = this.getCompilationUnit().getOverrideHelper().getResolvedFeatures(jvmOperation.getDeclaringType());
    final IResolvedOperation resolvedOperation = resolvedFeatures.getResolvedOperation(jvmOperation);
    final List<IResolvedOperation> overriddenOrImplemented = resolvedOperation.getOverriddenAndImplementedMethods();
    final Function1<IResolvedOperation, MemberDeclaration> _function = (IResolvedOperation it) -> {
      return this.getCompilationUnit().toMemberDeclaration(it.getDeclaration());
    };
    return Iterables.<MethodDeclaration>filter(ListExtensions.<IResolvedOperation, MemberDeclaration>map(overriddenOrImplemented, _function), MethodDeclaration.class);
  }
  return CollectionLiterals.<MethodDeclaration>emptyList();
}
 
Example 9
Source File: CompilationUnitImpl.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public Iterable<? extends AnnotationReference> getAnnotations() {
  return CollectionLiterals.<AnnotationReference>emptyList();
}
 
Example 10
Source File: Xtext2EcoreTransformerTest.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
protected List<? extends EStructuralFeature> features(final EClassifier clazz) {
  if ((clazz instanceof EClass)) {
    return ((EClass)clazz).getEStructuralFeatures();
  }
  return CollectionLiterals.<EStructuralFeature>emptyList();
}
 
Example 11
Source File: Xtext2EcoreTransformerTest.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
protected List<EClass> superTypes(final EClassifier clazz) {
  if ((clazz instanceof EClass)) {
    return ((EClass)clazz).getESuperTypes();
  }
  return CollectionLiterals.<EClass>emptyList();
}
 
Example 12
Source File: XtendConstructorDeclarationImpl.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public Iterable<? extends TypeParameterDeclaration> getTypeParameters() {
  return CollectionLiterals.<TypeParameterDeclaration>emptyList();
}
 
Example 13
Source File: XtendTypeParameterDeclarationImpl.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public Iterable<? extends AnnotationReference> getAnnotations() {
  return CollectionLiterals.<AnnotationReference>emptyList();
}
 
Example 14
Source File: TypeParameterDeclarationImpl.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public Iterable<? extends AnnotationReference> getAnnotations() {
  return CollectionLiterals.<AnnotationReference>emptyList();
}
 
Example 15
Source File: XIndexer.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public Iterable<IReferenceDescription> getReferenceDescriptions() {
	IllegalStateException exception = new IllegalStateException("getReferenceDescriptions" + getURI());
	LOG.error(exception, exception);
	return CollectionLiterals.<IReferenceDescription> emptyList();
}
 
Example 16
Source File: XIndexer.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public Iterable<QualifiedName> getImportedNames() {
	IllegalStateException exception = new IllegalStateException("getImportedNames" + getURI());
	LOG.error(exception, exception);
	return CollectionLiterals.<QualifiedName> emptyList();
}
 
Example 17
Source File: TClassifierImpl.java    From n4js with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public Iterable<ParameterizedTypeRef> getSuperClassifierRefs() {
	return CollectionLiterals.<ParameterizedTypeRef>emptyList();
}
 
Example 18
Source File: TClassifierImpl.java    From n4js with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public Iterable<ParameterizedTypeRef> getImplementedOrExtendedInterfaceRefs() {
	return CollectionLiterals.<ParameterizedTypeRef>emptyList();
}