I am currently developing an SWT java application on Windows 7. Usually the application will be minimized, and when there is an event on the serial port the application should m
There is a another "hackey" way to do this than what you found, which does not require you to minimize everything else. You actually need to call shell.setMinimized(false)
and after that shell.setActive()
to restore the previous state of the shell
. However, that only works if the shell
was truely in the minimized state. So here is my final solution, which artificially minimizes the shell
if it was not minimized already. The cost is a quick animation if the minimization has to be done.
shell.getDisplay().syncExec(new Runnable() {
@Override
public void run() {
if (!shell.getMinimized())
{
shell.setMinimized(true);
}
shell.setMinimized(false);
shell.setActive();
}
});