Skip to main content



      Home
Home » Modeling » EMF » Display diagnostic
Display diagnostic [message #1712237] Thu, 22 October 2015 06:39 Go to next message
Eclipse UserFriend
Dear EMF team,
would it be possible to add a basic method in the EMF api to print a diagnostic
such as:
Thanks
Francois

private String print(Diagnostic diagnostic) {
String message = diagnostic.getMessage();
List<Diagnostic> children = diagnostic.getChildren();
for (Diagnostic diagnostic2 : children) {
message += "\n"+diagnostic2.getMessage();
}
return message;
}
Re: Display diagnostic [message #1712238 is a reply to message #1712237] Thu, 22 October 2015 06:42 Go to previous messageGo to next message
Eclipse UserFriend
or better

/**
* <!-- begin-user-doc -->
* Prints diagnostics with indentation.
* <!-- end-user-doc -->
* @param diagnostic the diagnostic to print.
* @param indent the indentation for printing.
* @generated
*/
protected static void printDiagnostic(Diagnostic diagnostic,
String indent)
{
System.out.print(indent);
System.out.println(diagnostic.getMessage());
for (Iterator i = diagnostic.getChildren().iterator();
i.hasNext(); )
{
printDiagnostic((Diagnostic)i.next(), indent + " ");
}
}
Re: Display diagnostic [message #1712248 is a reply to message #1712238] Thu, 22 October 2015 07:09 Go to previous message
Eclipse UserFriend
You could have your own static utility method for this.

On 22/10/2015 12:42 PM, Francois Le Fevre wrote:
> or better
>
> /**
> * <!-- begin-user-doc -->
> * Prints diagnostics with indentation.
> * <!-- end-user-doc -->
> * @param diagnostic the diagnostic to print.
> * @param indent the indentation for printing.
> * @generated
> */
> protected static void printDiagnostic(Diagnostic diagnostic,
> String indent)
> {
> System.out.print(indent);
> System.out.println(diagnostic.getMessage());
> for (Iterator i = diagnostic.getChildren().iterator();
> i.hasNext(); )
> {
> printDiagnostic((Diagnostic)i.next(), indent + " ");
> }
> }
Previous Topic:Child extenders when extending several packages with the same name.
Next Topic:[XCore] bitwise operators in an operation not working
Goto Forum:
  


Current Time: Fri Nov 07 11:14:44 EST 2025

Powered by FUDForum. Page generated in 0.06126 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top