ErrorDialog: new line in MultiStatus not recognised [message #461804] |
Fri, 30 September 2005 12:58 |
Jim Messages: 15 Registered: July 2009 |
Junior Member |
|
|
Hi,
I'm using org.eclipse.jface.dialogs.ErrorDialog with an IStatus object to
communicate detailed errors to the user.
In the status class "org.eclipse.core.runtime.Status.Status(int severity,
String pluginId, int code, String
message, Throwable exception)", a message String containing the new line
character was given as a parameter.
But the new line character (either \n or \r) is not recognised in the
ErrorDialog.
As a result the stack trace, that I want to print out in the Details
section of the Dialog appears as one continuous line, instead of the usual
PrintStackTrace structure.
Here's my code:
Status[] childStatus = new Status[1];
childStatus[0] = new Status( Status.ERROR, "not_used", 0,
getStackTrace(e), e );
MultiStatus m = new MultiStatus( "not_used", 0, childStatus, e
.getMessage(), e );
ErrorDialog err = new ErrorDialog( Display.getDefault()
.getActiveShell(), "Match Exception", null, m,
IStatus.ERROR );
err.open();
public static String getStackTrace(Throwable t)
{
String s = "";
StackTraceElement[] stackElements = t.getStackTrace();
for (int i = 0; i < stackElements.length; i++)
{
s += " at " + stackElements[i].toString() + "\n";
}
System.out.println( s );
return s;
}
Any ideas?
Thanks,
|
|
|
Powered by
FUDForum. Page generated in 0.03624 seconds