Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Display diagnostic
Display diagnostic [message #1712237] Thu, 22 October 2015 10:39 Go to next message
Francois Le Fevre is currently offline Francois Le FevreFriend
Messages: 56
Registered: October 2014
Location: Paris Saclay, France
Member
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 10:42 Go to previous messageGo to next message
Francois Le Fevre is currently offline Francois Le FevreFriend
Messages: 56
Registered: October 2014
Location: Paris Saclay, France
Member
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 11:09 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
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 + " ");
> }
> }


Ed Merks
Professional Support: https://www.macromodeling.com/
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: Thu Apr 25 13:42:31 GMT 2024

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

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

Back to the top