0

I develop an eclipse plugin at the moment and I want to create a custom error dialog. I have tried to extend the workbencherrorhandler, but no dialog occurs. Can someone help me and tell me how to create a custom error Handler with equinox 2020 09. This is my first try:

public class StatusHandler extends WorkbenchErrorHandler {

@Override
  public void handle(final StatusAdapter statusAdapter, final int style) {
if (statusAdapter.getStatus() instanceof MultiStatus
&& ((MultiStatus) statusAdapter.getStatus()).getPlugin().contains("de.audivw.jabaf")) {
Display.getDefault().asyncExec(new Runnable() {

@Override
public void run() {
Shell shell = PlatformUI.getWorkbench().getDisplay().getActiveShell();
MultiStatus ms = (MultiStatus) statusAdapter.getStatus();
ErrorDialog dialog = new ErrorDialog(shell, "Fehler", null, ms,
IStatus.OK | IStatus.INFO | IStatus.WARNING | IStatus.ERROR);
dialog.open();
}
});
return;
}
super.handle(statusAdapter, style);
}
}

Thank you for your help,

Tobias

3
  • You can only override the handler in the WorkbenchAdvisor.getWorkbenchErrorHandler method - are you doing that? An ordinary plug-in the standard Eclipse can't change the error handler. Commented Sep 7, 2021 at 16:53
  • no I dont do that yet. Do you have an example code or can you say me where I have to call that methode ? Commented Sep 7, 2021 at 17:01
  • You don't call this method, Eclipe calls it. The workbench advisor is something an Eclipse RCP sets up as part of the Eclipse initialization. A normal plug-in cannot change the set up or what the error handler is. Commented Sep 7, 2021 at 17:08

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.