if (display.isDisposed())
return;
shell = new Shell (display,SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
if(! Constants.isOSX) {
shell.setImage(ImageRepository.getImage("azureus"));
}
shell.setText(MessageText.getString("dialog.associations.title"));
GridLayout layout = new GridLayout();
layout.numColumns = 3;
shell.setLayout (layout);
GridData gridData;
// text
Label user_label = new Label(shell,SWT.NULL);
Messages.setLanguageText(user_label, "dialog.associations.prompt");
gridData = new GridData(GridData.FILL_BOTH);
gridData.horizontalSpan = 3;
user_label.setLayoutData(gridData);
final Button checkBox = new Button(shell, SWT.CHECK);
checkBox.setSelection(true);
gridData = new GridData(GridData.FILL_BOTH);
gridData.horizontalSpan = 3;
checkBox.setLayoutData(gridData);
Messages.setLanguageText(checkBox, "dialog.associations.askagain");
// line
Label labelSeparator = new Label(shell,SWT.SEPARATOR | SWT.HORIZONTAL);
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 3;
labelSeparator.setLayoutData(gridData);
// buttons
new Label(shell,SWT.NULL);
Button bYes = new Button(shell,SWT.PUSH);
bYes.setText(MessageText.getString("Button.yes"));
gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_END | GridData.HORIZONTAL_ALIGN_FILL);
gridData.grabExcessHorizontalSpace = true;
gridData.widthHint = 70;
bYes.setLayoutData(gridData);
bYes.addListener(SWT.Selection,new Listener() {
public void handleEvent(Event e) {
close(true, checkBox.getSelection());
}
});
Button bNo = new Button(shell,SWT.PUSH);
bNo.setText(MessageText.getString("Button.no"));
gridData = new GridData(GridData.HORIZONTAL_ALIGN_END);
gridData.grabExcessHorizontalSpace = false;
gridData.widthHint = 70;
bNo.setLayoutData(gridData);
bNo.addListener(SWT.Selection,new Listener() {
public void handleEvent(Event e) {
close(false, checkBox.getSelection());
}
});
bYes.setFocus();
shell.setDefaultButton( bYes );
shell.addListener(SWT.Traverse, new Listener() {
public void handleEvent(Event e) {
if ( e.character == SWT.ESC){
close( false, true );
}
}
});
shell.pack ();
Utils.centreWindow( shell );
shell.open ();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}