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 #461804] Fri, 30 September 2005 12:58
Jim is currently offline JimFriend
Messages: 15
Registered: July 2009
Junior Member

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
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 );;

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?
Previous Topic:How to convert to XML
Next Topic:GUI update
Goto Forum:

Current Time: Mon Jul 16 16:12:44 GMT 2018

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

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

Back to the top