I have an operations class that has no gui. The class basically does data management. The class is called from a method in my Main GUI. The problem I am having is with displaying messages to the user if something fails. I am using MessageDialog, but it keeps failing at runtime. I think the issue is with Shell. When I try to use null as the shell.
MessageDialog.openError(null, "Printer Error Message", "Error getting print reply file.");
The error is null pointer exception
MessageDialog.openError(Display.getCurrent().getActiveShell() etc
The error is null pointer exception
MessageDialog.openError(Display.getDefault().getActiveShell()
The error is invalid thread access
- Being this is not a GUI class, do I have to pass in the shell from the GUI parent?
- Can I just create a shell in the class and then use that?
You can fix the
ERROR_THREAD_INVALID_ACCESSerror withDisplay.syncExecorDisplay.asyncExec. Try with: