use of org.jkiss.dbeaver.ext.mysql.model.MySQLCollation in project dbeaver by serge-rider.
the class MySQLCreateDatabaseDialog method createDialogArea.
@Override
protected Composite createDialogArea(Composite parent) {
final Composite composite = super.createDialogArea(parent);
final Composite group = new Composite(composite, SWT.NONE);
group.setLayout(new GridLayout(2, false));
final Text nameText = UIUtils.createLabelText(group, "Database name", "");
nameText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
name = nameText.getText();
getButton(IDialogConstants.OK_ID).setEnabled(!name.isEmpty());
}
});
final Combo charsetCombo = UIUtils.createLabelCombo(group, "Charset", SWT.BORDER | SWT.DROP_DOWN | SWT.READ_ONLY);
for (MySQLCharset cs : dataSource.getCharsets()) {
charsetCombo.add(cs.getName());
}
charsetCombo.setText(DEFAULT_CHARSET_NAME);
charset = dataSource.getCharset(DEFAULT_CHARSET_NAME);
assert charset != null;
final Combo collationCombo = UIUtils.createLabelCombo(group, "Collation", SWT.BORDER | SWT.DROP_DOWN | SWT.READ_ONLY);
for (MySQLCollation col : charset.getCollations()) {
collationCombo.add(col.getName());
}
collation = charset.getDefaultCollation();
if (collation != null) {
UIUtils.setComboSelection(collationCombo, collation.getName());
}
charsetCombo.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
charset = dataSource.getCharset(charsetCombo.getText());
assert charset != null;
collationCombo.removeAll();
for (MySQLCollation col : charset.getCollations()) {
collationCombo.add(col.getName());
}
collation = charset.getDefaultCollation();
if (collation != null) {
UIUtils.setComboSelection(collationCombo, collation.getName());
}
}
});
collationCombo.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
collation = charset.getCollation(collationCombo.getText());
}
});
return composite;
}
Aggregations