Search in sources :

Example 1 with IssueSeverities

use of org.eclipse.xtext.validation.IssueSeverities in project xtext-xtend by eclipse.

the class CachingResourceValidatorImpl method addWarningsForOrphanedJvmElements.

private void addWarningsForOrphanedJvmElements(final Resource resource, final CancelIndicator monitor, final IAcceptor<Issue> acceptor) {
    final IssueSeverities issueSeverities = this.issueSeveritiesProvider.getIssueSeverities(resource);
    final Severity severity = issueSeverities.getSeverity(IssueCodes.ORPHAN_ELMENT);
    boolean _equals = Objects.equal(severity, Severity.IGNORE);
    if (_equals) {
        return;
    }
    Iterable<JvmDeclaredType> _filter = Iterables.<JvmDeclaredType>filter(IterableExtensions.<EObject>tail(resource.getContents()), JvmDeclaredType.class);
    for (final JvmDeclaredType jvmType : _filter) {
        final Function1<JvmMember, Boolean> _function = (JvmMember it) -> {
            boolean _isSynthetic = this._jvmTypeExtensions.isSynthetic(it);
            return Boolean.valueOf((!_isSynthetic));
        };
        Iterable<JvmMember> _iterable = IteratorExtensions.<JvmMember>toIterable(IteratorExtensions.<JvmMember>filter(Iterators.<JvmMember>filter(jvmType.eAllContents(), JvmMember.class), _function));
        for (final JvmMember jvmMember : _iterable) {
            {
                this.operationCanceledManager.checkCanceled(monitor);
                final EObject sourceElement = this._iJvmModelAssociations.getPrimarySourceElement(jvmMember);
                if ((sourceElement == null)) {
                    this.addWarningForOrphanedJvmElement(resource, jvmMember, severity, acceptor);
                }
            }
        }
    }
}
Also used : EObject(org.eclipse.emf.ecore.EObject) JvmDeclaredType(org.eclipse.xtext.common.types.JvmDeclaredType) Severity(org.eclipse.xtext.diagnostics.Severity) JvmMember(org.eclipse.xtext.common.types.JvmMember) IssueSeverities(org.eclipse.xtext.validation.IssueSeverities)

Aggregations

EObject (org.eclipse.emf.ecore.EObject)1 JvmDeclaredType (org.eclipse.xtext.common.types.JvmDeclaredType)1 JvmMember (org.eclipse.xtext.common.types.JvmMember)1 Severity (org.eclipse.xtext.diagnostics.Severity)1 IssueSeverities (org.eclipse.xtext.validation.IssueSeverities)1