button_ok.setLayoutData(grid_data);
button_ok.setFont(skin.getButtonFont());
button_ok.setImage(skin.getButtonImage(SkinConstants.OK_BUTTON_IMAGE));
button_ok.setText(Localizer._("mainwindow.button.ok"));
button_ok.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent arg0) {
}
public void widgetSelected(SelectionEvent arg0) {
String server_ip = text_server_ip.getText();
if (!AddressUtils.isValidIP(server_ip)) {
MessageBox dialog = new MessageBox(shell,
SWT.OK | SWT.ICON_WARNING);
dialog.setMessage(Localizer._("serveraddwindow.wrong_server_address"));
dialog.open();
return ;
}
if (!AddressUtils.isValidPort(text_port.getText())) {
MessageBox dialog = new MessageBox(shell,
SWT.OK | SWT.ICON_WARNING);
dialog.setMessage(Localizer._("serveraddwindow.wrong_server_port"));
dialog.open();
return ;
}
int server_port = Integer.parseInt(text_port.getText());
try {
_core.getServerManager().newServer(server_ip, server_port);
} catch (ServerManagerException e) {
Utils.showWarningMessage(shell, "", e.getMessage());
}
shell.close();
} });
Button button_cancel = new Button(buttons_composite,SWT.NONE);
button_cancel.setImage(skin.getButtonImage(SkinConstants.CANCEL_BUTTON_IMAGE));
button_cancel.setText(Localizer._("mainwindow.button.cancel"));
button_cancel.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent arg0) {
}
public void widgetSelected(SelectionEvent arg0) {