final Display display = Display.getDefault();
display.syncExec(new Runnable(){
public void run() {
// test to make sure that GDI+ is installed
Image image = null;
Path path = null;
try {
image = new Image(display, 10, 10);
path = AWTSWTImageUtils.convertToPath(new Rectangle(0, 0, 8, 8), display);
status[0] = true;
} catch (Exception e) {
final String message =
Messages.UDIGApplication_error1
+ Messages.UDIGApplication_error2
+ "http://www.microsoft.com/downloads/details.aspx?FamilyID=6A63AB9C-DF12-4D41-933C-BE590FEAA05A&displaylang=en"; //$NON-NLS-1$
UiPlugin.log( message, null );
MessageDialog dialog = new MessageDialog(
display.getActiveShell(),
Messages.UDIGApplication_title,
null,
message,
MessageDialog.ERROR,
new String[]{"Exit","Continue"}, 0 );
int answer = dialog.open();
if( answer == 0 ){
PlatformUI.getWorkbench().close();
//System.exit(1); // need to ask the workbench to exit so this is clean...
}
} finally {
if (image != null)
image.dispose();
if (path != null)
path.dispose();
}
}
});
}
return status[0];