I'm implementing a update function that will use a server response to handle the update. Now my update need to ask the user (in a dialog) to restart the application. The only injection I can do in the class is the IEclipseContext.
Now how can I get the UISynchronize of the current running Eclipse RCP application? So that I safely can run this method:
private void showMessage(UISynchronize sync, final String message) {
sync.syncExec(new Runnable() {
@Override
public void run() {
MessageDialog.openInformation(null, "Information", message);
}
});
}
UISynchronize
is in the application IEclipseContext
so it will be available in any context except the OSGi services context.
All that UISynchronize
does is call Display.asyncExec
so if you haven't got a context available just use the traditional
Display.getDefault().asyncExec(....)