1

We are developing a product based on eclipse (it's a eclipse plugin and we have around 60+ plugin projects), I am using log4j as my logging framework and using it to log errors on business logic side. But I am not finding a way to handle UI errors which Eclipse throws in case if there is any bugs in UI, example:

Caused by: org.eclipse.swt.SWTException: Widget is disposed

I am talking about these type of errors. So how do I handle this exception so that I can log in our log files, so that bugs can be identified.

I tried this stackoverflow question, basically it says override public void eventLoopException(Throwable exception) from WorkbenchAdvisor class.

I tried like this, in one of our UI plugin project like this:

public class CustomWorkbenchAdvisor extends WorkbenchAdvisor {
     @Override
    public void eventLoopException(Throwable exception) {
        System.out.println("Error occured");
        super.eventLoopException(exception);
    }
}

And I delbrately created UI error, but when I see my console, I don't see "Error occured" displayed instead it displays:

!MESSAGE Unhandled event loop exception

With stacktrace. Can anyone guide me how can I handle these type of errors?

4

1 回答 1

0

您必须在创建应用程序WorkbenchAdvisor的调用中指定您的自定义。此调用在应用程序 plugin.xml 中的扩展点条目中PlatformUI.createAndRunWorkbench指定的主应用程序类中。<run><application>

于 2013-08-28T10:24:23.463 回答