{
return Diagnostic.OK_INSTANCE;
}
else
{
BasicDiagnostic basicDiagnostic = new BasicDiagnostic();
for (Resource.Diagnostic resourceDiagnostic : resource.getErrors())
{
Diagnostic diagnostic = null;
if (resourceDiagnostic instanceof Throwable)
{
diagnostic = BasicDiagnostic.toDiagnostic((Throwable)resourceDiagnostic);
}
else
{
diagnostic = new BasicDiagnostic(
Diagnostic.ERROR,
"org.eclipse.emf.ecore.resource",
0,
resourceDiagnostic.getMessage(),
new Object[]{resourceDiagnostic});
}
basicDiagnostic.add(diagnostic);
}
if (includeWarnings)
{
for (Resource.Diagnostic resourceDiagnostic : resource.getWarnings())
{
Diagnostic diagnostic = null;
if (resourceDiagnostic instanceof Throwable)
{
diagnostic = BasicDiagnostic.toDiagnostic((Throwable)resourceDiagnostic);
}
else
{
diagnostic = new BasicDiagnostic(
Diagnostic.WARNING,
"org.eclipse.emf.ecore.resource",
0,
resourceDiagnostic.getMessage(),
new Object[]{resourceDiagnostic});
}
basicDiagnostic.add(diagnostic);
}
}
return basicDiagnostic;
}