Skip to content

Instantly share code, notes, and snippets.

@bmaggi
Created June 22, 2017 11:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bmaggi/431fb9cc46dbf68e6e0b9c3270973ff3 to your computer and use it in GitHub Desktop.
Save bmaggi/431fb9cc46dbf68e6e0b9c3270973ff3 to your computer and use it in GitHub Desktop.
Pretty print for an EMF Diagnostic
import java.util.List;
import org.eclipse.emf.common.util.Diagnostic;
public class DiagnosticUtil {
// pretty print for an EMF Diagnostic
public static String print(Diagnostic diagnostic) {
List<Diagnostic> children = diagnostic.getChildren();
StringBuilder stringBuilder = new StringBuilder(diagnostic.getMessage());
for (Diagnostic diagnosticChildren : children) {
stringBuilder.append("\n"); //$NON-NLS-1$
stringBuilder.append(diagnosticChildren.getMessage());
}
return stringBuilder.toString();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment