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?