Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » ErrorDialog: new line in MultiStatus not recognised
ErrorDialog: new line in MultiStatus not recognised [message #461852] Mon, 03 October 2005 09:56
Jim is currently offline JimFriend
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,
Previous Topic:color of text in a texbox
Next Topic:Multiline FieldEditor text area?
Goto Forum:
  


Current Time: Tue Apr 23 09:24:47 GMT 2024

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

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

Back to the top