org.eclipse.xtext.validation.IssueSeverities Java Examples

The following examples show how to use org.eclipse.xtext.validation.IssueSeverities. 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 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);
}
 
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(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 #4
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 #5
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 #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(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 #7
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 #8
Source File: AbstractTypeComputationState.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
protected IssueSeverities getSeverities() {
	return resolvedTypes.getSeverities();
}
 
Example #9
Source File: SARLJvmTypeReferencesValidator.java    From sarl with Apache License 2.0 4 votes vote down vote up
@Override
protected IssueSeverities getIssueSeverities(Map<Object, Object> context, EObject eObject) {
	final IssueSeverities severities = super.getIssueSeverities(context, eObject);
	return this.warningSuppressor.getIssueSeverities(context, eObject, severities);
}
 
Example #10
Source File: DefaultProgrammaticWarningSuppressor.java    From sarl with Apache License 2.0 4 votes vote down vote up
SuppressWarningIssueSeverities(IssueSeverities delegate, boolean ignoreAll, Set<String> codes) {
	super(null, null, null);
	this.delegate = delegate;
	this.ignoredAll = ignoreAll;
	this.ignoredWarnings = codes;
}
 
Example #11
Source File: SARLValidator.java    From sarl with Apache License 2.0 4 votes vote down vote up
@Override
protected IssueSeverities getIssueSeverities(Map<Object, Object> context, EObject eObject) {
	final IssueSeverities severities = super.getIssueSeverities(context, eObject);
	return this.warningSuppressor.getIssueSeverities(context, eObject, severities);
}
 
Example #12
Source File: SARLEarlyExitValidator.java    From sarl with Apache License 2.0 4 votes vote down vote up
@Override
protected IssueSeverities getIssueSeverities(Map<Object, Object> context, EObject eObject) {
	final IssueSeverities severities = super.getIssueSeverities(context, eObject);
	return this.warningSuppressor.getIssueSeverities(context, eObject, severities);
}
 
Example #13
Source File: ClosureTypeComputerUnitTest.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
@Override
protected IssueSeverities getSeverities() {
	throw new UnsupportedOperationException();
}
 
Example #14
Source File: ResolvedTypes.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
protected IssueSeverities getSeverities() {
	return shared.issueSeverities;
}
 
Example #15
Source File: DefaultReentrantTypeResolver.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
protected IssueSeverities getIssueSeverities() {
	Resource resource = root == null ? null : root.eResource();
	return issueSeveritiesProvider.getIssueSeverities(resource);
}
 
Example #16
Source File: SARLValidator.java    From sarl with Apache License 2.0 2 votes vote down vote up
/** Replies if the given issue is ignored for the given object.
 *
 * @param issueCode the code if the issue.
 * @param currentObject the current object.
 * @return <code>true</code> if the issue is ignored.
 * @see #isIgnored(String)
 */
protected boolean isIgnored(String issueCode, EObject currentObject) {
	final IssueSeverities severities = getIssueSeverities(getContext(), currentObject);
	return severities.isIgnored(issueCode);
}
 
Example #17
Source File: IConfigurableIssueSeveritiesProvider.java    From sarl with Apache License 2.0 2 votes vote down vote up
/** Replies the issue severities for the given resource.
 *
 * @param context the context for determining the severities.
 * @return the issue severities.
 */
IssueSeverities getIssueSeverities(Resource context);
 
Example #18
Source File: IProgrammaticWarningSuppressor.java    From sarl with Apache License 2.0 2 votes vote down vote up
/** Replies the issue severities for the given object.
 *
 * @param context the context for retrieving the severities.
 * @param currentObject the current object.
 * @param predefinedSeverities the severities that were pre-computed, prior to the warning suppression.
 * @return the severties.
 */
IssueSeverities getIssueSeverities(Map<Object, Object> context, EObject currentObject,
		IssueSeverities predefinedSeverities);