Java Code Examples for org.eclipse.xtext.validation.IssueSeverities#getSeverity()

The following examples show how to use org.eclipse.xtext.validation.IssueSeverities#getSeverity() . 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: CachingResourceValidatorImpl.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
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_ELEMENT);
  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);
        }
      }
    }
  }
}
 
Example 2
Source File: IConfigurableIssueSeveritiesProviderTest.java    From sarl with Apache License 2.0 5 votes vote down vote up
@Test
public void getIssueSeverities() throws Exception {
	SarlScript script = file(SNIPSET, true);
	//
	IssueSeverities severities = this.provider.getIssueSeverities(script.eResource());
	//
	assertNotNull(severities);
	Severity severity = severities.getSeverity(IssueCodes.UNREACHABLE_BEHAVIOR_UNIT);
	assertNotNull(severity);
	assertSame(Severity.WARNING, severity);
}
 
Example 3
Source File: IConfigurableIssueSeveritiesProviderTest.java    From sarl with Apache License 2.0 5 votes vote down vote up
@Test
public void setSeverity() throws Exception {
	this.provider.setSeverity(IssueCodes.UNREACHABLE_BEHAVIOR_UNIT, Severity.INFO);
	//
	SarlScript script = file(SNIPSET, true);
	//
	IssueSeverities severities = this.provider.getIssueSeverities(script.eResource());
	assertNotNull(severities);
	Severity severity = severities.getSeverity(IssueCodes.UNREACHABLE_BEHAVIOR_UNIT);
	assertNotNull(severity);
	assertSame(Severity.INFO, severity);
}
 
Example 4
Source File: IConfigurableIssueSeveritiesProviderTest.java    From sarl with Apache License 2.0 5 votes vote down vote up
@Test
public void setAllSeverities() throws Exception {
	this.provider.setAllSeverities(Severity.INFO);
	//
	SarlScript script = file(SNIPSET, true);
	//
	IssueSeverities severities = this.provider.getIssueSeverities(script.eResource());
	assertNotNull(severities);
	Severity severity = severities.getSeverity(IssueCodes.UNREACHABLE_BEHAVIOR_UNIT);
	assertNotNull(severity);
	assertSame(Severity.INFO, severity);
}
 
Example 5
Source File: IConfigurableIssueSeveritiesProviderTest.java    From sarl with Apache License 2.0 5 votes vote down vote up
@Test
public void getIssueSeverities() throws Exception {
	SarlScript script = file(getParseHelper(), getValidationHelper(), SNIPSET);
	//
	IssueSeverities severities = this.provider.getIssueSeverities(script.eResource());
	//
	assertNotNull(severities);
	Severity severity = severities.getSeverity(IssueCodes.UNREACHABLE_BEHAVIOR_UNIT);
	assertNotNull(severity);
	assertSame(Severity.WARNING, severity);
}
 
Example 6
Source File: IConfigurableIssueSeveritiesProviderTest.java    From sarl with Apache License 2.0 5 votes vote down vote up
@Test
public void setSeverity() throws Exception {
	this.provider.setSeverity(IssueCodes.UNREACHABLE_BEHAVIOR_UNIT, Severity.INFO);
	//
	SarlScript script = file(getParseHelper(), getValidationHelper(), SNIPSET);
	//
	IssueSeverities severities = this.provider.getIssueSeverities(script.eResource());
	assertNotNull(severities);
	Severity severity = severities.getSeverity(IssueCodes.UNREACHABLE_BEHAVIOR_UNIT);
	assertNotNull(severity);
	assertSame(Severity.INFO, severity);
}
 
Example 7
Source File: IConfigurableIssueSeveritiesProviderTest.java    From sarl with Apache License 2.0 5 votes vote down vote up
@Test
public void setAllSeverities() throws Exception {
	this.provider.setAllSeverities(Severity.INFO);
	//
	SarlScript script = file(getParseHelper(), getValidationHelper(), SNIPSET);
	//
	IssueSeverities severities = this.provider.getIssueSeverities(script.eResource());
	assertNotNull(severities);
	Severity severity = severities.getSeverity(IssueCodes.UNREACHABLE_BEHAVIOR_UNIT);
	assertNotNull(severity);
	assertSame(Severity.INFO, severity);
}