How to show stack trace with error dialog in eclipse workbench [message #459517] |
Mon, 04 December 2006 08:55  |
Eclipse User |
|
|
|
Hi,
From WorkspaceJob.runInWorkspace(), we retun IStatus object, depending on
which eclipse backend reacts. If IStatus object is set to status
IStatus.ERROR, an error dialog appears. My intent is to show the actual
java error with the very error dialog, as well as the full stack trace. Is
it possible, please? Is it possible to install a custorm error dialog?
-Faisal
|
|
|
|
|
|
Re: How to show stack trace with error dialog in eclipse workbench [message #459675 is a reply to message #459670] |
Wed, 06 December 2006 06:52  |
Eclipse User |
|
|
|
You can easily build your own dialog if you want. ErrorDialog is a subclass of IconAndMessage, which is a subclass of Dialog, so if ErrorDialog doesn't quite do what you want, you can always create your own dialog message.
ErrorDialogs are supposed to be user-friendly, though, so you shouldn't necessarily want to have the stack trace displayed. It would be fairly easy to pass in the stacktrace as a string message if you wanted; you can either use printStackTrace(new PrintWriter(s = new StringWriter())); s.toString(), or alternatively build it up yourself.
I don't think you can replace Eclipse's dialog dynamically, but it's fairly easy to obtain the source for org.eclipse.jface.dialogs, then modifying the existing ErrorDialog and re-building the plugin, and then dropping it into your Eclipse install. I've used this technique to work around a few bugs that are in 3.2 that won't be available now until 3.3.
Instead of using dialogs, have you considered using the platform log service, which will probably log the stacktrace?
Platform.getLog("org.example.bundle").log(iStatusObject);
Alex.
|
|
|
Powered by
FUDForum. Page generated in 0.04207 seconds