Created
June 22, 2017 11:22
-
-
Save bmaggi/431fb9cc46dbf68e6e0b9c3270973ff3 to your computer and use it in GitHub Desktop.
Pretty print for an EMF Diagnostic
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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