Java Code Examples for org.eclipse.emf.common.util.Diagnostic#WARNING

The following examples show how to use org.eclipse.emf.common.util.Diagnostic#WARNING . 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: ComponentEditor.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Returns a diagnostic describing the errors and warnings listed in the resource
 * and the specified exception (if any).
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public Diagnostic analyzeResourceProblems ( Resource resource, Exception exception )
{
    boolean hasErrors = !resource.getErrors ().isEmpty ();
    if ( hasErrors || !resource.getWarnings ().isEmpty () )
    {
        BasicDiagnostic basicDiagnostic = new BasicDiagnostic ( hasErrors ? Diagnostic.ERROR : Diagnostic.WARNING, "org.eclipse.scada.configuration.component.editor", //$NON-NLS-1$
        0, getString ( "_UI_CreateModelError_message", resource.getURI () ), //$NON-NLS-1$
        new Object[] { exception == null ? (Object)resource : exception } );
        basicDiagnostic.merge ( EcoreUtil.computeDiagnostic ( resource, true ) );
        return basicDiagnostic;
    }
    else if ( exception != null )
    {
        return new BasicDiagnostic ( Diagnostic.ERROR, "org.eclipse.scada.configuration.component.editor", //$NON-NLS-1$
        0, getString ( "_UI_CreateModelError_message", resource.getURI () ), //$NON-NLS-1$
        new Object[] { exception } );
    }
    else
    {
        return Diagnostic.OK_INSTANCE;
    }
}
 
Example 2
Source File: DefaultCheckImpl.java    From dsl-devkit with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Gets a numeric value mapped to a given {@link Severity}. Severities are mapped to
 * <ul>
 * <li>{@link Diagnostic#ERROR}
 * <li>{@link Diagnostic#WARNING}
 * <li>{@link Diagnostic#INFO}
 * </ul>
 *
 * @param severity
 *          the issue severity
 * @return the numeric value representing a severity
 */
protected int toDiagnosticSeverity(final Severity severity) {
  int diagnosticSeverity = -1;
  switch (severity) {
  case ERROR:
    diagnosticSeverity = Diagnostic.ERROR;
    break;
  case WARNING:
    diagnosticSeverity = Diagnostic.WARNING;
    break;
  case INFO:
    diagnosticSeverity = Diagnostic.INFO;
    break;
  default:
    throw new IllegalArgumentException("Unknow severity " + severity); //$NON-NLS-1$
  }
  return diagnosticSeverity;
}
 
Example 3
Source File: VisualInterfaceEditor.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Returns a diagnostic describing the errors and warnings listed in the resource
 * and the specified exception (if any).
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public Diagnostic analyzeResourceProblems ( Resource resource, Exception exception )
{
    boolean hasErrors = !resource.getErrors ().isEmpty ();
    if ( hasErrors || !resource.getWarnings ().isEmpty () )
    {
        BasicDiagnostic basicDiagnostic = new BasicDiagnostic ( hasErrors ? Diagnostic.ERROR : Diagnostic.WARNING, "org.eclipse.scada.vi.model.editor", //$NON-NLS-1$
                0, getString ( "_UI_CreateModelError_message", resource.getURI () ), //$NON-NLS-1$
                new Object[] { exception == null ? (Object)resource : exception } );
        basicDiagnostic.merge ( EcoreUtil.computeDiagnostic ( resource, true ) );
        return basicDiagnostic;
    }
    else if ( exception != null )
    {
        return new BasicDiagnostic ( Diagnostic.ERROR, "org.eclipse.scada.vi.model.editor", //$NON-NLS-1$
                0, getString ( "_UI_CreateModelError_message", resource.getURI () ), //$NON-NLS-1$
                new Object[] { exception } );
    }
    else
    {
        return Diagnostic.OK_INSTANCE;
    }
}
 
Example 4
Source File: GlobalizeEditor.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Returns a diagnostic describing the errors and warnings listed in the resource
 * and the specified exception (if any).
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public Diagnostic analyzeResourceProblems ( Resource resource, Exception exception )
{
    boolean hasErrors = !resource.getErrors ().isEmpty ();
    if ( hasErrors || !resource.getWarnings ().isEmpty () )
    {
        BasicDiagnostic basicDiagnostic = new BasicDiagnostic ( hasErrors ? Diagnostic.ERROR : Diagnostic.WARNING, "org.eclipse.scada.configuration.globalization.editor", //$NON-NLS-1$
                0, getString ( "_UI_CreateModelError_message", resource.getURI () ), //$NON-NLS-1$
                new Object[] { exception == null ? (Object)resource : exception } );
        basicDiagnostic.merge ( EcoreUtil.computeDiagnostic ( resource, true ) );
        return basicDiagnostic;
    }
    else if ( exception != null )
    {
        return new BasicDiagnostic ( Diagnostic.ERROR, "org.eclipse.scada.configuration.globalization.editor", //$NON-NLS-1$
                0, getString ( "_UI_CreateModelError_message", resource.getURI () ), //$NON-NLS-1$
                new Object[] { exception } );
    }
    else
    {
        return Diagnostic.OK_INSTANCE;
    }
}
 
Example 5
Source File: MemoryEditor.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Returns a diagnostic describing the errors and warnings listed in the resource
 * and the specified exception (if any).
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public Diagnostic analyzeResourceProblems ( Resource resource, Exception exception )
{
    boolean hasErrors = !resource.getErrors ().isEmpty ();
    if ( hasErrors || !resource.getWarnings ().isEmpty () )
    {
        BasicDiagnostic basicDiagnostic = new BasicDiagnostic ( hasErrors ? Diagnostic.ERROR : Diagnostic.WARNING, "org.eclipse.scada.configuration.memory.editor", 0, getString ( "_UI_CreateModelError_message", resource.getURI () ), new Object[] { exception == null ? (Object)resource : exception } );
        basicDiagnostic.merge ( EcoreUtil.computeDiagnostic ( resource, true ) );
        return basicDiagnostic;
    }
    else if ( exception != null )
    {
        return new BasicDiagnostic ( Diagnostic.ERROR, "org.eclipse.scada.configuration.memory.editor", 0, getString ( "_UI_CreateModelError_message", resource.getURI () ), new Object[] { exception } );
    }
    else
    {
        return Diagnostic.OK_INSTANCE;
    }
}
 
Example 6
Source File: WorldEditor.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Returns a diagnostic describing the errors and warnings listed in the resource
 * and the specified exception (if any).
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public Diagnostic analyzeResourceProblems ( Resource resource, Exception exception )
{
    boolean hasErrors = !resource.getErrors ().isEmpty ();
    if ( hasErrors || !resource.getWarnings ().isEmpty () )
    {
        BasicDiagnostic basicDiagnostic = new BasicDiagnostic ( hasErrors ? Diagnostic.ERROR : Diagnostic.WARNING, "org.eclipse.scada.configuration.world.editor", //$NON-NLS-1$
        0, getString ( "_UI_CreateModelError_message", resource.getURI () ), //$NON-NLS-1$
        new Object[] { exception == null ? (Object)resource : exception } );
        basicDiagnostic.merge ( EcoreUtil.computeDiagnostic ( resource, true ) );
        return basicDiagnostic;
    }
    else if ( exception != null )
    {
        return new BasicDiagnostic ( Diagnostic.ERROR, "org.eclipse.scada.configuration.world.editor", //$NON-NLS-1$
        0, getString ( "_UI_CreateModelError_message", resource.getURI () ), //$NON-NLS-1$
        new Object[] { exception } );
    }
    else
    {
        return Diagnostic.OK_INSTANCE;
    }
}
 
Example 7
Source File: OsgiEditor.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Returns a diagnostic describing the errors and warnings listed in the resource
 * and the specified exception (if any).
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public Diagnostic analyzeResourceProblems ( Resource resource, Exception exception )
{
    boolean hasErrors = !resource.getErrors ().isEmpty ();
    if ( hasErrors || !resource.getWarnings ().isEmpty () )
    {
        BasicDiagnostic basicDiagnostic = new BasicDiagnostic ( hasErrors ? Diagnostic.ERROR : Diagnostic.WARNING, "org.eclipse.scada.configuration.world.editor", //$NON-NLS-1$
        0, getString ( "_UI_CreateModelError_message", resource.getURI () ), //$NON-NLS-1$
        new Object[] { exception == null ? (Object)resource : exception } );
        basicDiagnostic.merge ( EcoreUtil.computeDiagnostic ( resource, true ) );
        return basicDiagnostic;
    }
    else if ( exception != null )
    {
        return new BasicDiagnostic ( Diagnostic.ERROR, "org.eclipse.scada.configuration.world.editor", //$NON-NLS-1$
        0, getString ( "_UI_CreateModelError_message", resource.getURI () ), //$NON-NLS-1$
        new Object[] { exception } );
    }
    else
    {
        return Diagnostic.OK_INSTANCE;
    }
}
 
Example 8
Source File: ProfileEditor.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Returns a diagnostic describing the errors and warnings listed in the resource
 * and the specified exception (if any).
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public Diagnostic analyzeResourceProblems ( Resource resource, Exception exception )
{
    boolean hasErrors = !resource.getErrors ().isEmpty ();
    if ( hasErrors || !resource.getWarnings ().isEmpty () )
    {
        BasicDiagnostic basicDiagnostic = new BasicDiagnostic ( hasErrors ? Diagnostic.ERROR : Diagnostic.WARNING, "org.eclipse.scada.configuration.world.editor", //$NON-NLS-1$
        0, getString ( "_UI_CreateModelError_message", resource.getURI () ), //$NON-NLS-1$
        new Object[] { exception == null ? (Object)resource : exception } );
        basicDiagnostic.merge ( EcoreUtil.computeDiagnostic ( resource, true ) );
        return basicDiagnostic;
    }
    else if ( exception != null )
    {
        return new BasicDiagnostic ( Diagnostic.ERROR, "org.eclipse.scada.configuration.world.editor", //$NON-NLS-1$
        0, getString ( "_UI_CreateModelError_message", resource.getURI () ), //$NON-NLS-1$
        new Object[] { exception } );
    }
    else
    {
        return Diagnostic.OK_INSTANCE;
    }
}
 
Example 9
Source File: SetupEditor.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Returns a diagnostic describing the errors and warnings listed in the resource
 * and the specified exception (if any).
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public Diagnostic analyzeResourceProblems ( Resource resource, Exception exception )
{
    boolean hasErrors = !resource.getErrors ().isEmpty ();
    if ( hasErrors || !resource.getWarnings ().isEmpty () )
    {
        BasicDiagnostic basicDiagnostic = new BasicDiagnostic ( hasErrors ? Diagnostic.ERROR : Diagnostic.WARNING, "org.eclipse.scada.configuration.world.editor", //$NON-NLS-1$
        0, getString ( "_UI_CreateModelError_message", resource.getURI () ), //$NON-NLS-1$
        new Object[] { exception == null ? (Object)resource : exception } );
        basicDiagnostic.merge ( EcoreUtil.computeDiagnostic ( resource, true ) );
        return basicDiagnostic;
    }
    else if ( exception != null )
    {
        return new BasicDiagnostic ( Diagnostic.ERROR, "org.eclipse.scada.configuration.world.editor", //$NON-NLS-1$
        0, getString ( "_UI_CreateModelError_message", resource.getURI () ), //$NON-NLS-1$
        new Object[] { exception } );
    }
    else
    {
        return Diagnostic.OK_INSTANCE;
    }
}
 
Example 10
Source File: ValidateAction.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
private static int diagnosticToStatusSeverity(int diagnosticSeverity) {
	if (diagnosticSeverity == Diagnostic.OK) {
		return IStatus.OK;
	} else if (diagnosticSeverity == Diagnostic.INFO) {
		return IStatus.INFO;
	} else if (diagnosticSeverity == Diagnostic.WARNING) {
		return IStatus.WARNING;
	} else if (diagnosticSeverity == Diagnostic.ERROR || diagnosticSeverity == Diagnostic.CANCEL) {
		return IStatus.ERROR;
	}
	return IStatus.INFO;
}
 
Example 11
Source File: SARLDiagnosticLabelDecorator.java    From sarl with Apache License 2.0 5 votes vote down vote up
/** Replies the diagnotic adornment for the given element.
 *
 * @param element the model element.
 * @return the adornment.
 */
@SuppressWarnings("static-method")
protected int getIssueAdornment(XtendMember element) {
	final ICompositeNode node = NodeModelUtils.getNode(element);
	if (node == null) {
		return 0;
	}
	// Error markers are more important than warning markers.
	// Order of checks:
	// - parser error (from the resource) or semantic error (from Diagnostician)
	// - parser warning or semantic warning
	final Resource resource = element.eResource();
	if (!resource.getURI().isArchive()) {
		if (hasParserIssue(node, resource.getErrors())) {
			return JavaElementImageDescriptor.ERROR;
		}
		final Diagnostic diagnostic = Diagnostician.INSTANCE.validate(element);
        switch (diagnostic.getSeverity()) {
        case Diagnostic.ERROR:
        	return JavaElementImageDescriptor.ERROR;
        case Diagnostic.WARNING:
        	return JavaElementImageDescriptor.WARNING;
        default:
        }
		if (hasParserIssue(node, resource.getWarnings())) {
			return JavaElementImageDescriptor.WARNING;
		}
	}
	return 0;
}
 
Example 12
Source File: CrossflowEditor.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Returns a diagnostic describing the errors and warnings listed in the resource
 * and the specified exception (if any).
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public Diagnostic analyzeResourceProblems(Resource resource, Exception exception) {
	boolean hasErrors = !resource.getErrors().isEmpty();
	if (hasErrors || !resource.getWarnings().isEmpty()) {
		BasicDiagnostic basicDiagnostic =
			new BasicDiagnostic
				(hasErrors ? Diagnostic.ERROR : Diagnostic.WARNING,
				 "org.eclipse.scava.crossflow.language.editor",
				 0,
				 getString("_UI_CreateModelError_message", resource.getURI()),
				 new Object [] { exception == null ? (Object)resource : exception });
		basicDiagnostic.merge(EcoreUtil.computeDiagnostic(resource, true));
		return basicDiagnostic;
	}
	else if (exception != null) {
		return
			new BasicDiagnostic
				(Diagnostic.ERROR,
				 "org.eclipse.scava.crossflow.language.editor",
				 0,
				 getString("_UI_CreateModelError_message", resource.getURI()),
				 new Object[] { exception });
	}
	else {
		return Diagnostic.OK_INSTANCE;
	}
}
 
Example 13
Source File: ValidateAction.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
* @generated
*/
private static int diagnosticToStatusSeverity(int diagnosticSeverity) {
	if (diagnosticSeverity == Diagnostic.OK) {
		return IStatus.OK;
	} else if (diagnosticSeverity == Diagnostic.INFO) {
		return IStatus.INFO;
	} else if (diagnosticSeverity == Diagnostic.WARNING) {
		return IStatus.WARNING;
	} else if (diagnosticSeverity == Diagnostic.ERROR || diagnosticSeverity == Diagnostic.CANCEL) {
		return IStatus.ERROR;
	}
	return IStatus.INFO;
}
 
Example 14
Source File: AbstractBodyParser.java    From M2Doc with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Gets the {@link List} of {@link TemplateValidationMessage} from the given {@link Diagnostic}.
 * 
 * @param diagnostic
 *            the {@link Diagnostic}
 * @param queryText
 *            the query text
 * @param location
 *            the location of the {@link TemplateValidationMessage}
 * @return the {@link List} of {@link TemplateValidationMessage} from the given {@link Diagnostic}
 */
protected List<TemplateValidationMessage> getValidationMessage(Diagnostic diagnostic, String queryText,
        XWPFRun location) {
    final List<TemplateValidationMessage> res = new ArrayList<>();

    for (Diagnostic child : diagnostic.getChildren()) {
        final ValidationMessageLevel level;
        switch (diagnostic.getSeverity()) {
            case Diagnostic.INFO:
                level = ValidationMessageLevel.INFO;
                break;

            case Diagnostic.WARNING:
                level = ValidationMessageLevel.WARNING;
                break;

            case Diagnostic.ERROR:
                level = ValidationMessageLevel.ERROR;
                break;

            default:
                level = ValidationMessageLevel.INFO;
                break;
        }
        res.add(new TemplateValidationMessage(level,
                message(ParsingErrorMessage.INVALIDEXPR, queryText, child.getMessage()), location));
        res.addAll(getValidationMessage(child, queryText, location));
    }

    return res;
}
 
Example 15
Source File: M2DocUtils.java    From M2Doc with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Appends the given {@link Diagnostic} to the given {@link XWPFParagraph}.
 * 
 * @param paragraph
 *            the {@link XWPFParagraph}
 * @param diagnostic
 *            the {@link Diagnostic}
 * @return the maximum {@link ValidationMessageLevel}
 */
public static List<TemplateValidationMessage> appendDiagnosticMessage(XWPFParagraph paragraph,
        Diagnostic diagnostic) {
    final List<TemplateValidationMessage> res = new ArrayList<>();

    for (Diagnostic child : diagnostic.getChildren()) {
        switch (child.getSeverity()) {
            case Diagnostic.INFO:
                res.add(M2DocUtils.appendMessageRun(paragraph, ValidationMessageLevel.INFO,
                        getMessageWithException(child)));
                break;
            case Diagnostic.WARNING:
                res.add(M2DocUtils.appendMessageRun(paragraph, ValidationMessageLevel.WARNING,
                        getMessageWithException(child)));
                break;
            case Diagnostic.ERROR:
                res.add(M2DocUtils.appendMessageRun(paragraph, ValidationMessageLevel.ERROR,
                        getMessageWithException(child)));
                break;

            default:
                res.add(M2DocUtils.appendMessageRun(paragraph, ValidationMessageLevel.INFO,
                        getMessageWithException(child)));
                break;
        }
        paragraph.getRuns().get(paragraph.getRuns().size() - 1).addBreak();
        if (!child.getChildren().isEmpty()) {
            res.addAll(appendDiagnosticMessage(paragraph, child));
        }
    }

    return res;
}
 
Example 16
Source File: BeansEditor.java    From hybris-commerce-eclipse-plugin with Apache License 2.0 5 votes vote down vote up
/**
 * Returns a diagnostic describing the errors and warnings listed in the resource
 * and the specified exception (if any).
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public Diagnostic analyzeResourceProblems(Resource resource, Exception exception) {
	boolean hasErrors = !resource.getErrors().isEmpty();
	if (hasErrors || !resource.getWarnings().isEmpty()) {
		BasicDiagnostic basicDiagnostic =
			new BasicDiagnostic
				(hasErrors ? Diagnostic.ERROR : Diagnostic.WARNING,
				 "com.hybris.hyeclipse.emf.beans.editor",
				 0,
				 getString("_UI_CreateModelError_message", resource.getURI()),
				 new Object [] { exception == null ? (Object)resource : exception });
		basicDiagnostic.merge(EcoreUtil.computeDiagnostic(resource, true));
		return basicDiagnostic;
	}
	else if (exception != null) {
		return
			new BasicDiagnostic
				(Diagnostic.ERROR,
				 "com.hybris.hyeclipse.emf.beans.editor",
				 0,
				 getString("_UI_CreateModelError_message", resource.getURI()),
				 new Object[] { exception });
	}
	else {
		return Diagnostic.OK_INSTANCE;
	}
}
 
Example 17
Source File: ValidationMarkerProvider.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private static int diagnosticToStatusSeverity(final int diagnosticSeverity) {
    if (diagnosticSeverity == Diagnostic.OK) {
        return IStatus.OK;
    } else if (diagnosticSeverity == Diagnostic.INFO) {
        return IStatus.INFO;
    } else if (diagnosticSeverity == Diagnostic.WARNING) {
        return IStatus.WARNING;
    } else if (diagnosticSeverity == Diagnostic.ERROR
            || diagnosticSeverity == Diagnostic.CANCEL) {
        return IStatus.ERROR;
    }
    return IStatus.INFO;
}
 
Example 18
Source File: XtextValidator.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
public void doCreateMessage(String message, String code, int severity, EObject context, EStructuralFeature feature, ValidationMessageAcceptor acceptor) {
	if (severity == Diagnostic.WARNING) {
		acceptor.acceptWarning(message, context, feature, ValidationMessageAcceptor.INSIGNIFICANT_INDEX, code);
	} else if (severity == Diagnostic.ERROR) {
		acceptor.acceptError(message, context, feature, ValidationMessageAcceptor.INSIGNIFICANT_INDEX, code);
	} else if (severity == Diagnostic.INFO) {
		acceptor.acceptInfo(message, context, feature, ValidationMessageAcceptor.INSIGNIFICANT_INDEX, code);
	}
}
 
Example 19
Source File: ErrorToDiagnoticTranslator.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
protected int toDiagnosticSeverity(final GamlCompilationError e) {
	int diagnosticSeverity = -1;
	if (e.isError()) {
		diagnosticSeverity = Diagnostic.ERROR;
	} else if (e.isWarning()) {
		diagnosticSeverity = Diagnostic.WARNING;
	} else if (e.isInfo()) {
		diagnosticSeverity = Diagnostic.INFO;
	}

	return diagnosticSeverity;
}
 
Example 20
Source File: AbstractValidationTest.java    From dsl-devkit with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Check if the given issue code is found among issue codes for the object, located at the given position.
 *
 * @param root
 *          root object of the document
 * @param pos
 *          position to locate the target object
 */
@Override
public void apply(final EObject root, final Integer pos) {
  Iterable<Resource.Diagnostic> diagnostics = null;
  switch (expectedSeverity) {
  case Diagnostic.ERROR:
    diagnostics = root.eResource().getErrors();
    break;
  case Diagnostic.WARNING:
    diagnostics = root.eResource().getWarnings();
    break;
  case SEVERITY_UNDEFINED:
    diagnostics = Iterables.concat(root.eResource().getErrors(), root.eResource().getWarnings());
    break;
  }
  final List<Resource.Diagnostic> diagnosticsOnTargetPosition = Lists.newArrayList();
  boolean issueFound = false;
  int actualSeverity = expectedSeverity;
  boolean expectedMessageMatches = false;
  String actualMessage = "";

  for (AbstractDiagnostic diag : Iterables.filter(diagnostics, AbstractDiagnostic.class)) {
    if (diagnosticPositionEquals(pos, diag)) {
      // Add issue to the list of issues at the given position
      diagnosticsOnTargetPosition.add(diag);
      if (diag.getCode().equals(issueCode)) {
        issueFound = true;
        if (expectedSeverity == SEVERITY_UNDEFINED) {
          actualSeverity = root.eResource().getErrors().contains(diag) ? Diagnostic.ERROR : Diagnostic.WARNING;
        }
        actualMessage = diag.getMessage();
        // True if message matches with actual message or message is null
        expectedMessageMatches = message == null || actualMessage.equals(message);
        // Don't need to display error messages
        if (issueMustBeFound) {
          // Remove the diagnostic from the list of non-expected diagnostics
          getUnexpectedResourceDiagnostics().remove(diag);
          // Don't need to display error messages
          if (expectedMessageMatches) {
            return;
          }
        }
      }
    }
  }

  // Create error message
  createErrorMessage(pos, diagnosticsOnTargetPosition, issueFound, true, actualSeverity, expectedMessageMatches, actualMessage);
}