shell = ShellFactory.createShell(display,SWT.APPLICATION_MODAL | SWT.BORDER | SWT.TITLE | SWT.CLOSE);
if(!Constants.isOSX) {
shell.setImage(ImageRepository.getImage("azureus"));
}
GridLayout layout = new GridLayout();
layout.numColumns = 2;
shell.setLayout(layout);
GridData data;
label = new Label(shell,SWT.WRAP);
combo = new Combo(shell,SWT.READ_ONLY);
Button ok = new Button(shell,SWT.PUSH);
ok.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event arg0) {
result = combo.getText();
shell.dispose();
}
});
ok.setText(MessageText.getString("Button.ok"));
Button cancel = new Button(shell,SWT.PUSH);
cancel.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event arg0) {
result = null;
shell.dispose();
}
});
cancel.setText(MessageText.getString("Button.cancel"));
shell.addListener(SWT.Dispose,new Listener() {
public void handleEvent(Event arg0) {
}
});
data = new GridData(GridData.FILL_HORIZONTAL);
data.horizontalSpan = 2;
data.heightHint = 30;
label.setLayoutData(data);
data = new GridData(GridData.FILL_HORIZONTAL);
data.horizontalSpan = 2;
combo.setLayoutData(data);
data = new GridData();
data.widthHint = 80;
data.grabExcessHorizontalSpace = true;
data.grabExcessVerticalSpace = true;
data.verticalAlignment = SWT.END;
data.horizontalAlignment = SWT.END;
ok.setLayoutData(data);
data = new GridData();
data.grabExcessVerticalSpace = true;
data.verticalAlignment = SWT.END;
data.widthHint = 80;
cancel.setLayoutData(data);
shell.setSize(300,150);
shell.layout();
Utils.centerWindowRelativeTo(shell,parentShell);